summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_aspath.c7
-rw-r--r--bgpd/bgp_table.c35
-rwxr-xr-xconfigure.ac2
-rw-r--r--isisd/isis_bpf.c13
-rw-r--r--isisd/topology/Makefile.am3
-rw-r--r--lib/md5.c3
-rw-r--r--lib/prefix.h10
-rw-r--r--lib/table.c62
-rw-r--r--lib/table.h12
-rw-r--r--lib/vty.c6
-rw-r--r--ospf6d/ospf6_lsa.c11
-rw-r--r--ospf6d/ospf6_lsdb.c12
-rw-r--r--ospf6d/ospf6_route.c5
-rw-r--r--ospfd/ospf_ase.c2
-rw-r--r--ospfd/ospf_vty.c17
-rw-r--r--ospfd/ospfd.c62
-rw-r--r--ospfd/ospfd.h1
-rw-r--r--zebra/interface.c13
-rw-r--r--zebra/ioctl.c2
-rw-r--r--zebra/kernel_socket.c9
-rw-r--r--zebra/rtadv.c13
-rw-r--r--zebra/zebra_rib.c95
22 files changed, 107 insertions, 288 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index 440815b4..3c8032f8 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -728,8 +728,11 @@ assegments_parse (struct stream *s, size_t length, int use32bit)
if ( ((bytes + seg_size) > length)
/* 1771bis 4.3b: seg length contains one or more */
|| (segh.length == 0)
- /* Paranoia in case someone changes type of segment length */
- || ((sizeof segh.length > 1) && (segh.length > AS_SEGMENT_MAX)) )
+ /* Paranoia in case someone changes type of segment length.
+ * Shift both values by 0x10 to make the comparison operate
+ * on more, than 8 bits (otherwise it's a warning, bug #564).
+ */
+ || ((sizeof segh.length > 1) && (0x10 + segh.length > 0x10 + AS_SEGMENT_MAX)) )
{
if (head)
assegment_free_all (head);
diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c
index 5b8c6a49..91cab606 100644
--- a/bgpd/bgp_table.c
+++ b/bgpd/bgp_table.c
@@ -201,37 +201,10 @@ route_common (struct prefix *n, struct prefix *p, struct prefix *new)
}
}
-/* Macro version of check_bit (). */
-#define CHECK_BIT(X,P) ((((u_char *)(X))[(P) / 8]) >> (7 - ((P) % 8)) & 1)
-
-/* Check bit of the prefix. */
-static int
-check_bit (u_char *prefix, u_char prefixlen)
-{
- int offset;
- int shift;
- u_char *p = (u_char *)prefix;
-
- assert (prefixlen <= 128);
-
- offset = prefixlen / 8;
- shift = 7 - (prefixlen % 8);
-
- return (p[offset] >> shift & 1);
-}
-
-/* Macro version of set_link (). */
-#define SET_LINK(X,Y) (X)->link[CHECK_BIT(&(Y)->prefix,(X)->prefixlen)] = (Y);\
- (Y)->parent = (X)
-
static void
set_link (struct bgp_node *node, struct bgp_node *new)
{
- int bit;
-
- bit = check_bit (&new->p.u.prefix, node->p.prefixlen);
-
- assert (bit == 0 || bit == 1);
+ unsigned int bit = prefix_bit (&new->p.u.prefix, node->p.prefixlen);
node->link[bit] = new;
new->parent = node;
@@ -273,7 +246,7 @@ bgp_node_match (const struct bgp_table *table, struct prefix *p)
{
if (node->info)
matched = node;
- node = node->link[check_bit(&p->u.prefix, node->p.prefixlen)];
+ node = node->link[prefix_bit(&p->u.prefix, node->p.prefixlen)];
}
/* If matched route found, return it. */
@@ -325,7 +298,7 @@ bgp_node_lookup (const struct bgp_table *table, struct prefix *p)
if (node->p.prefixlen == p->prefixlen && node->info)
return bgp_lock_node (node);
- node = node->link[check_bit(&p->u.prefix, node->p.prefixlen)];
+ node = node->link[prefix_bit(&p->u.prefix, node->p.prefixlen)];
}
return NULL;
@@ -350,7 +323,7 @@ bgp_node_get (struct bgp_table *const table, struct prefix *p)
return node;
}
match = node;
- node = node->link[check_bit(&p->u.prefix, node->p.prefixlen)];
+ node = node->link[prefix_bit(&p->u.prefix, node->p.prefixlen)];
}
if (node == NULL)
diff --git a/configure.ac b/configure.ac
index aeed0d1b..17ab4387 100755
--- a/configure.ac
+++ b/configure.ac
@@ -1546,7 +1546,7 @@ echo "
Quagga configuration
--------------------
quagga version : ${PACKAGE_VERSION}
-host operationg system : ${host_os}
+host operating system : ${host_os}
source code location : ${srcdir}
compiler : ${CC}
compiler flags : ${CFLAGS}
diff --git a/isisd/isis_bpf.c b/isisd/isis_bpf.c
index e66ac98a..8c3602db 100644
--- a/isisd/isis_bpf.c
+++ b/isisd/isis_bpf.c
@@ -56,7 +56,7 @@ struct bpf_insn llcfilter[] = {
BPF_STMT (BPF_RET + BPF_K, (u_int) - 1),
BPF_STMT (BPF_RET + BPF_K, 0)
};
-int readblen = 0;
+u_int readblen = 0;
u_char *readbuff = NULL;
/*
@@ -77,8 +77,7 @@ open_bpf_dev (struct isis_circuit *circuit)
int i = 0, fd;
char bpfdev[128];
struct ifreq ifr;
- u_int16_t blen;
- int true = 1, false = 0;
+ u_int blen, immediate, seesent;
struct timeval timeout;
struct bpf_program bpf_prog;
@@ -123,7 +122,8 @@ open_bpf_dev (struct isis_circuit *circuit)
* Otherwise, a read will block until either the kernel
* buffer becomes full or a timeout occurs.
*/
- if (ioctl (fd, BIOCIMMEDIATE, (caddr_t) & true) < 0)
+ immediate = 1;
+ if (ioctl (fd, BIOCIMMEDIATE, (caddr_t) & immediate) < 0)
{
zlog_warn ("failed to set BPF dev to immediate mode");
}
@@ -132,7 +132,8 @@ open_bpf_dev (struct isis_circuit *circuit)
/*
* We want to see only incoming packets
*/
- if (ioctl (fd, BIOCSSEESENT, (caddr_t) & false) < 0)
+ seesent = 0;
+ if (ioctl (fd, BIOCSSEESENT, (caddr_t) & seesent) < 0)
{
zlog_warn ("failed to set BPF dev to incoming only mode");
}
@@ -141,7 +142,7 @@ open_bpf_dev (struct isis_circuit *circuit)
/*
* ...but all of them
*/
- if (ioctl (fd, BIOCPROMISC, (caddr_t) & true) < 0)
+ if (ioctl (fd, BIOCPROMISC) < 0)
{
zlog_warn ("failed to set BPF dev to promiscuous mode");
}
diff --git a/isisd/topology/Makefile.am b/isisd/topology/Makefile.am
index 2515b38b..b25497cb 100644
--- a/isisd/topology/Makefile.am
+++ b/isisd/topology/Makefile.am
@@ -3,6 +3,9 @@
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
+AM_CFLAGS = $(PICFLAGS)
+AM_LDFLAGS = $(PILDFLAGS)
+
noinst_LIBRARIES = libtopology.a
libtopology_a_SOURCES = \
diff --git a/lib/md5.c b/lib/md5.c
index f1bd0668..894de648 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -232,7 +232,7 @@ static void md5_calc(const uint8_t *b64, md5_ctxt * ctxt)
const uint32_t *X = (const uint32_t *)b64;
#elif (BYTE_ORDER == BIG_ENDIAN)
uint32_t X[16];
-#endif
+
if (BYTE_ORDER == BIG_ENDIAN)
{
/* 4 byte words */
@@ -255,6 +255,7 @@ static void md5_calc(const uint8_t *b64, md5_ctxt * ctxt)
y[56] = b64[59]; y[57] = b64[58]; y[58] = b64[57]; y[59] = b64[56];
y[60] = b64[63]; y[61] = b64[62]; y[62] = b64[61]; y[63] = b64[60];
}
+#endif
ROUND1(A, B, C, D, 0, Sa, 1); ROUND1(D, A, B, C, 1, Sb, 2);
ROUND1(C, D, A, B, 2, Sc, 3); ROUND1(B, C, D, A, 3, Sd, 4);
diff --git a/lib/prefix.h b/lib/prefix.h
index 9cfc1556..d3707209 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -127,6 +127,16 @@ struct prefix_rd
/* Prefix's family member. */
#define PREFIX_FAMILY(p) ((p)->family)
+/* Check bit of the prefix. */
+static inline unsigned int
+prefix_bit (const u_char *prefix, const u_char prefixlen)
+{
+ unsigned int offset = prefixlen / 8;
+ unsigned int shift = 7 - (prefixlen % 8);
+
+ return (prefix[offset] >> shift) & 1;
+}
+
/* Prototypes. */
extern int afi2family (int);
extern int family2afi (int);
diff --git a/lib/table.c b/lib/table.c
index 2ade71b8..04df3af5 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -125,7 +125,7 @@ route_table_free (struct route_table *rt)
}
/* Utility mask array. */
-static u_char maskbit[] =
+static const u_char maskbit[] =
{
0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff
};
@@ -165,37 +165,10 @@ route_common (struct prefix *n, struct prefix *p, struct prefix *new)
}
}
-/* Macro version of check_bit (). */
-#define CHECK_BIT(X,P) ((((u_char *)(X))[(P) / 8]) >> (7 - ((P) % 8)) & 1)
-
-/* Check bit of the prefix. */
-static int
-check_bit (u_char *prefix, u_char prefixlen)
-{
- int offset;
- int shift;
- u_char *p = (u_char *)prefix;
-
- assert (prefixlen <= 128);
-
- offset = prefixlen / 8;
- shift = 7 - (prefixlen % 8);
-
- return (p[offset] >> shift & 1);
-}
-
-/* Macro version of set_link (). */
-#define SET_LINK(X,Y) do { (X)->link[CHECK_BIT(&(Y)->p.u.prefix,(X)->p.prefixlen)] = (Y);\
- (Y)->parent = (X); } while (0)
-
static void
set_link (struct route_node *node, struct route_node *new)
{
- int bit;
-
- bit = check_bit (&new->p.u.prefix, node->p.prefixlen);
-
- assert (bit == 0 || bit == 1);
+ unsigned int bit = prefix_bit (&new->p.u.prefix, node->p.prefixlen);
node->link[bit] = new;
new->parent = node;
@@ -219,26 +192,9 @@ route_unlock_node (struct route_node *node)
route_node_delete (node);
}
-/* Dump routing table. */
-static void __attribute__ ((unused))
-route_dump_node (struct route_table *t)
-{
- struct route_node *node;
- char buf[46];
-
- for (node = route_top (t); node != NULL; node = route_next (node))
- {
- printf ("[%d] %p %s/%d\n",
- node->lock,
- node->info,
- inet_ntop (node->p.family, &node->p.u.prefix, buf, 46),
- node->p.prefixlen);
- }
-}
-
/* Find matched prefix. */
struct route_node *
-route_node_match (struct route_table *table, struct prefix *p)
+route_node_match (const struct route_table *table, const struct prefix *p)
{
struct route_node *node;
struct route_node *matched;
@@ -253,7 +209,7 @@ route_node_match (struct route_table *table, struct prefix *p)
{
if (node->info)
matched = node;
- node = node->link[check_bit(&p->u.prefix, node->p.prefixlen)];
+ node = node->link[prefix_bit(&p->u.prefix, node->p.prefixlen)];
}
/* If matched route found, return it. */
@@ -264,7 +220,8 @@ route_node_match (struct route_table *table, struct prefix *p)
}
struct route_node *
-route_node_match_ipv4 (struct route_table *table, struct in_addr *addr)
+route_node_match_ipv4 (const struct route_table *table,
+ const struct in_addr *addr)
{
struct prefix_ipv4 p;
@@ -278,7 +235,8 @@ route_node_match_ipv4 (struct route_table *table, struct in_addr *addr)
#ifdef HAVE_IPV6
struct route_node *
-route_node_match_ipv6 (struct route_table *table, struct in6_addr *addr)
+route_node_match_ipv6 (const struct route_table *table,
+ const struct in6_addr *addr)
{
struct prefix_ipv6 p;
@@ -305,7 +263,7 @@ route_node_lookup (struct route_table *table, struct prefix *p)
if (node->p.prefixlen == p->prefixlen && node->info)
return route_lock_node (node);
- node = node->link[check_bit(&p->u.prefix, node->p.prefixlen)];
+ node = node->link[prefix_bit(&p->u.prefix, node->p.prefixlen)];
}
return NULL;
@@ -330,7 +288,7 @@ route_node_get (struct route_table *table, struct prefix *p)
return node;
}
match = node;
- node = node->link[check_bit(&p->u.prefix, node->p.prefixlen)];
+ node = node->link[prefix_bit(&p->u.prefix, node->p.prefixlen)];
}
if (node == NULL)
diff --git a/lib/table.h b/lib/table.h
index 45ec6067..41d1fa70 100644
--- a/lib/table.h
+++ b/lib/table.h
@@ -66,13 +66,13 @@ extern struct route_node *route_node_get (struct route_table *,
extern struct route_node *route_node_lookup (struct route_table *,
struct prefix *);
extern struct route_node *route_lock_node (struct route_node *node);
-extern struct route_node *route_node_match (struct route_table *,
- struct prefix *);
-extern struct route_node *route_node_match_ipv4 (struct route_table *,
- struct in_addr *);
+extern struct route_node *route_node_match (const struct route_table *,
+ const struct prefix *);
+extern struct route_node *route_node_match_ipv4 (const struct route_table *,
+ const struct in_addr *);
#ifdef HAVE_IPV6
-extern struct route_node *route_node_match_ipv6 (struct route_table *,
- struct in6_addr *);
+extern struct route_node *route_node_match_ipv6 (const struct route_table *,
+ const struct in6_addr *);
#endif /* HAVE_IPV6 */
#endif /* _ZEBRA_TABLE_H */
diff --git a/lib/vty.c b/lib/vty.c
index 6a307c6b..6b627a30 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -1955,6 +1955,7 @@ uty_accept (int accept_sock)
unsigned int on;
struct prefix *p = NULL;
struct access_list *acl = NULL;
+ char *bufp;
/* We continue hearing vty socket. */
vty_event (VTY_SERV, accept_sock, NULL);
@@ -2023,6 +2024,11 @@ uty_accept (int accept_sock)
uzlog (NULL, LOG_INFO, "can't set sockopt to vty_sock : %s",
safe_strerror (errno));
+ zlog (NULL, LOG_INFO, "Vty connection from %s",
+ (bufp = sockunion_su2str (&su)));
+ if (bufp)
+ XFREE (MTYPE_TMP, bufp);
+
vty = vty_create (vty_sock, &su);
return 0;
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index 07d9f91e..c1db3741 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -256,7 +256,7 @@ ospf6_lsa_premature_aging (struct ospf6_lsa *lsa)
int
ospf6_lsa_compare (struct ospf6_lsa *a, struct ospf6_lsa *b)
{
- signed long seqnuma, seqnumb;
+ int seqnuma, seqnumb;
u_int16_t cksuma, cksumb;
u_int16_t agea, ageb;
@@ -264,16 +264,13 @@ ospf6_lsa_compare (struct ospf6_lsa *a, struct ospf6_lsa *b)
assert (b && b->header);
assert (OSPF6_LSA_IS_SAME (a, b));
- seqnuma = ((signed long) ntohl (a->header->seqnum))
- - (signed long) INITIAL_SEQUENCE_NUMBER;
- seqnumb = ((signed long) ntohl (b->header->seqnum))
- - (signed long) INITIAL_SEQUENCE_NUMBER;
+ seqnuma = (int) ntohl (a->header->seqnum);
+ seqnumb = (int) ntohl (b->header->seqnum);
/* compare by sequence number */
- /* XXX, LS sequence number wrapping */
if (seqnuma > seqnumb)
return -1;
- else if (seqnuma < seqnumb)
+ if (seqnuma < seqnumb)
return 1;
/* Checksum */
diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c
index b839d16e..d2e3e04c 100644
--- a/ospf6d/ospf6_lsdb.c
+++ b/ospf6d/ospf6_lsdb.c
@@ -258,9 +258,6 @@ ospf6_lsdb_lookup (u_int16_t type, u_int32_t id, u_int32_t adv_router,
return (struct ospf6_lsa *) node->info;
}
-/* Macro version of check_bit (). */
-#define CHECK_BIT(X,P) ((((u_char *)(X))[(P) / 8]) >> (7 - ((P) % 8)) & 1)
-
struct ospf6_lsa *
ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id, u_int32_t adv_router,
struct ospf6_lsdb *lsdb)
@@ -291,7 +288,7 @@ ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id, u_int32_t adv_router,
prefix_match (&node->p, p))
{
matched = node;
- node = node->link[CHECK_BIT(&p->u.prefix, node->p.prefixlen)];
+ node = node->link[prefix_bit(&p->u.prefix, node->p.prefixlen)];
}
if (matched)
@@ -384,7 +381,7 @@ ospf6_lsdb_type_router_head (u_int16_t type, u_int32_t adv_router,
/* Walk down tree. */
while (node && node->p.prefixlen <= key.prefixlen &&
prefix_match (&node->p, (struct prefix *) &key))
- node = node->link[CHECK_BIT(&key.prefix, node->p.prefixlen)];
+ node = node->link[prefix_bit(&key.prefix, node->p.prefixlen)];
if (node)
route_lock_node (node);
@@ -438,7 +435,7 @@ ospf6_lsdb_type_head (u_int16_t type, struct ospf6_lsdb *lsdb)
node = lsdb->table->top;
while (node && node->p.prefixlen <= key.prefixlen &&
prefix_match (&node->p, (struct prefix *) &key))
- node = node->link[CHECK_BIT(&key.prefix, node->p.prefixlen)];
+ node = node->link[prefix_bit(&key.prefix, node->p.prefixlen)];
if (node)
route_lock_node (node);
@@ -553,7 +550,10 @@ ospf6_new_ls_id (u_int16_t type, u_int32_t adv_router,
if (ntohl (lsa->header->id) < id)
continue;
if (ntohl (lsa->header->id) > id)
+ {
+ ospf6_lsa_unlock (lsa);
break;
+ }
id++;
}
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index 9832f570..1e1f4fb5 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -706,9 +706,6 @@ ospf6_route_best_next (struct ospf6_route *route)
return next;
}
-/* Macro version of check_bit (). */
-#define CHECK_BIT(X,P) ((((u_char *)(X))[(P) / 8]) >> (7 - ((P) % 8)) & 1)
-
struct ospf6_route *
ospf6_route_match_head (struct prefix *prefix,
struct ospf6_route_table *table)
@@ -720,7 +717,7 @@ ospf6_route_match_head (struct prefix *prefix,
node = table->table->top;
while (node && node->p.prefixlen < prefix->prefixlen &&
prefix_match (&node->p, prefix))
- node = node->link[CHECK_BIT(&prefix->u.prefix, node->p.prefixlen)];
+ node = node->link[prefix_bit(&prefix->u.prefix, node->p.prefixlen)];
if (node)
route_lock_node (node);
diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c
index 7bddf3f4..5d0cae42 100644
--- a/ospfd/ospf_ase.c
+++ b/ospfd/ospf_ase.c
@@ -157,6 +157,7 @@ ospf_ase_forward_address_check (struct ospf *ospf, struct in_addr fwd_addr)
return 1;
}
+#if 0
/* Calculate ASBR route. */
static struct ospf_route *
ospf_ase_calculate_asbr_route (struct ospf *ospf,
@@ -237,6 +238,7 @@ ospf_ase_calculate_asbr_route (struct ospf *ospf,
return asbr_route;
}
+#endif
static struct ospf_route *
ospf_ase_calculate_new_route (struct ospf_lsa *lsa,
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index e144c299..adc822a7 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -3511,7 +3511,7 @@ show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self)
return 0;
}
-const char *show_database_desc[] =
+static const char *show_database_desc[] =
{
"unknown",
"Router Link States",
@@ -3529,10 +3529,7 @@ const char *show_database_desc[] =
#endif /* HAVE_OPAQUE_LSA */
};
-#define SHOW_OSPF_COMMON_HEADER \
- "Link ID ADV Router Age Seq# CkSum"
-
-const char *show_database_header[] =
+static const char *show_database_header[] =
{
"",
"Link ID ADV Router Age Seq# CkSum Link count",
@@ -3550,16 +3547,6 @@ const char *show_database_header[] =
#endif /* HAVE_OPAQUE_LSA */
};
-const char *show_lsa_flags[] =
-{
- "Self-originated",
- "Checked",
- "Received",
- "Approved",
- "Discard",
- "Translated",
-};
-
static void
show_ip_ospf_database_header (struct vty *vty, struct ospf_lsa *lsa)
{
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index b86986b5..a7553e73 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -71,6 +71,8 @@ static void ospf_area_free (struct ospf_area *);
static void ospf_network_run (struct prefix *, struct ospf_area *);
static void ospf_network_run_interface (struct prefix *, struct ospf_area *,
struct interface *);
+static int ospf_network_match_iface (const struct connected *,
+ const struct prefix *);
static void ospf_finish_final (struct ospf *);
#define OSPF_EXTERNAL_LSA_ORIGINATE_DELAY 1
@@ -589,7 +591,7 @@ ospf_area_new (struct ospf *ospf, struct in_addr area_id)
return new;
}
-void
+static void
ospf_area_free (struct ospf_area *area)
{
struct route_node *rn;
@@ -719,7 +721,7 @@ ospf_network_new (struct in_addr area_id, int format)
return new;
}
-void
+static void
ospf_network_free (struct ospf *ospf, struct ospf_network *network)
{
ospf_area_check_free (ospf, network->area_id);
@@ -832,62 +834,14 @@ ospf_network_unset (struct ospf *ospf, struct prefix_ipv4 *p,
/* Check whether interface matches given network
* returns: 1, true. 0, false
*/
-int
-ospf_network_match_iface(struct connected *co, struct prefix *net)
+static int
+ospf_network_match_iface(const struct connected *co, const struct prefix *net)
{
-/* #define COMPATIBILITY_MODE */
- /* The old code used to have a special case for PtP interfaces:
-
- if (if_is_pointopoint (co->ifp) && co->destination &&
- IPV4_ADDR_SAME ( &(co->destination->u.prefix4), &(net->u.prefix4)))
- return 1;
-
- The new approach is much more general. If a peer address is supplied,
- then we are routing to that prefix, so that's the address to compare
- against (not the local address, which may not be unique).
- */
-#ifndef COMPATIBILITY_MODE
/* new approach: more elegant and conceptually clean */
return prefix_match(net, CONNECTED_PREFIX(co));
-#else /* COMPATIBILITY_MODE */
- /* match old (strange?) behavior */
-
- /* Behaviour to match both Cisco where:
- * iface address lies within network specified -> ospf
- * and zebra 0.9[2ish-3]:
- * PtP special case: network specified == iface peer addr -> ospf
- */
-
- /* For PtP, match if peer address matches network address exactly.
- * This can be addr/32 or addr/p for p < 32, but the addr must match
- * exactly; this is not a test for falling within the prefix. This
- * test is solely for compatibility with zebra.
- */
- if (CONNECTED_PEER(co) &&
- IPV4_ADDR_SAME ( &(co->destination->u.prefix4), &(net->u.prefix4)))
- return 1;
-
-#if 0
- /* Decline to accept PtP if dst address does not match the
- * prefix. (ifdefed out because this is a workaround, not the
- * desired behavior.) */
- if (if_is_pointopoint (co->ifp) &&
- ! prefix_match (net, co->destination))
- return 0;
-#endif
-
- /* If the address is within the prefix, accept. Note that this
- * applies to PtP as well as other types.
- */
- if (prefix_match (net, co->address))
- return 1;
-
- return 0; /* no match */
-
-#endif /* COMPATIBILITY_MODE */
}
-void
+static void
ospf_network_run_interface (struct prefix *p, struct ospf_area *area,
struct interface *ifp)
{
@@ -944,7 +898,7 @@ ospf_network_run_interface (struct prefix *p, struct ospf_area *area,
}
}
-void
+static void
ospf_network_run (struct prefix *p, struct ospf_area *area)
{
struct interface *ifp;
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index f81c682c..b24b3ced 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -558,7 +558,6 @@ extern struct ospf *ospf_lookup (void);
extern struct ospf *ospf_get (void);
extern void ospf_finish (struct ospf *);
extern void ospf_router_id_update (struct ospf *ospf);
-extern int ospf_network_match_iface (struct connected *, struct prefix *);
extern int ospf_network_set (struct ospf *, struct prefix_ipv4 *,
struct in_addr);
extern int ospf_network_unset (struct ospf *, struct prefix_ipv4 *,
diff --git a/zebra/interface.c b/zebra/interface.c
index 9dfb6d50..ba4cf25f 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -830,19 +830,6 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
#endif /* HAVE_NET_RT_IFLIST */
}
-/* Check supported address family. */
-static int
-if_supported_family (int family)
-{
- if (family == AF_INET)
- return 1;
-#ifdef HAVE_IPV6
- if (family == AF_INET6)
- return 1;
-#endif /* HAVE_IPV6 */
- return 0;
-}
-
/* Wrapper hook point for zebra daemon so that ifindex can be set
* DEFUN macro not used as extract.pl HAS to ignore this
* See also interface_cmd in lib/if.c
diff --git a/zebra/ioctl.c b/zebra/ioctl.c
index 5cf9e7b0..d783b0a3 100644
--- a/zebra/ioctl.c
+++ b/zebra/ioctl.c
@@ -372,7 +372,7 @@ if_get_flags (struct interface *ifp)
if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_LINKDETECTION))
{
(void) memset(&ifmr, 0, sizeof(ifmr));
- strncpy (&ifmr.ifm_name, ifp->name, IFNAMSIZ);
+ strncpy (ifmr.ifm_name, ifp->name, IFNAMSIZ);
/* Seems not all interfaces implement this ioctl */
if (if_ioctl(SIOCGIFMEDIA, (caddr_t) &ifmr) < 0)
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 8beac71d..feeaf5d0 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -173,7 +173,9 @@ static const struct message rtm_flag_str[] =
#ifdef RTF_MASK
{RTF_MASK, "MASK"},
#endif /* RTF_MASK */
+#ifdef RTF_CLONING
{RTF_CLONING, "CLONING"},
+#endif /* RTF_CLONING */
{RTF_XRESOLVE, "XRESOLVE"},
{RTF_LLINFO, "LLINFO"},
{RTF_STATIC, "STATIC"},
@@ -236,7 +238,7 @@ af_check (int family)
static void
rtm_flag_dump (int flag)
{
- struct message *mes;
+ const struct message *mes;
static char buf[BUFSIZ];
buf[0] = '\0';
@@ -999,9 +1001,14 @@ rtm_write (int message,
if (gate && message == RTM_ADD)
msg.rtm.rtm_flags |= RTF_GATEWAY;
+ /* When RTF_CLONING is unavailable on BSD, should we set some
+ * other flag instead?
+ */
+#ifdef RTF_CLONING
if (! gate && message == RTM_ADD && ifp &&
(ifp->flags & IFF_POINTOPOINT) == 0)
msg.rtm.rtm_flags |= RTF_CLONING;
+#endif /* RTF_CLONING */
/* If no protocol specific gateway is specified, use link
address for gateway. */
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 0bcdafb0..8cc3c4cb 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -87,12 +87,6 @@ rtadv_new (void)
return XCALLOC (MTYPE_TMP, sizeof (struct rtadv));
}
-static void
-rtadv_free (struct rtadv *rtadv)
-{
- XFREE (MTYPE_TMP, rtadv);
-}
-
static int
rtadv_recv_packet (int sock, u_char *buf, int buflen,
struct sockaddr_in6 *from, unsigned int *ifindex,
@@ -138,7 +132,10 @@ rtadv_recv_packet (int sock, u_char *buf, int buflen,
/* Incoming packet's hop limit. */
if (cmsgptr->cmsg_level == IPPROTO_IPV6 &&
cmsgptr->cmsg_type == IPV6_HOPLIMIT)
- *hoplimit = *((int *) CMSG_DATA (cmsgptr));
+ {
+ int *hoptr = (int *) CMSG_DATA (cmsgptr);
+ *hoplimit = *hoptr;
+ }
}
return ret;
}
@@ -467,7 +464,7 @@ rtadv_read (struct thread *thread)
int len;
u_char buf[RTADV_MSG_SIZE];
struct sockaddr_in6 from;
- unsigned int ifindex;
+ unsigned int ifindex = 0;
int hoplimit = -1;
sock = THREAD_FD (thread);
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 1d1876d8..12f3fa5a 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -93,15 +93,6 @@ vrf_alloc (const char *name)
return vrf;
}
-/* Free VRF. */
-static void
-vrf_free (struct vrf *vrf)
-{
- if (vrf->name)
- XFREE (MTYPE_VRF_NAME, vrf->name);
- XFREE (MTYPE_VRF, vrf);
-}
-
/* Lookup VRF by identifier. */
struct vrf *
vrf_lookup (u_int32_t id)
@@ -109,20 +100,6 @@ vrf_lookup (u_int32_t id)
return vector_lookup (vrf_vector, id);
}
-/* Lookup VRF by name. */
-static struct vrf *
-vrf_lookup_by_name (char *name)
-{
- unsigned int i;
- struct vrf *vrf;
-
- for (i = 0; i < vector_active (vrf_vector); i++)
- if ((vrf = vector_slot (vrf_vector, i)) != NULL)
- if (vrf->name && name && strcmp (vrf->name, name) == 0)
- return vrf;
- return NULL;
-}
-
/* Initialize VRF. */
static void
vrf_init (void)
@@ -362,7 +339,7 @@ nexthop_active_ipv4 (struct rib *rib, struct nexthop *nexthop, int set,
{
route_unlock_node (rn);
- /* If lookup self prefix return immidiately. */
+ /* If lookup self prefix return immediately. */
if (rn == top)
return 0;
@@ -463,7 +440,7 @@ nexthop_active_ipv6 (struct rib *rib, struct nexthop *nexthop, int set,
{
route_unlock_node (rn);
- /* If lookup self prefix return immidiately. */
+ /* If lookup self prefix return immediately. */
if (rn == top)
return 0;
@@ -791,7 +768,7 @@ rib_match_ipv6 (struct in6_addr *addr)
* The return value is the final value of 'ACTIVE' flag.
*/
-static int
+static unsigned
nexthop_active_check (struct route_node *rn, struct rib *rib,
struct nexthop *nexthop, int set)
{
@@ -905,7 +882,7 @@ static int
nexthop_active_update (struct route_node *rn, struct rib *rib, int set)
{
struct nexthop *nexthop;
- int prev_active, prev_index, new_active;
+ unsigned int prev_active, prev_index, new_active;
rib->nexthop_active_num = 0;
UNSET_FLAG (rib->flags, ZEBRA_FLAG_CHANGED);
@@ -1294,49 +1271,28 @@ rib_meta_queue_add (struct meta_queue *mq, struct route_node *rn)
static void
rib_queue_add (struct zebra_t *zebra, struct route_node *rn)
{
- char buf[INET_ADDRSTRLEN];
- assert (zebra && rn);
if (IS_ZEBRA_DEBUG_RIB_Q)
- inet_ntop (AF_INET, &rn->p.u.prefix, buf, INET_ADDRSTRLEN);
-
- /* Pointless to queue a route_node with no RIB entries to add or remove */
- if (!rn->info)
{
- zlog_debug ("%s: called for route_node (%p, %d) with no ribs",
- __func__, rn, rn->lock);
- zlog_backtrace(LOG_DEBUG);
- return;
- }
-
- if (IS_ZEBRA_DEBUG_RIB_Q)
- zlog_info ("%s: %s/%d: work queue added", __func__, buf, rn->p.prefixlen);
+ char buf[INET6_ADDRSTRLEN];
- assert (zebra);
-
- if (zebra->ribq == NULL)
- {
- zlog_err ("%s: work_queue does not exist!", __func__);
- return;
+ zlog_info ("%s: %s/%d: work queue added", __func__,
+ inet_ntop (rn->p.family, &rn->p.u.prefix, buf, INET6_ADDRSTRLEN),
+ rn->p.prefixlen);
}
- /* The RIB queue should normally be either empty or holding the only work_queue_item
- * element. In the latter case this element would hold a pointer to the meta queue
- * structure, which must be used to actually queue the route nodes to process. So
- * create the MQ holder, if necessary, then push the work into it in any case.
+ /*
+ * The RIB queue should normally be either empty or holding the only
+ * work_queue_item element. In the latter case this element would
+ * hold a pointer to the meta queue structure, which must be used to
+ * actually queue the route nodes to process. So create the MQ
+ * holder, if necessary, then push the work into it in any case.
* This semantics was introduced after 0.99.9 release.
*/
-
- /* Should I invent work_queue_empty() and use it, or it's Ok to do as follows? */
if (!zebra->ribq->items->count)
work_queue_add (zebra->ribq, zebra->mq);
rib_meta_queue_add (zebra->mq, rn);
-
- if (IS_ZEBRA_DEBUG_RIB_Q)
- zlog_debug ("%s: %s/%d: rn %p queued", __func__, buf, rn->p.prefixlen, rn);
-
- return;
}
/* Create new meta queue.
@@ -1364,8 +1320,6 @@ meta_queue_new (void)
static void
rib_queue_init (struct zebra_t *zebra)
{
- assert (zebra);
-
if (! (zebra->ribq = work_queue_new (zebra->master,
"route_node processing")))
{
@@ -1381,11 +1335,7 @@ rib_queue_init (struct zebra_t *zebra)
zebra->ribq->spec.hold = rib_process_hold_time;
if (!(zebra->mq = meta_queue_new ()))
- {
zlog_err ("%s: could not initialise meta queue!", __func__);
- return;
- }
- return;
}
/* RIB updates are processed via a queue of pointers to route_nodes.
@@ -1653,10 +1603,10 @@ void rib_dump (const char * func, const struct prefix_ipv4 * p, const struct rib
zlog_debug ("%s: dumping RIB entry %p for %s/%d", func, rib, straddr1, p->prefixlen);
zlog_debug
(
- "%s: refcnt == %lu, uptime == %u, type == %u, table == %d",
+ "%s: refcnt == %lu, uptime == %lu, type == %u, table == %d",
func,
rib->refcnt,
- rib->uptime,
+ (unsigned long) rib->uptime,
rib->type,
rib->table
);
@@ -2860,19 +2810,6 @@ rib_update (void)
rib_queue_add (&zebrad, rn);
}
-/* Interface goes up. */
-static void
-rib_if_up (struct interface *ifp)
-{
- rib_update ();
-}
-
-/* Interface goes down. */
-static void
-rib_if_down (struct interface *ifp)
-{
- rib_update ();
-}
/* Remove all routes which comes from non main table. */
static void