debugf(BABEL_DEBUG_IF, "receive a 'interface add'");
interface_recalculate(ifp);
-
+
return 0;
}
int
-babel_interface_delete (ZAPI_CALLBACK_ARGS)
+babel_ifp_destroy(struct interface *ifp)
{
- struct interface *ifp;
- struct stream *s;
-
debugf(BABEL_DEBUG_IF, "receive a 'interface delete'");
- s = zclient->ibuf;
- ifp = zebra_interface_state_read(s, vrf_id); /* it updates iflist */
-
- if (ifp == NULL)
- return 0;
-
if (IS_ENABLE(ifp))
interface_reset(ifp);
- /* To support pseudo interface do not free interface structure. */
- /* if_delete(ifp); */
- if_set_index(ifp, IFINDEX_INTERNAL);
-
return 0;
}
return 0;
}
-int babel_ifp_destroy(struct interface *ifp)
-{
- return 0;
-}
-
void
babel_if_init(void)
{
zclient_init(zclient, ZEBRA_ROUTE_BABEL, 0, &babeld_privs);
zclient->zebra_connected = babel_zebra_connected;
- zclient->interface_delete = babel_interface_delete;
zclient->interface_address_add = babel_interface_address_add;
zclient->interface_address_delete = babel_interface_address_delete;
zclient->redistribute_route_add = babel_zebra_read_route;
}
}
-static int bfdd_interface_update(ZAPI_CALLBACK_ARGS)
+static int bfd_ifp_destroy(struct interface *ifp)
{
- struct interface *ifp;
-
- /* Update interface information. */
- ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
- if (ifp == NULL)
- return 0;
-
bfdd_sessions_disable_interface(ifp);
- if_set_index(ifp, IFINDEX_INTERNAL);
-
return 0;
}
return 0;
}
-static int bfd_ifp_destroy(struct interface *ifp)
-{
- return 0;
-}
-
void bfdd_zclient_init(struct zebra_privs_t *bfdd_priv)
{
if_zapi_callbacks(bfd_ifp_create, NULL, NULL, bfd_ifp_destroy);
/* Send replay request on zebra connect. */
zclient->zebra_connected = bfdd_zebra_connected;
- /* Learn interfaces from zebra instead of the OS. */
- zclient->interface_delete = bfdd_interface_update;
-
/* Learn about interface VRF. */
zclient->interface_vrf_update = bfdd_interface_vrf_update;
}
}
-static int bgp_interface_delete(ZAPI_CALLBACK_ARGS)
+static int bgp_ifp_destroy(struct interface *ifp)
{
- struct stream *s;
- struct interface *ifp;
struct bgp *bgp;
- bgp = bgp_lookup_by_vrf_id(vrf_id);
-
- s = zclient->ibuf;
- ifp = zebra_interface_state_read(s, vrf_id);
- if (!ifp) /* This may happen if we've just unregistered for a VRF. */
- return 0;
+ bgp = bgp_lookup_by_vrf_id(ifp->vrf_id);
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", bgp->vrf_id, ifp->name);
if (bgp)
bgp_update_interface_nbrs(bgp, ifp, NULL);
bgp_mac_del_mac_entry(ifp);
- if_set_index(ifp, IFINDEX_INTERNAL);
return 0;
}
return 0;
}
-static int bgp_ifp_destroy(struct interface *ifp)
-{
- return 0;
-}
-
void bgp_zebra_init(struct thread_master *master, unsigned short instance)
{
zclient_num_connects = 0;
zclient_init(zclient, ZEBRA_ROUTE_BGP, 0, &bgpd_privs);
zclient->zebra_connected = bgp_zebra_connected;
zclient->router_id_update = bgp_router_id_update;
- zclient->interface_delete = bgp_interface_delete;
zclient->interface_address_add = bgp_interface_address_add;
zclient->interface_address_delete = bgp_interface_address_delete;
zclient->interface_nbr_address_add = bgp_interface_nbr_address_add;
static int eigrp_ifp_destroy(struct interface *ifp)
{
+ if (if_is_up(ifp))
+ zlog_warn("Zebra: got delete of %s, but interface is still up",
+ ifp->name);
+
+ if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
+ zlog_debug(
+ "Zebra: interface delete %s index %d flags %llx metric %d mtu %d",
+ ifp->name, ifp->ifindex, (unsigned long long)ifp->flags,
+ ifp->metric, ifp->mtu);
+
+ if (ifp->info)
+ eigrp_if_free(ifp->info, INTERFACE_DOWN_BY_ZEBRA);
+
return 0;
}
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
-static int eigrp_interface_delete(ZAPI_CALLBACK_ARGS);
static int eigrp_interface_address_add(ZAPI_CALLBACK_ARGS);
static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS);
zclient_init(zclient, ZEBRA_ROUTE_EIGRP, 0, &eigrpd_privs);
zclient->zebra_connected = eigrp_zebra_connected;
zclient->router_id_update = eigrp_router_id_update_zebra;
- zclient->interface_delete = eigrp_interface_delete;
zclient->interface_address_add = eigrp_interface_address_add;
zclient->interface_address_delete = eigrp_interface_address_delete;
zclient->redistribute_route_add = eigrp_zebra_read_route;
return 0;
}
-static int eigrp_interface_delete(ZAPI_CALLBACK_ARGS)
-{
- struct interface *ifp;
- struct stream *s;
-
- s = zclient->ibuf;
- /* zebra_interface_state_read () updates interface structure in iflist
- */
- ifp = zebra_interface_state_read(s, vrf_id);
-
- if (ifp == NULL)
- return 0;
-
- if (if_is_up(ifp))
- zlog_warn("Zebra: got delete of %s, but interface is still up",
- ifp->name);
-
- if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
- zlog_debug(
- "Zebra: interface delete %s index %d flags %llx metric %d mtu %d",
- ifp->name, ifp->ifindex, (unsigned long long)ifp->flags,
- ifp->metric, ifp->mtu);
-
- if (ifp->info)
- eigrp_if_free(ifp->info, INTERFACE_DOWN_BY_ZEBRA);
-
- if_set_index(ifp, IFINDEX_INTERNAL);
- return 0;
-}
-
static int eigrp_interface_address_add(ZAPI_CALLBACK_ARGS)
{
struct connected *c;
static int isis_ifp_destroy(struct interface *ifp)
{
+ if (if_is_operative(ifp))
+ zlog_warn("Zebra: got delete of %s, but interface is still up",
+ ifp->name);
+
+ isis_csm_state_change(IF_DOWN_FROM_Z, circuit_scan_by_ifp(ifp), ifp);
+
+ /* Cannot call if_delete because we should retain the pseudo interface
+ in case there is configuration info attached to it. */
+ if_delete_retain(ifp);
+
return 0;
}
return 0;
}
-static int isis_zebra_if_del(ZAPI_CALLBACK_ARGS)
-{
- struct interface *ifp;
- struct stream *s;
-
- s = zclient->ibuf;
- ifp = zebra_interface_state_read(s, vrf_id);
-
- if (!ifp)
- return 0;
-
- if (if_is_operative(ifp))
- zlog_warn("Zebra: got delete of %s, but interface is still up",
- ifp->name);
-
- isis_csm_state_change(IF_DOWN_FROM_Z, circuit_scan_by_ifp(ifp), ifp);
-
- /* Cannot call if_delete because we should retain the pseudo interface
- in case there is configuration info attached to it. */
- if_delete_retain(ifp);
-
- if_set_index(ifp, IFINDEX_INTERNAL);
-
- return 0;
-}
-
static int isis_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
{
struct connected *c;
zclient_init(zclient, PROTO_TYPE, 0, &isisd_privs);
zclient->zebra_connected = isis_zebra_connected;
zclient->router_id_update = isis_router_id_update_zebra;
- zclient->interface_delete = isis_zebra_if_del;
zclient->interface_address_add = isis_zebra_if_address_add;
zclient->interface_address_delete = isis_zebra_if_address_del;
zclient->interface_link_params = isis_zebra_link_params;
struct kaddr *);
static int ldp_zebra_send_mpls_labels(int, struct kroute *);
static int ldp_router_id_update(ZAPI_CALLBACK_ARGS);
-static int ldp_interface_delete(ZAPI_CALLBACK_ARGS);
static int ldp_interface_address_add(ZAPI_CALLBACK_ARGS);
static int ldp_interface_address_delete(ZAPI_CALLBACK_ARGS);
static int ldp_zebra_read_route(ZAPI_CALLBACK_ARGS);
}
static int
-ldp_interface_delete(ZAPI_CALLBACK_ARGS)
+ldp_ifp_destroy(struct interface *ifp)
{
- struct interface *ifp;
struct kif kif;
- /* zebra_interface_state_read() updates interface structure in iflist */
- ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
- if (ifp == NULL)
- return (0);
-
debug_zebra_in("interface delete %s index %d mtu %d", ifp->name,
ifp->ifindex, ifp->mtu);
- /* To support pseudo interface do not free interface structure. */
- /* if_delete(ifp); */
- if_set_index(ifp, IFINDEX_INTERNAL);
-
ifp2kif(ifp, &kif);
main_imsg_compose_both(IMSG_IFSTATUS, &kif, sizeof(kif));
extern struct zebra_privs_t ldpd_privs;
-static int ldp_ifp_destroy(struct interface *ifp)
-{
- return 0;
-}
-
void
ldp_zebra_init(struct thread_master *master)
{
/* set callbacks */
zclient->zebra_connected = ldp_zebra_connected;
zclient->router_id_update = ldp_router_id_update;
- zclient->interface_delete = ldp_interface_delete;
zclient->interface_address_add = ldp_interface_address_add;
zclient->interface_address_delete = ldp_interface_address_delete;
zclient->redistribute_route_add = ldp_zebra_read_route;
(*ifp_master.create_hook)(ifp);
}
+void if_destroy_via_zapi(struct interface *ifp)
+{
+ if (ifp_master.destroy_hook)
+ (*ifp_master.destroy_hook)(ifp);
+
+ if_set_index(ifp, IFINDEX_INTERNAL);
+}
+
void if_up_via_zapi(struct interface *ifp)
{
if (ifp_master.up_hook)
extern void if_new_via_zapi(struct interface *ifp);
extern void if_up_via_zapi(struct interface *ifp);
extern void if_down_via_zapi(struct interface *ifp);
+extern void if_destroy_via_zapi(struct interface *ifp);
extern const struct frr_yang_module_info frr_interface_info;
return ifp;
}
+static void zclient_interface_delete(struct zclient *zclient, vrf_id_t vrf_id)
+{
+ struct interface *ifp;
+ struct stream *s = zclient->ibuf;
+
+ ifp = zebra_interface_state_read(s, vrf_id);
+
+ if (ifp == NULL)
+ return;
+
+ if_destroy_via_zapi(ifp);
+ return;
+}
+
static void zclient_interface_up(struct zclient *zclient, vrf_id_t vrf_id)
{
struct interface *ifp;
zclient_interface_add(zclient, vrf_id);
break;
case ZEBRA_INTERFACE_DELETE:
- if (zclient->interface_delete)
- (*zclient->interface_delete)(command, zclient, length,
- vrf_id);
+ zclient_interface_delete(zclient, vrf_id);
break;
case ZEBRA_INTERFACE_ADDRESS_ADD:
if (zclient->interface_address_add)
void (*zebra_connected)(struct zclient *);
void (*zebra_capabilities)(struct zclient_capabilities *cap);
int (*router_id_update)(ZAPI_CALLBACK_ARGS);
- int (*interface_delete)(ZAPI_CALLBACK_ARGS);
int (*interface_address_add)(ZAPI_CALLBACK_ARGS);
int (*interface_address_delete)(ZAPI_CALLBACK_ARGS);
int (*interface_link_params)(ZAPI_CALLBACK_ARGS);
return 0;
}
-int nhrp_interface_delete(ZAPI_CALLBACK_ARGS)
+int nhrp_ifp_destroy(struct interface *ifp)
{
- struct interface *ifp;
- struct stream *s;
-
- s = zclient->ibuf;
- ifp = zebra_interface_state_read(s, vrf_id);
- if (ifp == NULL)
- return 0;
-
debugf(NHRP_DEBUG_IF, "if-delete: %s", ifp->name);
nhrp_interface_update(ifp);
- if_set_index(ifp, IFINDEX_INTERNAL);
-
return 0;
}
nhrp_interface_update_nbma(ifp);
}
-
-int nhrp_ifp_destroy(struct interface *ifp)
-{
- return 0;
-}
zclient = zclient_new(master, &zclient_options_default);
zclient->zebra_connected = nhrp_zebra_connected;
- zclient->interface_delete = nhrp_interface_delete;
zclient->interface_address_add = nhrp_interface_address_add;
zclient->interface_address_delete = nhrp_interface_address_delete;
zclient->redistribute_route_add = nhrp_route_read;
static int ospf6_ifp_destroy(struct interface *ifp)
{
+ if (if_is_up(ifp))
+ zlog_warn("Zebra: got delete of %s, but interface is still up",
+ ifp->name);
+
+ if (IS_OSPF6_DEBUG_ZEBRA(RECV))
+ zlog_debug("Zebra Interface delete: %s index %d mtu %d",
+ ifp->name, ifp->ifindex, ifp->mtu6);
+
return 0;
}
AFI_IP6, type, 0, VRF_DEFAULT);
}
-static int ospf6_zebra_if_del(ZAPI_CALLBACK_ARGS)
-{
- struct interface *ifp;
-
- if (!(ifp = zebra_interface_state_read(zclient->ibuf, vrf_id)))
- return 0;
-
- if (if_is_up(ifp))
- zlog_warn("Zebra: got delete of %s, but interface is still up",
- ifp->name);
-
- if (IS_OSPF6_DEBUG_ZEBRA(RECV))
- zlog_debug("Zebra Interface delete: %s index %d mtu %d",
- ifp->name, ifp->ifindex, ifp->mtu6);
-
- if_set_index(ifp, IFINDEX_INTERNAL);
- return 0;
-}
-
static int ospf6_zebra_if_address_update_add(ZAPI_CALLBACK_ARGS)
{
struct connected *c;
zclient_init(zclient, ZEBRA_ROUTE_OSPF6, 0, &ospf6d_privs);
zclient->zebra_connected = ospf6_zebra_connected;
zclient->router_id_update = ospf6_router_id_update_zebra;
- zclient->interface_delete = ospf6_zebra_if_del;
zclient->interface_address_add = ospf6_zebra_if_address_update_add;
zclient->interface_address_delete =
ospf6_zebra_if_address_update_delete;
DEFINE_HOOK(ospf_vl_add, (struct ospf_vl_data * vd), (vd))
DEFINE_HOOK(ospf_vl_delete, (struct ospf_vl_data * vd), (vd))
DEFINE_HOOK(ospf_if_update, (struct interface * ifp), (ifp))
+DEFINE_HOOK(ospf_if_delete, (struct interface * ifp), (ifp))
int ospf_interface_neighbor_count(struct ospf_interface *oi)
{
static int ospf_ifp_destroy(struct interface *ifp)
{
+ struct route_node *rn;
+
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
+ zlog_debug(
+ "Zebra: interface delete %s vrf %s[%u] index %d flags %llx metric %d mtu %d",
+ ifp->name, ospf_vrf_id_to_name(ifp->vrf_id),
+ ifp->vrf_id, ifp->ifindex,
+ (unsigned long long)ifp->flags, ifp->metric, ifp->mtu);
+
+ hook_call(ospf_if_delete, ifp);
+
+ for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn))
+ if (rn->info)
+ ospf_if_free((struct ospf_interface *)rn->info);
+
return 0;
}
DECLARE_HOOK(ospf_vl_delete, (struct ospf_vl_data * vd), (vd))
DECLARE_HOOK(ospf_if_update, (struct interface * ifp), (ifp))
+DECLARE_HOOK(ospf_if_delete, (struct interface * ifp), (ifp))
+
#endif /* _ZEBRA_OSPF_INTERFACE_H */
DEFINE_MTYPE_STATIC(OSPFD, OSPF_REDISTRIBUTE, "OSPF Redistriute")
DEFINE_MTYPE_STATIC(OSPFD, OSPF_DIST_ARGS, "OSPF Distribute arguments")
-DEFINE_HOOK(ospf_if_delete, (struct interface * ifp), (ifp))
-
/* Zebra structure to hold current status. */
struct zclient *zclient = NULL;
return 0;
}
-static int ospf_interface_delete(ZAPI_CALLBACK_ARGS)
-{
- struct interface *ifp;
- struct stream *s;
- struct route_node *rn;
-
- s = zclient->ibuf;
- /* zebra_interface_state_read() updates interface structure in iflist */
- ifp = zebra_interface_state_read(s, vrf_id);
-
- if (ifp == NULL)
- return 0;
-
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
- zlog_debug(
- "Zebra: interface delete %s vrf %s[%u] index %d flags %llx metric %d mtu %d",
- ifp->name, ospf_vrf_id_to_name(ifp->vrf_id),
- ifp->vrf_id, ifp->ifindex,
- (unsigned long long)ifp->flags, ifp->metric, ifp->mtu);
-
- hook_call(ospf_if_delete, ifp);
-
- for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn))
- if (rn->info)
- ospf_if_free((struct ospf_interface *)rn->info);
-
- if_set_index(ifp, IFINDEX_INTERNAL);
- return 0;
-}
-
static int ospf_interface_address_add(ZAPI_CALLBACK_ARGS)
{
struct connected *c;
zclient_init(zclient, ZEBRA_ROUTE_OSPF, instance, &ospfd_privs);
zclient->zebra_connected = ospf_zebra_connected;
zclient->router_id_update = ospf_router_id_update_zebra;
- zclient->interface_delete = ospf_interface_delete;
zclient->interface_address_add = ospf_interface_address_add;
zclient->interface_address_delete = ospf_interface_address_delete;
zclient->interface_link_params = ospf_interface_link_params;
extern void ospf_zebra_vrf_register(struct ospf *ospf);
extern void ospf_zebra_vrf_deregister(struct ospf *ospf);
-DECLARE_HOOK(ospf_if_delete, (struct interface * ifp), (ifp))
-
#endif /* _ZEBRA_OSPF_ZEBRA_H */
return 0;
}
-static int interface_delete(ZAPI_CALLBACK_ARGS)
+int pbr_ifp_destroy(struct interface *ifp)
{
- struct interface *ifp;
- struct stream *s;
-
- s = zclient->ibuf;
- /* zebra_interface_state_read () updates interface structure in iflist
- */
- ifp = zebra_interface_state_read(s, vrf_id);
-
- if (ifp == NULL)
- return 0;
-
DEBUGD(&pbr_dbg_zebra,
"%s: %s", __PRETTY_FUNCTION__, ifp->name);
- if_set_index(ifp, IFINDEX_INTERNAL);
-
return 0;
}
zclient_init(zclient, ZEBRA_ROUTE_PBR, 0, &pbr_privs);
zclient->zebra_connected = zebra_connected;
- zclient->interface_delete = interface_delete;
zclient->interface_address_add = interface_address_add;
zclient->interface_address_delete = interface_address_delete;
zclient->route_notify_owner = route_notify_owner;
zclient_send_message(zclient);
}
-
-int pbr_ifp_destroy(struct interface *ifp)
-{
- return 0;
-}
int pim_ifp_destroy(struct interface *ifp)
{
+ struct pim_instance *pim;
+
+ if (PIM_DEBUG_ZEBRA) {
+ zlog_debug(
+ "%s: %s index %d(%u) flags %ld metric %d mtu %d operative %d",
+ __PRETTY_FUNCTION__, ifp->name, ifp->ifindex,
+ ifp->vrf_id, (long)ifp->flags, ifp->metric, ifp->mtu,
+ if_is_operative(ifp));
+ }
+
+ if (!if_is_operative(ifp))
+ pim_if_addr_del_all(ifp);
+
+ pim = pim_get_pim_instance(ifp->vrf_id);
+ if (pim && pim->vxlan.term_if == ifp)
+ pim_vxlan_del_term_dev(pim);
+
return 0;
}
return 0;
}
-static int pim_zebra_if_del(ZAPI_CALLBACK_ARGS)
-{
- struct interface *ifp;
- struct pim_instance *pim;
-
- ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
- if (!ifp)
- return 0;
-
- if (PIM_DEBUG_ZEBRA) {
- zlog_debug(
- "%s: %s index %d(%u) flags %ld metric %d mtu %d operative %d",
- __PRETTY_FUNCTION__, ifp->name, ifp->ifindex, vrf_id,
- (long)ifp->flags, ifp->metric, ifp->mtu,
- if_is_operative(ifp));
- }
-
- if (!if_is_operative(ifp))
- pim_if_addr_del_all(ifp);
-
- if_set_index(ifp, IFINDEX_INTERNAL);
-
- pim = pim_get_pim_instance(vrf_id);
- if (pim && pim->vxlan.term_if == ifp)
- pim_vxlan_del_term_dev(pim);
-
- return 0;
-}
-
static int pim_zebra_interface_vrf_update(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
zclient->zebra_capabilities = pim_zebra_capabilities;
zclient->zebra_connected = pim_zebra_connected;
zclient->router_id_update = pim_router_id_update_zebra;
- zclient->interface_delete = pim_zebra_if_del;
zclient->interface_address_add = pim_zebra_if_address_add;
zclient->interface_address_delete = pim_zebra_if_address_del;
zclient->interface_vrf_update = pim_zebra_interface_vrf_update;
return 0;
}
-int rip_interface_delete(ZAPI_CALLBACK_ARGS)
+static int rip_ifp_destroy(struct interface *ifp)
{
- struct interface *ifp;
- struct stream *s;
-
-
- s = zclient->ibuf;
- /* zebra_interface_state_read() updates interface structure in iflist */
- ifp = zebra_interface_state_read(s, vrf_id);
-
- if (ifp == NULL)
- return 0;
-
rip_interface_sync(ifp);
if (if_is_up(ifp)) {
rip_if_down(ifp);
ifp->name, ifp->vrf_id, ifp->ifindex,
(unsigned long long)ifp->flags, ifp->metric, ifp->mtu);
- /* To support pseudo interface do not free interface structure. */
- /* if_delete(ifp); */
- if_set_index(ifp, IFINDEX_INTERNAL);
-
return 0;
}
return 0;
}
-static int rip_ifp_destroy(struct interface *ifp)
-{
- return 0;
-}
-
/* Allocate and initialize interface vector. */
void rip_if_init(void)
{
zclient = zclient_new(master, &zclient_options_default);
zclient_init(zclient, ZEBRA_ROUTE_RIP, 0, &ripd_privs);
zclient->zebra_connected = rip_zebra_connected;
- zclient->interface_delete = rip_interface_delete;
zclient->interface_address_add = rip_interface_address_add;
zclient->interface_address_delete = rip_interface_address_delete;
zclient->interface_vrf_update = rip_interface_vrf_update;
return 0;
}
-int ripng_interface_delete(ZAPI_CALLBACK_ARGS)
+static int ripng_ifp_destroy(struct interface *ifp)
{
- struct interface *ifp;
- struct stream *s;
-
- s = zclient->ibuf;
- /* zebra_interface_state_read() updates interface structure in iflist
- */
- ifp = zebra_interface_state_read(s, vrf_id);
-
- if (ifp == NULL)
- return 0;
-
ripng_interface_sync(ifp);
if (if_is_up(ifp)) {
ripng_if_down(ifp);
ifp->name, ifp->vrf_id, ifp->ifindex,
(unsigned long long)ifp->flags, ifp->metric, ifp->mtu6);
- /* To support pseudo interface do not free interface structure. */
- /* if_delete(ifp); */
- if_set_index(ifp, IFINDEX_INTERNAL);
-
return 0;
}
INTERFACE_NODE, "%s(config-if)# ", 1 /* VTYSH */
};
-static int ripng_ifp_destroy(struct interface *ifp)
-{
- return 0;
-}
-
/* Initialization of interface. */
void ripng_if_init(void)
{
zclient_init(zclient, ZEBRA_ROUTE_RIPNG, 0, &ripngd_privs);
zclient->zebra_connected = ripng_zebra_connected;
- zclient->interface_delete = ripng_interface_delete;
zclient->interface_address_add = ripng_interface_address_add;
zclient->interface_address_delete = ripng_interface_address_delete;
zclient->interface_vrf_update = ripng_interface_vrf_update;
return 0;
}
-static int interface_delete(ZAPI_CALLBACK_ARGS)
+static int sharp_ifp_destroy(struct interface *ifp)
{
- struct interface *ifp;
- struct stream *s;
-
- s = zclient->ibuf;
- /* zebra_interface_state_read () updates interface structure in iflist
- */
- ifp = zebra_interface_state_read(s, vrf_id);
-
- if (ifp == NULL)
- return 0;
-
- if_set_index(ifp, IFINDEX_INTERNAL);
-
return 0;
}
static int interface_address_add(ZAPI_CALLBACK_ARGS)
{
-
zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
return 0;
return 0;
}
-static int sharp_ifp_destroy(struct interface *ifp)
-{
- return 0;
-}
-
extern struct zebra_privs_t sharp_privs;
void sharp_zebra_init(void)
zclient_init(zclient, ZEBRA_ROUTE_SHARP, 0, &sharp_privs);
zclient->zebra_connected = zebra_connected;
- zclient->interface_delete = interface_delete;
zclient->interface_address_add = interface_address_add;
zclient->interface_address_delete = interface_address_delete;
zclient->route_notify_owner = route_notify_owner;
return 0;
}
-static int interface_delete(ZAPI_CALLBACK_ARGS)
+static int static_ifp_destroy(struct interface *ifp)
{
- struct interface *ifp;
- struct stream *s;
-
- s = zclient->ibuf;
- /* zebra_interface_state_read () updates interface structure in iflist
- */
- ifp = zebra_interface_state_read(s, vrf_id);
-
- if (ifp == NULL)
- return 0;
-
- if_set_index(ifp, IFINDEX_INTERNAL);
-
static_ifindex_update(ifp, false);
return 0;
}
zclient, &api);
}
-static int static_ifp_destroy(struct interface *ifp)
-{
- return 0;
-}
-
void static_zebra_init(void)
{
struct zclient_options opt = { .receive_notify = true };
zclient_init(zclient, ZEBRA_ROUTE_STATIC, 0, &static_privs);
zclient->zebra_capabilities = static_zebra_capabilities;
zclient->zebra_connected = zebra_connected;
- zclient->interface_delete = interface_delete;
zclient->interface_address_add = interface_address_add;
zclient->interface_address_delete = interface_address_delete;
zclient->route_notify_owner = route_notify_owner;
return 0;
}
-static int vrrp_zebra_if_del(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+int vrrp_ifp_destroy(struct interface *ifp)
{
- struct interface *ifp;
-
- ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
-
- if (!ifp)
- return 0;
-
- vrrp_zebra_debug_if_state(ifp, vrf_id, __func__);
+ vrrp_zebra_debug_if_state(ifp, ifp->vrf_id, __func__);
vrrp_if_del(ifp);
- if_set_index(ifp, IFINDEX_INTERNAL);
-
return 0;
}
down);
}
-int vrrp_ifp_destroy(struct interface *ifp)
-{
- return 0;
-}
-
void vrrp_zebra_init(void)
{
if_zapi_callbacks(vrrp_ifp_create, vrrp_ifp_up,
zclient->zebra_connected = vrrp_zebra_connected;
zclient->router_id_update = vrrp_router_id_update_zebra;
- zclient->interface_delete = vrrp_zebra_if_del;
zclient->interface_address_add = vrrp_zebra_if_address_add;
zclient->interface_address_delete = vrrp_zebra_if_address_del;