summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@users.noreply.github.com>2021-04-29 18:50:16 +0200
committerGitHub <noreply@github.com>2021-04-29 18:50:16 +0200
commit54188809234abef9fff62505d57e4afb41e39433 (patch)
treeee28fcd19f596cd6b530e41df8d02cf9b6a99b71 /zebra
parentMerge pull request #8409 from rgirada/ospf-memleak (diff)
parentzebra: use safe stream decodes for evpn zapi msg (diff)
downloadfrr-54188809234abef9fff62505d57e4afb41e39433.tar.xz
frr-54188809234abef9fff62505d57e4afb41e39433.zip
Merge pull request #7165 from qlyoung/fix-zapi-codec-badness
Fix zapi codec badness
Diffstat (limited to 'zebra')
-rw-r--r--zebra/rtadv.c13
-rw-r--r--zebra/zebra_evpn_mh.c13
-rw-r--r--zebra/zebra_mroute.c2
-rw-r--r--zebra/zebra_vxlan.c2
4 files changed, 12 insertions, 18 deletions
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 8ffb3870f..1e06b3e0e 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -1063,22 +1063,13 @@ static void zebra_interface_radv_set(ZAPI_HANDLER_ARGS, int enable)
ifindex_t ifindex;
struct interface *ifp;
struct zebra_if *zif;
- int ra_interval_rxd;
+ uint32_t ra_interval;
s = msg;
/* Get interface index and RA interval. */
STREAM_GETL(s, ifindex);
- 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;
+ STREAM_GETL(s, ra_interval);
if (IS_ZEBRA_DEBUG_EVENT) {
struct vrf *vrf = zvrf->vrf;
diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c
index cabba707a..0038689e8 100644
--- a/zebra/zebra_evpn_mh.c
+++ b/zebra/zebra_evpn_mh.c
@@ -2484,8 +2484,8 @@ void zebra_evpn_proc_remote_es(ZAPI_HANDLER_ARGS)
memset(&esi, 0, sizeof(esi_t));
s = msg;
- stream_get(&esi, s, sizeof(esi_t));
- vtep_ip.s_addr = stream_get_ipv4(s);
+ STREAM_GET(&esi, s, sizeof(esi_t));
+ STREAM_GET(&vtep_ip.s_addr, s, sizeof(vtep_ip.s_addr));
if (hdr->command == ZEBRA_REMOTE_ES_VTEP_ADD) {
uint32_t zapi_flags;
@@ -2493,16 +2493,19 @@ void zebra_evpn_proc_remote_es(ZAPI_HANDLER_ARGS)
uint16_t df_pref;
bool esr_rxed;
- zapi_flags = stream_getl(s);
+ STREAM_GETL(s, zapi_flags);
esr_rxed = (zapi_flags & ZAPI_ES_VTEP_FLAG_ESR_RXED) ? true
: false;
- df_alg = stream_getc(s);
- df_pref = stream_getw(s);
+ STREAM_GETC(s, df_alg);
+ STREAM_GETW(s, df_pref);
zebra_evpn_remote_es_add(&esi, vtep_ip, esr_rxed, df_alg,
df_pref);
} else {
zebra_evpn_remote_es_del(&esi, vtep_ip);
}
+
+stream_failure:
+ return;
}
void zebra_evpn_es_mac_deref_entry(zebra_mac_t *mac)
diff --git a/zebra/zebra_mroute.c b/zebra/zebra_mroute.c
index 3af805558..ef0f2d892 100644
--- a/zebra/zebra_mroute.c
+++ b/zebra/zebra_mroute.c
@@ -65,7 +65,7 @@ stream_failure:
stream_put_in_addr(s, &mroute.sg.src);
stream_put_in_addr(s, &mroute.sg.grp);
stream_put(s, &mroute.lastused, sizeof(mroute.lastused));
- stream_putl(s, suc);
+ stream_putl(s, (uint32_t)suc);
stream_putw_at(s, 0, stream_get_endp(s));
zserv_send_message(client, s);
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index 4cd3b60a0..3ac7ee8f4 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -3749,7 +3749,7 @@ zebra_vxlan_remote_macip_helper(bool add, struct stream *s, vni_t *vni,
memset(ip, 0, sizeof(*ip));
STREAM_GETL(s, *vni);
STREAM_GET(macaddr->octet, s, ETH_ALEN);
- STREAM_GETL(s, *ipa_len);
+ STREAM_GETW(s, *ipa_len);
if (*ipa_len) {
if (*ipa_len == IPV4_MAX_BYTELEN)