summaryrefslogtreecommitdiff
path: root/system-linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'system-linux.c')
-rw-r--r--system-linux.c9
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);