summaryrefslogtreecommitdiff
path: root/sharpd
diff options
context:
space:
mode:
authorMark Stapp <mjs@labn.net>2023-06-28 15:31:23 -0400
committerMark Stapp <mjs@labn.net>2023-07-10 16:43:53 -0400
commit89ff272d387460fd066639e3fa979f14a2ed147c (patch)
tree967660aa0f1d8587c00fe3d42235a6306c3d8935 /sharpd
parentbb58cad150cd626a780b091b61a2d2ca6235e1e3 (diff)
sharpd: allow sharpd to install non-recursive routes
Add a config option so that sharpd can install routes without the ALLOW_RECURSION flag, matching IGP behavior. The default remains 'recursion'. Signed-off-by: Mark Stapp <mjs@labn.net>
Diffstat (limited to 'sharpd')
-rw-r--r--sharpd/sharp_vty.c12
-rw-r--r--sharpd/sharp_zebra.c1
2 files changed, 9 insertions, 4 deletions
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c
index 3a2a7aa407..f0a75a5fc2 100644
--- a/sharpd/sharp_vty.c
+++ b/sharpd/sharp_vty.c
@@ -179,7 +179,7 @@ DEFPY (install_routes,
<nexthop <A.B.C.D$nexthop4|X:X::X:X$nexthop6>|\
nexthop-group NHGNAME$nexthop_group>\
[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]",
+ (1-1000000)$routes [instance (0-255)$instance] [repeat (2-1000)$rpt] [opaque WORD] [no-recurse$norecurse]",
"Sharp routing Protocol\n"
"install some routes\n"
"Routes to install\n"
@@ -201,7 +201,8 @@ DEFPY (install_routes,
"Should we repeat this command\n"
"How many times to repeat this command\n"
"What opaque data to send down\n"
- "The opaque data\n")
+ "The opaque data\n"
+ "No recursive nexthops\n")
{
struct vrf *vrf;
struct prefix prefix;
@@ -210,6 +211,7 @@ DEFPY (install_routes,
sg.r.total_routes = routes;
sg.r.installed_routes = 0;
+ sg.r.flags = 0;
if (rpt >= 2)
sg.r.repeat = rpt * 2;
@@ -317,12 +319,16 @@ DEFPY (install_routes,
else
sg.r.opaque[0] = '\0';
+ /* Default is to ask for recursive nexthop resolution */
+ if (norecurse == NULL)
+ SET_FLAG(sg.r.flags, ZEBRA_FLAG_ALLOW_RECURSION);
+
sg.r.inst = instance;
sg.r.vrf_id = vrf->vrf_id;
rts = routes;
sharp_install_routes_helper(&prefix, sg.r.vrf_id, sg.r.inst, nhgid,
&sg.r.nhop_group, &sg.r.backup_nhop_group,
- rts, 0, sg.r.opaque);
+ rts, sg.r.flags, sg.r.opaque);
return CMD_SUCCESS;
}
diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c
index df18118b02..c095fec17b 100644
--- a/sharpd/sharp_zebra.c
+++ b/sharpd/sharp_zebra.c
@@ -247,7 +247,6 @@ static bool route_add(const struct prefix *p, vrf_id_t vrf_id, uint8_t instance,
memcpy(&api.prefix, p, sizeof(*p));
api.flags = flags;
- SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION);
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
/* Only send via ID if nhgroup has been successfully installed */