return 0;
}
-int
-babel_interface_add (ZAPI_CALLBACK_ARGS)
+int babel_ifp_create (struct interface *ifp)
{
- struct interface *ifp = NULL;
-
debugf(BABEL_DEBUG_IF, "receive a 'interface add'");
- /* read and add the interface in the iflist. */
- ifp = zebra_interface_add_read (zclient->ibuf, vrf_id);
-
- if (ifp == NULL) {
- return 0;
- }
-
interface_recalculate(ifp);
- return 0;
-}
+
+ return 0;
+ }
int
babel_interface_delete (ZAPI_CALLBACK_ARGS)
return CMD_SUCCESS;
}
-int babel_ifp_create(struct interface *ifp)
-{
- return 0;
-}
-
int babel_ifp_up(struct interface *ifp)
{
return 0;
zclient_init(zclient, ZEBRA_ROUTE_BABEL, 0, &babeld_privs);
zclient->zebra_connected = babel_zebra_connected;
- zclient->interface_add = babel_interface_add;
zclient->interface_delete = babel_interface_delete;
zclient->interface_up = babel_interface_up;
zclient->interface_down = babel_interface_down;
{
struct interface *ifp;
- /*
- * `zebra_interface_add_read` will handle the interface creation
- * on `lib/if.c`. We'll use that data structure instead of
- * rolling our own.
- */
- if (cmd == ZEBRA_INTERFACE_ADD) {
- ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
- if (ifp == NULL)
- return 0;
-
- bfdd_sessions_enable_interface(ifp);
- return 0;
- }
-
/* Update interface information. */
ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
if (ifp == NULL)
static int bfd_ifp_create(struct interface *ifp)
{
+ bfdd_sessions_enable_interface(ifp);
+
return 0;
}
zclient->zebra_connected = bfdd_zebra_connected;
/* Learn interfaces from zebra instead of the OS. */
- zclient->interface_add = bfdd_interface_update;
zclient->interface_delete = bfdd_interface_update;
/* Learn about interface VRF. */
}
}
-/* Inteface addition message from zebra. */
-static int bgp_interface_add(ZAPI_CALLBACK_ARGS)
-{
- struct interface *ifp;
- struct bgp *bgp;
-
- ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
- if (!ifp) // unexpected
- return 0;
-
- if (BGP_DEBUG(zebra, ZEBRA) && ifp)
- zlog_debug("Rx Intf add VRF %u IF %s", vrf_id, ifp->name);
-
- bgp = bgp_lookup_by_vrf_id(vrf_id);
- if (!bgp)
- return 0;
-
- bgp_mac_add_mac_entry(ifp);
-
- bgp_update_interface_nbrs(bgp, ifp, ifp);
- return 0;
-}
-
static int bgp_interface_delete(ZAPI_CALLBACK_ARGS)
{
struct stream *s;
static int bgp_ifp_create(struct interface *ifp)
{
+ struct bgp *bgp;
+
+ if (BGP_DEBUG(zebra, ZEBRA))
+ zlog_debug("Rx Intf add VRF %u IF %s", ifp->vrf_id, ifp->name);
+
+ bgp = bgp_lookup_by_vrf_id(ifp->vrf_id);
+ if (!bgp)
+ return 0;
+
+ bgp_mac_add_mac_entry(ifp);
+
+ bgp_update_interface_nbrs(bgp, ifp, ifp);
return 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_add = bgp_interface_add;
zclient->interface_delete = bgp_interface_delete;
zclient->interface_address_add = bgp_interface_address_add;
zclient->interface_address_delete = bgp_interface_address_delete;
static int eigrp_ifp_create(struct interface *ifp)
{
+ struct eigrp_interface *ei = ifp->info;
+
+ if (!ei)
+ return 0;
+
+ ei->params.type = eigrp_default_iftype(ifp);
+
+ eigrp_if_update(ifp);
+
return 0;
}
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
-static int eigrp_interface_add(ZAPI_CALLBACK_ARGS);
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_add = eigrp_interface_add;
zclient->interface_delete = eigrp_interface_delete;
zclient->interface_up = eigrp_interface_state_up;
zclient->interface_down = eigrp_interface_state_down;
return 0;
}
-/* Inteface addition message from zebra. */
-static int eigrp_interface_add(ZAPI_CALLBACK_ARGS)
-{
- struct interface *ifp;
- struct eigrp_interface *ei;
-
- ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
-
- if (!ifp->info)
- return 0;
-
- ei = ifp->info;
-
- ei->params.type = eigrp_default_iftype(ifp);
-
- eigrp_if_update(ifp);
-
- return 0;
-}
-
static int eigrp_interface_delete(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
DEFINE_QOBJ_TYPE(isis_circuit)
+DEFINE_HOOK(isis_if_new_hook, (struct interface *ifp), (ifp))
+
/*
* Prototypes.
*/
static int isis_ifp_create(struct interface *ifp)
{
+ if (if_is_operative(ifp))
+ isis_csm_state_change(IF_UP_FROM_Z, circuit_scan_by_ifp(ifp),
+ ifp);
+
+ hook_call(isis_if_new_hook, ifp);
+
return 0;
}
#include "isis_constants.h"
#include "isis_common.h"
+DECLARE_HOOK(isis_if_new_hook, (struct interface *ifp), (ifp));
+
struct isis_lsp;
struct password {
struct zclient *zclient = NULL;
-DEFINE_HOOK(isis_if_new_hook, (struct interface *ifp), (ifp))
-
/* Router-id update message from zebra. */
static int isis_router_id_update_zebra(ZAPI_CALLBACK_ARGS)
{
return 0;
}
-static int isis_zebra_if_add(ZAPI_CALLBACK_ARGS)
-{
- struct interface *ifp;
-
- ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
-
- if (if_is_operative(ifp))
- isis_csm_state_change(IF_UP_FROM_Z, circuit_scan_by_ifp(ifp),
- ifp);
-
- hook_call(isis_if_new_hook, ifp);
-
- return 0;
-}
-
static int isis_zebra_if_del(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
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_add = isis_zebra_if_add;
zclient->interface_delete = isis_zebra_if_del;
zclient->interface_up = isis_zebra_if_state_up;
zclient->interface_down = isis_zebra_if_state_down;
extern struct zclient *zclient;
-DECLARE_HOOK(isis_if_new_hook, (struct interface *ifp), (ifp));
-
void isis_zebra_init(struct thread_master *);
void isis_zebra_stop(void);
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_add(ZAPI_CALLBACK_ARGS);
static int ldp_interface_delete(ZAPI_CALLBACK_ARGS);
static int ldp_interface_status_change(ZAPI_CALLBACK_ARGS);
static int ldp_interface_address_add(ZAPI_CALLBACK_ARGS);
}
static int
-ldp_interface_add(ZAPI_CALLBACK_ARGS)
+ldp_ifp_create(struct interface *ifp)
{
- struct interface *ifp;
struct kif kif;
- ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
debug_zebra_in("interface add %s index %d mtu %d", ifp->name,
ifp->ifindex, ifp->mtu);
ifp2kif(ifp, &kif);
main_imsg_compose_both(IMSG_IFSTATUS, &kif, sizeof(kif));
- return (0);
+ return 0;
}
static int
extern struct zebra_privs_t ldpd_privs;
-static int ldp_ifp_create(struct interface *ifp)
-{
- return 0;
-}
-
static int ldp_ifp_up(struct interface *ifp)
{
return 0;
/* set callbacks */
zclient->zebra_connected = ldp_zebra_connected;
zclient->router_id_update = ldp_router_id_update;
- zclient->interface_add = ldp_interface_add;
zclient->interface_delete = ldp_interface_delete;
zclient->interface_up = ldp_interface_status_change;
zclient->interface_down = ldp_interface_status_change;
return ifp;
}
+void if_new_via_zapi(struct interface *ifp)
+{
+ if (ifp_master.create_hook)
+ (*ifp_master.create_hook)(ifp);
+}
+
struct interface *if_create(const char *name, vrf_id_t vrf_id)
{
return if_create_backend(name, IFINDEX_INTERNAL, vrf_id);
int (*down)(struct interface *ifp),
int (*destroy)(struct interface *ifp));
+extern void if_new_via_zapi(struct interface *ifp);
+
extern const struct frr_yang_module_info frr_interface_info;
#ifdef __cplusplus
vrf_delete(vrf);
}
-struct interface *zebra_interface_add_read(struct stream *s, vrf_id_t vrf_id)
+static void zclient_interface_add(struct zclient *zclient, vrf_id_t vrf_id)
{
struct interface *ifp;
char ifname_tmp[INTERFACE_NAMSIZ];
+ struct stream *s = zclient->ibuf;
/* Read interface name. */
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
zebra_interface_if_set_value(s, ifp);
- return ifp;
+ if_new_via_zapi(ifp);
}
/*
* Read interface up/down msg (ZEBRA_INTERFACE_UP/ZEBRA_INTERFACE_DOWN)
* from zebra server. The format of this message is the same as
- * that sent for ZEBRA_INTERFACE_ADD/ZEBRA_INTERFACE_DELETE (see
- * comments for zebra_interface_add_read), except that no sockaddr_dl
- * is sent at the tail of the message.
+ * that sent for ZEBRA_INTERFACE_ADD/ZEBRA_INTERFACE_DELETE,
+ * except that no sockaddr_dl is sent at the tail of the message.
*/
struct interface *zebra_interface_state_read(struct stream *s, vrf_id_t vrf_id)
{
zclient_vrf_delete(zclient, vrf_id);
break;
case ZEBRA_INTERFACE_ADD:
- if (zclient->interface_add)
- (*zclient->interface_add)(command, zclient, length,
- vrf_id);
+ zclient_interface_add(zclient, vrf_id);
break;
case ZEBRA_INTERFACE_DELETE:
if (zclient->interface_delete)
void (*zebra_connected)(struct zclient *);
void (*zebra_capabilities)(struct zclient_capabilities *cap);
int (*router_id_update)(ZAPI_CALLBACK_ARGS);
- int (*interface_add)(ZAPI_CALLBACK_ARGS);
int (*interface_delete)(ZAPI_CALLBACK_ARGS);
int (*interface_up)(ZAPI_CALLBACK_ARGS);
int (*interface_down)(ZAPI_CALLBACK_ARGS);
extern void zclient_interface_set_master(struct zclient *client,
struct interface *master,
struct interface *slave);
-extern struct interface *zebra_interface_add_read(struct stream *, vrf_id_t);
extern struct interface *zebra_interface_state_read(struct stream *s, vrf_id_t);
extern struct connected *zebra_interface_address_read(int, struct stream *,
vrf_id_t);
}
}
-int nhrp_interface_add(ZAPI_CALLBACK_ARGS)
+int nhrp_ifp_create(struct interface *ifp)
{
- struct interface *ifp;
-
- /* read and add the interface in the iflist. */
- ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
- if (ifp == NULL)
- return 0;
-
debugf(NHRP_DEBUG_IF, "if-add: %s, ifindex: %u, hw_type: %d %s",
ifp->name, ifp->ifindex, ifp->ll_type,
if_link_type_str(ifp->ll_type));
nhrp_interface_update_nbma(ifp);
}
-int nhrp_ifp_create(struct interface *ifp)
-{
- return 0;
-}
-
int nhrp_ifp_up(struct interface *ifp)
{
return 0;
zclient = zclient_new(master, &zclient_options_default);
zclient->zebra_connected = nhrp_zebra_connected;
- zclient->interface_add = nhrp_interface_add;
zclient->interface_delete = nhrp_interface_delete;
zclient->interface_up = nhrp_interface_up;
zclient->interface_down = nhrp_interface_down;
#include "ospf6_spf.h"
#include "ospf6d.h"
#include "ospf6_bfd.h"
+#include "ospf6_zebra.h"
DEFINE_MTYPE_STATIC(OSPF6D, CFG_PLIST_NAME, "configured prefix list names")
DEFINE_QOBJ_TYPE(ospf6_interface)
static int ospf6_ifp_create(struct interface *ifp)
{
+ if (IS_OSPF6_DEBUG_ZEBRA(RECV))
+ zlog_debug("Zebra Interface add: %s index %d mtu %d", ifp->name,
+ ifp->ifindex, ifp->mtu6);
+ ospf6_interface_if_add(ifp);
+
return 0;
}
AFI_IP6, type, 0, VRF_DEFAULT);
}
-/* Inteface addition message from zebra. */
-static int ospf6_zebra_if_add(ZAPI_CALLBACK_ARGS)
-{
- struct interface *ifp;
-
- ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
- if (IS_OSPF6_DEBUG_ZEBRA(RECV))
- zlog_debug("Zebra Interface add: %s index %d mtu %d", ifp->name,
- ifp->ifindex, ifp->mtu6);
- ospf6_interface_if_add(ifp);
- return 0;
-}
-
static int ospf6_zebra_if_del(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
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_add = ospf6_zebra_if_add;
zclient->interface_delete = ospf6_zebra_if_del;
zclient->interface_up = ospf6_zebra_if_state_update;
zclient->interface_down = ospf6_zebra_if_state_update;
DEFINE_QOBJ_TYPE(ospf_interface)
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))
int ospf_interface_neighbor_count(struct ospf_interface *oi)
{
return OSPF_IFTYPE_BROADCAST;
}
+void ospf_if_interface(struct interface *ifp)
+{
+ hook_call(ospf_if_update, ifp);
+}
+
static int ospf_ifp_create(struct interface *ifp)
{
+ struct ospf *ospf = NULL;
+
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
+ zlog_debug(
+ "Zebra: interface add %s vrf %s[%u] index %d flags %llx metric %d mtu %d speed %u",
+ ifp->name, ospf_vrf_id_to_name(ifp->vrf_id),
+ ifp->vrf_id, ifp->ifindex,
+ (unsigned long long)ifp->flags, ifp->metric, ifp->mtu,
+ ifp->speed);
+
+ assert(ifp->info);
+
+ if (IF_DEF_PARAMS(ifp)
+ && !OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp), type)) {
+ SET_IF_PARAM(IF_DEF_PARAMS(ifp), type);
+ IF_DEF_PARAMS(ifp)->type = ospf_default_iftype(ifp);
+ }
+
+ ospf = ospf_lookup_by_vrf_id(ifp->vrf_id);
+ if (!ospf)
+ return 0;
+
+ ospf_if_recalculate_output_cost(ifp);
+
+ ospf_if_update(ospf, ifp);
+
+ hook_call(ospf_if_update, ifp);
+
return 0;
}
state of the interface. */
extern void ospf_if_set_multicast(struct ospf_interface *);
+extern void ospf_if_interface(struct interface *ifp);
+
DECLARE_HOOK(ospf_vl_add, (struct ospf_vl_data * vd), (vd))
DECLARE_HOOK(ospf_vl_delete, (struct ospf_vl_data * vd), (vd))
+DECLARE_HOOK(ospf_if_update, (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_update, (struct interface * ifp), (ifp))
DEFINE_HOOK(ospf_if_delete, (struct interface * ifp), (ifp))
/* Zebra structure to hold current status. */
return 0;
}
-/* Inteface addition message from zebra. */
-static int ospf_interface_add(ZAPI_CALLBACK_ARGS)
-{
- struct interface *ifp = NULL;
- struct ospf *ospf = NULL;
-
- ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
- if (ifp == NULL)
- return 0;
-
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
- zlog_debug(
- "Zebra: interface add %s vrf %s[%u] index %d flags %llx metric %d mtu %d speed %u",
- ifp->name, ospf_vrf_id_to_name(ifp->vrf_id),
- ifp->vrf_id, ifp->ifindex,
- (unsigned long long)ifp->flags, ifp->metric, ifp->mtu,
- ifp->speed);
-
- assert(ifp->info);
-
- if (IF_DEF_PARAMS(ifp)
- && !OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp), type)) {
- SET_IF_PARAM(IF_DEF_PARAMS(ifp), type);
- IF_DEF_PARAMS(ifp)->type = ospf_default_iftype(ifp);
- }
-
- ospf = ospf_lookup_by_vrf_id(vrf_id);
- if (!ospf)
- return 0;
-
- ospf_if_recalculate_output_cost(ifp);
-
- ospf_if_update(ospf, ifp);
-
- hook_call(ospf_if_update, ifp);
-
- return 0;
-}
-
static int ospf_interface_delete(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
ospf_if_update(ospf, c->ifp);
- hook_call(ospf_if_update, c->ifp);
+ ospf_if_interface(c->ifp);
return 0;
}
/* Call interface hook functions to clean up */
ospf_if_free(oi);
- hook_call(ospf_if_update, c->ifp);
+ ospf_if_interface(c->ifp);
connected_free(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_add = ospf_interface_add;
zclient->interface_delete = ospf_interface_delete;
zclient->interface_up = ospf_interface_state_up;
zclient->interface_down = ospf_interface_state_down;
extern void ospf_zebra_vrf_register(struct ospf *ospf);
extern void ospf_zebra_vrf_deregister(struct ospf *ospf);
-DECLARE_HOOK(ospf_if_update, (struct interface * ifp), (ifp))
DECLARE_HOOK(ospf_if_delete, (struct interface * ifp), (ifp))
#endif /* _ZEBRA_OSPF_ZEBRA_H */
/* Update connected redistribute. */
update_redistributed(ospf, 1);
+
}
void ospf_remove_vls_through_area(struct ospf *ospf, struct ospf_area *area)
}
/* Inteface addition message from zebra. */
-static int interface_add(ZAPI_CALLBACK_ARGS)
+int pbr_ifp_create(struct interface *ifp)
{
- struct interface *ifp;
-
- ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
-
- if (!ifp)
- return 0;
-
DEBUGD(&pbr_dbg_zebra,
"%s: %s", __PRETTY_FUNCTION__, ifp->name);
zclient_init(zclient, ZEBRA_ROUTE_PBR, 0, &pbr_privs);
zclient->zebra_connected = zebra_connected;
- zclient->interface_add = interface_add;
zclient->interface_delete = interface_delete;
zclient->interface_up = interface_state_up;
zclient->interface_down = interface_state_down;
zclient_send_message(zclient);
}
-int pbr_ifp_create(struct interface *ifp)
-{
- return 0;
-}
-
int pbr_ifp_up(struct interface *ifp)
{
return 0;
int pim_ifp_create(struct interface *ifp)
{
+ struct pim_instance *pim;
+
+ pim = pim_get_pim_instance(ifp->vrf_id);
+ 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)) {
+ struct pim_interface *pim_ifp;
+
+ pim_ifp = ifp->info;
+ /*
+ * If we have a pim_ifp already and this is an if_add
+ * that means that we probably have a vrf move event
+ * If that is the case, set the proper vrfness.
+ */
+ if (pim_ifp)
+ pim_ifp->pim = pim;
+ pim_if_addr_add_all(ifp);
+ }
+
+ /*
+ * If we are a vrf device that is up, open up the pim_socket for
+ * listening
+ * to incoming pim messages irrelevant if the user has configured us
+ * for pim or not.
+ */
+ if (pim_if_is_vrf_device(ifp)) {
+ struct pim_interface *pim_ifp;
+
+ if (!ifp->info) {
+ pim_ifp = pim_if_new(ifp, false, false, false,
+ false /*vxlan_term*/);
+ ifp->info = pim_ifp;
+ }
+
+ pim_sock_add(ifp);
+ }
+
+ if (!strncmp(ifp->name, PIM_VXLAN_TERM_DEV_NAME,
+ sizeof(PIM_VXLAN_TERM_DEV_NAME)))
+ pim_vxlan_add_term_dev(pim, ifp);
+
return 0;
}
return 0;
}
-static int pim_zebra_if_add(ZAPI_CALLBACK_ARGS)
-{
- struct interface *ifp;
- struct pim_instance *pim;
-
- /*
- zebra api adds/dels interfaces using the same call
- interface_add_read below, see comments in lib/zclient.c
- */
- ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
- if (!ifp)
- return 0;
-
- pim = pim_get_pim_instance(vrf_id);
- 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)) {
- struct pim_interface *pim_ifp;
-
- pim_ifp = ifp->info;
- /*
- * If we have a pim_ifp already and this is an if_add
- * that means that we probably have a vrf move event
- * If that is the case, set the proper vrfness.
- */
- if (pim_ifp)
- pim_ifp->pim = pim;
- pim_if_addr_add_all(ifp);
- }
-
- /*
- * If we are a vrf device that is up, open up the pim_socket for
- * listening
- * to incoming pim messages irrelevant if the user has configured us
- * for pim or not.
- */
- if (pim_if_is_vrf_device(ifp)) {
- struct pim_interface *pim_ifp;
-
- if (!ifp->info) {
- pim_ifp = pim_if_new(ifp, false, false, false,
- false /*vxlan_term*/);
- ifp->info = pim_ifp;
- }
-
- pim_sock_add(ifp);
- }
-
- if (!strncmp(ifp->name, PIM_VXLAN_TERM_DEV_NAME,
- sizeof(PIM_VXLAN_TERM_DEV_NAME)))
- pim_vxlan_add_term_dev(pim, ifp);
-
- return 0;
-}
-
static int pim_zebra_if_del(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
struct pim_instance *pim;
- /*
- zebra api adds/dels interfaces using the same call
- interface_add_read below, see comments in lib/zclient.c
-
- comments in lib/zclient.c seem to indicate that calling
- zebra_interface_add_read is the correct call, but that
- results in an attemted out of bounds read which causes
- pimd to assert. Other clients use zebra_interface_state_read
- and it appears to work just fine.
- */
ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
if (!ifp)
return 0;
zclient->zebra_capabilities = pim_zebra_capabilities;
zclient->zebra_connected = pim_zebra_connected;
zclient->router_id_update = pim_router_id_update_zebra;
- zclient->interface_add = pim_zebra_if_add;
zclient->interface_delete = pim_zebra_if_del;
zclient->interface_up = pim_zebra_if_state_up;
zclient->interface_down = pim_zebra_if_state_down;
}
/* Inteface addition message from zebra. */
-int rip_interface_add(ZAPI_CALLBACK_ARGS)
+static int rip_ifp_create(struct interface *ifp)
{
- struct interface *ifp;
-
- ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
rip_interface_sync(ifp);
if (IS_RIP_DEBUG_ZEBRA)
return 0;
}
-static int rip_ifp_create(struct interface *ifp)
-{
- return 0;
-}
-
static int rip_ifp_up(struct interface *ifp)
{
return 0;
zclient = zclient_new(master, &zclient_options_default);
zclient_init(zclient, ZEBRA_ROUTE_RIP, 0, &ripd_privs);
zclient->zebra_connected = rip_zebra_connected;
- zclient->interface_add = rip_interface_add;
zclient->interface_delete = rip_interface_delete;
zclient->interface_address_add = rip_interface_address_add;
zclient->interface_address_delete = rip_interface_address_delete;
}
/* Inteface addition message from zebra. */
-int ripng_interface_add(ZAPI_CALLBACK_ARGS)
+static int ripng_ifp_create(struct interface *ifp)
{
- struct interface *ifp;
-
- ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
ripng_interface_sync(ifp);
if (IS_RIPNG_DEBUG_ZEBRA)
INTERFACE_NODE, "%s(config-if)# ", 1 /* VTYSH */
};
-static int ripng_ifp_create(struct interface *ifp)
-{
- return 0;
-}
-
static int ripng_ifp_up(struct interface *ifp)
{
return 0;
zclient->zebra_connected = ripng_zebra_connected;
zclient->interface_up = ripng_interface_up;
zclient->interface_down = ripng_interface_down;
- zclient->interface_add = ripng_interface_add;
zclient->interface_delete = ripng_interface_delete;
zclient->interface_address_add = ripng_interface_address_add;
zclient->interface_address_delete = ripng_interface_address_delete;
}
/* Inteface addition message from zebra. */
-static int interface_add(ZAPI_CALLBACK_ARGS)
+static int sharp_ifp_create(struct interface *ifp)
{
- struct interface *ifp;
-
- ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
-
- if (!ifp->info)
- return 0;
-
return 0;
}
return 0;
}
-static int sharp_ifp_create(struct interface *ifp)
-{
- return 0;
-}
-
static int sharp_ifp_up(struct interface *ifp)
{
return 0;
zclient_init(zclient, ZEBRA_ROUTE_SHARP, 0, &sharp_privs);
zclient->zebra_connected = zebra_connected;
- zclient->interface_add = interface_add;
zclient->interface_delete = interface_delete;
zclient->interface_up = interface_state_up;
zclient->interface_down = interface_state_down;
}
/* Inteface addition message from zebra. */
-static int interface_add(ZAPI_CALLBACK_ARGS)
+static int static_ifp_create(struct interface *ifp)
{
- struct interface *ifp;
-
- ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
-
- if (!ifp)
- return 0;
-
static_ifindex_update(ifp, true);
+
return 0;
}
zclient, &api);
}
-static int static_ifp_create(struct interface *ifp)
-{
- return 0;
-}
-
static int static_ifp_up(struct interface *ifp)
{
return 0;
zclient_init(zclient, ZEBRA_ROUTE_STATIC, 0, &static_privs);
zclient->zebra_capabilities = static_zebra_capabilities;
zclient->zebra_connected = zebra_connected;
- zclient->interface_add = interface_add;
zclient->interface_delete = interface_delete;
zclient->interface_up = interface_state_up;
zclient->interface_down = interface_state_down;
return 0;
}
-static int vrrp_zebra_if_add(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+int vrrp_ifp_create(struct interface *ifp)
{
- struct interface *ifp;
-
- /*
- * zebra api adds/dels interfaces using the same call
- * interface_add_read below, see comments in lib/zclient.c
- */
- ifp = zebra_interface_add_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_add(ifp);
down);
}
-int vrrp_ifp_create(struct interface *ifp)
-{
- return 0;
-}
-
int vrrp_ifp_up(struct interface *ifp)
{
return 0;
zclient->zebra_connected = vrrp_zebra_connected;
zclient->router_id_update = vrrp_router_id_update_zebra;
- zclient->interface_add = vrrp_zebra_if_add;
zclient->interface_delete = vrrp_zebra_if_del;
zclient->interface_up = vrrp_zebra_if_state_up;
zclient->interface_down = vrrp_zebra_if_state_down;