summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
Diffstat (limited to 'zebra')
-rw-r--r--zebra/if_linkdetect.c25
-rw-r--r--zebra/if_netlink.c5
-rw-r--r--zebra/interface.c8
-rw-r--r--zebra/interface.h11
-rw-r--r--zebra/irdp_packet.c2
-rw-r--r--zebra/linkdetect_null.c12
-rw-r--r--zebra/rt_netlink.c32
-rw-r--r--zebra/rtadv.c4
-rw-r--r--zebra/rtread_netlink.c6
-rw-r--r--zebra/zebra_rib.c11
10 files changed, 79 insertions, 37 deletions
diff --git a/zebra/if_linkdetect.c b/zebra/if_linkdetect.c
index 9ae7c6a6..4f95c16e 100644
--- a/zebra/if_linkdetect.c
+++ b/zebra/if_linkdetect.c
@@ -22,9 +22,6 @@
#include <zebra.h>
#include "log.h"
#include "privs.h"
-
-#include "log.h"
-#include "privs.h"
#include "prefix.h"
#include "zebra/interface.h"
@@ -32,14 +29,14 @@
extern struct zebra_privs_t zserv_privs;
static int
-linkdetect (const char *name, int onoff)
+linkdetect (const char *name, const char *ver, int onoff)
{
FILE *fp;
int save_errno;
char proc_name[128];
snprintf(proc_name, sizeof(proc_name)-1,
- "/proc/sys/net/ipv4/conf/%s/link_detect", name);
+ "/proc/sys/net/%s/conf/%s/link_detect", ver, name);
if ( zserv_privs.change(ZPRIVS_RAISE) )
zlog_err ("Can't raise privileges, %s", safe_strerror (errno) );
@@ -71,11 +68,25 @@ linkdetect (const char *name, int onoff)
int
if_linkdetect_on (const char *name)
{
- return linkdetect (name, 1);
+ return linkdetect (name, "ipv4", 1);
}
int
if_linkdetect_off (const char *name)
{
- return linkdetect (name, 1);
+ return linkdetect (name, "ipv4", 0);
+}
+
+#ifdef HAVE_IPV6
+int
+if_linkdetect_ipv6_on (const char *name)
+{
+ return linkdetect (name, "ipv6", 1);
+}
+
+int
+if_linkdetect_ipv6_off (const char *name)
+{
+ return linkdetect (name, "ipv6", 0);
}
+#endif
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index c9c14760..701c81b6 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -22,12 +22,11 @@
#include <zebra.h>
-/* Extern from rt_netlink.c */
-void interface_lookup_netlink ();
+extern int interface_lookup_netlink (void);
/* Interface information read by netlink. */
void
-interface_list ()
+interface_list (void)
{
interface_lookup_netlink ();
}
diff --git a/zebra/interface.c b/zebra/interface.c
index f6d2ff9b..916c58a6 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -833,6 +833,7 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
#endif /* HAVE_NET_RT_IFLIST */
}
+#if 0
/* Check supported address family. */
static int
if_supported_family (int family)
@@ -845,6 +846,7 @@ if_supported_family (int family)
#endif /* HAVE_IPV6 */
return 0;
}
+#endif
/* Wrapper hook point for zebra daemon so that ifindex can be set
* DEFUN macro not used as extract.pl HAS to ignore this
@@ -1032,6 +1034,9 @@ DEFUN (linkdetect,
/* Enable FIB to remove kernel routes as well */
if_linkdetect_on(ifp->name);
+#ifdef HAVE_IPV6
+ if_linkdetect_ipv6_on(ifp->name);
+#endif
/* When linkdetection is enabled, if might come down */
if (!if_is_operative(ifp) && if_was_operative) if_down(ifp);
@@ -1058,6 +1063,9 @@ DEFUN (no_linkdetect,
/* Disable FIB update on link-detect */
if_linkdetect_off(ifp->name);
+#ifdef HAVE_IPV6
+ if_linkdetect_ipv6_off(ifp->name);
+#endif
/* Interface may come up after disabling link detection */
if (if_is_operative(ifp) && !if_was_operative) if_up(ifp);
diff --git a/zebra/interface.h b/zebra/interface.h
index 6f356686..114270e7 100644
--- a/zebra/interface.h
+++ b/zebra/interface.h
@@ -234,13 +234,20 @@ extern int interface_list_proc (void);
extern int ifaddr_proc_ipv6 (void);
#endif /* HAVE_PROC_NET_IF_INET6 */
-#ifdef HAVE_PROC_NET_IPV4_CONF
+#ifdef HAVE_LINKDETECT
extern int if_linkdetect_on (const char *);
extern int if_linkdetect_off (const char *);
+# ifdef HAVE_IPV6
+extern int if_linkdetect_ipv6_on (const char *);
+extern int if_linkdetect_ipv6_off (const char *);
+# endif
#else
-#error config
#define if_linkdetect_on(name)
#define if_linkdetect_off(name)
+# ifdef HAVE_IPV6
+#define if_linkdetect_ipv6_on(name)
+#define if_linkdetect_ipv6_off(name)
+# endif
#endif
diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c
index 3c5f1559..ae121ea1 100644
--- a/zebra/irdp_packet.c
+++ b/zebra/irdp_packet.c
@@ -231,7 +231,7 @@ int irdp_read_raw(struct thread *r)
struct zebra_if *zi;
struct irdp_interface *irdp;
char buf[IRDP_RX_BUF];
- int ret, ifindex;
+ int ret, ifindex = 0;
int irdp_sock = THREAD_FD (r);
t_irdp_raw = thread_add_read (zebrad.master, irdp_read_raw, NULL, irdp_sock);
diff --git a/zebra/linkdetect_null.c b/zebra/linkdetect_null.c
index c33363e1..1f160c8e 100644
--- a/zebra/linkdetect_null.c
+++ b/zebra/linkdetect_null.c
@@ -14,3 +14,15 @@ if_linkdetect_off (const char *name)
{
return 0;
}
+
+int
+if_linkdetect_ipv6_on (const char *name)
+{
+ return 0;
+}
+
+int
+if_linkdetect_ipv6_off (const char *name)
+{
+ return 0;
+}
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 71d26a76..c6ec08c6 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -53,7 +53,7 @@ struct nlsock
} netlink = { -1, 0, {0}, "netlink-listen"}, /* kernel messages */
netlink_cmd = { -1, 0, {0}, "netlink-cmd"}; /* command channel */
-struct message nlmsg_str[] = {
+static struct message nlmsg_str[] = {
{RTM_NEWROUTE, "RTM_NEWROUTE"},
{RTM_DELROUTE, "RTM_DELROUTE"},
{RTM_GETROUTE, "RTM_GETROUTE"},
@@ -66,7 +66,7 @@ struct message nlmsg_str[] = {
{0, NULL}
};
-const char *nexthop_types_desc[] =
+static const char *nexthop_types_desc[] =
{
"none",
"Directly connected",
@@ -440,7 +440,7 @@ netlink_parse_rtattr (struct rtattr **tb, int max, struct rtattr *rta,
/* Called from interface_lookup_netlink(). This function is only used
during bootstrap. */
-int
+static int
netlink_interface (struct sockaddr_nl *snl, struct nlmsghdr *h)
{
int len;
@@ -517,7 +517,7 @@ netlink_interface (struct sockaddr_nl *snl, struct nlmsghdr *h)
}
/* Lookup interface IPv4/IPv6 address. */
-int
+static int
netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h)
{
int len;
@@ -652,7 +652,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h)
}
/* Looking up routing table by netlink interface. */
-int
+static int
netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h)
{
int len;
@@ -769,7 +769,7 @@ struct message rtproto_str[] = {
};
/* Routing information change from the kernel. */
-int
+static int
netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
{
int len;
@@ -910,7 +910,7 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
return 0;
}
-int
+static int
netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
{
int len;
@@ -1023,7 +1023,7 @@ netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
return 0;
}
-int
+static int
netlink_information_fetch (struct sockaddr_nl *snl, struct nlmsghdr *h)
{
/* JF: Ignore messages that aren't from the kernel */
@@ -1125,7 +1125,7 @@ netlink_route_read (void)
/* Utility function comes from iproute2.
Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> */
-int
+static int
addattr_l (struct nlmsghdr *n, int maxlen, int type, void *data, int alen)
{
int len;
@@ -1145,7 +1145,7 @@ addattr_l (struct nlmsghdr *n, int maxlen, int type, void *data, int alen)
return 0;
}
-int
+static int
rta_addattr_l (struct rtattr *rta, int maxlen, int type, void *data, int alen)
{
int len;
@@ -1167,7 +1167,7 @@ rta_addattr_l (struct rtattr *rta, int maxlen, int type, void *data, int alen)
/* Utility function comes from iproute2.
Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> */
-int
+static int
addattr32 (struct nlmsghdr *n, int maxlen, int type, int data)
{
int len;
@@ -1195,7 +1195,7 @@ netlink_talk_filter (struct sockaddr_nl *snl, struct nlmsghdr *h)
}
/* sendmsg() to netlink socket then recvmsg(). */
-int
+static int
netlink_talk (struct nlmsghdr *n, struct nlsock *nl)
{
int status;
@@ -1241,7 +1241,7 @@ netlink_talk (struct nlmsghdr *n, struct nlsock *nl)
}
/* Routing table change via netlink interface. */
-int
+static int
netlink_route (int cmd, int family, void *dest, int length, void *gate,
int index, int zebra_flags, int table)
{
@@ -1316,7 +1316,7 @@ netlink_route (int cmd, int family, void *dest, int length, void *gate,
}
/* Routing table change via netlink interface. */
-int
+static int
netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
int family)
{
@@ -1779,7 +1779,7 @@ kernel_delete_ipv6_old (struct prefix_ipv6 *dest, struct in6_addr *gate,
#endif /* HAVE_IPV6 */
/* Interface address modification. */
-int
+static int
netlink_address (int cmd, int family, struct interface *ifp,
struct connected *ifc)
{
@@ -1844,7 +1844,7 @@ kernel_address_delete_ipv4 (struct interface *ifp, struct connected *ifc)
extern struct thread_master *master;
/* Kernel route reflection. */
-int
+static int
kernel_read (struct thread *thread)
{
int ret;
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 4bdb83d5..0097e28f 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -90,11 +90,13 @@ rtadv_new (void)
return new;
}
+#if 0
static void
rtadv_free (struct rtadv *rtadv)
{
XFREE (MTYPE_TMP, rtadv);
}
+#endif
static int
rtadv_recv_packet (int sock, u_char *buf, int buflen,
@@ -451,7 +453,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/rtread_netlink.c b/zebra/rtread_netlink.c
index 0b255a53..44715d94 100644
--- a/zebra/rtread_netlink.c
+++ b/zebra/rtread_netlink.c
@@ -21,11 +21,9 @@
*/
#include <zebra.h>
+extern void netlink_route_read (void);
-/* Extern from rt_netlink.c */
-void netlink_route_read ();
-
-void route_read ()
+void route_read (void)
{
netlink_route_read ();
}
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 5ae556bf..59b53fa1 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -93,6 +93,7 @@ vrf_alloc (const char *name)
return vrf;
}
+#if 0
/* Free VRF. */
static void
vrf_free (struct vrf *vrf)
@@ -101,6 +102,7 @@ vrf_free (struct vrf *vrf)
XFREE (MTYPE_VRF_NAME, vrf->name);
XFREE (MTYPE_VRF, vrf);
}
+#endif
/* Lookup VRF by identifier. */
struct vrf *
@@ -109,6 +111,7 @@ vrf_lookup (u_int32_t id)
return vector_lookup (vrf_vector, id);
}
+#if 0
/* Lookup VRF by name. */
static struct vrf *
vrf_lookup_by_name (char *name)
@@ -122,6 +125,7 @@ vrf_lookup_by_name (char *name)
return vrf;
return NULL;
}
+#endif
/* Initialize VRF. */
static void
@@ -911,8 +915,7 @@ nexthop_active_check (struct route_node *rn, struct rib *rib,
return CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
rmap = 0;
- if (rib->type >= 0 && rib->type < ZEBRA_ROUTE_MAX &&
- proto_rm[family][rib->type])
+ if (rib->type < ZEBRA_ROUTE_MAX && proto_rm[family][rib->type])
rmap = route_map_lookup_by_name (proto_rm[family][rib->type]);
if (!rmap && proto_rm[family][ZEBRA_ROUTE_MAX])
rmap = route_map_lookup_by_name (proto_rm[family][ZEBRA_ROUTE_MAX]);
@@ -1567,7 +1570,7 @@ 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,
@@ -2780,6 +2783,7 @@ rib_update (void)
rib_queue_add (&zebrad, rn);
}
+#if 0
/* Interface goes up. */
static void
rib_if_up (struct interface *ifp)
@@ -2793,6 +2797,7 @@ rib_if_down (struct interface *ifp)
{
rib_update ();
}
+#endif
/* Remove all routes which comes from non main table. */
static void