- case AVAHI_PROTO_INET:
- {
- naddress.in.sin_family = AF_INET;
- naddress.in.sin_port = port;
- naddress.in.sin_addr.s_addr = address->data.ipv4.address;
- }
- break;
-
- case AVAHI_PROTO_INET6:
- {
- naddress.in6.sin6_family = AF_INET6;
- naddress.in6.sin6_port = port;
- memcpy(naddress.in6.sin6_addr.s6_addr, address->data.ipv6.address, sizeof(naddress.in6.sin6_addr.s6_addr));
- }
- break;
-
- default:
- naddress.unknown.family = AF_UNKNOWN;
- break;
- }
-
- if(naddress.unknown.family != AF_UNKNOWN)
- {
- meshlink_hint_address(mesh, (meshlink_node_t *)node, (struct sockaddr*)&naddress);
+ logger(mesh, MESHLINK_INFO, "Node %s is part of the mesh network.\n", node->name);
+
+ sockaddr_t naddress;
+ memset(&naddress, 0, sizeof(naddress));
+
+ switch(address->proto)
+ {
+ case AVAHI_PROTO_INET:
+ {
+ naddress.in.sin_family = AF_INET;
+ naddress.in.sin_port = htons(port);
+ naddress.in.sin_addr.s_addr = address->data.ipv4.address;
+ }
+ break;
+
+ case AVAHI_PROTO_INET6:
+ {
+ naddress.in6.sin6_family = AF_INET6;
+ naddress.in6.sin6_port = htons(port);
+ memcpy(naddress.in6.sin6_addr.s6_addr, address->data.ipv6.address, sizeof(naddress.in6.sin6_addr.s6_addr));
+ }
+ break;
+
+ default:
+ naddress.unknown.family = AF_UNKNOWN;
+ break;
+ }
+
+ if(naddress.unknown.family != AF_UNKNOWN)
+ {
+ meshlink_hint_address(mesh, (meshlink_node_t *)node, (struct sockaddr*)&naddress);
+ }
+ else
+ {
+ logger(mesh, MESHLINK_WARNING, "Could not resolve node %s to a known address family type.\n", node->name);
+ }