diff mbox series

[OpenWrt-Devel] interface: add IPv6 addresses without IFA_F_NOPREFIXROUTE

Message ID 1576665890-5819-1-git-send-email-alin.nastac@gmail.com
State Superseded
Headers show
Series [OpenWrt-Devel] interface: add IPv6 addresses without IFA_F_NOPREFIXROUTE | expand

Commit Message

Alin Năstac Dec. 18, 2019, 10:44 a.m. UTC
When netifd manages the prefix route directly, it will remove it
the moment prefix gets deprecated. This will make it impossible
for the target to send ICMPv6 errors back to LAN devices still
using the deprecated prefix, thus breaking the L-14 requirement
of RFC 7084.

Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
---
 interface-ip.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

Comments

Alin Năstac Feb. 3, 2020, 3:29 p.m. UTC | #1
On Wed, Dec 18, 2019 at 11:44 AM Alin Nastac <alin.nastac@gmail.com> wrote:
>
> When netifd manages the prefix route directly, it will remove it
> the moment prefix gets deprecated. This will make it impossible
> for the target to send ICMPv6 errors back to LAN devices still
> using the deprecated prefix, thus breaking the L-14 requirement
> of RFC 7084.
>
> Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
> ---
>  interface-ip.c | 18 +-----------------
>  1 file changed, 1 insertion(+), 17 deletions(-)
>
> diff --git a/interface-ip.c b/interface-ip.c
> index c159e09..0958fcb 100644
> --- a/interface-ip.c
> +++ b/interface-ip.c
> @@ -905,20 +905,14 @@ interface_set_prefix_address(struct device_prefix_assignment *assignment,
>         struct device *l3_downlink = iface->l3_dev.dev;
>
>         struct device_addr addr;
> -       struct device_route route;
>         memset(&addr, 0, sizeof(addr));
> -       memset(&route, 0, sizeof(route));
>
>         addr.addr.in6 = assignment->addr;
>         addr.mask = assignment->length;
> -       addr.flags = DEVADDR_INET6 | DEVADDR_OFFLINK;
> +       addr.flags = DEVADDR_INET6;
>         addr.preferred_until = prefix->preferred_until;
>         addr.valid_until = prefix->valid_until;
>
> -       route.flags = DEVADDR_INET6;
> -       route.mask = addr.mask < 64 ? 64 : addr.mask;
> -       route.addr = addr.addr;
> -
>         if (!add && assignment->enabled) {
>                 time_t now = system_get_rtime();
>
> @@ -939,10 +933,6 @@ interface_set_prefix_address(struct device_prefix_assignment *assignment,
>                                                         addr.mask, 0, iface, "unreachable", true);
>                 }
>
> -               clear_if_addr(&route.addr, route.mask);
> -               interface_set_route_info(iface, &route);
> -
> -               system_del_route(l3_downlink, &route);
>                 system_add_address(l3_downlink, &addr);
>
>                 assignment->addr = in6addr_any;
> @@ -955,7 +945,6 @@ interface_set_prefix_address(struct device_prefix_assignment *assignment,
>                                 return;
>
>                         assignment->addr = addr.addr.in6;
> -                       route.addr = addr.addr;
>                 }
>
>                 if (system_add_address(l3_downlink, &addr))
> @@ -976,11 +965,6 @@ interface_set_prefix_address(struct device_prefix_assignment *assignment,
>                         }
>                 }
>
> -               clear_if_addr(&route.addr, route.mask);
> -               interface_set_route_info(iface, &route);
> -
> -               system_add_route(l3_downlink, &route);
> -
>                 if (uplink && uplink->l3_dev.dev && !(l3_downlink->settings.flags & DEV_OPT_MTU6)) {
>                         int mtu = system_update_ipv6_mtu(uplink->l3_dev.dev, 0);
>                         int mtu_old = system_update_ipv6_mtu(l3_downlink, 0);
> --
> 2.7.4
>

This patch has been superseded by https://patchwork.ozlabs.org/patch/1232885/ .
diff mbox series

Patch

diff --git a/interface-ip.c b/interface-ip.c
index c159e09..0958fcb 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -905,20 +905,14 @@  interface_set_prefix_address(struct device_prefix_assignment *assignment,
 	struct device *l3_downlink = iface->l3_dev.dev;
 
 	struct device_addr addr;
-	struct device_route route;
 	memset(&addr, 0, sizeof(addr));
-	memset(&route, 0, sizeof(route));
 
 	addr.addr.in6 = assignment->addr;
 	addr.mask = assignment->length;
-	addr.flags = DEVADDR_INET6 | DEVADDR_OFFLINK;
+	addr.flags = DEVADDR_INET6;
 	addr.preferred_until = prefix->preferred_until;
 	addr.valid_until = prefix->valid_until;
 
-	route.flags = DEVADDR_INET6;
-	route.mask = addr.mask < 64 ? 64 : addr.mask;
-	route.addr = addr.addr;
-
 	if (!add && assignment->enabled) {
 		time_t now = system_get_rtime();
 
@@ -939,10 +933,6 @@  interface_set_prefix_address(struct device_prefix_assignment *assignment,
 							addr.mask, 0, iface, "unreachable", true);
 		}
 
-		clear_if_addr(&route.addr, route.mask);
-		interface_set_route_info(iface, &route);
-
-		system_del_route(l3_downlink, &route);
 		system_add_address(l3_downlink, &addr);
 
 		assignment->addr = in6addr_any;
@@ -955,7 +945,6 @@  interface_set_prefix_address(struct device_prefix_assignment *assignment,
 				return;
 
 			assignment->addr = addr.addr.in6;
-			route.addr = addr.addr;
 		}
 
 		if (system_add_address(l3_downlink, &addr))
@@ -976,11 +965,6 @@  interface_set_prefix_address(struct device_prefix_assignment *assignment,
 			}
 		}
 
-		clear_if_addr(&route.addr, route.mask);
-		interface_set_route_info(iface, &route);
-
-		system_add_route(l3_downlink, &route);
-
 		if (uplink && uplink->l3_dev.dev && !(l3_downlink->settings.flags & DEV_OPT_MTU6)) {
 			int mtu = system_update_ipv6_mtu(uplink->l3_dev.dev, 0);
 			int mtu_old = system_update_ipv6_mtu(l3_downlink, 0);