#include "ripd/rip_debug.h"
#include "ripd/rip_interface.h"
+DEFINE_MTYPE_STATIC(RIPD, RIP_INTERFACE, "RIP interface")
+DEFINE_MTYPE(RIPD, RIP_INTERFACE_STRING, "RIP Interface String")
DEFINE_HOOK(rip_ifaddr_add, (struct connected * ifc), (ifc))
DEFINE_HOOK(rip_ifaddr_del, (struct connected * ifc), (ifc))
}
/* Inteface link down message processing. */
-int rip_interface_down(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+static int rip_ifp_down(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);
rip_if_down(ifp);
}
/* Inteface link up message processing */
-int rip_interface_up(int command, struct zclient *zclient, zebra_size_t length,
- vrf_id_t vrf_id)
+static int rip_ifp_up(struct interface *ifp)
{
- struct interface *ifp;
-
- /* zebra_interface_state_read () updates interface structure in
- iflist. */
- ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
-
- if (ifp == NULL)
- return 0;
-
if (IS_RIP_DEBUG_ZEBRA)
zlog_debug(
"interface %s vrf %u index %d flags %#llx metric %d mtu %d is up",
}
/* Inteface addition message from zebra. */
-int rip_interface_add(int command, struct zclient *zclient, zebra_size_t length,
- vrf_id_t vrf_id)
+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;
}
-int rip_interface_delete(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+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;
}
/* VRF update for an interface. */
-int rip_interface_vrf_update(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+int rip_interface_vrf_update(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
vrf_id_t new_vrf_id;
ri->ri_receive = yang_get_default_enum("%s/version-receive", RIP_IFACE);
ri->v2_broadcast = yang_get_default_bool("%s/v2-broadcast", RIP_IFACE);
- if (ri->auth_str)
- XFREE(MTYPE_RIP_INTERFACE_STRING, ri->auth_str);
+ XFREE(MTYPE_RIP_INTERFACE_STRING, ri->auth_str);
- if (ri->key_chain)
- XFREE(MTYPE_RIP_INTERFACE_STRING, ri->key_chain);
+ XFREE(MTYPE_RIP_INTERFACE_STRING, ri->key_chain);
ri->list[RIP_FILTER_IN] = NULL;
ri->list[RIP_FILTER_OUT] = NULL;
0);
}
-int rip_interface_address_add(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+int rip_interface_address_add(ZAPI_CALLBACK_ARGS)
{
struct connected *ifc;
struct prefix *p;
&address, ifc->ifp->ifindex);
}
-int rip_interface_address_delete(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+int rip_interface_address_delete(ZAPI_CALLBACK_ARGS)
{
struct connected *ifc;
struct prefix *p;
/* Install interface node. */
install_node(&interface_node, rip_interface_config_write);
if_cmd_init();
+ if_zapi_callbacks(rip_ifp_create, rip_ifp_up,
+ rip_ifp_down, rip_ifp_destroy);
}