libnl/lib/route
roopa 29b71371e7 route cache: Fix handling of ipv6 multipath routes
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@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Nolan Leake <nolan@cumulusnetworks.com>
Reviewed-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-12-17 15:16:02 +01:00
..
cls Clang diagnostics 2012-10-19 22:32:59 +06:00
link link: socket-CAN helper functions 2012-11-29 22:17:58 +01:00
qdisc Clang diagnostics 2012-10-19 22:32:59 +06:00
.gitignore Let git ignore generated pktloc source files 2010-07-03 15:56:07 +02:00
addr.c cache: provide safe variant of nl_cache_mngt_require() and use it 2012-11-16 01:11:55 +01:00
class.c Fix types-related warnings based on clang diagnostics 2012-06-13 13:30:26 +02:00
classid.c Use NL_DBG() instead of printing warnings and errors to stderr 2012-11-16 00:42:34 +01:00
cls.c Fix types-related warnings based on clang diagnostics 2012-06-13 13:30:26 +02:00
link.c cache: provide safe variant of nl_cache_mngt_require() and use it 2012-11-16 01:11:55 +01:00
neigh.c cache: provide safe variant of nl_cache_mngt_require() and use it 2012-11-16 01:11:55 +01:00
neightbl.c cache: provide safe variant of nl_cache_mngt_require() and use it 2012-11-16 01:11:55 +01:00
nexthop.c cache: provide safe variant of nl_cache_mngt_require() and use it 2012-11-16 01:11:55 +01:00
pktloc.c Clang diagnostics 2012-10-19 22:32:59 +06:00
pktloc_grammar.l Packet location updates 2010-10-27 01:21:50 +02:00
pktloc_syntax.y pktloc: support to specify a shift operator for packet locations 2010-11-04 20:01:36 +01:00
qdisc.c Fix types-related warnings based on clang diagnostics 2012-06-13 13:30:26 +02:00
route.c route: Document ROUTE_CACHE_CONTENT flag 2012-08-30 13:19:56 +02:00
route_obj.c route cache: Fix handling of ipv6 multipath routes 2012-12-17 15:16:02 +01:00
route_utils.c constify struct trans_tbl 2010-11-17 16:09:08 +01:00
rtnl.c doc: documentation restructuring 2012-05-10 12:03:59 +02:00
rule.c missing extended Table attribute for lib/route/ 2012-03-06 10:15:30 +01:00
tc.c cache: provide safe variant of nl_cache_mngt_require() and use it 2012-11-16 01:11:55 +01:00