## 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)
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;
}
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))
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
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))
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
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
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++)
{
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);
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);
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 *);