summaryrefslogtreecommitdiffstats
path: root/lib/prefix.c
diff options
context:
space:
mode:
authorChris Hall <chris.hall@highwayman.com>2011-03-29 00:29:35 +0100
committerChris Hall <chris.hall@highwayman.com>2011-03-29 00:29:35 +0100
commite20f7ccd9e110fcd5deb945f8d23922efd8b0822 (patch)
tree89b61ee61ac306817dc19b9313806bf2562b1c1b /lib/prefix.c
parent6481583be322b0ba223a0140500a0a6d50546dd9 (diff)
downloadquagga-ex14.tar.bz2
quagga-ex14.tar.xz
Bring "ex" version up to date with 0.99.18ex14
Release: 0.99.18ex14 Also fixes issue with unknown attributes -- does not release them prematurely. Contains the "bgpd: New show commands for improved view and address family support", which is post 0.99.18. (But not RFC 5082 GTSM.)
Diffstat (limited to 'lib/prefix.c')
-rw-r--r--lib/prefix.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/prefix.c b/lib/prefix.c
index f13050e5..867c86a3 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -41,7 +41,7 @@ static const u_char maskbit[] = { 0x00, 0x80, 0xc0, 0xe0, 0xf0,
/* Address Famiy Identifier to Address Family converter. */
int
-afi2family (int afi)
+afi2family (afi_t afi)
{
if (afi == AFI_IP)
return AF_INET;
@@ -52,7 +52,7 @@ afi2family (int afi)
return 0;
}
-int
+afi_t
family2afi (int family)
{
if (family == AF_INET)
@@ -70,15 +70,16 @@ prefix_match (const struct prefix *n, const struct prefix *p)
{
int offset;
int shift;
-
- /* Set both prefix's head pointer. */
- const u_char *np = (const u_char *)&n->u.prefix;
- const u_char *pp = (const u_char *)&p->u.prefix;
+ const u_char *np, *pp;
/* If n's prefix is longer than p's one return 0. */
if (n->prefixlen > p->prefixlen)
return 0;
+ /* Set both prefix's head pointer. */
+ np = (const u_char *)&n->u.prefix;
+ pp = (const u_char *)&p->u.prefix;
+
offset = n->prefixlen / PNBBY;
shift = n->prefixlen % PNBBY;