mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 13:01:59 +00:00
sharpd: Allow nhop tracking to specify connected
Allow the sharp daemon to specify whether or not a watched nexthop should be connected or not. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
ecc4d697cd
commit
a60ffbc985
@ -49,11 +49,12 @@ uint32_t rts;
|
||||
int32_t repeat;
|
||||
|
||||
DEFPY(watch_nexthop_v6, watch_nexthop_v6_cmd,
|
||||
"sharp watch nexthop X:X::X:X$nhop",
|
||||
"sharp watch nexthop X:X::X:X$nhop [connected$connected]",
|
||||
"Sharp routing Protocol\n"
|
||||
"Watch for changes\n"
|
||||
"Watch for nexthop changes\n"
|
||||
"The v6 nexthop to signal for watching\n")
|
||||
"The v6 nexthop to signal for watching\n"
|
||||
"Should the route be connected\n")
|
||||
{
|
||||
struct prefix p;
|
||||
|
||||
@ -63,17 +64,18 @@ DEFPY(watch_nexthop_v6, watch_nexthop_v6_cmd,
|
||||
memcpy(&p.u.prefix6, &nhop, 16);
|
||||
p.family = AF_INET6;
|
||||
|
||||
sharp_zebra_nexthop_watch(&p, true);
|
||||
sharp_zebra_nexthop_watch(&p, true, !!connected);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFPY(watch_nexthop_v4, watch_nexthop_v4_cmd,
|
||||
"sharp watch nexthop A.B.C.D$nhop",
|
||||
"sharp watch nexthop A.B.C.D$nhop [connected$connected]",
|
||||
"Sharp routing Protocol\n"
|
||||
"Watch for changes\n"
|
||||
"Watch for nexthop changes\n"
|
||||
"The v4 nexthop to signal for watching\n")
|
||||
"The v4 nexthop to signal for watching\n"
|
||||
"Should the route be connected\n")
|
||||
{
|
||||
struct prefix p;
|
||||
|
||||
@ -83,7 +85,7 @@ DEFPY(watch_nexthop_v4, watch_nexthop_v4_cmd,
|
||||
p.u.prefix4 = nhop;
|
||||
p.family = AF_INET;
|
||||
|
||||
sharp_zebra_nexthop_watch(&p, true);
|
||||
sharp_zebra_nexthop_watch(&p, true, !!connected);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -328,14 +328,14 @@ void route_delete(struct prefix *p, uint8_t instance)
|
||||
return;
|
||||
}
|
||||
|
||||
void sharp_zebra_nexthop_watch(struct prefix *p, bool watch)
|
||||
void sharp_zebra_nexthop_watch(struct prefix *p, bool watch, bool connected)
|
||||
{
|
||||
int command = ZEBRA_NEXTHOP_REGISTER;
|
||||
|
||||
if (!watch)
|
||||
command = ZEBRA_NEXTHOP_UNREGISTER;
|
||||
|
||||
if (zclient_send_rnh(zclient, command, p, true, VRF_DEFAULT) < 0)
|
||||
if (zclient_send_rnh(zclient, command, p, connected, VRF_DEFAULT) < 0)
|
||||
zlog_warn("%s: Failure to send nexthop to zebra",
|
||||
__PRETTY_FUNCTION__);
|
||||
}
|
||||
|
@ -28,7 +28,8 @@ extern void vrf_label_add(vrf_id_t vrf_id, afi_t afi, mpls_label_t label);
|
||||
extern void route_add(struct prefix *p, uint8_t instance,
|
||||
struct nexthop_group *nhg);
|
||||
extern void route_delete(struct prefix *p, uint8_t instance);
|
||||
extern void sharp_zebra_nexthop_watch(struct prefix *p, bool watch);
|
||||
extern void sharp_zebra_nexthop_watch(struct prefix *p, bool watch,
|
||||
bool connected);
|
||||
|
||||
extern void sharp_install_routes_helper(struct prefix *p, uint8_t instance,
|
||||
struct nexthop_group *nhg,
|
||||
|
Loading…
Reference in New Issue
Block a user