mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-05 06:42:08 +00:00
Merge pull request #1315 from dslicenc/bgp-interface
bgpd: check for bgp instance before processing interfaces
This commit is contained in:
commit
3cda750598
@ -224,6 +224,10 @@ static int bgp_interface_delete(int command, struct zclient *zclient,
|
|||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
|
||||||
|
bgp = bgp_lookup_by_vrf_id(vrf_id);
|
||||||
|
if (!bgp)
|
||||||
|
return 0;
|
||||||
|
|
||||||
s = zclient->ibuf;
|
s = zclient->ibuf;
|
||||||
ifp = zebra_interface_state_read(s, vrf_id);
|
ifp = zebra_interface_state_read(s, vrf_id);
|
||||||
if (!ifp) /* This may happen if we've just unregistered for a VRF. */
|
if (!ifp) /* This may happen if we've just unregistered for a VRF. */
|
||||||
@ -232,10 +236,6 @@ static int bgp_interface_delete(int command, struct zclient *zclient,
|
|||||||
if (BGP_DEBUG(zebra, ZEBRA))
|
if (BGP_DEBUG(zebra, ZEBRA))
|
||||||
zlog_debug("Rx Intf del VRF %u IF %s", vrf_id, ifp->name);
|
zlog_debug("Rx Intf del VRF %u IF %s", vrf_id, ifp->name);
|
||||||
|
|
||||||
bgp = bgp_lookup_by_vrf_id(vrf_id);
|
|
||||||
if (!bgp)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
bgp_update_interface_nbrs(bgp, ifp, NULL);
|
bgp_update_interface_nbrs(bgp, ifp, NULL);
|
||||||
|
|
||||||
ifp->ifindex = IFINDEX_DELETED;
|
ifp->ifindex = IFINDEX_DELETED;
|
||||||
@ -252,6 +252,10 @@ static int bgp_interface_up(int command, struct zclient *zclient,
|
|||||||
struct listnode *node, *nnode;
|
struct listnode *node, *nnode;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
|
||||||
|
bgp = bgp_lookup_by_vrf_id(vrf_id);
|
||||||
|
if (!bgp)
|
||||||
|
return 0;
|
||||||
|
|
||||||
s = zclient->ibuf;
|
s = zclient->ibuf;
|
||||||
ifp = zebra_interface_state_read(s, vrf_id);
|
ifp = zebra_interface_state_read(s, vrf_id);
|
||||||
|
|
||||||
@ -261,10 +265,6 @@ static int bgp_interface_up(int command, struct zclient *zclient,
|
|||||||
if (BGP_DEBUG(zebra, ZEBRA))
|
if (BGP_DEBUG(zebra, ZEBRA))
|
||||||
zlog_debug("Rx Intf up VRF %u IF %s", vrf_id, ifp->name);
|
zlog_debug("Rx Intf up VRF %u IF %s", vrf_id, ifp->name);
|
||||||
|
|
||||||
bgp = bgp_lookup_by_vrf_id(vrf_id);
|
|
||||||
if (!bgp)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, c))
|
for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, c))
|
||||||
bgp_connected_add(bgp, c);
|
bgp_connected_add(bgp, c);
|
||||||
|
|
||||||
@ -284,6 +284,10 @@ static int bgp_interface_down(int command, struct zclient *zclient,
|
|||||||
struct listnode *node, *nnode;
|
struct listnode *node, *nnode;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
|
||||||
|
bgp = bgp_lookup_by_vrf_id(vrf_id);
|
||||||
|
if (!bgp)
|
||||||
|
return 0;
|
||||||
|
|
||||||
s = zclient->ibuf;
|
s = zclient->ibuf;
|
||||||
ifp = zebra_interface_state_read(s, vrf_id);
|
ifp = zebra_interface_state_read(s, vrf_id);
|
||||||
if (!ifp)
|
if (!ifp)
|
||||||
@ -292,10 +296,6 @@ static int bgp_interface_down(int command, struct zclient *zclient,
|
|||||||
if (BGP_DEBUG(zebra, ZEBRA))
|
if (BGP_DEBUG(zebra, ZEBRA))
|
||||||
zlog_debug("Rx Intf down VRF %u IF %s", vrf_id, ifp->name);
|
zlog_debug("Rx Intf down VRF %u IF %s", vrf_id, ifp->name);
|
||||||
|
|
||||||
bgp = bgp_lookup_by_vrf_id(vrf_id);
|
|
||||||
if (!bgp)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, c))
|
for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, c))
|
||||||
bgp_connected_delete(bgp, c);
|
bgp_connected_delete(bgp, c);
|
||||||
|
|
||||||
@ -338,6 +338,11 @@ static int bgp_interface_address_add(int command, struct zclient *zclient,
|
|||||||
zebra_size_t length, vrf_id_t vrf_id)
|
zebra_size_t length, vrf_id_t vrf_id)
|
||||||
{
|
{
|
||||||
struct connected *ifc;
|
struct connected *ifc;
|
||||||
|
struct bgp *bgp;
|
||||||
|
|
||||||
|
bgp = bgp_lookup_by_vrf_id(vrf_id);
|
||||||
|
if (!bgp)
|
||||||
|
return 0;
|
||||||
|
|
||||||
ifc = zebra_interface_address_read(command, zclient->ibuf, vrf_id);
|
ifc = zebra_interface_address_read(command, zclient->ibuf, vrf_id);
|
||||||
|
|
||||||
@ -352,13 +357,8 @@ static int bgp_interface_address_add(int command, struct zclient *zclient,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (if_is_operative(ifc->ifp)) {
|
if (if_is_operative(ifc->ifp)) {
|
||||||
struct bgp *bgp;
|
|
||||||
|
|
||||||
bgp = bgp_lookup_by_vrf_id(vrf_id);
|
|
||||||
if (!bgp)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
bgp_connected_add(bgp, ifc);
|
bgp_connected_add(bgp, ifc);
|
||||||
|
|
||||||
/* If we have learnt of any neighbors on this interface,
|
/* If we have learnt of any neighbors on this interface,
|
||||||
* check to kick off any BGP interface-based neighbors,
|
* check to kick off any BGP interface-based neighbors,
|
||||||
* but only if this is a link-local address.
|
* but only if this is a link-local address.
|
||||||
@ -377,6 +377,10 @@ static int bgp_interface_address_delete(int command, struct zclient *zclient,
|
|||||||
struct connected *ifc;
|
struct connected *ifc;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
|
||||||
|
bgp = bgp_lookup_by_vrf_id(vrf_id);
|
||||||
|
if (!bgp)
|
||||||
|
return 0;
|
||||||
|
|
||||||
ifc = zebra_interface_address_read(command, zclient->ibuf, vrf_id);
|
ifc = zebra_interface_address_read(command, zclient->ibuf, vrf_id);
|
||||||
|
|
||||||
if (ifc == NULL)
|
if (ifc == NULL)
|
||||||
@ -390,9 +394,7 @@ static int bgp_interface_address_delete(int command, struct zclient *zclient,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (if_is_operative(ifc->ifp)) {
|
if (if_is_operative(ifc->ifp)) {
|
||||||
bgp = bgp_lookup_by_vrf_id(vrf_id);
|
bgp_connected_delete(bgp, ifc);
|
||||||
if (bgp)
|
|
||||||
bgp_connected_delete(bgp, ifc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
connected_free(ifc);
|
connected_free(ifc);
|
||||||
|
Loading…
Reference in New Issue
Block a user