diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2024-10-25 21:21:32 -0400 | 
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2024-10-28 14:10:06 -0400 | 
| commit | aff8eaa4a2dec64a66ea7349dfffac1b0dac2820 (patch) | |
| tree | 32435225dc863ce4bdcc1faa4a907e096a1972de /sharpd | |
| parent | ea0b8a0364bdb37679064b680347d7276c03ca06 (diff) | |
sharpd: Allow sharpd to watch nexthops in the mrib
Nothing special here, just allow sharpd to ask to watch
nexthops in the mrib.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'sharpd')
| -rw-r--r-- | sharpd/sharp_vty.c | 16 | ||||
| -rw-r--r-- | sharpd/sharp_zebra.c | 11 | ||||
| -rw-r--r-- | sharpd/sharp_zebra.h | 4 | 
3 files changed, 16 insertions, 15 deletions
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c index 21c596bf71..c9211a152f 100644 --- a/sharpd/sharp_vty.c +++ b/sharpd/sharp_vty.c @@ -82,7 +82,7 @@ DEFPY(watch_redistribute, watch_redistribute_cmd,  }  DEFPY(watch_nexthop_v6, watch_nexthop_v6_cmd, -      "sharp watch [vrf NAME$vrf_name] <nexthop$n X:X::X:X$nhop|import$import X:X::X:X/M$inhop>  [connected$connected]", +      "sharp watch [vrf NAME$vrf_name] <nexthop$n X:X::X:X$nhop|import$import X:X::X:X/M$inhop>  [connected$connected] [mrib$mrib]",        "Sharp routing Protocol\n"        "Watch for changes\n"        "The vrf we would like to watch if non-default\n" @@ -91,7 +91,8 @@ DEFPY(watch_nexthop_v6, watch_nexthop_v6_cmd,        "The v6 nexthop to signal for watching\n"        "Watch for import check changes\n"        "The v6 prefix to signal for watching\n" -      "Should the route be connected\n") +      "Should the route be connected\n" +      "In the Multicast rib\n")  {  	struct vrf *vrf;  	struct prefix p; @@ -119,14 +120,13 @@ DEFPY(watch_nexthop_v6, watch_nexthop_v6_cmd,  	}  	sharp_nh_tracker_get(&p); -	sharp_zebra_nexthop_watch(&p, vrf->vrf_id, type_import, -				  true, !!connected); +	sharp_zebra_nexthop_watch(&p, vrf->vrf_id, type_import, true, !!connected, !!mrib);  	return CMD_SUCCESS;  }  DEFPY(watch_nexthop_v4, watch_nexthop_v4_cmd, -      "sharp watch [vrf NAME$vrf_name] <nexthop$n A.B.C.D$nhop|import$import A.B.C.D/M$inhop> [connected$connected]", +      "sharp watch [vrf NAME$vrf_name] <nexthop$n A.B.C.D$nhop|import$import A.B.C.D/M$inhop> [connected$connected] [mrib$mrib]",        "Sharp routing Protocol\n"        "Watch for changes\n"        "The vrf we would like to watch if non-default\n" @@ -135,7 +135,8 @@ DEFPY(watch_nexthop_v4, watch_nexthop_v4_cmd,        "The v4 address to signal for watching\n"        "Watch for import check changes\n"        "The v4 prefix for import check to watch\n" -      "Should the route be connected\n") +      "Should the route be connected\n" +      "In the Multicast rib\n")  {  	struct vrf *vrf;  	struct prefix p; @@ -164,8 +165,7 @@ DEFPY(watch_nexthop_v4, watch_nexthop_v4_cmd,  	}  	sharp_nh_tracker_get(&p); -	sharp_zebra_nexthop_watch(&p, vrf->vrf_id, type_import, -				  true, !!connected); +	sharp_zebra_nexthop_watch(&p, vrf->vrf_id, type_import, true, !!connected, !!mrib);  	return CMD_SUCCESS;  } diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c index 1048436b43..4447b69bf6 100644 --- a/sharpd/sharp_zebra.c +++ b/sharpd/sharp_zebra.c @@ -618,18 +618,19 @@ void nhg_del(uint32_t id)  	zclient_nhg_send(zclient, ZEBRA_NHG_DEL, &api_nhg);  } -void sharp_zebra_nexthop_watch(struct prefix *p, vrf_id_t vrf_id, bool import, -			       bool watch, bool connected) +void sharp_zebra_nexthop_watch(struct prefix *p, vrf_id_t vrf_id, bool import, bool watch, +			       bool connected, bool mrib)  { -	int command; +	int command = ZEBRA_NEXTHOP_REGISTER; +	safi_t safi = mrib ? SAFI_MULTICAST : SAFI_UNICAST;  	command = ZEBRA_NEXTHOP_REGISTER;  	if (!watch)  		command = ZEBRA_NEXTHOP_UNREGISTER; -	if (zclient_send_rnh(zclient, command, p, SAFI_UNICAST, connected, -			     false, vrf_id) == ZCLIENT_SEND_FAILURE) +	if (zclient_send_rnh(zclient, command, p, safi, connected, false, vrf_id) == +	    ZCLIENT_SEND_FAILURE)  		zlog_warn("%s: Failure to send nexthop to zebra", __func__);  } diff --git a/sharpd/sharp_zebra.h b/sharpd/sharp_zebra.h index 5cbcc14665..7a86897beb 100644 --- a/sharpd/sharp_zebra.h +++ b/sharpd/sharp_zebra.h @@ -18,8 +18,8 @@ extern void vrf_label_add(vrf_id_t vrf_id, afi_t afi, mpls_label_t label);  extern void nhg_add(uint32_t id, const struct nexthop_group *nhg,  		    const struct nexthop_group *backup_nhg);  extern void nhg_del(uint32_t id); -extern void sharp_zebra_nexthop_watch(struct prefix *p, vrf_id_t vrf_id, -				      bool import, bool watch, bool connected); +extern void sharp_zebra_nexthop_watch(struct prefix *p, vrf_id_t vrf_id, bool import, bool watch, +				      bool connected, bool mrib);  extern void sharp_install_routes_helper(struct prefix *p, vrf_id_t vrf_id,  					uint8_t instance, uint32_t nhgid,  | 
