summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
Diffstat (limited to 'zebra')
-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
5 files changed, 30 insertions, 102 deletions
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