summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/user/sharp.rst2
-rw-r--r--sharpd/sharp_vty.c41
-rw-r--r--zebra/zebra_rnh.c2
3 files changed, 25 insertions, 20 deletions
diff --git a/doc/user/sharp.rst b/doc/user/sharp.rst
index 4568c2a901..111e9dc9e8 100644
--- a/doc/user/sharp.rst
+++ b/doc/user/sharp.rst
@@ -71,7 +71,7 @@ keyword. At present, no sharp commands will be preserved in the config.
be used for pop and forward operations when the specified label is seen.
.. index:: sharp watch
-.. clicmd:: [no] sharp watch <nexthop|import> <A.B.C.D|X:X::X:X> [connected]
+.. clicmd:: [no] sharp watch <nexthop <A.B.C.D|X:X::X:X>|import <A.B.C.D/M:X:X::X:X/M> [connected]
Instruct zebra to monitor and notify sharp when the specified nexthop is
changed. The notification from zebra is written into the debug log.
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c
index a7552547e9..60cfb2e486 100644
--- a/sharpd/sharp_vty.c
+++ b/sharpd/sharp_vty.c
@@ -39,14 +39,15 @@
#endif
DEFPY(watch_nexthop_v6, watch_nexthop_v6_cmd,
- "sharp watch [vrf NAME$name] <nexthop$n|import$import> X:X::X:X$nhop [connected$connected]",
+ "sharp watch [vrf NAME$name] <nexthop$n X:X::X:X$nhop|import$import X:X::X:X/M$inhop> [connected$connected]",
"Sharp routing Protocol\n"
"Watch for changes\n"
"The vrf we would like to watch if non-default\n"
"The NAME of the vrf\n"
"Watch for nexthop changes\n"
- "Watch for import check changes\n"
"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")
{
struct vrf *vrf;
@@ -62,16 +63,17 @@ DEFPY(watch_nexthop_v6, watch_nexthop_v6_cmd,
return CMD_WARNING;
}
- if (n)
- type_import = false;
- else
- type_import = true;
-
memset(&p, 0, sizeof(p));
- p.prefixlen = 128;
- memcpy(&p.u.prefix6, &nhop, 16);
- p.family = AF_INET6;
+ if (n) {
+ type_import = false;
+ p.prefixlen = 128;
+ memcpy(&p.u.prefix6, &nhop, 16);
+ p.family = AF_INET6;
+ } else {
+ type_import = true;
+ p = *(const struct prefix *)inhop;
+ }
sharp_nh_tracker_get(&p);
sharp_zebra_nexthop_watch(&p, vrf->vrf_id, type_import,
@@ -81,14 +83,15 @@ DEFPY(watch_nexthop_v6, watch_nexthop_v6_cmd,
}
DEFPY(watch_nexthop_v4, watch_nexthop_v4_cmd,
- "sharp watch [vrf NAME$name] <nexthop$n|import$import> A.B.C.D$nhop [connected$connected]",
+ "sharp watch [vrf NAME$name] <nexthop$n A.B.C.D$nhop|import$import A.B.C.D/M$inhop> [connected$connected]",
"Sharp routing Protocol\n"
"Watch for changes\n"
"The vrf we would like to watch if non-default\n"
"The NAME of the vrf\n"
"Watch for nexthop changes\n"
+ "The v4 address to signal for watching\n"
"Watch for import check changes\n"
- "The v4 nexthop to signal for watching\n"
+ "The v4 prefix for import check to watch\n"
"Should the route be connected\n")
{
struct vrf *vrf;
@@ -106,14 +109,16 @@ DEFPY(watch_nexthop_v4, watch_nexthop_v4_cmd,
memset(&p, 0, sizeof(p));
- if (n)
+ if (n) {
type_import = false;
- else
+ p.prefixlen = 32;
+ p.u.prefix4 = nhop;
+ p.family = AF_INET;
+ }
+ else {
type_import = true;
-
- p.prefixlen = 32;
- p.u.prefix4 = nhop;
- p.family = AF_INET;
+ p = *(const struct prefix *)inhop;
+ }
sharp_nh_tracker_get(&p);
sharp_zebra_nexthop_watch(&p, vrf->vrf_id, type_import,
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index 0397b96983..da2fe4a30c 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -924,7 +924,7 @@ void zebra_print_rnh_table(vrf_id_t vrfid, afi_t afi, struct vty *vty,
}
for (rn = route_top(table); rn; rn = route_next(rn)) {
- if (p && prefix_cmp(&rn->p, p) != 0)
+ if (p && !prefix_match(&rn->p, p))
continue;
if (rn->info)