summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2015-11-04 13:26:38 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2015-12-08 14:12:10 -0500
commita979ab70e0ec51f3cf779edae509f3c52be0b0f4 (patch)
treef81b6472598e824ea37e3f17e1dd8b167044fbeb /zebra/zebra_rib.c
parent9bcdd1a252ba84424eb06e84adf7fb48ae66ce1f (diff)
downloadquagga-a979ab70e0ec51f3cf779edae509f3c52be0b0f4.tar.bz2
quagga-a979ab70e0ec51f3cf779edae509f3c52be0b0f4.tar.xz
zebra: combine static_ipv[4|6]_nexthop_same into one function
Combine the static_ipv[4|6]_nexthop_same into static_nexthop_same. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 4d122c42..f0c180c9 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -2372,7 +2372,7 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p, struct static_ro
}
static int
-static_ipv4_nexthop_same (struct nexthop *nexthop, struct static_route *si)
+static_nexthop_same (struct nexthop *nexthop, struct static_route *si)
{
if (nexthop->type == NEXTHOP_TYPE_IPV4
&& si->type == STATIC_IPV4_GATEWAY
@@ -2385,6 +2385,19 @@ static_ipv4_nexthop_same (struct nexthop *nexthop, struct static_route *si)
if (nexthop->type == NEXTHOP_TYPE_BLACKHOLE
&& si->type == STATIC_IPV4_BLACKHOLE)
return 1;
+ if (nexthop->type == NEXTHOP_TYPE_IPV6
+ && si->type == STATIC_IPV6_GATEWAY
+ && IPV6_ADDR_SAME (&nexthop->gate.ipv6, &si->addr.ipv6))
+ return 1;
+ if (nexthop->type == NEXTHOP_TYPE_IFNAME
+ && si->type == STATIC_IPV6_IFNAME
+ && strcmp (nexthop->ifname, si->ifname) == 0)
+ return 1;
+ if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME
+ && si->type == STATIC_IPV6_GATEWAY_IFNAME
+ && IPV6_ADDR_SAME (&nexthop->gate.ipv6, &si->addr.ipv6)
+ && strcmp (nexthop->ifname, si->ifname) == 0)
+ return 1;
return 0;
}
@@ -2424,7 +2437,7 @@ static_uninstall_ipv4 (safi_t safi, struct prefix *p, struct static_route *si)
/* Lookup nexthop. */
for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
- if (static_ipv4_nexthop_same (nexthop, si))
+ if (static_nexthop_same (nexthop, si))
break;
/* Can't find nexthop. */
@@ -2842,25 +2855,6 @@ rib_delete_ipv6 (int type, int flags, struct prefix_ipv6 *p,
return 0;
}
-static int
-static_ipv6_nexthop_same (struct nexthop *nexthop, struct static_route *si)
-{
- if (nexthop->type == NEXTHOP_TYPE_IPV6
- && si->type == STATIC_IPV6_GATEWAY
- && IPV6_ADDR_SAME (&nexthop->gate.ipv6, &si->addr.ipv6))
- return 1;
- if (nexthop->type == NEXTHOP_TYPE_IFNAME
- && si->type == STATIC_IPV6_IFNAME
- && strcmp (nexthop->ifname, si->ifname) == 0)
- return 1;
- if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME
- && si->type == STATIC_IPV6_GATEWAY_IFNAME
- && IPV6_ADDR_SAME (&nexthop->gate.ipv6, &si->addr.ipv6)
- && strcmp (nexthop->ifname, si->ifname) == 0)
- return 1;
- return 0;
-}
-
static void
static_uninstall_ipv6 (struct prefix *p, struct static_route *si)
{
@@ -2896,7 +2890,7 @@ static_uninstall_ipv6 (struct prefix *p, struct static_route *si)
/* Lookup nexthop. */
for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
- if (static_ipv6_nexthop_same (nexthop, si))
+ if (static_nexthop_same (nexthop, si))
break;
/* Can't find nexthop. */