diff options
author | Hiroki Shirokura <slank.dev@gmail.com> | 2020-12-06 01:10:33 +0100 |
---|---|---|
committer | Mark Stapp <mjs@voltanet.io> | 2021-06-02 16:24:47 +0200 |
commit | dc3883cffef8b995ee3f36f52cd75673304e2cf9 (patch) | |
tree | 79883962b5f07e5fb8057ddedfa3e82715c81afd /sharpd | |
parent | sharpd: install_routes_helper support ZAPI_ROUTE flags (step1) (diff) | |
download | frr-dc3883cffef8b995ee3f36f52cd75673304e2cf9.tar.xz frr-dc3883cffef8b995ee3f36f52cd75673304e2cf9.zip |
shaprd: install route supports nexthop-seg6local (step1)
In this patch, we can install seg6local routes from shapd cli. New sub
command "sharp install route $PREFIX nexthop-seg6local" is added to
install seg6local routes via ZEBRA_ROUTE_ADD. This is for the behaviour
test(topotest) to ensure SRv6 ZAPI is working fine.
NEW-CLI:
sharp install routes 1::1 nexthop-seg6local dum0 End 1
sharp install routes 2::1 nexthop-seg6local dum0 End_X 2001::1 1
sharp install routes 3::1 nexthop-seg6local dum0 End_T 10 1
sharp install routes 4::1 nexthop-seg6local dum0 End_DX4 10.0.0.1 1
SRv6 routes are installed as NEXTHOP_IFINDEX routes because of seg6local
specification. seg6local routes depends the output device status instead
of routing-nexthop.
FYI:
In seg6local implementation, kernel don't care RTA_OIF on the nexthop
deeply but some requirement are exist as follow.
(a) DEV isn't loopback interface
(b) DEV's ipv6 status is enabled
(c) DEV's enslaving status is the same with target-route
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
Diffstat (limited to 'sharpd')
-rw-r--r-- | sharpd/sharp_vty.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c index de2d092c3..253d1943b 100644 --- a/sharpd/sharp_vty.c +++ b/sharpd/sharp_vty.c @@ -189,7 +189,13 @@ DEFPY (install_routes, "sharp install routes [vrf NAME$vrf_name]\ <A.B.C.D$start4|X:X::X:X$start6>\ <nexthop <A.B.C.D$nexthop4|X:X::X:X$nexthop6>|\ - nexthop-group NHGNAME$nexthop_group>\ + nexthop-group NHGNAME$nexthop_group|\ + nexthop-seg6local NAME$seg6l_oif\ + <End$seg6l_end|\ + End_X$seg6l_endx X:X::X:X$seg6l_endx_nh6|\ + End_T$seg6l_endt (1-4294967295)$seg6l_endt_table|\ + End_DX4$seg6l_enddx4 A.B.C.D$seg6l_enddx4_nh4|\ + End_DT6$seg6l_enddt6 (1-4294967295)$seg6l_enddt6_table>>\ [backup$backup <A.B.C.D$backup_nexthop4|X:X::X:X$backup_nexthop6>] \ (1-1000000)$routes [instance (0-255)$instance] [repeat (2-1000)$rpt] [opaque WORD]", "Sharp routing Protocol\n" @@ -204,6 +210,17 @@ DEFPY (install_routes, "V6 Nexthop address to use\n" "Nexthop-Group to use\n" "The Name of the nexthop-group\n" + "Nexthop-seg6local to use\n" + "Output device to use\n" + "SRv6 End function to use\n" + "SRv6 End.X function to use\n" + "V6 Nexthop address to use\n" + "SRv6 End.T function to use\n" + "Redirect table id to use\n" + "SRv6 End.DX4 function to use\n" + "V4 Nexthop address to use\n" + "SRv6 End.DT6 function to use\n" + "Redirect table id to use\n" "Backup nexthop to use(Can be an IPv4 or IPv6 address)\n" "Backup V4 Nexthop address to use\n" "Backup V6 Nexthop address to use\n" @@ -291,6 +308,32 @@ DEFPY (install_routes, sg.r.backup_nhop.vrf_id = vrf->vrf_id; sg.r.backup_nhop_group.nexthop = bnhgc->nhg.nexthop; } + } else if (seg6l_oif) { + struct seg6local_context ctx; + enum seg6local_action_t action; + memset(&ctx, 0, sizeof(struct seg6local_context)); + if (seg6l_enddx4) { + action = ZEBRA_SEG6_LOCAL_ACTION_END_DX4; + ctx.nh4 = seg6l_enddx4_nh4; + } else if (seg6l_endx) { + action = ZEBRA_SEG6_LOCAL_ACTION_END_X; + ctx.nh6 = seg6l_endx_nh6; + } else if (seg6l_endt) { + action = ZEBRA_SEG6_LOCAL_ACTION_END_T; + ctx.table = seg6l_endt_table; + } else if (seg6l_enddt6) { + action = ZEBRA_SEG6_LOCAL_ACTION_END_DT6; + ctx.table = seg6l_enddt6_table; + } else { + action = ZEBRA_SEG6_LOCAL_ACTION_END; + } + + sg.r.nhop.type = NEXTHOP_TYPE_IFINDEX; + sg.r.nhop.ifindex = ifname2ifindex(seg6l_oif, vrf->vrf_id); + sg.r.nhop.vrf_id = vrf->vrf_id; + sg.r.nhop_group.nexthop = &sg.r.nhop; + nexthop_add_seg6local(&sg.r.nhop, action, &ctx); + SET_FLAG(route_flags, ZEBRA_FLAG_SEG6LOCAL_ROUTE); } else { if (nexthop4.s_addr != INADDR_ANY) { sg.r.nhop.gate.ipv4 = nexthop4; |