diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-09-19 05:07:44 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-09-19 19:34:06 +0200 |
commit | ddbf3e60604019d4b38d51226700e2244cc531b6 (patch) | |
tree | d3403922091432832dfffe8b86e8c6610691e177 /eigrpd | |
parent | *: Switch all zclient->interface_add to interface create callback (diff) | |
download | frr-ddbf3e60604019d4b38d51226700e2244cc531b6.tar.xz frr-ddbf3e60604019d4b38d51226700e2244cc531b6.zip |
*: Convert from ->interface_up to the interface callback
For all the places we have a zclient->interface_up convert
them to use the interface ifp_up callback instead.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'eigrpd')
-rw-r--r-- | eigrpd/eigrp_interface.c | 41 | ||||
-rw-r--r-- | eigrpd/eigrp_zebra.c | 72 |
2 files changed, 41 insertions, 72 deletions
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) { |