summaryrefslogtreecommitdiff
path: root/bgpd/bgp_evpn_vty.c
diff options
context:
space:
mode:
authoranlan_cs <vic.lan@pica8.com>2022-11-18 21:48:16 +0800
committeranlan_cs <vic.lan@pica8.com>2022-11-18 22:06:37 +0800
commitf3a88e7272cd5b89e3d85b674db658f3a9ee87e1 (patch)
treefb3c1979e36eff4a2a9f739dd881b4c10b168964 /bgpd/bgp_evpn_vty.c
parent298748af21f1bd2a1e3890353e7ef6a47946cdf7 (diff)
bgpd: fix null pointer dereference
It is possible there is no ip address in type2 prefix, that leads to crash in `build_evpn_type2_prefix()`. Signed-off-by: anlan_cs <vic.lan@pica8.com>
Diffstat (limited to 'bgpd/bgp_evpn_vty.c')
-rw-r--r--bgpd/bgp_evpn_vty.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index 88c1329f48..6350093b27 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -2537,6 +2537,7 @@ static void evpn_show_route_vni_macip(struct vty *vty, struct bgp *bgp,
safi_t safi;
json_object *json_paths = NULL;
struct ethaddr empty_mac = {};
+ struct ipaddr empty_ip = {};
const struct prefix_evpn *evp;
afi = AFI_L2VPN;
@@ -2550,7 +2551,8 @@ static void evpn_show_route_vni_macip(struct vty *vty, struct bgp *bgp,
return;
}
- build_evpn_type2_prefix(&p, mac ? mac : &empty_mac, ip);
+ build_evpn_type2_prefix(&p, mac ? mac : &empty_mac,
+ ip ? ip : &empty_ip);
/* See if route exists. Look for both non-sticky and sticky. */
dest = bgp_evpn_vni_node_lookup(vpn, &p, NULL);