summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDinesh G Dutt <ddutt@cumulusnetworks.com>2015-09-16 08:39:54 -0700
committerDinesh G Dutt <ddutt@cumulusnetworks.com>2015-09-16 08:39:54 -0700
commit9246e792aa6d55a1dbc99a8b6d1be46dee51093c (patch)
tree68627e5b11a60e44e5b2e838036918c213dc1323
parent4db757ae909b62896aba50eeb9615f2968215a66 (diff)
parentb2d8fe02de717129c86dddc79ae1b5644093632b (diff)
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
-rw-r--r--bgpd/Makefile.am2
-rw-r--r--bgpd/bgp_vty.c5
-rw-r--r--zebra/rt_netlink.c7
-rw-r--r--zebra/zserv.c17
-rw-r--r--zebra/zserv.h1
5 files changed, 28 insertions, 4 deletions
diff --git a/bgpd/Makefile.am b/bgpd/Makefile.am
index 7fdaa17957..54b26187a7 100644
--- a/bgpd/Makefile.am
+++ b/bgpd/Makefile.am
@@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in.
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
-DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
+DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" -DMULTIPATH_NUM=@MULTIPATH_NUM@
INSTALL_SDATA=@INSTALL@ -m 600
AM_CFLAGS = $(PICFLAGS) $(WERROR)
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index f1397f6561..d2c0a41bab 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -1011,6 +1011,11 @@ bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths,
bgp_recalculate_all_bestpaths (bgp);
+ if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
+ vty_out (vty,
+ "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
+ maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
+
return CMD_SUCCESS;
}
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index e0124dcb49..dfff7869aa 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -780,7 +780,6 @@ netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h)
if (len < (int) sizeof (*rtnh) || rtnh->rtnh_len > len)
break;
- rib->nexthop_num++;
index = rtnh->rtnh_ifindex;
gate = 0;
if (rtnh->rtnh_len > sizeof (*rtnh))
@@ -806,6 +805,8 @@ netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h)
rtnh = RTNH_NEXT(rtnh);
}
+ zserv_nexthop_num_warn(__func__, (const struct prefix *)&p,
+ rib->nexthop_num);
if (rib->nexthop_num == 0)
XFREE (MTYPE_RIB, rib);
else
@@ -983,7 +984,6 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
if (len < (int) sizeof (*rtnh) || rtnh->rtnh_len > len)
break;
- rib->nexthop_num++;
index = rtnh->rtnh_ifindex;
gate = 0;
if (rtnh->rtnh_len > sizeof (*rtnh))
@@ -1009,6 +1009,9 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
rtnh = RTNH_NEXT(rtnh);
}
+ zserv_nexthop_num_warn(__func__, (const struct prefix *)&p,
+ rib->nexthop_num);
+
if (rib->nexthop_num == 0)
XFREE (MTYPE_RIB, rib);
else
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 188665814a..1bd5b98825 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -1015,6 +1015,18 @@ zread_interface_delete (struct zserv *client, u_short length)
return 0;
}
+void
+zserv_nexthop_num_warn (const char *caller, const struct prefix *p, const u_char nexthop_num)
+{
+ if ((MULTIPATH_NUM != 0) && (nexthop_num > MULTIPATH_NUM))
+ {
+ char buff[80];
+ prefix2str(p, buff, 80);
+ zlog_warn("%s: Prefix %s has %d nexthops, but we can only use the first %d",
+ caller, buff, nexthop_num, MULTIPATH_NUM);
+ }
+}
+
/* This function support multiple nexthop. */
/*
* Parse the ZEBRA_IPV4_ROUTE_ADD sent from client. Update rib and
@@ -1060,6 +1072,7 @@ zread_ipv4_add (struct zserv *client, u_short length)
if (CHECK_FLAG (message, ZAPI_MESSAGE_NEXTHOP))
{
nexthop_num = stream_getc (s);
+ zserv_nexthop_num_warn(__func__, (const struct prefix *)&p, nexthop_num);
for (i = 0; i < nexthop_num; i++)
{
@@ -1295,6 +1308,7 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length)
int max_nh_if = 0;
nexthop_num = stream_getc (s);
+ zserv_nexthop_num_warn(__func__, (const struct prefix *)&p, nexthop_num);
for (i = 0; i < nexthop_num; i++)
{
nexthop_type = stream_getc (s);
@@ -1415,7 +1429,8 @@ zread_ipv6_add (struct zserv *client, u_short length)
int max_nh_if = 0;
nexthop_num = stream_getc (s);
- for (i = 0; i < nexthop_num; i++)
+ zserv_nexthop_num_warn(__func__, (const struct prefix *)&p, nexthop_num);
+ for (i = 0; i < nexthop_num; i++)
{
nexthop_type = stream_getc (s);
diff --git a/zebra/zserv.h b/zebra/zserv.h
index db20bad263..41aaecef14 100644
--- a/zebra/zserv.h
+++ b/zebra/zserv.h
@@ -155,6 +155,7 @@ extern int zsend_router_id_update(struct zserv *, struct prefix *);
extern pid_t pid;
extern void zserv_create_header(struct stream *s, uint16_t cmd);
+extern void zserv_nexthop_num_warn(const char *, const struct prefix *, const u_char);
extern int zebra_server_send_message(struct zserv *client);
extern void zebra_route_map_write_delay_timer(struct vty *);