|
@@ -106,7 +106,7 @@ mdns_record_add_or_get(UA_DiscoveryManager *dm, const char *record, const char *
|
|
|
|
|
|
/* see http://stackoverflow.com/a/10838854/869402 */
|
|
/* see http://stackoverflow.com/a/10838854/869402 */
|
|
static IP_ADAPTER_ADDRESSES *
|
|
static IP_ADAPTER_ADDRESSES *
|
|
-getInterfaces(UA_Server *server) {
|
|
|
|
|
|
+getInterfaces(const UA_Server *server) {
|
|
IP_ADAPTER_ADDRESSES* adapter_addresses = NULL;
|
|
IP_ADAPTER_ADDRESSES* adapter_addresses = NULL;
|
|
|
|
|
|
/* Start with a 16 KB buffer and resize if needed - multiple attempts in
|
|
/* Start with a 16 KB buffer and resize if needed - multiple attempts in
|
|
@@ -151,12 +151,32 @@ getInterfaces(UA_Server *server) {
|
|
#endif /* _WIN32 */
|
|
#endif /* _WIN32 */
|
|
|
|
|
|
static UA_Boolean
|
|
static UA_Boolean
|
|
-mdns_is_self_announce(UA_Server *server, struct serverOnNetwork_list_entry *entry) {
|
|
|
|
|
|
+mdns_is_self_announce(const UA_Server *server, const struct serverOnNetwork_list_entry *entry) {
|
|
for (size_t i=0; i<server->config.networkLayersSize; i++) {
|
|
for (size_t i=0; i<server->config.networkLayersSize; i++) {
|
|
UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
|
|
UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
|
|
if(UA_String_equal(&entry->serverOnNetwork.discoveryUrl,
|
|
if(UA_String_equal(&entry->serverOnNetwork.discoveryUrl,
|
|
&nl->discoveryUrl))
|
|
&nl->discoveryUrl))
|
|
return true;
|
|
return true;
|
|
|
|
+ // check discoveryUrl ignoring tailing slash
|
|
|
|
+ if (((
|
|
|
|
+ nl->discoveryUrl.length == entry->serverOnNetwork.discoveryUrl.length +1 &&
|
|
|
|
+ nl->discoveryUrl.data[nl->discoveryUrl.length-1] == '/'
|
|
|
|
+ ) || (
|
|
|
|
+ entry->serverOnNetwork.discoveryUrl.length == nl->discoveryUrl.length +1 &&
|
|
|
|
+ entry->serverOnNetwork.discoveryUrl.data[entry->serverOnNetwork.discoveryUrl.length-1] == '/'
|
|
|
|
+ )
|
|
|
|
+ ) &&
|
|
|
|
+ memcmp(nl->discoveryUrl.data, entry->serverOnNetwork.discoveryUrl.data,
|
|
|
|
+ UA_MIN(nl->discoveryUrl.length, entry->serverOnNetwork.discoveryUrl.length)) == 0
|
|
|
|
+ ) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (nl->discoveryUrl.length == entry->serverOnNetwork.discoveryUrl.length +1 &&
|
|
|
|
+ nl->discoveryUrl.data[nl->discoveryUrl.length-1] == '/' &&
|
|
|
|
+ memcmp(nl->discoveryUrl.data, entry->serverOnNetwork.discoveryUrl.data, nl->discoveryUrl.length-1) == 0
|
|
|
|
+ ) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/* The discovery URL may also just contain the IP address, but in our
|
|
/* The discovery URL may also just contain the IP address, but in our
|