summaryrefslogtreecommitdiff
path: root/ripngd/ripng_interface.c
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2019-09-30 07:46:19 -0400
committerGitHub <noreply@github.com>2019-09-30 07:46:19 -0400
commit9898a2fb3441e7382dba4190233f466b8271deae (patch)
tree9629a5ce665db95addf0d0bc0f46864ef71b5a49 /ripngd/ripng_interface.c
parent5c256b572ca09b5d15b67ba0236c8a2678dda19c (diff)
parent26f8f6fe7fb90208d4a5eb285fdf0dca83bde508 (diff)
Merge pull request #5009 from donaldsharp/interface_deletion
lib, zebra: Allow for interface deletion when kernel event happens
Diffstat (limited to 'ripngd/ripng_interface.c')
-rw-r--r--ripngd/ripng_interface.c50
1 files changed, 6 insertions, 44 deletions
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index 9ed9dc28fe..a132f723ed 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -196,19 +196,8 @@ static int ripng_if_down(struct interface *ifp)
}
/* Inteface link up message processing. */
-int ripng_interface_up(ZAPI_CALLBACK_ARGS)
+static int ripng_ifp_up(struct interface *ifp)
{
- struct stream *s;
- struct interface *ifp;
-
- /* zebra_interface_state_read() updates interface structure in iflist.
- */
- s = zclient->ibuf;
- ifp = zebra_interface_state_read(s, vrf_id);
-
- if (ifp == NULL)
- return 0;
-
if (IS_RIPNG_DEBUG_ZEBRA)
zlog_debug(
"interface up %s vrf %u index %d flags %llx metric %d mtu %d",
@@ -230,19 +219,8 @@ int ripng_interface_up(ZAPI_CALLBACK_ARGS)
}
/* Inteface link down message processing. */
-int ripng_interface_down(ZAPI_CALLBACK_ARGS)
+static int ripng_ifp_down(struct interface *ifp)
{
- struct stream *s;
- struct interface *ifp;
-
- /* zebra_interface_state_read() updates interface structure in iflist.
- */
- s = zclient->ibuf;
- ifp = zebra_interface_state_read(s, vrf_id);
-
- if (ifp == NULL)
- return 0;
-
ripng_interface_sync(ifp);
ripng_if_down(ifp);
@@ -256,11 +234,8 @@ int ripng_interface_down(ZAPI_CALLBACK_ARGS)
}
/* 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)
@@ -281,19 +256,8 @@ int ripng_interface_add(ZAPI_CALLBACK_ARGS)
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);
@@ -304,10 +268,6 @@ int ripng_interface_delete(ZAPI_CALLBACK_ARGS)
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;
}
@@ -999,4 +959,6 @@ void ripng_if_init(void)
/* Install interface node. */
install_node(&interface_node, interface_config_write);
if_cmd_init();
+ if_zapi_callbacks(ripng_ifp_create, ripng_ifp_up,
+ ripng_ifp_down, ripng_ifp_destroy);
}