summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2020-01-06 23:51:44 -0300
committerGitHub <noreply@github.com>2020-01-06 23:51:44 -0300
commiteada87a4abcb15aae7f42607d48161176fa40a4b (patch)
treee368e6b6cad0ce65d94f9042d21a9cf2d97cb313
parentcf84bf26cf0cf326ffcc71957848162b63d59c57 (diff)
parent40441c3da939375ef3354ad214f8b8bacded5c91 (diff)
Merge pull request #5623 from qlyoung/fix-zebra-rtadv-interval-overflow
zebra: disallow negative rtadv intvl, fix overflow
-rw-r--r--zebra/rtadv.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 5dd6012f62..e9a97d4b15 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -965,16 +965,25 @@ static void zebra_interface_radv_set(ZAPI_HANDLER_ARGS, int enable)
ifindex_t ifindex;
struct interface *ifp;
struct zebra_if *zif;
- int ra_interval;
+ int ra_interval_rxd;
s = msg;
/* Get interface index and RA interval. */
STREAM_GETL(s, ifindex);
- STREAM_GETL(s, ra_interval);
+ STREAM_GETL(s, ra_interval_rxd);
+
+ if (ra_interval_rxd < 0) {
+ zlog_warn(
+ "Requested RA interval %d is garbage; ignoring request",
+ ra_interval_rxd);
+ return;
+ }
+
+ unsigned int ra_interval = ra_interval_rxd;
if (IS_ZEBRA_DEBUG_EVENT)
- zlog_debug("%u: IF %u RA %s from client %s, interval %ds",
+ zlog_debug("%u: IF %u RA %s from client %s, interval %ums",
zvrf_id(zvrf), ifindex,
enable ? "enable" : "disable",
zebra_route_string(client->proto), ra_interval);
@@ -1001,7 +1010,7 @@ static void zebra_interface_radv_set(ZAPI_HANDLER_ARGS, int enable)
SET_FLAG(zif->rtadv.ra_configured, BGP_RA_CONFIGURED);
ipv6_nd_suppress_ra_set(ifp, RA_ENABLE);
if (ra_interval
- && (ra_interval * 1000) < zif->rtadv.MaxRtrAdvInterval
+ && (ra_interval * 1000) < (unsigned int) zif->rtadv.MaxRtrAdvInterval
&& !CHECK_FLAG(zif->rtadv.ra_configured,
VTY_RA_INTERVAL_CONFIGURED))
zif->rtadv.MaxRtrAdvInterval = ra_interval * 1000;