summaryrefslogtreecommitdiffstats
path: root/sharpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-07-31 16:47:46 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-07-31 16:47:46 +0200
commit1be0815df0a716b65dd759609c361ff0950d0523 (patch)
treeff378283313ca3e31d8c79d4efbf61b12cb3f6d3 /sharpd
parentMerge pull request #4735 from dslicenc/bgp-clear-interface (diff)
downloadfrr-1be0815df0a716b65dd759609c361ff0950d0523.tar.xz
frr-1be0815df0a716b65dd759609c361ff0950d0523.zip
sharpd: Update 'sharp watch import` to allow prefix
Instead of defaulting the import-check to a /32 allow the tester to specify any prefix that they want when doing an import-check. Test: donna.cumulusnetworks.com# sharp watch import A.B.C.D/M The v4 prefix for import check to watch X:X::X:X/M The v6 prefix to signal for watching donna.cumulusnetworks.com# sharp watch import 4.5.6.0/24 donna.cumulusnetworks.com# show ip import-check 4.5.6.0 resolved via kernel via 10.50.11.1, enp0s3 Client list: sharp(fd 21) donna.cumulusnetworks.com# sharp watch import 4:5:6::0/64 donna.cumulusnetworks.com# show ipv6 import-check 4:5:6:: resolved via kernel fe80::cad7:19ff:fe0a:fdfd, via enp0s3 fe80::ce37:abff:fe4f:a601, via enp0s3 Client list: sharp(fd 21) donna.cumulusnetworks.com# sharp watch nexthop A.B.C.D The v4 address to signal for watching X:X::X:X The v6 nexthop to signal for watching donna.cumulusnetworks.com# sharp watch nexthop 4.5.6.7 donna.cumulusnetworks.com# sharp watch nexthop 4:5::6:7 donna.cumulusnetworks.com# show ip nht 4.5.6.7 unresolved Client list: sharp(fd 21) donna.cumulusnetworks.com# show ipv6 nht 4:5::6:7 unresolved Client list: sharp(fd 21) Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'sharpd')
-rw-r--r--sharpd/sharp_vty.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c
index a7552547e..60cfb2e48 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,