From: Felix Fietkau Date: Fri, 14 Oct 2011 01:35:52 +0000 (+0200) Subject: fix adding routes X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=2f47fa5db2ce0fbe118ed9b6727c3956a48c85fb;p=project%2Fnetifd.git fix adding routes --- 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;