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-group NHGNAME$nexthop_group>\ [backup$backup ] \ - (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 */