diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-10-14 03:35:52 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-10-14 03:35:52 +0200 |
commit | 2f47fa5db2ce0fbe118ed9b6727c3956a48c85fb (patch) | |
tree | e06b1aeb3559339b0d14a1f8b676db08b8907118 /system-linux.c | |
parent | 206958f8b6eb0a4e65749f481d8e17d552391c2f (diff) |
fix adding routes
Diffstat (limited to 'system-linux.c')
-rw-r--r-- | system-linux.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/system-linux.c b/system-linux.c index e04fa23..cf4e9c7 100644 --- a/system-linux.c +++ b/system-linux.c @@ -393,6 +393,7 @@ static int system_rt(struct device *dev, struct device_route *route, int cmd) { int alen = ((route->flags & DEVADDR_FAMILY) == DEVADDR_INET4) ? 4 : 16; bool have_gw; + unsigned int flags = 0; if (alen == 4) have_gw = !!route->nexthop.in.s_addr; @@ -414,7 +415,10 @@ static int system_rt(struct device *dev, struct device_route *route, int cmd) .rtm_type = (cmd == RTM_DELROUTE) ? 0: RTN_UNICAST, }; - struct nl_msg *msg = nlmsg_alloc_simple(cmd, 0); + if (cmd == RTM_NEWROUTE) + flags |= NLM_F_CREATE | NLM_F_REPLACE; + + struct nl_msg *msg = nlmsg_alloc_simple(cmd, flags); if (!msg) return -1; |