forked from Mirror/frr
*: remove ZEBRA_INTERFACE_VRF_UPDATE
Currently when one interface changes its VRF, zebra will send these messages to all daemons in *order*: 1) `ZEBRA_INTERFACE_DELETE` ( notify them delete from old VRF ) 2) `ZEBRA_INTERFACE_VRF_UPDATE` ( notify them move from old to new VRF ) 3) `ZEBRA_INTERFACE_ADD` ( notify them added into new VRF ) When daemons deal with `VRF_UPDATE`, they use `zebra_interface_vrf_update_read()->if_lookup_by_name()` to check the interface exist or not in old VRF. This check will always return *NULL* because `DELETE` ( deleted from old VRF ) is already done, so can't find this interface in old VRF. Send `VRF_UPDATE` is redundant and unuseful. `DELETE` and `ADD` are enough, they will deal with RB tree, so don't send this `VRF_UPDATE` message when vrf changes. Since all daemons have good mechanism to deal with changing vrf, and don't use this `VRF_UPDATE` mechanism. So, it is safe to completely remove all the code with `VRF_UPDATE`. Signed-off-by: anlan_cs <anlan_cs@tom.com>
This commit is contained in:
parent
d6a9c7ec87
commit
b580c52698
|
@ -756,20 +756,6 @@ static int bfd_ifp_destroy(struct interface *ifp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int bfdd_interface_vrf_update(ZAPI_CALLBACK_ARGS)
|
||||
{
|
||||
struct interface *ifp;
|
||||
vrf_id_t nvrfid;
|
||||
|
||||
ifp = zebra_interface_vrf_update_read(zclient->ibuf, vrf_id, &nvrfid);
|
||||
if (ifp == NULL)
|
||||
return 0;
|
||||
|
||||
if_update_to_new_vrf(ifp, nvrfid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bfdd_sessions_enable_address(struct connected *ifc)
|
||||
{
|
||||
struct bfd_session_observer *bso;
|
||||
|
@ -833,9 +819,6 @@ static zclient_handler *const bfd_handlers[] = {
|
|||
*/
|
||||
[ZEBRA_BFD_DEST_REPLAY] = bfdd_replay,
|
||||
|
||||
/* Learn about interface VRF. */
|
||||
[ZEBRA_INTERFACE_VRF_UPDATE] = bfdd_interface_vrf_update,
|
||||
|
||||
/* Learn about new addresses being registered. */
|
||||
[ZEBRA_INTERFACE_ADDRESS_ADD] = bfdd_interface_address_update,
|
||||
[ZEBRA_INTERFACE_ADDRESS_DELETE] = bfdd_interface_address_update,
|
||||
|
|
|
@ -477,66 +477,6 @@ static int bgp_interface_nbr_address_delete(ZAPI_CALLBACK_ARGS)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* VRF update for an interface. */
|
||||
static int bgp_interface_vrf_update(ZAPI_CALLBACK_ARGS)
|
||||
{
|
||||
struct interface *ifp;
|
||||
vrf_id_t new_vrf_id;
|
||||
struct connected *c;
|
||||
struct nbr_connected *nc;
|
||||
struct listnode *node, *nnode;
|
||||
struct bgp *bgp;
|
||||
struct peer *peer;
|
||||
|
||||
ifp = zebra_interface_vrf_update_read(zclient->ibuf, vrf_id,
|
||||
&new_vrf_id);
|
||||
if (!ifp)
|
||||
return 0;
|
||||
|
||||
if (BGP_DEBUG(zebra, ZEBRA))
|
||||
zlog_debug("Rx Intf VRF change VRF %u IF %s NewVRF %u", vrf_id,
|
||||
ifp->name, new_vrf_id);
|
||||
|
||||
bgp = bgp_lookup_by_vrf_id(vrf_id);
|
||||
|
||||
if (bgp) {
|
||||
for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, c))
|
||||
bgp_connected_delete(bgp, c);
|
||||
|
||||
for (ALL_LIST_ELEMENTS(ifp->nbr_connected, node, nnode, nc))
|
||||
bgp_nbr_connected_delete(bgp, nc, 1);
|
||||
|
||||
/* Fast external-failover */
|
||||
if (!CHECK_FLAG(bgp->flags, BGP_FLAG_NO_FAST_EXT_FAILOVER)) {
|
||||
for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
|
||||
if ((peer->ttl != BGP_DEFAULT_TTL)
|
||||
&& (peer->gtsm_hops
|
||||
!= BGP_GTSM_HOPS_CONNECTED))
|
||||
continue;
|
||||
|
||||
if (ifp == peer->nexthop.ifp)
|
||||
BGP_EVENT_ADD(peer->connection,
|
||||
BGP_Stop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if_update_to_new_vrf(ifp, new_vrf_id);
|
||||
|
||||
bgp = bgp_lookup_by_vrf_id(new_vrf_id);
|
||||
if (!bgp)
|
||||
return 0;
|
||||
|
||||
for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, c))
|
||||
bgp_connected_add(bgp, c);
|
||||
|
||||
for (ALL_LIST_ELEMENTS(ifp->nbr_connected, node, nnode, nc))
|
||||
bgp_nbr_connected_add(bgp, nc);
|
||||
|
||||
hook_call(bgp_vrf_status_changed, bgp, ifp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Zebra route add and delete treatment. */
|
||||
static int zebra_read_route(ZAPI_CALLBACK_ARGS)
|
||||
{
|
||||
|
@ -3401,7 +3341,6 @@ static zclient_handler *const bgp_handlers[] = {
|
|||
[ZEBRA_INTERFACE_ADDRESS_DELETE] = bgp_interface_address_delete,
|
||||
[ZEBRA_INTERFACE_NBR_ADDRESS_ADD] = bgp_interface_nbr_address_add,
|
||||
[ZEBRA_INTERFACE_NBR_ADDRESS_DELETE] = bgp_interface_nbr_address_delete,
|
||||
[ZEBRA_INTERFACE_VRF_UPDATE] = bgp_interface_vrf_update,
|
||||
[ZEBRA_REDISTRIBUTE_ROUTE_ADD] = zebra_read_route,
|
||||
[ZEBRA_REDISTRIBUTE_ROUTE_DEL] = zebra_read_route,
|
||||
[ZEBRA_NEXTHOP_UPDATE] = bgp_read_nexthop_update,
|
||||
|
|
|
@ -351,7 +351,6 @@ static const struct zebra_desc_table command_types[] = {
|
|||
DESC_ENTRY(ZEBRA_VRF_ADD),
|
||||
DESC_ENTRY(ZEBRA_VRF_DELETE),
|
||||
DESC_ENTRY(ZEBRA_VRF_LABEL),
|
||||
DESC_ENTRY(ZEBRA_INTERFACE_VRF_UPDATE),
|
||||
DESC_ENTRY(ZEBRA_BFD_CLIENT_REGISTER),
|
||||
DESC_ENTRY(ZEBRA_BFD_CLIENT_DEREGISTER),
|
||||
DESC_ENTRY(ZEBRA_INTERFACE_ENABLE_RADV),
|
||||
|
|
|
@ -127,7 +127,6 @@ typedef enum {
|
|||
ZEBRA_VRF_ADD,
|
||||
ZEBRA_VRF_DELETE,
|
||||
ZEBRA_VRF_LABEL,
|
||||
ZEBRA_INTERFACE_VRF_UPDATE,
|
||||
ZEBRA_BFD_CLIENT_REGISTER,
|
||||
ZEBRA_BFD_CLIENT_DEREGISTER,
|
||||
ZEBRA_INTERFACE_ENABLE_RADV,
|
||||
|
|
|
@ -162,29 +162,6 @@ static int ospf_interface_link_params(ZAPI_CALLBACK_ARGS)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* VRF update for an interface. */
|
||||
static int ospf_interface_vrf_update(ZAPI_CALLBACK_ARGS)
|
||||
{
|
||||
struct interface *ifp = NULL;
|
||||
vrf_id_t new_vrf_id;
|
||||
|
||||
ifp = zebra_interface_vrf_update_read(zclient->ibuf, vrf_id,
|
||||
&new_vrf_id);
|
||||
if (!ifp)
|
||||
return 0;
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
zlog_debug(
|
||||
"%s: Rx Interface %s VRF change vrf_id %u New vrf %s id %u",
|
||||
__func__, ifp->name, vrf_id,
|
||||
ospf_vrf_id_to_name(new_vrf_id), new_vrf_id);
|
||||
|
||||
/*if_update(ifp, ifp->name, strlen(ifp->name), new_vrf_id);*/
|
||||
if_update_to_new_vrf(ifp, new_vrf_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Nexthop, ifindex, distance and metric information. */
|
||||
static void ospf_zebra_add_nexthop(struct ospf *ospf, struct ospf_path *path,
|
||||
struct zapi_route *api)
|
||||
|
@ -2203,7 +2180,6 @@ static zclient_handler *const ospf_handlers[] = {
|
|||
[ZEBRA_INTERFACE_ADDRESS_ADD] = ospf_interface_address_add,
|
||||
[ZEBRA_INTERFACE_ADDRESS_DELETE] = ospf_interface_address_delete,
|
||||
[ZEBRA_INTERFACE_LINK_PARAMS] = ospf_interface_link_params,
|
||||
[ZEBRA_INTERFACE_VRF_UPDATE] = ospf_interface_vrf_update,
|
||||
|
||||
[ZEBRA_REDISTRIBUTE_ROUTE_ADD] = ospf_zebra_read_route,
|
||||
[ZEBRA_REDISTRIBUTE_ROUTE_DEL] = ospf_zebra_read_route,
|
||||
|
|
|
@ -129,29 +129,6 @@ int pbr_ifp_down(struct interface *ifp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int interface_vrf_update(ZAPI_CALLBACK_ARGS)
|
||||
{
|
||||
struct interface *ifp;
|
||||
vrf_id_t new_vrf_id;
|
||||
|
||||
ifp = zebra_interface_vrf_update_read(zclient->ibuf, vrf_id,
|
||||
&new_vrf_id);
|
||||
|
||||
if (!ifp) {
|
||||
DEBUGD(&pbr_dbg_zebra, "%s: VRF change interface not found",
|
||||
__func__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEBUGD(&pbr_dbg_zebra, "%s: %s VRF change %u -> %u", __func__,
|
||||
ifp->name, vrf_id, new_vrf_id);
|
||||
|
||||
if_update_to_new_vrf(ifp, new_vrf_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int route_notify_owner(ZAPI_CALLBACK_ARGS)
|
||||
{
|
||||
struct prefix p;
|
||||
|
@ -436,7 +413,6 @@ extern struct zebra_privs_t pbr_privs;
|
|||
static zclient_handler *const pbr_handlers[] = {
|
||||
[ZEBRA_INTERFACE_ADDRESS_ADD] = interface_address_add,
|
||||
[ZEBRA_INTERFACE_ADDRESS_DELETE] = interface_address_delete,
|
||||
[ZEBRA_INTERFACE_VRF_UPDATE] = interface_vrf_update,
|
||||
[ZEBRA_ROUTE_NOTIFY_OWNER] = route_notify_owner,
|
||||
[ZEBRA_RULE_NOTIFY_OWNER] = rule_notify_owner,
|
||||
[ZEBRA_NEXTHOP_UPDATE] = pbr_zebra_nexthop_update,
|
||||
|
|
|
@ -51,39 +51,6 @@ static int pim_router_id_update_zebra(ZAPI_CALLBACK_ARGS)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int pim_zebra_interface_vrf_update(ZAPI_CALLBACK_ARGS)
|
||||
{
|
||||
struct interface *ifp;
|
||||
vrf_id_t new_vrf_id;
|
||||
struct pim_instance *pim;
|
||||
struct pim_interface *pim_ifp;
|
||||
|
||||
ifp = zebra_interface_vrf_update_read(zclient->ibuf, vrf_id,
|
||||
&new_vrf_id);
|
||||
if (!ifp)
|
||||
return 0;
|
||||
|
||||
if (PIM_DEBUG_ZEBRA)
|
||||
zlog_debug("%s: %s updating from %u to %u", __func__, ifp->name,
|
||||
vrf_id, new_vrf_id);
|
||||
|
||||
pim = pim_get_pim_instance(new_vrf_id);
|
||||
if (!pim)
|
||||
return 0;
|
||||
|
||||
if_update_to_new_vrf(ifp, new_vrf_id);
|
||||
|
||||
pim_ifp = ifp->info;
|
||||
if (!pim_ifp)
|
||||
return 0;
|
||||
|
||||
pim_ifp->pim->mcast_if_count--;
|
||||
pim_ifp->pim = pim;
|
||||
pim_ifp->pim->mcast_if_count++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef PIM_DEBUG_IFADDR_DUMP
|
||||
static void dump_if_address(struct interface *ifp)
|
||||
{
|
||||
|
@ -463,7 +430,6 @@ static zclient_handler *const pim_handlers[] = {
|
|||
|
||||
[ZEBRA_NEXTHOP_UPDATE] = pim_parse_nexthop_update,
|
||||
[ZEBRA_ROUTER_ID_UPDATE] = pim_router_id_update_zebra,
|
||||
[ZEBRA_INTERFACE_VRF_UPDATE] = pim_zebra_interface_vrf_update,
|
||||
|
||||
#if PIM_IPV == 4
|
||||
[ZEBRA_VXLAN_SG_ADD] = pim_zebra_vxlan_sg_proc,
|
||||
|
|
|
@ -383,31 +383,6 @@ static int rip_ifp_destroy(struct interface *ifp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* VRF update for an interface. */
|
||||
int rip_interface_vrf_update(ZAPI_CALLBACK_ARGS)
|
||||
{
|
||||
struct interface *ifp;
|
||||
vrf_id_t new_vrf_id;
|
||||
|
||||
ifp = zebra_interface_vrf_update_read(zclient->ibuf, vrf_id,
|
||||
&new_vrf_id);
|
||||
if (!ifp)
|
||||
return 0;
|
||||
|
||||
if (IS_RIP_DEBUG_ZEBRA) {
|
||||
struct vrf *nvrf = vrf_lookup_by_id(new_vrf_id);
|
||||
|
||||
zlog_debug("interface %s VRF change vrf %s(%u) new vrf %s(%u)",
|
||||
ifp->name, ifp->vrf->name, vrf_id, VRF_LOGNAME(nvrf),
|
||||
new_vrf_id);
|
||||
}
|
||||
|
||||
if_update_to_new_vrf(ifp, new_vrf_id);
|
||||
rip_interface_sync(ifp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rip_interface_clean(struct rip_interface *ri)
|
||||
{
|
||||
ri->enable_network = 0;
|
||||
|
|
|
@ -222,7 +222,6 @@ static void rip_zebra_connected(struct zclient *zclient)
|
|||
zclient_handler *const rip_handlers[] = {
|
||||
[ZEBRA_INTERFACE_ADDRESS_ADD] = rip_interface_address_add,
|
||||
[ZEBRA_INTERFACE_ADDRESS_DELETE] = rip_interface_address_delete,
|
||||
[ZEBRA_INTERFACE_VRF_UPDATE] = rip_interface_vrf_update,
|
||||
[ZEBRA_REDISTRIBUTE_ROUTE_ADD] = rip_zebra_read_route,
|
||||
[ZEBRA_REDISTRIBUTE_ROUTE_DEL] = rip_zebra_read_route,
|
||||
};
|
||||
|
|
|
@ -264,31 +264,6 @@ static int ripng_ifp_destroy(struct interface *ifp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* VRF update for an interface. */
|
||||
int ripng_interface_vrf_update(ZAPI_CALLBACK_ARGS)
|
||||
{
|
||||
struct interface *ifp;
|
||||
vrf_id_t new_vrf_id;
|
||||
|
||||
ifp = zebra_interface_vrf_update_read(zclient->ibuf, vrf_id,
|
||||
&new_vrf_id);
|
||||
if (!ifp)
|
||||
return 0;
|
||||
|
||||
if (IS_RIPNG_DEBUG_ZEBRA) {
|
||||
struct vrf *nvrf = vrf_lookup_by_id(new_vrf_id);
|
||||
|
||||
zlog_debug("interface %s VRF change vrf %s(%u) new vrf %s(%u)",
|
||||
ifp->name, ifp->vrf->name, vrf_id, VRF_LOGNAME(nvrf),
|
||||
new_vrf_id);
|
||||
}
|
||||
|
||||
if_update_to_new_vrf(ifp, new_vrf_id);
|
||||
ripng_interface_sync(ifp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ripng_interface_clean(struct ripng *ripng)
|
||||
{
|
||||
struct interface *ifp;
|
||||
|
|
|
@ -222,7 +222,6 @@ static void ripng_zebra_connected(struct zclient *zclient)
|
|||
static zclient_handler *const ripng_handlers[] = {
|
||||
[ZEBRA_INTERFACE_ADDRESS_ADD] = ripng_interface_address_add,
|
||||
[ZEBRA_INTERFACE_ADDRESS_DELETE] = ripng_interface_address_delete,
|
||||
[ZEBRA_INTERFACE_VRF_UPDATE] = ripng_interface_vrf_update,
|
||||
[ZEBRA_REDISTRIBUTE_ROUTE_ADD] = ripng_zebra_read_route,
|
||||
[ZEBRA_REDISTRIBUTE_ROUTE_DEL] = ripng_zebra_read_route,
|
||||
};
|
||||
|
|
|
@ -413,7 +413,6 @@ extern int ripng_interface_add(ZAPI_CALLBACK_ARGS);
|
|||
extern int ripng_interface_delete(ZAPI_CALLBACK_ARGS);
|
||||
extern int ripng_interface_address_add(ZAPI_CALLBACK_ARGS);
|
||||
extern int ripng_interface_address_delete(ZAPI_CALLBACK_ARGS);
|
||||
extern int ripng_interface_vrf_update(ZAPI_CALLBACK_ARGS);
|
||||
extern void ripng_interface_sync(struct interface *ifp);
|
||||
|
||||
extern struct ripng *ripng_lookup_by_vrf_id(vrf_id_t vrf_id);
|
||||
|
|
|
@ -853,7 +853,7 @@ void if_handle_vrf_change(struct interface *ifp, vrf_id_t vrf_id)
|
|||
if_down_del_nbr_connected(ifp);
|
||||
|
||||
/* Send out notification on interface VRF change. */
|
||||
/* This is to issue an UPDATE or a DELETE, as appropriate. */
|
||||
/* This is to issue a DELETE, as appropriate. */
|
||||
zebra_interface_vrf_update_del(ifp, vrf_id);
|
||||
|
||||
if (if_is_vrf(ifp))
|
||||
|
|
|
@ -592,9 +592,8 @@ void zebra_interface_vrf_update_del(struct interface *ifp, vrf_id_t new_vrf_id)
|
|||
struct zserv *client;
|
||||
|
||||
if (IS_ZEBRA_DEBUG_EVENT)
|
||||
zlog_debug(
|
||||
"MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/DEL %s VRF Id %u -> %u",
|
||||
ifp->name, ifp->vrf->vrf_id, new_vrf_id);
|
||||
zlog_debug("MESSAGE: ZEBRA_INTERFACE_DELETE %s VRF Id %u -> %u",
|
||||
ifp->name, ifp->vrf->vrf_id, new_vrf_id);
|
||||
|
||||
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
|
||||
/* Do not send unsolicited messages to synchronous clients. */
|
||||
|
@ -606,7 +605,6 @@ void zebra_interface_vrf_update_del(struct interface *ifp, vrf_id_t new_vrf_id)
|
|||
zsend_interface_update(ZEBRA_INTERFACE_DOWN, client, ifp);
|
||||
client->ifdel_cnt++;
|
||||
zsend_interface_delete(client, ifp);
|
||||
zsend_interface_vrf_update(client, ifp, new_vrf_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -619,9 +617,8 @@ void zebra_interface_vrf_update_add(struct interface *ifp, vrf_id_t old_vrf_id)
|
|||
struct zserv *client;
|
||||
|
||||
if (IS_ZEBRA_DEBUG_EVENT)
|
||||
zlog_debug(
|
||||
"MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/ADD %s VRF Id %u -> %u",
|
||||
ifp->name, old_vrf_id, ifp->vrf->vrf_id);
|
||||
zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADD %s VRF Id %u -> %u",
|
||||
ifp->name, old_vrf_id, ifp->vrf->vrf_id);
|
||||
|
||||
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
|
||||
/* Do not send unsolicited messages to synchronous clients. */
|
||||
|
|
|
@ -435,27 +435,6 @@ int zsend_interface_addresses(struct zserv *client, struct interface *ifp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Notify client about interface moving from one VRF to another.
|
||||
* Whether client is interested in old and new VRF is checked by caller.
|
||||
*/
|
||||
int zsend_interface_vrf_update(struct zserv *client, struct interface *ifp,
|
||||
vrf_id_t vrf_id)
|
||||
{
|
||||
struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ);
|
||||
|
||||
zclient_create_header(s, ZEBRA_INTERFACE_VRF_UPDATE, ifp->vrf->vrf_id);
|
||||
|
||||
/* Fill in the name of the interface and its new VRF (id) */
|
||||
stream_put(s, ifp->name, INTERFACE_NAMSIZ);
|
||||
stream_putl(s, vrf_id);
|
||||
|
||||
/* Write packet size. */
|
||||
stream_putw_at(s, 0, stream_get_endp(s));
|
||||
|
||||
client->if_vrfchg_cnt++;
|
||||
return zserv_send_message(client, s);
|
||||
}
|
||||
|
||||
/* Add new nbr connected IPv6 address */
|
||||
void nbr_connected_add_ipv6(struct interface *ifp, struct in6_addr *address)
|
||||
{
|
||||
|
|
|
@ -57,8 +57,6 @@ extern int zsend_redistribute_route(int cmd, struct zserv *zclient,
|
|||
|
||||
extern int zsend_router_id_update(struct zserv *zclient, afi_t afi,
|
||||
struct prefix *p, vrf_id_t vrf_id);
|
||||
extern int zsend_interface_vrf_update(struct zserv *zclient,
|
||||
struct interface *ifp, vrf_id_t vrf_id);
|
||||
extern int zsend_interface_link_params(struct zserv *zclient,
|
||||
struct interface *ifp);
|
||||
extern int zsend_pw_update(struct zserv *client, struct zebra_pw *pw);
|
||||
|
|
Loading…
Reference in a new issue