if (ifc->address->family == AF_INET)
{
- if (ifc->anchor = if_anchor_lookup_by_address(ifc->address->u.prefix4))
- {
- /* found an anchor, so I'm unnumbered */
- SET_FLAG (ifc->flags, ZEBRA_IFA_UNNUMBERED);
- listnode_add (ifc->anchor->unnumbered, ifc);
- }
- else
- {
- /* I'm numbered */
- UNSET_FLAG (ifc->flags, ZEBRA_IFA_UNNUMBERED);
- ifc->unnumbered = list_new();
- }
+ if ((ifc->anchor = if_anchor_lookup_by_address(ifc->address->u.prefix4)))
+ {
+ /* found an anchor, so I'm unnumbered */
+ SET_FLAG (ifc->flags, ZEBRA_IFA_UNNUMBERED);
+ listnode_add (ifc->anchor->unnumbered, ifc);
+ }
+ else
+ {
+ /* I'm numbered */
+ UNSET_FLAG (ifc->flags, ZEBRA_IFA_UNNUMBERED);
+ ifc->unnumbered = list_new();
+ }
}
listnode_add (ifp->connected, ifc);
#include <zebra.h>
#include "zebra/zserv.h"
-
-extern int interface_lookup_netlink (void);
+#include "zebra/rt_netlink.h"
/* Interface information read by netlink. */
void
}
/* Update interface's statistics. */
-void
+static void
ifstat_update_proc (void)
{
FILE *fp;
{
struct listnode *node, *nnode;
struct in_addr ip;
- int pref;
int ret;
struct interface *ifp;
struct zebra_if *zi;
if (!ret)
return CMD_WARNING;
- pref = atoi(argv[1]);
-
for (ALL_LIST_ELEMENTS (irdp->AdvPrefList, node, nnode, adv))
{
if(adv->ip.s_addr == ip.s_addr )
#include "zebra/interface.h"
#include "zebra/zebra_fpm.h"
-void ifstat_update_proc (void) { return; }
+static void ifstat_update_proc (void) { return; }
#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA
#pragma weak rtadv_config_write = ifstat_update_proc
#pragma weak irdp_config_write = ifstat_update_proc
if (!rib)
continue;
- if ((afi == AFI_IP) && (rn->p.family == AF_INET) ||
- (afi == AFI_IP6) && (rn->p.family == AF_INET6))
+ if (((afi == AFI_IP) && (rn->p.family == AF_INET)) ||
+ ((afi == AFI_IP6) && (rn->p.family == AF_INET6)))
{
if (add)
zebra_add_import_table_entry (rn, rib);
u_short instance;
/* Which routing table */
- int table;
+ uint32_t table;
/* Metric */
u_int32_t metric;
#include "zebra/router-id.h"
#include "zebra/redistribute.h"
-static struct list rid_all_sorted_list;
-static struct list rid_lo_sorted_list;
+static struct list _rid_all_sorted_list;
+static struct list _rid_lo_sorted_list;
+static struct list *rid_all_sorted_list = &_rid_all_sorted_list;
+static struct list *rid_lo_sorted_list = &_rid_lo_sorted_list;
static struct prefix rid_user_assigned;
/* master zebra server structure */
if (rid_user_assigned.u.prefix4.s_addr)
p->u.prefix4.s_addr = rid_user_assigned.u.prefix4.s_addr;
- else if (!list_isempty (&rid_lo_sorted_list))
+ else if (!list_isempty (rid_lo_sorted_list))
{
- node = listtail (&rid_lo_sorted_list);
+ node = listtail (rid_lo_sorted_list);
c = listgetdata (node);
p->u.prefix4.s_addr = c->address->u.prefix4.s_addr;
}
- else if (!list_isempty (&rid_all_sorted_list))
+ else if (!list_isempty (rid_all_sorted_list))
{
- node = listtail (&rid_all_sorted_list);
+ node = listtail (rid_all_sorted_list);
c = listgetdata (node);
p->u.prefix4.s_addr = c->address->u.prefix4.s_addr;
}
if (!strncmp (ifc->ifp->name, "lo", 2)
|| !strncmp (ifc->ifp->name, "dummy", 5))
- l = &rid_lo_sorted_list;
+ l = rid_lo_sorted_list;
else
- l = &rid_all_sorted_list;
+ l = rid_all_sorted_list;
if (!router_id_find_node (l, ifc))
listnode_add_sort (l, ifc);
if (!strncmp (ifc->ifp->name, "lo", 2)
|| !strncmp (ifc->ifp->name, "dummy", 5))
- l = &rid_lo_sorted_list;
+ l = rid_lo_sorted_list;
else
- l = &rid_all_sorted_list;
+ l = rid_all_sorted_list;
if ((c = router_id_find_node (l, ifc)))
listnode_delete (l, c);
install_element (CONFIG_NODE, &router_id_cmd);
install_element (CONFIG_NODE, &no_router_id_cmd);
- memset (&rid_all_sorted_list, 0, sizeof (rid_all_sorted_list));
- memset (&rid_lo_sorted_list, 0, sizeof (rid_lo_sorted_list));
+ memset (rid_all_sorted_list, 0, sizeof (rid_all_sorted_list));
+ memset (rid_lo_sorted_list, 0, sizeof (rid_lo_sorted_list));
memset (&rid_user_assigned, 0, sizeof (rid_user_assigned));
- rid_all_sorted_list.cmp = router_id_cmp;
- rid_lo_sorted_list.cmp = router_id_cmp;
+ rid_all_sorted_list->cmp = router_id_cmp;
+ rid_lo_sorted_list->cmp = router_id_cmp;
rid_user_assigned.family = AF_INET;
rid_user_assigned.prefixlen = 32;
/* Utility function comes from iproute2.
Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> */
int
-addattr_l (struct nlmsghdr *n, int maxlen, int type, void *data, int alen)
+addattr_l (struct nlmsghdr *n, unsigned int maxlen, int type, void *data, int alen)
{
int len;
struct rtattr *rta;
/* Utility function comes from iproute2.
Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> */
int
-addattr32 (struct nlmsghdr *n, int maxlen, int type, int data)
+addattr32 (struct nlmsghdr *n, unsigned int maxlen, int type, int data)
{
int len;
struct rtattr *rta;
#define NL_DEFAULT_ROUTE_METRIC 20
extern int
-addattr32 (struct nlmsghdr *n, int maxlen, int type, int data);
+addattr32 (struct nlmsghdr *n, unsigned int maxlen, int type, int data);
extern int
-addattr_l (struct nlmsghdr *n, int maxlen, int type, void *data, int alen);
+addattr_l (struct nlmsghdr *n, unsigned int maxlen, int type, void *data, int alen);
extern int
rta_addattr_l (struct rtattr *rta, int maxlen, int type, void *data, int alen);
extern const char *
nl_rtproto_to_str (u_char rtproto);
+extern int netlink_route_read(void);
+extern int interface_lookup_netlink(void);
#endif /* HAVE_NETLINK */
}
if ((radvert->nd_ra_retransmit && zif->rtadv.AdvRetransTimer) &&
- (ntohl(radvert->nd_ra_retransmit) != zif->rtadv.AdvRetransTimer))
+ (ntohl(radvert->nd_ra_retransmit) != (unsigned int)zif->rtadv.AdvRetransTimer))
{
zlog_warn("our AdvRetransTimer on %s doesn't agree with %s",
ifp->name, addr_str);
#include <zebra.h>
#include "zebra/zserv.h"
-
-extern void netlink_route_read (void);
+#include "zebra/rt_netlink.h"
void route_read (void)
{
#define PTM_MSG_LEN 4
#define PTM_HEADER_LEN 37
-char *ZEBRA_PTM_GET_STATUS_CMD = "get-status";
-char *ZEBRA_PTM_PORT_STR = "port";
-char *ZEBRA_PTM_CBL_STR = "cbl status";
-char *ZEBRA_PTM_PASS_STR = "pass";
-char *ZEBRA_PTM_FAIL_STR = "fail";
-char *ZEBRA_PTM_BFDSTATUS_STR = "BFD status";
-char *ZEBRA_PTM_BFDDEST_STR = "BFD peer";
+const char *ZEBRA_PTM_GET_STATUS_CMD = "get-status";
+const char *ZEBRA_PTM_PORT_STR = "port";
+const char *ZEBRA_PTM_CBL_STR = "cbl status";
+const char *ZEBRA_PTM_PASS_STR = "pass";
+const char *ZEBRA_PTM_FAIL_STR = "fail";
+const char *ZEBRA_PTM_BFDSTATUS_STR = "BFD status";
+const char *ZEBRA_PTM_BFDDEST_STR = "BFD peer";
extern struct zebra_t zebrad;
int ptm_enable;
}
static char *
-zebra_ptm_find_key(char *key_arg, char *arg, int arglen)
+zebra_ptm_find_key(const char *key_arg, char *arg, int arglen)
{
char buf[ZEBRA_PTM_MAX_SOCKBUF];
char *data, *hdr, *key, *val;
if (!strcmp (bfdst_str, ZEBRA_PTM_FAIL_STR)) {
if (ifp->ptm_enable && if_is_no_ptm_operative (ifp)) {
if (inet_pton(AF_INET, dest_str, &dest_addr) <= 0) {
- zlog_err("%s: Peer addr not found\n", __func__,
+ zlog_err("%s: Peer addr(%s) not found\n", __func__,
dest_str);
return;
}
}
/* Add nexthop to the end of a nexthop list. */
-void
+static void
_nexthop_add (struct nexthop **target, struct nexthop *nexthop)
{
struct nexthop *last;
struct rib *same = NULL;
struct nexthop *nexthop;
int ret = 0;
- int table_id = 0;
+ unsigned int table_id = 0;
if (rib)
table_id = rib->table;
route_map_event_t type)
{
int ret;
- char *dep_name = (char *)arg;
+ char *dep_name = NULL;
const char *tmpstr;
char *rmap_name = NULL;
if ((tmpstr = route_map_get_match_arg(index, command)) != NULL)
dep_name = XSTRDUP(MTYPE_ROUTE_MAP_RULE, tmpstr);
}
+ else
+ {
+ dep_name = XSTRDUP(MTYPE_ROUTE_MAP_RULE, arg);
+ }
rmap_name = XSTRDUP(MTYPE_ROUTE_MAP_NAME, index->map->name);
}
if (type != RMAP_EVENT_MATCH_DELETED && dep_name)
route_map_upd8_dependency(type, dep_name, rmap_name);
- if (arg == NULL && dep_name)
+ if (dep_name)
XFREE(MTYPE_ROUTE_MAP_RULE, dep_name);
if (rmap_name)
XFREE(MTYPE_ROUTE_MAP_NAME, rmap_name);
if (first)
{
- vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE, VTY_NEWLINE,
- VTY_NEWLINE);
+ vty_out (vty, SHOW_ROUTE_V4_HEADER);
first = 0;
}
vty_show_ip_route (vty, rn, rib);
{
u_int32_t table_id = 0;
int distance = ZEBRA_TABLE_DISTANCE_DEFAULT;
- char *route_map_name = NULL;
if (argc)
VTY_GET_INTEGER("table", table_id, argv[0]);
struct stream *s;
struct prefix p;
u_short l = 0;
- u_char flags;
- u_char exact_match;
if (IS_ZEBRA_DEBUG_NHT)
zlog_debug("rnh_unregister msg from client %s: length=%d\n",
while (l < length)
{
- flags = stream_getc(s);
+ (void)stream_getc(s); //Connected or not. Not used in this function
p.family = stream_getw(s);
p.prefixlen = stream_getc(s);
l += 4;
u_char nexthop_type;
unsigned long ifindex;
struct prefix_ipv6 p;
- u_char ifname_len;
safi_t safi;
static struct in6_addr nexthops[MULTIPATH_NUM];
static unsigned int ifindices[MULTIPATH_NUM];
#include "if.h"
#include "workqueue.h"
#include "routemap.h"
+#include "vty.h"
#include "zclient.h"
/* Default port information. */
struct list *client_list;
/* default table */
- int rtm_table_default;
+ u_int32_t rtm_table_default;
/* rib work queue */
struct work_queue *ribq;