Skip to content

Commit

Permalink
zebra: fix static srv6 segment-list sid order
Browse files Browse the repository at this point in the history
When configuring a SID list by vtysh, the segment list
obtained in iproute2 is the exact opposite:
>
>vtysh:
>ipv6 route 2005::/64 eth0 segments 2001:db8:aaaa::7/2002::2/2003::3/2004::4
>
>root@r1:/# ip -6 route
>2005::/64 nhid 6  encap seg6 mode encap segs 4 [ 2004::4 2003::3 2002::2 2001:db8:aaaa::7 ] dev dummy0 proto 196 metric 20 pref medium
>

Fix this by keeping the same vtysh config and swap the
segment's order of the list in the rt_netlink.c
>
>root@r1:/# ip -6 route
>2005::/64 nhid 6  encap seg6 mode encap segs 4 [ 2001:db8:aaaa::7 2002::2 2003::3 2004::4 ] dev dummy0 proto 196 metric 20 pref medium
>

Fixes: f20cf14 ("bgpd,lib,sharpd,zebra: srv6 introduce multiple segs/SIDs in nexthop")

Signed-off-by: Dmytro Shytyi <[email protected]>
  • Loading branch information
dmytroshytyi-6WIND authored and pguibert6WIND committed Mar 27, 2024
1 parent d5f17cd commit a3536fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zebra/rt_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,7 @@ static ssize_t fill_seg6ipt_encap(char *buffer, size_t buflen,
srh->first_segment = segs->num_segs - 1;

for (i = 0; i < segs->num_segs; i++) {
memcpy(&srh->segments[i], &segs->seg[i],
memcpy(&srh->segments[segs->num_segs - i - 1], &segs->seg[i],
sizeof(struct in6_addr));
}

Expand Down

0 comments on commit a3536fa

Please sign in to comment.