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

2014-11-25 Thread Kristian Evensen
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.even...@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@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


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

2014-11-25 Thread Steven Barth
NAK, this would break source-dest-routing for IPv6 (documentation seems 
to be wrong here).

Maybe we should use RTA_PREFSRC for IPv4 and RTA_SRC for IPv6?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


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

2014-11-25 Thread Kristian Evensen
On Tue, Nov 25, 2014 at 8:47 PM, Steven Barth cy...@openwrt.org wrote:
 Maybe we should use RTA_PREFSRC for IPv4 and RTA_SRC for IPv6?

Sounds good to me. I am not to familiar with configuring IPv6, so I
was not aware that RTA_SRC is used differently there.

If no-one else jumps in before me, I will submit an updated patch tomorow.

-Kristian
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH]netifd: Fix source routing for IPv6 prefix address

2013-12-18 Thread Hans Dedecker
Fixes source routing for IPv6 prefix address on the interface
to which a prefix is assigned. If a packet is received on this
interface with as destination address the IPv6 prefix address
coming from a different prefix then this networking rule will
take care of the selection of the correct IPv6 routing table.
This rule lines up with proto address networking rules behavior.

Signed-off-by: Hans Dedecker dedec...@gmail.com
---
 interface-ip.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/interface-ip.c b/interface-ip.c
index 3771b5d..27ec009 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -639,6 +639,9 @@ interface_set_prefix_address(struct 
device_prefix_assignment *assignment,
addr.valid_until = now + 7200;
system_add_address(l3_downlink, addr);
if (prefix-iface) {
+   set_ip_source_policy(false, true, IPRULE_PRIORITY_ADDR, 
addr.addr,
+   128, prefix-iface-ip6table, NULL, 
NULL);
+
set_ip_source_policy(false, true, IPRULE_PRIORITY_NW, 
addr.addr,
addr.mask, prefix-iface-ip6table, 
iface, NULL);
 
@@ -650,6 +653,9 @@ interface_set_prefix_address(struct 
device_prefix_assignment *assignment,
} else if (add  (iface-state == IFS_UP || iface-state == 
IFS_SETUP)) {
system_add_address(l3_downlink, addr);
if (prefix-iface  !assignment-enabled) {
+   set_ip_source_policy(true, true, IPRULE_PRIORITY_ADDR, 
addr.addr,
+   128, prefix-iface-ip6table, NULL, 
NULL);
+
set_ip_source_policy(true, true, 
IPRULE_PRIORITY_REJECT, addr.addr,
addr.mask, 0, iface, unreachable);
 
-- 
1.7.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH]netifd: Fix source routing for IPv6 prefix address

2013-12-18 Thread Steven Barth

Hello Hans,

could you please explain your patch again. I didn't quite get the 
paragraph you've written. It seems the sentence is a bit garbled.



Thanks,

Steven
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel