X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-core%2Fiface-pfroute.c;h=a7ecdc95c57e010f12c7640a4153176b92724aa5;hb=9aa4773acbfadbcf95aaf0063510f8be8ddcbd86;hp=56149dae83ee7ff2e0f96bd4c0494278fa95f0f7;hpb=d266407d3e6d8f2a8e14e8bd2f89fa8a4333613c;p=catta diff --git a/avahi-core/iface-pfroute.c b/avahi-core/iface-pfroute.c index 56149da..a7ecdc9 100644 --- a/avahi-core/iface-pfroute.c +++ b/avahi-core/iface-pfroute.c @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -87,8 +88,8 @@ static void rtm_info(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m) hw->mtu = ifm->ifm_data.ifi_mtu; hw->mac_address_size = sdl->sdl_alen; - if (hw->mac_address_size > AVAHI_MAX_MAC_ADDRESS) - hw->mac_address_size = AVAHI_MAX_MAC_ADDRESS; + if (hw->mac_address_size > AVAHI_MAC_ADDRESS_MAX) + hw->mac_address_size = AVAHI_MAC_ADDRESS_MAX; memcpy(hw->mac_address, sdl->sdl_data + sdl->sdl_nlen, hw->mac_address_size); @@ -118,6 +119,11 @@ static void rtm_addr(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m) int prefixlen = 0; struct sockaddr *sa =NULL; +#ifdef __NetBSD__ + if(((struct sockaddr *)cp)->sa_family == AF_UNSPEC) + ((struct sockaddr *)cp)->sa_family = AF_INET; +#endif + if(((struct sockaddr *)cp)->sa_family != AF_INET && ((struct sockaddr *)cp)->sa_family != AF_INET6) return; @@ -145,7 +151,18 @@ static void rtm_addr(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m) default: break; } + break; case AF_INET6: + switch (1<sin6_addr.s6_addr); + break; + case RTA_IFA: + memcpy(raddr.data.data, &((struct sockaddr_in6 *)sa)->sin6_addr, sizeof(struct in6_addr)); + raddr_valid = 1; + default: + break; + } break; default: break; @@ -219,15 +236,12 @@ static void socket_event(AvahiWatch *w, int fd, AvahiWatchEvent event,void *user assert(fd == nl->fd); do { - time_t now = time(NULL); if((bytes = recv(nl->fd, msg, 2048, MSG_DONTWAIT)) < 0) { if (errno == EAGAIN || errno == EINTR) return; avahi_log_error(__FILE__": recv() failed: %s", strerror(errno)); return; } - - avahi_log_debug("socket_event: got message of size %d on %s", (int)bytes, ctime(&now)); parse_rtmsg((struct rt_msghdr *)msg, bytes ,m); } while (bytes > 0);