Skip to content

Commit a2840d4

Browse files
idoschkuba-moo
authored andcommitted
seg6: Allow End.X behavior to accept an oif
Extend the End.X behavior to accept an output interface as an optional attribute and make use of it when resolving a route. This is needed when user space wants to use a link-local address as the nexthop address. Before: # ip route add 2001:db8:1::/64 encap seg6local action End.X nh6 fe80::1 oif eth0 dev sr6 # ip route add 2001:db8:2::/64 encap seg6local action End.X nh6 2001:db8:10::1 dev sr6 $ ip -6 route show 2001:db8:1::/64 encap seg6local action End.X nh6 fe80::1 dev sr6 metric 1024 pref medium 2001:db8:2::/64 encap seg6local action End.X nh6 2001:db8:10::1 dev sr6 metric 1024 pref medium After: # ip route add 2001:db8:1::/64 encap seg6local action End.X nh6 fe80::1 oif eth0 dev sr6 # ip route add 2001:db8:2::/64 encap seg6local action End.X nh6 2001:db8:10::1 dev sr6 $ ip -6 route show 2001:db8:1::/64 encap seg6local action End.X nh6 fe80::1 oif eth0 dev sr6 metric 1024 pref medium 2001:db8:2::/64 encap seg6local action End.X nh6 2001:db8:10::1 dev sr6 metric 1024 pref medium Note that the oif attribute is not dumped to user space when it was not specified (as an oif of 0) since each entry keeps track of the optional attributes that it parsed during configuration (see struct seg6_local_lwt::parsed_optattrs). Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Andrea Mayer <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3159671 commit a2840d4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/ipv6/seg6_local.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ static int end_next_csid_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)
421421
static int input_action_end_x_finish(struct sk_buff *skb,
422422
struct seg6_local_lwt *slwt)
423423
{
424-
seg6_lookup_any_nexthop(skb, &slwt->nh6, 0, false, 0);
424+
seg6_lookup_any_nexthop(skb, &slwt->nh6, 0, false, slwt->oif);
425425

426426
return dst_input(skb);
427427
}
@@ -1480,7 +1480,8 @@ static struct seg6_action_desc seg6_action_table[] = {
14801480
.action = SEG6_LOCAL_ACTION_END_X,
14811481
.attrs = SEG6_F_ATTR(SEG6_LOCAL_NH6),
14821482
.optattrs = SEG6_F_LOCAL_COUNTERS |
1483-
SEG6_F_LOCAL_FLAVORS,
1483+
SEG6_F_LOCAL_FLAVORS |
1484+
SEG6_F_ATTR(SEG6_LOCAL_OIF),
14841485
.input = input_action_end_x,
14851486
},
14861487
{

0 commit comments

Comments
 (0)