[OpenWrt-Devel] [PATCH] netifd: Fix source routing

Kristian Evensen kristian.evensen at gmail.com
Tue Nov 25 14:24:53 EST 2014


According to the OpenWRT Network documentation for route, the 'source' option
is "The preferred source address when sending to destinations covered by the
target". However, netifd currently stores this value in RTA_SRC on
NEWROUTE/DELROUTE.

RTA_SRC is not used by kernel when handling NEWROUTE nor DELROUTE. Store the
source address in RTA_PREFSRC, so that option works as specified in
documentation.

Signed-off-by: Kristian Evensen <kristian.evensen at gmail.com>
---
 system-linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/system-linux.c b/system-linux.c
index 83827d5..428302f 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -1429,7 +1429,7 @@ static int system_rt(struct device *dev, struct device_route *route, int cmd)
 		nla_put(msg, RTA_DST, alen, &route->addr);
 
 	if (route->sourcemask)
-		nla_put(msg, RTA_SRC, alen, &route->source);
+		nla_put(msg, RTA_PREFSRC, alen, &route->source);
 
 	if (route->metric > 0)
 		nla_put_u32(msg, RTA_PRIORITY, route->metric);
-- 
2.1.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list