diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-09-05 03:00:04 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-09-06 03:03:58 +0200 |
commit | ba041beaae736a509a1e288e749703eed307935b (patch) | |
tree | ffb9f13b4acf4a8663390486f49dd1b8f77cc01b /sharpd | |
parent | zebra: Fix _route_entry_dump to handle nexthop family as appropriate (diff) | |
download | frr-ba041beaae736a509a1e288e749703eed307935b.tar.xz frr-ba041beaae736a509a1e288e749703eed307935b.zip |
sharpd: Modify route install to allow v6 nexthops
Allow the user to create a v4 route with a v6 nexthop.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'sharpd')
-rw-r--r-- | sharpd/sharp_vty.c | 16 | ||||
-rw-r--r-- | sharpd/sharp_zebra.c | 2 |
2 files changed, 12 insertions, 6 deletions
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c index 956da9d4e..9462eb575 100644 --- a/sharpd/sharp_vty.c +++ b/sharpd/sharp_vty.c @@ -81,13 +81,14 @@ DEFPY(watch_nexthop_v4, watch_nexthop_v4_cmd, DEFPY (install_routes, install_routes_cmd, - "sharp install routes A.B.C.D$start nexthop A.B.C.D$nexthop (1-1000000)$routes [instance (0-255)$instance]", + "sharp install routes A.B.C.D$start nexthop <A.B.C.D$nexthop4|X:X::X:X$nexthop6> (1-1000000)$routes [instance (0-255)$instance]", "Sharp routing Protocol\n" "install some routes\n" "Routes to install\n" "Address to start /32 generation at\n" - "Nexthop to use\n" - "Nexthop address\n" + "Nexthop to use(Can be an IPv4 or IPv6 address)\n" + "V4 Nexthop address to use\n" + "V6 Nexthop address to use\n" "How many to create\n" "Instance to use\n" "Instance\n") @@ -107,8 +108,13 @@ DEFPY (install_routes, p.prefixlen = 32; p.u.prefix4 = start; - nhop.gate.ipv4 = nexthop; - nhop.type = NEXTHOP_TYPE_IPV4; + if (nexthop4.s_addr != INADDR_ANY) { + nhop.gate.ipv4 = nexthop4; + nhop.type = NEXTHOP_TYPE_IPV4; + } else { + memcpy(&nhop.gate.ipv6, &nexthop6, IPV6_MAX_BYTELEN); + nhop.type = NEXTHOP_TYPE_IPV6; + } zlog_debug("Inserting %ld routes", routes); diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c index fcb555170..286f32087 100644 --- a/sharpd/sharp_zebra.c +++ b/sharpd/sharp_zebra.c @@ -193,7 +193,7 @@ void route_add(struct prefix *p, uint8_t instance, struct nexthop *nh) api_nh = &api.nexthops[0]; api_nh->vrf_id = VRF_DEFAULT; - api_nh->gate.ipv4 = nh->gate.ipv4; + api_nh->gate = nh->gate; api_nh->type = nh->type; api_nh->ifindex = nh->ifindex; api.nexthop_num = 1; |