diff options
author | Steven Barth <steven@midlink.org> | 2015-05-26 13:51:52 +0200 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2015-05-26 13:51:52 +0200 |
commit | 3204adab41de155959575eb4d3a415ea947b861f (patch) | |
tree | 03f1f565155fce58bf9846e16b41d01394277922 /system-linux.c | |
parent | c68587663ef18fa87841be0a5281264361fab411 (diff) |
linux: more IPv6 onlink-route handling fixes / improvements
Signed-off-by: Steven Barth <steven@midlink.org>
Diffstat (limited to 'system-linux.c')
-rw-r--r-- | system-linux.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/system-linux.c b/system-linux.c index 08b6757..a6dde59 100644 --- a/system-linux.c +++ b/system-linux.c @@ -30,6 +30,7 @@ #include <linux/rtnetlink.h> #include <linux/sockios.h> #include <linux/ip.h> +#include <linux/if_addr.h> #include <linux/if_link.h> #include <linux/if_vlan.h> #include <linux/if_bridge.h> @@ -47,10 +48,6 @@ #define RT_TABLE_PRELOCAL 128 #endif -#ifndef IFA_F_NOPREFIXROUTE -#define IFA_F_NOPREFIXROUTE 0x200 -#endif - #include <string.h> #include <fcntl.h> #include <glob.h> @@ -1431,7 +1428,6 @@ static int system_addr(struct device *dev, struct device_addr *addr, int cmd) .ifa_family = (alen == 4) ? AF_INET : AF_INET6, .ifa_prefixlen = addr->mask, .ifa_index = dev->ifindex, - .ifa_flags = (addr->flags & DEVADDR_OFFLINK) ? IFA_F_NOPREFIXROUTE : 0, }; struct nl_msg *msg; @@ -1474,6 +1470,9 @@ static int system_addr(struct device *dev, struct device_addr *addr, int cmd) } nla_put(msg, IFA_CACHEINFO, sizeof(cinfo), &cinfo); + + if (cmd == RTM_NEWADDR && (addr->flags & DEVADDR_OFFLINK)) + nla_put_u32(msg, IFA_FLAGS, IFA_F_NOPREFIXROUTE); } return system_rtnl_call(msg); |