summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_evpn.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@nvidia.com>2020-09-23 21:31:52 +0200
committerQuentin Young <qlyoung@nvidia.com>2021-04-28 17:43:45 +0200
commit0ffd0fb536f0da9c92207b606c3d34126292f356 (patch)
tree6cdafe6d371b17bf45581cccfb92fb65a6f200ad /bgpd/bgp_evpn.c
parentMerge pull request #8531 from mjstapp/fix_backups_misc (diff)
downloadfrr-0ffd0fb536f0da9c92207b606c3d34126292f356.tar.xz
frr-0ffd0fb536f0da9c92207b606c3d34126292f356.zip
bgpd, zebra: encode ip addr len as uint16
This is always a 16 bit unsigned value. - signed int is the wrong type to use - encoding a signed int as a uint32 is bad practice - decoding a signed int encoded as a uint32 into a uint16 is bad practice Signed-off-by: Quentin Young <qlyoung@nvidia.com>
Diffstat (limited to 'bgpd/bgp_evpn.c')
-rw-r--r--bgpd/bgp_evpn.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index a9fceb6cd..047b9742e 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -586,7 +586,7 @@ static int bgp_zebra_send_remote_macip(struct bgp *bgp, struct bgpevpn *vpn,
uint8_t flags, uint32_t seq, esi_t *esi)
{
struct stream *s;
- int ipa_len;
+ uint16_t ipa_len;
static struct in_addr zero_remote_vtep_ip;
/* Check socket. */
@@ -614,11 +614,11 @@ static int bgp_zebra_send_remote_macip(struct bgp *bgp, struct bgpevpn *vpn,
stream_put(s, &p->prefix.macip_addr.mac.octet, ETH_ALEN); /* Mac Addr */
/* IP address length and IP address, if any. */
if (is_evpn_prefix_ipaddr_none(p))
- stream_putl(s, 0);
+ stream_putw(s, 0);
else {
ipa_len = is_evpn_prefix_ipaddr_v4(p) ? IPV4_MAX_BYTELEN
: IPV6_MAX_BYTELEN;
- stream_putl(s, ipa_len);
+ stream_putw(s, ipa_len);
stream_put(s, &p->prefix.macip_addr.ip.ip.addr, ipa_len);
}
/* If the ESI is valid that becomes the nexthop; tape out the