mpls: multipath route support
Subsystems (2)
PATCH v5 1/2 mpls: multipath route support
From: Roopa Prabhu <[email protected]>
This patch adds support for MPLS multipath routes.
Includes following changes to support multipath:
- splits struct mpls_route into 'struct mpls_route + struct mpls_nh'
- 'struct mpls_nh' represents a mpls nexthop label forwarding entry
- moves mpls route and nexthop structures into internal.h
- A mpls_route can point to multiple mpls_nh structs
- the nexthops are maintained as a array (similar to ipv4 fib)
- In the process of restructuring, this patch also consistently changes all labels to u8
- Adds support to parse/fill RTA_MULTIPATH netlink attribute for multipath routes similar to ipv4/v6 fib
- In this patch, the multipath route nexthop selection algorithm simply returns the first nexthop. It is replaced by a hash based algorithm from Robert Shearman in the next patch
- mpls_route_update cleanup: remove 'dev' handling in mpls_route_update. mpls_route_update though implemented to update based on dev, it was never used that way. And the dev handling gets tricky with multiple nexthops. Cannot match against any single nexthops dev. So, this patch removes the unused 'dev' handling in mpls_route_update.
Example:
$ip -f mpls route add 100 nexthop as 200 via inet 10.1.1.2 dev swp1 \
nexthop as 700 via inet 10.1.1.6 dev swp2 \
nexthop as 800 via inet 40.1.1.2 dev swp3$ip -f mpls route show
100
nexthop as to 200 via inet 10.1.1.2 dev swp1
nexthop as to 700 via inet 10.1.1.6 dev swp2
nexthop as to 800 via inet 40.1.1.2 dev swp3--- include/net/mpls_iptunnel.h | 2 +- net/mpls/af_mpls.c | 493 +++++++++++++++++++++++++++++++------------- net/mpls/internal.h | 52 ++++- 3 files changed, 398 insertions(+), 149 deletions(-)
include/net/mpls_iptunnel.h +1 -1
@@ -18,7 +18,7 @@struct mpls_iptunnel_encap {u32 label[MAX_NEW_LABELS ]; -u32 labels; +u8 labels; };static inline struct mpls_iptunnel_encap *mpls_lwtunnel_encap (struct lwtunnel_state *lwtstate)
net/mpls/af_mpls.c +346 -147
708 lines not on this page · raw message
net/mpls/internal.h +51 -1
65 lines not on this page · raw message
Signature · 1 line
1.9.1
Quoted 37 lines · Roopa Prabhu
From: Roopa Prabhu <[email protected]>
This patch adds support for MPLS multipath routes.
Includes following changes to support multipath:
- splits structmpls_routeinto 'structmpls_route+ structmpls_nh'- 'struct
mpls_nh' represents a mpls nexthop label forwarding entry- moves mpls route and nexthop structures into
internal.h- A
mpls_routecan point to multiplempls_nhstructs- the nexthops are maintained as a array (similar to ipv4 fib)
- In the process of restructuring, this patch also consistently changes all labels to u8
- Adds support to parse/fill
RTA_MULTIPATHnetlink attribute for multipath routes similar to ipv4/v6 fib- In this patch, the multipath route nexthop selection algorithm simply returns the first nexthop. It is replaced by a hash based algorithm from Robert Shearman in the next patch
-
mpls_route_updatecleanup: remove 'dev' handling inmpls_route_update.mpls_route_updatethough implemented to update based on dev, it was never used that way. And the dev handling gets tricky with multiple nexthops. Cannot match against any single nexthops dev. So, this patch removes the unused 'dev' handling inmpls_route_update.Example:
$ip -f mpls route add 100 nexthop as 200 via inet 10.1.1.2 dev swp1 \ nexthop as 700 via inet 10.1.1.6 dev swp2 \ nexthop as 800 via inet 40.1.1.2 dev swp3
Quoted 7 lines
$ip -f mpls route show
100nexthop as to 200 via inet 10.1.1.2 dev swp1 nexthop as to 700 via inet 10.1.1.6 dev swp2 nexthop as to 800 via inet 40.1.1.2 dev swp3Signed-off-by Roopa Prabhu <[email protected]>
I think that find_outdev could be simplified, but as it's now clear what the expectations are with dev refcounts are during route update I'm happy with this latest patch.