summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-08-31 21:58:31 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-08-31 22:11:17 +0200
commitf229873a87c97721f198677920d162c7e299f1e3 (patch)
tree08465974898f72852119822398b815c29828a8e5 /isisd
parentzebra: Clean up indentation (diff)
downloadfrr-f229873a87c97721f198677920d162c7e299f1e3.tar.xz
frr-f229873a87c97721f198677920d162c7e299f1e3.zip
*: Cleanup multiple is_default... code
There are 3 different implementations of is_prefix. Standardize on is_prefix_default and fix it's implementation. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'isisd')
-rw-r--r--isisd/isis_redist.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c
index ea94b6580..198cf35e6 100644
--- a/isisd/isis_redist.c
+++ b/isisd/isis_redist.c
@@ -64,17 +64,6 @@ static afi_t afi_for_redist_protocol(int protocol)
return AFI_IP;
}
-static int is_default(struct prefix *p)
-{
- if (p->family == AF_INET)
- if (p->u.prefix4.s_addr == 0 && p->prefixlen == 0)
- return 1;
- if (p->family == AF_INET6)
- if (IN6_IS_ADDR_UNSPECIFIED(&p->u.prefix6) && p->prefixlen == 0)
- return 1;
- return 0;
-}
-
static struct route_table *get_ext_info(struct isis *i, int family)
{
int protocol = redist_protocol(family);
@@ -286,7 +275,7 @@ void isis_redist_add(int type, struct prefix *p, u_char distance,
info->distance = distance;
info->metric = metric;
- if (is_default(p))
+ if (is_default_prefix(p))
type = DEFAULT_ROUTE;
for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area))
@@ -316,7 +305,7 @@ void isis_redist_delete(int type, struct prefix *p)
zlog_debug("%s: Removing route %s from %s.", __func__, debug_buf,
zebra_route_string(type));
- if (is_default(p)) {
+ if (is_default_prefix(p)) {
/* Don't remove default route but add synthetic route for use
* by "default-information originate always". Areas without the
* "always" setting will ignore routes with origin
@@ -454,7 +443,7 @@ static void isis_redist_set(struct isis_area *area, int level, int family,
info = rn->info;
if (type == DEFAULT_ROUTE) {
- if (!is_default(&rn->p))
+ if (!is_default_prefix(&rn->p))
continue;
} else {
if (info->origin != type)
@@ -490,7 +479,7 @@ static void isis_redist_unset(struct isis_area *area, int level, int family,
info = rn->info;
if (type == DEFAULT_ROUTE) {
- if (!is_default(&rn->p))
+ if (!is_default_prefix(&rn->p))
continue;
} else {
if (info->origin != type)