[PATCH] route cache: Fix handling of ipv6 multipath routes

Thomas Graf tgraf at suug.ch
Mon Dec 17 09:16:27 EST 2012


On 12/12/12 at 09:50pm, roopa at cumulusnetworks.com wrote:
> From: roopa <roopa at cumulusnetworks.com>
> 
> There are two ways kernel handles ipv6 equal cost multipath routes
> depending on which kernel version you are looking at.
> 
> older kernels without ipv6 ECMP support, accept the below ECMP routes,
> #ip -6 route add 2001::/16 nexthop via fe80:2::2 dev swp1
> #ip -6 route add 2001::/16 nexthop via fe80:2::3 dev swp1
> 
> store them as separate routes and pick the last one during lookup.
> 
> Newer kernels, after the support for equal cost multipath routes
> was added http://patchwork.ozlabs.org/patch/188562/,
> now accept multipath routes added individually using the
> above 'ip -6 route' format OR
> sent using RTA_MULTIPATH with the below command
> #ip -6 route add 2001::/16 nexthop via fe80:2::2 dev swp1 nexthop via fe80:2::3 dev swp1
> 
> And the kernel now stores and treats them as equal cost multipath routes
> during lookups.
> 
> However in all cases above, netlink notifications to ipv6 ECMP route adds and deletes
> come separately for each next hop.
> 
> Example libnl notification in the above case with both old and new kernels:
> 	inet6 2001::/16 table main type unicast
>                 scope global priority 0x400 protocol boot
>                 nexthop via fe80:2::2 dev swp1
> 
>         inet6 2001::/16 table main type unicast
>                 scope global priority 0x400 protocol boot
>                 nexthop via fe80:2::3 dev swp1
> 
> 
> 
> Since they are separate route notifications for objects with same key,
> libnl replaces the existing ones and hence only the last route update sticks.
> 
> This patch uses the oo_update feature to not replace but update an
> existing route if its a ipv6 equal cost multipath route.
> The object after an update looks like the below (similar to ipv4 ECMP routes):
> 
>         inet6 2001::/16 table main type unicast
>                 scope global priority 0x400 protocol boot
>                 nexthop via fe80:2::2 dev swp1
>                 nexthop via fe80:2::3 dev swp1
> 
> 
> Signed-off-by: Shrijeet Mukherjee <shm at cumulusnetworks.com>
> Signed-off-by: Roopa Prabhu <roopa at cumulusnetworks.com>
> Reviewed-by: Nolan Leake <nolan at cumulusnetworks.com>
> Reviewed-by: Wilson Kok <wkok at cumulusnetworks.com>

Nice, patch applied.



More information about the libnl mailing list