summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--babeld/babel_zebra.c1
-rw-r--r--bgpd/bgp_zebra.c20
-rw-r--r--eigrpd/eigrp_interface.c41
-rw-r--r--eigrpd/eigrp_zebra.c72
-rw-r--r--isisd/isis_circuit.c2
-rw-r--r--isisd/isis_zebra.c15
-rw-r--r--ldpd/ldp_zebra.c29
-rw-r--r--lib/if.c6
-rw-r--r--lib/if.h1
-rw-r--r--lib/zclient.c17
-rw-r--r--lib/zclient.h1
-rw-r--r--nhrpd/nhrp_interface.c13
-rw-r--r--nhrpd/nhrp_route.c1
-rw-r--r--ospf6d/ospf6_interface.c9
-rw-r--r--ospf6d/ospf6_zebra.c1
-rw-r--r--ospfd/ospf_interface.c41
-rw-r--r--ospfd/ospf_zebra.c69
-rw-r--r--pbrd/pbr_zebra.c12
-rw-r--r--pimd/pim_iface.c53
-rw-r--r--pimd/pim_zebra.c75
-rw-r--r--pimd/pim_zebra.h3
-rw-r--r--ripd/rip_interface.c16
-rw-r--r--ripd/rip_zebra.c1
-rw-r--r--ripngd/ripng_interface.c18
-rw-r--r--ripngd/ripng_zebra.c1
-rw-r--r--sharpd/sharp_zebra.c22
-rw-r--r--staticd/static_zebra.c42
-rw-r--r--vrrpd/vrrp_zebra.c23
28 files changed, 212 insertions, 393 deletions
diff --git a/babeld/babel_zebra.c b/babeld/babel_zebra.c
index 3b58db7f2..7fc2bfd1c 100644
--- a/babeld/babel_zebra.c
+++ b/babeld/babel_zebra.c
@@ -241,7 +241,6 @@ void babelz_zebra_init(void)
zclient->zebra_connected = babel_zebra_connected;
zclient->interface_delete = babel_interface_delete;
- zclient->interface_up = babel_interface_up;
zclient->interface_down = babel_interface_down;
zclient->interface_address_add = babel_interface_address_add;
zclient->interface_address_delete = babel_interface_address_delete;
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 3477b9491..e758cd2e6 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -227,27 +227,19 @@ static int bgp_interface_delete(ZAPI_CALLBACK_ARGS)
return 0;
}
-static int bgp_interface_up(ZAPI_CALLBACK_ARGS)
+static int bgp_ifp_up(struct interface *ifp)
{
- struct stream *s;
- struct interface *ifp;
struct connected *c;
struct nbr_connected *nc;
struct listnode *node, *nnode;
struct bgp *bgp;
- bgp = bgp_lookup_by_vrf_id(vrf_id);
-
- s = zclient->ibuf;
- ifp = zebra_interface_state_read(s, vrf_id);
-
- if (!ifp)
- return 0;
+ bgp = bgp_lookup_by_vrf_id(ifp->vrf_id);
bgp_mac_add_mac_entry(ifp);
if (BGP_DEBUG(zebra, ZEBRA))
- zlog_debug("Rx Intf up VRF %u IF %s", vrf_id, ifp->name);
+ zlog_debug("Rx Intf up VRF %u IF %s", ifp->vrf_id, ifp->name);
if (!bgp)
return 0;
@@ -2715,11 +2707,6 @@ static int bgp_ifp_create(struct interface *ifp)
return 0;
}
-static int bgp_ifp_up(struct interface *ifp)
-{
- return 0;
-}
-
static int bgp_ifp_down(struct interface *ifp)
{
return 0;
@@ -2751,7 +2738,6 @@ void bgp_zebra_init(struct thread_master *master, unsigned short instance)
zclient->interface_vrf_update = bgp_interface_vrf_update;
zclient->redistribute_route_add = zebra_read_route;
zclient->redistribute_route_del = zebra_read_route;
- zclient->interface_up = bgp_interface_up;
zclient->interface_down = bgp_interface_down;
zclient->nexthop_update = bgp_read_nexthop_update;
zclient->import_check_update = bgp_read_import_check_update;
diff --git a/eigrpd/eigrp_interface.c b/eigrpd/eigrp_interface.c
index f2faf22e8..7c0c03f48 100644
--- a/eigrpd/eigrp_interface.c
+++ b/eigrpd/eigrp_interface.c
@@ -54,6 +54,7 @@
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_memory.h"
#include "eigrpd/eigrp_fsm.h"
+#include "eigrpd/eigrp_dump.h"
struct eigrp_interface *eigrp_if_new(struct eigrp *eigrp, struct interface *ifp,
struct prefix *p)
@@ -138,6 +139,46 @@ static int eigrp_ifp_create(struct interface *ifp)
static int eigrp_ifp_up(struct interface *ifp)
{
+ /* Interface is already up. */
+ if (if_is_operative(ifp)) {
+ /* Temporarily keep ifp values. */
+ struct interface if_tmp;
+ memcpy(&if_tmp, ifp, sizeof(struct interface));
+
+ if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra: Interface[%s] state update.",
+ ifp->name);
+
+ if (if_tmp.bandwidth != ifp->bandwidth) {
+ if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
+ zlog_debug(
+ "Zebra: Interface[%s] bandwidth change %d -> %d.",
+ ifp->name, if_tmp.bandwidth,
+ ifp->bandwidth);
+
+ // eigrp_if_recalculate_output_cost (ifp);
+ }
+
+ if (if_tmp.mtu != ifp->mtu) {
+ if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
+ zlog_debug(
+ "Zebra: Interface[%s] MTU change %u -> %u.",
+ ifp->name, if_tmp.mtu, ifp->mtu);
+
+ /* Must reset the interface (simulate down/up) when MTU
+ * changes. */
+ eigrp_if_reset(ifp);
+ }
+ return 0;
+ }
+
+ if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra: Interface[%s] state change to up.",
+ ifp->name);
+
+ if (ifp->info)
+ eigrp_if_up(ifp->info);
+
return 0;
}
diff --git a/eigrpd/eigrp_zebra.c b/eigrpd/eigrp_zebra.c
index 8c8f73b5b..8fdb279e5 100644
--- a/eigrpd/eigrp_zebra.c
+++ b/eigrpd/eigrp_zebra.c
@@ -56,10 +56,7 @@
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);
-static int eigrp_interface_state_up(ZAPI_CALLBACK_ARGS);
static int eigrp_interface_state_down(ZAPI_CALLBACK_ARGS);
-static struct interface *zebra_interface_if_lookup(struct stream *,
- vrf_id_t vrf_id);
static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS);
@@ -114,7 +111,6 @@ void eigrp_zebra_init(void)
zclient->zebra_connected = eigrp_zebra_connected;
zclient->router_id_update = eigrp_router_id_update_zebra;
zclient->interface_delete = eigrp_interface_delete;
- zclient->interface_up = eigrp_interface_state_up;
zclient->interface_down = eigrp_interface_state_down;
zclient->interface_address_add = eigrp_interface_address_add;
zclient->interface_address_delete = eigrp_interface_address_delete;
@@ -232,62 +228,6 @@ static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS)
return 0;
}
-static int eigrp_interface_state_up(ZAPI_CALLBACK_ARGS)
-{
- struct interface *ifp;
-
- ifp = zebra_interface_if_lookup(zclient->ibuf, vrf_id);
-
- if (ifp == NULL)
- return 0;
-
- /* Interface is already up. */
- if (if_is_operative(ifp)) {
- /* Temporarily keep ifp values. */
- struct interface if_tmp;
- memcpy(&if_tmp, ifp, sizeof(struct interface));
-
- zebra_interface_if_set_value(zclient->ibuf, ifp);
-
- if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
- zlog_debug("Zebra: Interface[%s] state update.",
- ifp->name);
-
- if (if_tmp.bandwidth != ifp->bandwidth) {
- if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
- zlog_debug(
- "Zebra: Interface[%s] bandwidth change %d -> %d.",
- ifp->name, if_tmp.bandwidth,
- ifp->bandwidth);
-
- // eigrp_if_recalculate_output_cost (ifp);
- }
-
- if (if_tmp.mtu != ifp->mtu) {
- if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
- zlog_debug(
- "Zebra: Interface[%s] MTU change %u -> %u.",
- ifp->name, if_tmp.mtu, ifp->mtu);
-
- /* Must reset the interface (simulate down/up) when MTU
- * changes. */
- eigrp_if_reset(ifp);
- }
- return 0;
- }
-
- zebra_interface_if_set_value(zclient->ibuf, ifp);
-
- if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE))
- zlog_debug("Zebra: Interface[%s] state change to up.",
- ifp->name);
-
- if (ifp->info)
- eigrp_if_up(ifp->info);
-
- return 0;
-}
-
static int eigrp_interface_state_down(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
@@ -307,18 +247,6 @@ static int eigrp_interface_state_down(ZAPI_CALLBACK_ARGS)
return 0;
}
-static struct interface *zebra_interface_if_lookup(struct stream *s,
- vrf_id_t vrf_id)
-{
- char ifname_tmp[INTERFACE_NAMSIZ];
-
- /* Read interface name. */
- stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
-
- /* And look it up. */
- return if_lookup_by_name(ifname_tmp, vrf_id);
-}
-
void eigrp_zebra_route_add(struct eigrp *eigrp, struct prefix *p,
struct list *successors, uint32_t distance)
{
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index c78554e5e..ce3e972e4 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -1404,6 +1404,8 @@ static int isis_ifp_create(struct interface *ifp)
static int isis_ifp_up(struct interface *ifp)
{
+ isis_csm_state_change(IF_UP_FROM_Z, circuit_scan_by_ifp(ifp), ifp);
+
return 0;
}
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c
index ea4622db3..5309a220a 100644
--- a/isisd/isis_zebra.c
+++ b/isisd/isis_zebra.c
@@ -98,20 +98,6 @@ static int isis_zebra_if_del(ZAPI_CALLBACK_ARGS)
return 0;
}
-static int isis_zebra_if_state_up(ZAPI_CALLBACK_ARGS)
-{
- struct interface *ifp;
-
- ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
-
- if (ifp == NULL)
- return 0;
-
- isis_csm_state_change(IF_UP_FROM_Z, circuit_scan_by_ifp(ifp), ifp);
-
- return 0;
-}
-
static int isis_zebra_if_state_down(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
@@ -372,7 +358,6 @@ void isis_zebra_init(struct thread_master *master)
zclient->zebra_connected = isis_zebra_connected;
zclient->router_id_update = isis_router_id_update_zebra;
zclient->interface_delete = isis_zebra_if_del;
- zclient->interface_up = isis_zebra_if_state_up;
zclient->interface_down = isis_zebra_if_state_down;
zclient->interface_address_add = isis_zebra_if_address_add;
zclient->interface_address_delete = isis_zebra_if_address_del;
diff --git a/ldpd/ldp_zebra.c b/ldpd/ldp_zebra.c
index d24079f41..d3eac6017 100644
--- a/ldpd/ldp_zebra.c
+++ b/ldpd/ldp_zebra.c
@@ -301,22 +301,13 @@ ldp_interface_delete(ZAPI_CALLBACK_ARGS)
}
static int
-ldp_interface_status_change(ZAPI_CALLBACK_ARGS)
+ldp_interface_status_change_helper(struct interface *ifp)
{
- struct interface *ifp;
struct listnode *node;
struct connected *ifc;
struct kif kif;
struct kaddr ka;
- /*
- * 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 %s state update", ifp->name);
ifp2kif(ifp, &kif);
@@ -338,6 +329,21 @@ ldp_interface_status_change(ZAPI_CALLBACK_ARGS)
return (0);
}
+static int
+ldp_interface_status_change(ZAPI_CALLBACK_ARGS)
+{
+ 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);
+
+ return ldp_interface_status_change_helper(ifp);
+}
static int
ldp_interface_address_add(ZAPI_CALLBACK_ARGS)
@@ -531,7 +537,7 @@ extern struct zebra_privs_t ldpd_privs;
static int ldp_ifp_up(struct interface *ifp)
{
- return 0;
+ return ldp_interface_status_change_helper(ifp);
}
static int ldp_ifp_down(struct interface *ifp)
@@ -558,7 +564,6 @@ ldp_zebra_init(struct thread_master *master)
zclient->zebra_connected = ldp_zebra_connected;
zclient->router_id_update = ldp_router_id_update;
zclient->interface_delete = ldp_interface_delete;
- zclient->interface_up = ldp_interface_status_change;
zclient->interface_down = ldp_interface_status_change;
zclient->interface_address_add = ldp_interface_address_add;
zclient->interface_address_delete = ldp_interface_address_delete;
diff --git a/lib/if.c b/lib/if.c
index 8d68e1958..d4835d136 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -181,6 +181,12 @@ void if_new_via_zapi(struct interface *ifp)
(*ifp_master.create_hook)(ifp);
}
+void if_up_via_zapi(struct interface *ifp)
+{
+ if (ifp_master.up_hook)
+ (*ifp_master.up_hook)(ifp);
+}
+
struct interface *if_create(const char *name, vrf_id_t vrf_id)
{
return if_create_backend(name, IFINDEX_INTERNAL, vrf_id);
diff --git a/lib/if.h b/lib/if.h
index 0261f03f7..28c147365 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -564,6 +564,7 @@ extern void if_zapi_callbacks(int (*create)(struct interface *ifp),
int (*destroy)(struct interface *ifp));
extern void if_new_via_zapi(struct interface *ifp);
+extern void if_up_via_zapi(struct interface *ifp);
extern const struct frr_yang_module_info frr_interface_info;
diff --git a/lib/zclient.c b/lib/zclient.c
index ea151be53..a8e5e0290 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -1592,6 +1592,19 @@ struct interface *zebra_interface_state_read(struct stream *s, vrf_id_t vrf_id)
return ifp;
}
+static void zclient_interface_up(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)
+ return;
+
+ if_up_via_zapi(ifp);
+}
+
static void link_params_set_value(struct stream *s, struct if_link_params *iflp)
{
@@ -2822,9 +2835,7 @@ static int zclient_read(struct thread *thread)
command, zclient, length, vrf_id);
break;
case ZEBRA_INTERFACE_UP:
- if (zclient->interface_up)
- (*zclient->interface_up)(command, zclient, length,
- vrf_id);
+ zclient_interface_up(zclient, vrf_id);
break;
case ZEBRA_INTERFACE_DOWN:
if (zclient->interface_down)
diff --git a/lib/zclient.h b/lib/zclient.h
index 9361b56c3..60b2ec820 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -241,7 +241,6 @@ struct zclient {
void (*zebra_capabilities)(struct zclient_capabilities *cap);
int (*router_id_update)(ZAPI_CALLBACK_ARGS);
int (*interface_delete)(ZAPI_CALLBACK_ARGS);
- int (*interface_up)(ZAPI_CALLBACK_ARGS);
int (*interface_down)(ZAPI_CALLBACK_ARGS);
int (*interface_address_add)(ZAPI_CALLBACK_ARGS);
int (*interface_address_delete)(ZAPI_CALLBACK_ARGS);
diff --git a/nhrpd/nhrp_interface.c b/nhrpd/nhrp_interface.c
index 5d47d0ae8..29e614477 100644
--- a/nhrpd/nhrp_interface.c
+++ b/nhrpd/nhrp_interface.c
@@ -326,14 +326,8 @@ int nhrp_interface_delete(ZAPI_CALLBACK_ARGS)
return 0;
}
-int nhrp_interface_up(ZAPI_CALLBACK_ARGS)
+int nhrp_ifp_up(struct interface *ifp)
{
- struct interface *ifp;
-
- ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
- if (ifp == NULL)
- return 0;
-
debugf(NHRP_DEBUG_IF, "if-up: %s", ifp->name);
nhrp_interface_update_nbma(ifp);
@@ -430,11 +424,6 @@ void nhrp_interface_set_source(struct interface *ifp, const char *ifname)
nhrp_interface_update_nbma(ifp);
}
-int nhrp_ifp_up(struct interface *ifp)
-{
- return 0;
-}
-
int nhrp_ifp_down(struct interface *ifp)
{
return 0;
diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c
index 3d0bd7804..1cb99b4ee 100644
--- a/nhrpd/nhrp_route.c
+++ b/nhrpd/nhrp_route.c
@@ -346,7 +346,6 @@ void nhrp_zebra_init(void)
zclient = zclient_new(master, &zclient_options_default);
zclient->zebra_connected = nhrp_zebra_connected;
zclient->interface_delete = nhrp_interface_delete;
- zclient->interface_up = nhrp_interface_up;
zclient->interface_down = nhrp_interface_down;
zclient->interface_address_add = nhrp_interface_address_add;
zclient->interface_address_delete = nhrp_interface_address_delete;
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index ca0e94518..f931b1848 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -1948,6 +1948,15 @@ static int ospf6_ifp_create(struct interface *ifp)
static int ospf6_ifp_up(struct interface *ifp)
{
+ if (IS_OSPF6_DEBUG_ZEBRA(RECV))
+ zlog_debug(
+ "Zebra Interface state change: "
+ "%s index %d flags %llx metric %d mtu %d bandwidth %d",
+ ifp->name, ifp->ifindex, (unsigned long long)ifp->flags,
+ ifp->metric, ifp->mtu6, ifp->bandwidth);
+
+ ospf6_interface_state_update(ifp);
+
return 0;
}
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c
index d809cff6c..c28838f3e 100644
--- a/ospf6d/ospf6_zebra.c
+++ b/ospf6d/ospf6_zebra.c
@@ -571,7 +571,6 @@ void ospf6_zebra_init(struct thread_master *master)
zclient->zebra_connected = ospf6_zebra_connected;
zclient->router_id_update = ospf6_router_id_update_zebra;
zclient->interface_delete = ospf6_zebra_if_del;
- zclient->interface_up = ospf6_zebra_if_state_update;
zclient->interface_down = ospf6_zebra_if_state_update;
zclient->interface_address_add = ospf6_zebra_if_address_update_add;
zclient->interface_address_delete =
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index c132a3447..570624f92 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -1259,6 +1259,47 @@ static int ospf_ifp_create(struct interface *ifp)
static int ospf_ifp_up(struct interface *ifp)
{
+ struct ospf_interface *oi;
+ struct route_node *rn;
+
+ /* Interface is already up. */
+ if (if_is_operative(ifp)) {
+ /* Temporarily keep ifp values. */
+ struct interface if_tmp;
+ memcpy(&if_tmp, ifp, sizeof(struct interface));
+
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
+ zlog_debug(
+ "Zebra: Interface[%s] state update speed %u -> %u, bw %d -> %d",
+ ifp->name, if_tmp.speed, ifp->speed,
+ if_tmp.bandwidth, ifp->bandwidth);
+
+ ospf_if_recalculate_output_cost(ifp);
+
+ if (if_tmp.mtu != ifp->mtu) {
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
+ zlog_debug(
+ "Zebra: Interface[%s] MTU change %u -> %u.",
+ ifp->name, if_tmp.mtu, ifp->mtu);
+
+ /* Must reset the interface (simulate down/up) when MTU
+ * changes. */
+ ospf_if_reset(ifp);
+ }
+ return 0;
+ }
+
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra: Interface[%s] state change to up.",
+ ifp->name);
+
+ for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
+ if ((oi = rn->info) == NULL)
+ continue;
+
+ ospf_if_up(oi);
+ }
+
return 0;
}
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 62c7cdd44..16ab10252 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -126,74 +126,6 @@ static int ospf_interface_delete(ZAPI_CALLBACK_ARGS)
return 0;
}
-static struct interface *zebra_interface_if_lookup(struct stream *s,
- vrf_id_t vrf_id)
-{
- char ifname_tmp[INTERFACE_NAMSIZ];
-
- /* Read interface name. */
- stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
-
- /* And look it up. */
- return if_lookup_by_name(ifname_tmp, vrf_id);
-}
-
-static int ospf_interface_state_up(ZAPI_CALLBACK_ARGS)
-{
- struct interface *ifp;
- struct ospf_interface *oi;
- struct route_node *rn;
-
- ifp = zebra_interface_if_lookup(zclient->ibuf, vrf_id);
-
- if (ifp == NULL)
- return 0;
-
- /* Interface is already up. */
- if (if_is_operative(ifp)) {
- /* Temporarily keep ifp values. */
- struct interface if_tmp;
- memcpy(&if_tmp, ifp, sizeof(struct interface));
-
- zebra_interface_if_set_value(zclient->ibuf, ifp);
-
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
- zlog_debug(
- "Zebra: Interface[%s] state update speed %u -> %u, bw %d -> %d",
- ifp->name, if_tmp.speed, ifp->speed,
- if_tmp.bandwidth, ifp->bandwidth);
-
- ospf_if_recalculate_output_cost(ifp);
-
- if (if_tmp.mtu != ifp->mtu) {
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
- zlog_debug(
- "Zebra: Interface[%s] MTU change %u -> %u.",
- ifp->name, if_tmp.mtu, ifp->mtu);
-
- /* Must reset the interface (simulate down/up) when MTU
- * changes. */
- ospf_if_reset(ifp);
- }
- return 0;
- }
-
- zebra_interface_if_set_value(zclient->ibuf, ifp);
-
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
- zlog_debug("Zebra: Interface[%s] state change to up.",
- ifp->name);
-
- for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
- if ((oi = rn->info) == NULL)
- continue;
-
- ospf_if_up(oi);
- }
-
- return 0;
-}
-
static int ospf_interface_state_down(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
@@ -1485,7 +1417,6 @@ void ospf_zebra_init(struct thread_master *master, unsigned short instance)
zclient->zebra_connected = ospf_zebra_connected;
zclient->router_id_update = ospf_router_id_update_zebra;
zclient->interface_delete = ospf_interface_delete;
- zclient->interface_up = ospf_interface_state_up;
zclient->interface_down = ospf_interface_state_down;
zclient->interface_address_add = ospf_interface_address_add;
zclient->interface_address_delete = ospf_interface_address_delete;
diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c
index af4b1e832..e82bed5ed 100644
--- a/pbrd/pbr_zebra.c
+++ b/pbrd/pbr_zebra.c
@@ -126,12 +126,8 @@ static int interface_address_delete(ZAPI_CALLBACK_ARGS)
return 0;
}
-static int interface_state_up(ZAPI_CALLBACK_ARGS)
+int pbr_ifp_up(struct interface *ifp)
{
- struct interface *ifp;
-
- ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
-
DEBUGD(&pbr_dbg_zebra,
"%s: %s is up", __PRETTY_FUNCTION__, ifp->name);
@@ -441,7 +437,6 @@ void pbr_zebra_init(void)
zclient_init(zclient, ZEBRA_ROUTE_PBR, 0, &pbr_privs);
zclient->zebra_connected = zebra_connected;
zclient->interface_delete = interface_delete;
- zclient->interface_up = interface_state_up;
zclient->interface_down = interface_state_down;
zclient->interface_address_add = interface_address_add;
zclient->interface_address_delete = interface_address_delete;
@@ -572,11 +567,6 @@ void pbr_send_pbr_map(struct pbr_map_sequence *pbrms,
zclient_send_message(zclient);
}
-int pbr_ifp_up(struct interface *ifp)
-{
- return 0;
-}
-
int pbr_ifp_down(struct interface *ifp)
{
return 0;
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index 94b92a7b0..26829b3a3 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -1581,6 +1581,59 @@ int pim_ifp_create(struct interface *ifp)
int pim_ifp_up(struct interface *ifp)
{
+ struct pim_instance *pim;
+ uint32_t table_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));
+ }
+
+ pim = pim_get_pim_instance(ifp->vrf_id);
+ 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() suffices for bringing up both IGMP and
+ PIM
+ */
+ pim_if_addr_add_all(ifp);
+ }
+
+ /*
+ * If we have a pimreg device callback and it's for a specific
+ * table set the master appropriately
+ */
+ if (sscanf(ifp->name, "pimreg%" SCNu32, &table_id) == 1) {
+ struct vrf *vrf;
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+ if ((table_id == vrf->data.l.table_id)
+ && (ifp->vrf_id != vrf->vrf_id)) {
+ struct interface *master = if_lookup_by_name(
+ vrf->name, vrf->vrf_id);
+
+ if (!master) {
+ zlog_debug(
+ "%s: Unable to find Master interface for %s",
+ __PRETTY_FUNCTION__, vrf->name);
+ return 0;
+ }
+ pim_zebra_interface_set_master(master, ifp);
+ }
+ }
+ }
return 0;
}
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index a2b356759..58d906339 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -92,74 +92,6 @@ static int pim_zebra_if_del(ZAPI_CALLBACK_ARGS)
return 0;
}
-static int pim_zebra_if_state_up(ZAPI_CALLBACK_ARGS)
-{
- struct pim_instance *pim;
- struct interface *ifp;
- uint32_t table_id;
-
- /*
- zebra api notifies interface up/down events by using the same call
- zebra_interface_state_read below, see comments in lib/zclient.c
- */
- 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));
- }
-
- pim = pim_get_pim_instance(vrf_id);
- 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() suffices for bringing up both IGMP and
- PIM
- */
- pim_if_addr_add_all(ifp);
- }
-
- /*
- * If we have a pimreg device callback and it's for a specific
- * table set the master appropriately
- */
- if (sscanf(ifp->name, "pimreg%" SCNu32, &table_id) == 1) {
- struct vrf *vrf;
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- if ((table_id == vrf->data.l.table_id)
- && (ifp->vrf_id != vrf->vrf_id)) {
- struct interface *master = if_lookup_by_name(
- vrf->name, vrf->vrf_id);
-
- if (!master) {
- zlog_debug(
- "%s: Unable to find Master interface for %s",
- __PRETTY_FUNCTION__, vrf->name);
- return 0;
- }
- zclient_interface_set_master(zclient, master,
- ifp);
- }
- }
- }
- return 0;
-}
-
static int pim_zebra_if_state_down(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
@@ -723,7 +655,6 @@ void pim_zebra_init(void)
zclient->zebra_connected = pim_zebra_connected;
zclient->router_id_update = pim_router_id_update_zebra;
zclient->interface_delete = pim_zebra_if_del;
- zclient->interface_up = pim_zebra_if_state_up;
zclient->interface_down = pim_zebra_if_state_down;
zclient->interface_address_add = pim_zebra_if_address_add;
zclient->interface_address_delete = pim_zebra_if_address_del;
@@ -1229,3 +1160,9 @@ struct zclient *pim_zebra_zclient_get(void)
else
return NULL;
}
+
+void pim_zebra_interface_set_master(struct interface *vrf,
+ struct interface *ifp)
+{
+ zclient_interface_set_master(zclient, vrf, ifp);
+}
diff --git a/pimd/pim_zebra.h b/pimd/pim_zebra.h
index c9ed89863..0f216cf5c 100644
--- a/pimd/pim_zebra.h
+++ b/pimd/pim_zebra.h
@@ -51,4 +51,7 @@ void pim_zebra_update_all_interfaces(struct pim_instance *pim);
void pim_zebra_upstream_rpf_changed(struct pim_instance *pim,
struct pim_upstream *up,
struct pim_rpf *old);
+
+void pim_zebra_interface_set_master(struct interface *vrf,
+ struct interface *ifp);
#endif /* PIM_ZEBRA_H */
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 11657536b..e654c0912 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -373,17 +373,8 @@ int rip_interface_down(ZAPI_CALLBACK_ARGS)
}
/* Inteface link up message processing */
-int rip_interface_up(ZAPI_CALLBACK_ARGS)
+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",
@@ -1250,11 +1241,6 @@ static int rip_interface_delete_hook(struct interface *ifp)
return 0;
}
-static int rip_ifp_up(struct interface *ifp)
-{
- return 0;
-}
-
static int rip_ifp_down(struct interface *ifp)
{
return 0;
diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c
index 92d37bdca..0635c15d9 100644
--- a/ripd/rip_zebra.c
+++ b/ripd/rip_zebra.c
@@ -241,7 +241,6 @@ void rip_zclient_init(struct thread_master *master)
zclient->interface_delete = rip_interface_delete;
zclient->interface_address_add = rip_interface_address_add;
zclient->interface_address_delete = rip_interface_address_delete;
- zclient->interface_up = rip_interface_up;
zclient->interface_down = rip_interface_down;
zclient->interface_vrf_update = rip_interface_vrf_update;
zclient->redistribute_route_add = rip_zebra_read_route;
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index 7b0ebd42c..1f056906c 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",
@@ -986,11 +975,6 @@ static struct cmd_node interface_node = {
INTERFACE_NODE, "%s(config-if)# ", 1 /* VTYSH */
};
-static int ripng_ifp_up(struct interface *ifp)
-{
- return 0;
-}
-
static int ripng_ifp_down(struct interface *ifp)
{
return 0;
diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c
index a0e096bc6..13d7fc3e4 100644
--- a/ripngd/ripng_zebra.c
+++ b/ripngd/ripng_zebra.c
@@ -242,7 +242,6 @@ void zebra_init(struct thread_master *master)
zclient_init(zclient, ZEBRA_ROUTE_RIPNG, 0, &ripngd_privs);
zclient->zebra_connected = ripng_zebra_connected;
- zclient->interface_up = ripng_interface_up;
zclient->interface_down = ripng_interface_down;
zclient->interface_delete = ripng_interface_delete;
zclient->interface_address_add = ripng_interface_address_add;
diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c
index 343ac67d0..76bfae254 100644
--- a/sharpd/sharp_zebra.c
+++ b/sharpd/sharp_zebra.c
@@ -46,17 +46,6 @@ struct zclient *zclient = NULL;
/* For registering threads. */
extern struct thread_master *master;
-static struct interface *zebra_interface_if_lookup(struct stream *s)
-{
- char ifname_tmp[INTERFACE_NAMSIZ];
-
- /* Read interface name. */
- stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
-
- /* And look it up. */
- return if_lookup_by_name(ifname_tmp, VRF_DEFAULT);
-}
-
/* Inteface addition message from zebra. */
static int sharp_ifp_create(struct interface *ifp)
{
@@ -102,11 +91,8 @@ static int interface_address_delete(ZAPI_CALLBACK_ARGS)
return 0;
}
-static int interface_state_up(ZAPI_CALLBACK_ARGS)
+static int sharp_ifp_up(struct interface *ifp)
{
-
- zebra_interface_if_lookup(zclient->ibuf);
-
return 0;
}
@@ -385,11 +371,6 @@ static int sharp_nexthop_update(ZAPI_CALLBACK_ARGS)
return 0;
}
-static int sharp_ifp_up(struct interface *ifp)
-{
- return 0;
-}
-
static int sharp_ifp_down(struct interface *ifp)
{
return 0;
@@ -414,7 +395,6 @@ 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_up = interface_state_up;
zclient->interface_down = interface_state_down;
zclient->interface_address_add = interface_address_add;
zclient->interface_address_delete = interface_address_delete;
diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c
index 2a6bfbd60..4ba244208 100644
--- a/staticd/static_zebra.c
+++ b/staticd/static_zebra.c
@@ -49,17 +49,6 @@ bool debug;
struct zclient *zclient;
static struct hash *static_nht_hash;
-static struct interface *zebra_interface_if_lookup(struct stream *s)
-{
- char ifname_tmp[INTERFACE_NAMSIZ];
-
- /* Read interface name. */
- stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
-
- /* And look it up. */
- return if_lookup_by_name(ifname_tmp, VRF_DEFAULT);
-}
-
/* Inteface addition message from zebra. */
static int static_ifp_create(struct interface *ifp)
{
@@ -107,26 +96,19 @@ static int interface_address_delete(ZAPI_CALLBACK_ARGS)
return 0;
}
-static int interface_state_up(ZAPI_CALLBACK_ARGS)
+static int static_ifp_up(struct interface *ifp)
{
- struct interface *ifp;
-
- ifp = zebra_interface_if_lookup(zclient->ibuf);
-
- if (ifp) {
- if (if_is_vrf(ifp)) {
- struct static_vrf *svrf =
- static_vrf_lookup_by_id(vrf_id);
+ if (if_is_vrf(ifp)) {
+ struct static_vrf *svrf = static_vrf_lookup_by_id(ifp->vrf_id);
- static_fixup_vrf_ids(svrf);
- static_config_install_delayed_routes(svrf);
- }
-
- /* Install any static reliant on this interface coming up */
- static_install_intf_nh(ifp);
- static_ifindex_update(ifp, true);
+ static_fixup_vrf_ids(svrf);
+ static_config_install_delayed_routes(svrf);
}
+ /* Install any static reliant on this interface coming up */
+ static_install_intf_nh(ifp);
+ static_ifindex_update(ifp, true);
+
return 0;
}
@@ -499,11 +481,6 @@ extern void static_zebra_route_add(struct route_node *rn,
zclient, &api);
}
-static int static_ifp_up(struct interface *ifp)
-{
- return 0;
-}
-
static int static_ifp_down(struct interface *ifp)
{
return 0;
@@ -527,7 +504,6 @@ void static_zebra_init(void)
zclient->zebra_capabilities = static_zebra_capabilities;
zclient->zebra_connected = zebra_connected;
zclient->interface_delete = interface_delete;
- zclient->interface_up = interface_state_up;
zclient->interface_down = interface_state_down;
zclient->interface_address_add = interface_address_add;
zclient->interface_address_delete = interface_address_delete;
diff --git a/vrrpd/vrrp_zebra.c b/vrrpd/vrrp_zebra.c
index b4fcc3c36..3b8be9da1 100644
--- a/vrrpd/vrrp_zebra.c
+++ b/vrrpd/vrrp_zebra.c
@@ -108,22 +108,9 @@ static int vrrp_zebra_if_del(int command, struct zclient *zclient,
return 0;
}
-static int vrrp_zebra_if_state_up(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+int vrrp_ifp_up(struct interface *ifp)
{
- struct interface *ifp;
-
- /*
- * zebra api notifies interface up/down events by using the same call
- * zebra_interface_state_read below, see comments in lib/zclient.c ifp =
- * zebra_interface_state_read(zclient->ibuf, vrf_id);
- */
- 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_up(ifp);
@@ -224,11 +211,6 @@ int vrrp_zclient_send_interface_protodown(struct interface *ifp, bool down)
down);
}
-int vrrp_ifp_up(struct interface *ifp)
-{
- return 0;
-}
-
int vrrp_ifp_down(struct interface *ifp)
{
return 0;
@@ -250,7 +232,6 @@ void vrrp_zebra_init(void)
zclient->zebra_connected = vrrp_zebra_connected;
zclient->router_id_update = vrrp_router_id_update_zebra;
zclient->interface_delete = vrrp_zebra_if_del;
- zclient->interface_up = vrrp_zebra_if_state_up;
zclient->interface_down = vrrp_zebra_if_state_down;
zclient->interface_address_add = vrrp_zebra_if_address_add;
zclient->interface_address_delete = vrrp_zebra_if_address_del;