summaryrefslogtreecommitdiffstats
path: root/sharpd/sharp_zebra.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-01-10 00:58:36 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-01-11 01:26:31 +0100
commitdbc1bf462b5ca972b26e6e12a665f3a4625b3557 (patch)
treec1f1860a1e400e9595594d26316489848ca5b644 /sharpd/sharp_zebra.c
parentlib: Add another 32 bit accessor to the prefix data structure (diff)
downloadfrr-dbc1bf462b5ca972b26e6e12a665f3a4625b3557.tar.xz
frr-dbc1bf462b5ca972b26e6e12a665f3a4625b3557.zip
sharpd: Allow route install/removal of v6 routes.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'sharpd/sharp_zebra.c')
-rw-r--r--sharpd/sharp_zebra.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c
index 37591fa41..8d6260494 100644
--- a/sharpd/sharp_zebra.c
+++ b/sharpd/sharp_zebra.c
@@ -142,13 +142,22 @@ void sharp_install_routes_helper(struct prefix *p, uint8_t instance,
uint32_t routes)
{
uint32_t temp, i;
+ bool v4 = false;
zlog_debug("Inserting %u routes", routes);
- temp = ntohl(p->u.prefix4.s_addr);
+ if (p->family == AF_INET) {
+ v4 = true;
+ temp = ntohl(p->u.prefix4.s_addr);
+ } else
+ temp = ntohl(p->u.val32[3]);
+
for (i = 0; i < routes; i++) {
route_add(p, (uint8_t)instance, nhg);
- p->u.prefix4.s_addr = htonl(++temp);
+ if (v4)
+ p->u.prefix4.s_addr = htonl(++temp);
+ else
+ p->u.val32[3] = htonl(++temp);
}
}
@@ -156,13 +165,22 @@ void sharp_remove_routes_helper(struct prefix *p, uint8_t instance,
uint32_t routes)
{
uint32_t temp, i;
+ bool v4 = false;
zlog_debug("Removing %u routes", routes);
- temp = ntohl(p->u.prefix4.s_addr);
+ if (p->family == AF_INET) {
+ v4 = true;
+ temp = ntohl(p->u.prefix4.s_addr);
+ } else
+ temp = ntohl(p->u.val32[3]);
+
for (i = 0; i < routes; i++) {
route_delete(p, (uint8_t)instance);
- p->u.prefix4.s_addr = htonl(++temp);
+ if (v4)
+ p->u.prefix4.s_addr = htonl(++temp);
+ else
+ p->u.val32[3] = htonl(++temp);
}
}