From 4568a6f8423fbb25dee7ccb539ed215f391071b0 Mon Sep 17 00:00:00 2001 From: Vladislav Grishenko Date: Mon, 19 Aug 2013 16:07:07 +0100 Subject: [PATCH] IFACE_PERMANENT interface flag in enumeration. --- src/bpf.c | 4 ++++ src/dnsmasq.h | 1 + src/netlink.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/src/bpf.c b/src/bpf.c index fcb9f55..619a662 100644 --- a/src/bpf.c +++ b/src/bpf.c @@ -159,6 +159,10 @@ int iface_enumerate(int family, void *parm, int (*callback)()) if (ifr6.ifr_ifru.ifru_flags6 & IN6_IFF_DEPRECATED) flags |= IFACE_DEPRECATED; + + if (!(ifr6.ifr_ifru.ifru_flags6 & (IN6_IFF_AUTOCONF | IN6_IFF_TEMPORARY))) + flags |= IFACE_PERMANENT; + } ifr6.ifr_addr = *((struct sockaddr_in6 *) addrs->ifa_addr); diff --git a/src/dnsmasq.h b/src/dnsmasq.h index 0295376..f37034d 100644 --- a/src/dnsmasq.h +++ b/src/dnsmasq.h @@ -400,6 +400,7 @@ union mysockaddr { /* bits in flag param to IPv6 callbacks from iface_enumerate() */ #define IFACE_TENTATIVE 1 #define IFACE_DEPRECATED 2 +#define IFACE_PERMANENT 4 #define SERV_FROM_RESOLV 1 /* 1 for servers from resolv, 0 for command line. */ diff --git a/src/netlink.c b/src/netlink.c index 5e4d924..43cd21e 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -265,6 +265,9 @@ int iface_enumerate(int family, void *parm, int (*callback)()) if (ifa->ifa_flags & IFA_F_DEPRECATED) flags |= IFACE_DEPRECATED; + + if (ifa->ifa_flags & IFA_F_PERMANENT) + flags |= IFACE_PERMANENT; if (addrp && callback_ok) if (!((*callback)(addrp, (int)(ifa->ifa_prefixlen), (int)(ifa->ifa_scope),