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>
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);
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))
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
info = rn->info;
if (type == DEFAULT_ROUTE) {
- if (!is_default(&rn->p))
+ if (!is_default_prefix(&rn->p))
continue;
} else {
if (info->origin != type)
info = rn->info;
if (type == DEFAULT_ROUTE) {
- if (!is_default(&rn->p))
+ if (!is_default_prefix(&rn->p))
continue;
} else {
if (info->origin != type)
return 0;
}
-static inline int is_default_prefix(struct prefix *p)
+static inline int is_default_prefix(const struct prefix *p)
{
if (!p)
return 0;
- if (((p->family == AF_INET) && (p->u.prefix4.s_addr == INADDR_ANY))
- || ((p->family == AF_INET6)
- && !memcmp(&p->u.prefix6, &in6addr_any,
- sizeof(struct in6_addr))))
+ if ((p->family == AF_INET) &&
+ (p->u.prefix4.s_addr == INADDR_ANY) &&
+ (p->prefixlen == 0))
+ return 1;
+
+ if ((p->family == AF_INET6) &&
+ (p->prefixlen == 0) &&
+ (!memcmp(&p->u.prefix6, &in6addr_any,
+ sizeof(struct in6_addr))))
return 1;
return 0;
return 0;
}
-int is_default(struct prefix *p)
-{
- if (p->family == AF_INET)
- if (p->u.prefix4.s_addr == 0 && p->prefixlen == 0)
- return 1;
-#if 0 /* IPv6 default separation is now pending until protocol daemon \
- can handle that. */
- if (p->family == AF_INET6)
- if (IN6_IS_ADDR_UNSPECIFIED (&p->u.prefix6) && p->prefixlen == 0)
- return 1;
-#endif /* 0 */
- return 0;
-}
-
static void zebra_redistribute_default(struct zserv *client, vrf_id_t vrf_id)
{
int afi;
for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) {
send_redistribute = 0;
- if (is_default(p)
+ if (is_default_prefix(p)
&& vrf_bitmap_check(client->redist_default, re->vrf_id))
send_redistribute = 1;
else if (vrf_bitmap_check(client->redist[afi][ZEBRA_ROUTE_ALL],
}
for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) {
- if ((is_default(p)
+ if ((is_default_prefix(p)
&& vrf_bitmap_check(client->redist_default, re->vrf_id))
|| vrf_bitmap_check(client->redist[afi][ZEBRA_ROUTE_ALL],
re->vrf_id)
extern void zebra_import_table_rm_update(void);
-extern int is_default(struct prefix *);
-
#endif /* _ZEBRA_REDISTRIBUTE_H */