diff --git a/src/dhcp6.c b/src/dhcp6.c index af6b404..b71cdac 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -25,7 +25,7 @@ struct iface_param { }; static int complete_context6(struct in6_addr *local, int prefix, - int scope, int if_index, int dad, + int scope, int if_index, int flags, int preferred, int valid, void *vparam); static int make_duid1(int index, unsigned int type, char *mac, size_t maclen, void *parm); @@ -182,7 +182,7 @@ void dhcp6_packet(time_t now) } static int complete_context6(struct in6_addr *local, int prefix, - int scope, int if_index, int dad, int preferred, + int scope, int if_index, int flags, int preferred, int valid, void *vparam) { struct dhcp_context *context; @@ -190,7 +190,7 @@ static int complete_context6(struct in6_addr *local, int prefix, struct iname *tmp; (void)scope; /* warning */ - (void)dad; + (void)flags; (void)preferred; (void)valid; @@ -479,7 +479,7 @@ struct cparam { }; static int construct_worker(struct in6_addr *local, int prefix, - int scope, int if_index, int dad, + int scope, int if_index, int flags, int preferred, int valid, void *vparam) { char ifrn_name[IFNAMSIZ]; @@ -487,7 +487,7 @@ static int construct_worker(struct in6_addr *local, int prefix, struct dhcp_context *template, *context; (void)scope; - (void)dad; + (void)flags; struct cparam *param = vparam; diff --git a/src/dnsmasq.h b/src/dnsmasq.h index 43f5968..5e4d3ab 100644 --- a/src/dnsmasq.h +++ b/src/dnsmasq.h @@ -389,6 +389,11 @@ union mysockaddr { #endif }; +/* bits in flag param to IPv6 callbacks from iface_enumerate() */ +#define IFACE_TENTATIVE 1 +#define IFACE_DEPRECATED 2 + + #define SERV_FROM_RESOLV 1 /* 1 for servers from resolv, 0 for command line. */ #define SERV_NO_ADDR 2 /* no server, this domain is local only */ #define SERV_LITERAL_ADDRESS 4 /* addr is the answer, not the server */ diff --git a/src/lease.c b/src/lease.c index 079a767..6add538 100644 --- a/src/lease.c +++ b/src/lease.c @@ -363,13 +363,13 @@ static int find_interface_v4(struct in_addr local, int if_index, #ifdef HAVE_DHCP6 static int find_interface_v6(struct in6_addr *local, int prefix, - int scope, int if_index, int dad, + int scope, int if_index, int flags, int preferred, int valid, void *vparam) { struct dhcp_lease *lease; (void)scope; - (void)dad; + (void)flags; (void)preferred; (void)valid; diff --git a/src/netlink.c b/src/netlink.c index 4b9ad14..8a4ecf4 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -239,6 +239,8 @@ int iface_enumerate(int family, void *parm, int (*callback)()) { struct in6_addr *addrp = NULL; u32 valid = 0, preferred = 0; + int flags = 0; + while (RTA_OK(rta, len1)) { if (rta->rta_type == IFA_ADDRESS) @@ -252,9 +254,15 @@ int iface_enumerate(int family, void *parm, int (*callback)()) rta = RTA_NEXT(rta, len1); } + if (ifa->ifa_flags & IFA_F_TENTATIVE) + flags |= IFACE_TENTATIVE; + + if (ifa->ifa_flags & IFA_F_DEPRECATED) + flags |= IFACE_DEPRECATED; + if (addrp && callback_ok) if (!((*callback)(addrp, (int)(ifa->ifa_prefixlen), (int)(ifa->ifa_scope), - (int)(ifa->ifa_index), (int)(ifa->ifa_flags & IFA_F_TENTATIVE), + (int)(ifa->ifa_index), flags, (int) preferred, (int)valid, parm))) callback_ok = 0; } diff --git a/src/network.c b/src/network.c index 266edd5..6e2bee8 100644 --- a/src/network.c +++ b/src/network.c @@ -291,7 +291,7 @@ static int iface_allowed(struct irec **irecp, int if_index, #ifdef HAVE_IPV6 static int iface_allowed_v6(struct in6_addr *local, int prefix, - int scope, int if_index, int dad, + int scope, int if_index, int flags, int preferred, int valid, void *vparam) { union mysockaddr addr; @@ -312,7 +312,7 @@ static int iface_allowed_v6(struct in6_addr *local, int prefix, addr.in6.sin6_port = htons(daemon->port); addr.in6.sin6_scope_id = if_index; - return iface_allowed((struct irec **)vparam, if_index, &addr, netmask, dad); + return iface_allowed((struct irec **)vparam, if_index, &addr, netmask, !!(flags & IFACE_TENTATIVE)); } #endif diff --git a/src/radv.c b/src/radv.c index 2cce57e..debccb2 100644 --- a/src/radv.c +++ b/src/radv.c @@ -40,10 +40,10 @@ struct search_param { static void send_ra(time_t now, int iface, char *iface_name, struct in6_addr *dest); static int add_prefixes(struct in6_addr *local, int prefix, - int scope, int if_index, int dad, + int scope, int if_index, int flags, int preferred, int valid, void *vparam); static int iface_search(struct in6_addr *local, int prefix, - int scope, int if_index, int dad, + int scope, int if_index, int flags, int prefered, int valid, void *vparam); static int add_lla(int index, unsigned int type, char *mac, size_t maclen, void *parm); @@ -325,13 +325,13 @@ static void send_ra(time_t now, int iface, char *iface_name, struct in6_addr *de } static int add_prefixes(struct in6_addr *local, int prefix, - int scope, int if_index, int dad, + int scope, int if_index, int flags, int preferred, int valid, void *vparam) { struct ra_param *param = vparam; (void)scope; /* warning */ - (void)dad; + (void)flags; (void)preferred; (void)valid; @@ -526,14 +526,13 @@ time_t periodic_ra(time_t now) } static int iface_search(struct in6_addr *local, int prefix, - int scope, int if_index, int dad, + int scope, int if_index, int flags, int preferred, int valid, void *vparam) { struct search_param *param = vparam; struct dhcp_context *context; (void)scope; - (void)dad; (void)preferred; (void)valid; @@ -549,7 +548,7 @@ static int iface_search(struct in6_addr *local, int prefix, timeout value and arrange for RA to be sent unless interface is still doing DAD.*/ - if (!dad) + if (!(flags & IFACE_TENTATIVE)) param->iface = if_index; if (difftime(param->now, context->ra_short_period_start) < 60.0)