bgpd: rfapi: avoid null pointer dereference in vnc_export_bgp_disable if rfapi is not provisioned

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
This commit is contained in:
G. Paul Ziemba 2018-02-11 08:13:12 -08:00 committed by Lou Berger
parent 58e7db106d
commit b8e031e542

View File

@ -2049,6 +2049,9 @@ void vnc_direct_bgp_rh_reexport(struct bgp *bgp, afi_t afi)
*/ */
void vnc_export_bgp_enable(struct bgp *bgp, afi_t afi) void vnc_export_bgp_enable(struct bgp *bgp, afi_t afi)
{ {
if (!bgp->rfapi_cfg)
return;
switch (bgp->rfapi_cfg->flags & BGP_VNC_CONFIG_EXPORT_BGP_MODE_BITS) { switch (bgp->rfapi_cfg->flags & BGP_VNC_CONFIG_EXPORT_BGP_MODE_BITS) {
case BGP_VNC_CONFIG_EXPORT_BGP_MODE_NONE: case BGP_VNC_CONFIG_EXPORT_BGP_MODE_NONE:
break; break;
@ -2069,6 +2072,9 @@ void vnc_export_bgp_enable(struct bgp *bgp, afi_t afi)
void vnc_export_bgp_disable(struct bgp *bgp, afi_t afi) void vnc_export_bgp_disable(struct bgp *bgp, afi_t afi)
{ {
if (!bgp->rfapi_cfg)
return;
switch (bgp->rfapi_cfg->flags & BGP_VNC_CONFIG_EXPORT_BGP_MODE_BITS) { switch (bgp->rfapi_cfg->flags & BGP_VNC_CONFIG_EXPORT_BGP_MODE_BITS) {
case BGP_VNC_CONFIG_EXPORT_BGP_MODE_NONE: case BGP_VNC_CONFIG_EXPORT_BGP_MODE_NONE:
break; break;