summaryrefslogtreecommitdiff
path: root/zebra/interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/interface.c')
-rw-r--r--zebra/interface.c60
1 files changed, 23 insertions, 37 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index 982a63a022..b824e313ec 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -51,6 +51,7 @@
#include "zebra/interface.h"
#include "zebra/zebra_vxlan.h"
#include "zebra/zebra_errors.h"
+#include "zebra/zebra_evpn_mh.h"
DEFINE_MTYPE_STATIC(ZEBRA, ZINFO, "Zebra Interface Information")
@@ -127,6 +128,7 @@ static int if_zebra_new_hook(struct interface *ifp)
struct zebra_if *zebra_if;
zebra_if = XCALLOC(MTYPE_ZINFO, sizeof(struct zebra_if));
+ zebra_if->ifp = ifp;
zebra_if->multicast = IF_ZEBRA_MULTICAST_UNSPEC;
zebra_if->shutdown = IF_ZEBRA_SHUTDOWN_OFF;
@@ -238,6 +240,8 @@ static int if_zebra_delete_hook(struct interface *ifp)
list_delete(&rtadv->AdvDNSSLList);
#endif /* HAVE_RTADV */
+ zebra_evpn_if_cleanup(zebra_if);
+
if_nhg_dependents_release(ifp);
zebra_if_nhg_dependents_free(zebra_if);
@@ -385,8 +389,7 @@ int if_subnet_delete(struct interface *ifp, struct connected *ifc)
rn = route_node_lookup(zebra_if->ipv4_subnets, &cp);
if (!(rn && rn->info)) {
flog_warn(EC_ZEBRA_REMOVE_ADDR_UNKNOWN_SUBNET,
- "Trying to remove an address from an unknown subnet."
- " (please report this bug)");
+ "Trying to remove an address from an unknown subnet. (please report this bug)");
return -1;
}
route_unlock_node(rn);
@@ -400,8 +403,7 @@ int if_subnet_delete(struct interface *ifp, struct connected *ifc)
if (!listnode_lookup(addr_list, ifc)) {
flog_warn(
EC_ZEBRA_REMOVE_UNREGISTERED_ADDR,
- "Trying to remove an address from a subnet where it is not"
- " currently registered. (please report this bug)");
+ "Trying to remove an address from a subnet where it is not currently registered. (please report this bug)");
return -1;
}
@@ -618,8 +620,7 @@ void if_add_update(struct interface *ifp)
if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON) {
if (IS_ZEBRA_DEBUG_KERNEL) {
zlog_debug(
- "interface %s vrf %s(%u) index %d is shutdown. "
- "Won't wake it up.",
+ "interface %s vrf %s(%u) index %d is shutdown. Won't wake it up.",
ifp->name, VRF_LOGNAME(zvrf->vrf),
ifp->vrf_id, ifp->ifindex);
}
@@ -834,6 +835,7 @@ void if_delete_update(struct interface *ifp)
memset(&zif->l2info, 0, sizeof(union zebra_l2if_info));
memset(&zif->brslave_info, 0,
sizeof(struct zebra_l2info_brslave));
+ zebra_evpn_if_cleanup(zif);
}
if (!ifp->configured) {
@@ -1075,6 +1077,8 @@ void if_up(struct interface *ifp)
} else if (IS_ZEBRA_IF_MACVLAN(ifp))
zebra_vxlan_macvlan_up(ifp);
+ if (zif->es_info.es)
+ zebra_evpn_es_if_oper_state_change(zif, true /*up*/);
}
/* Interface goes down. We have to manage different behavior of based
@@ -1109,6 +1113,8 @@ void if_down(struct interface *ifp)
} else if (IS_ZEBRA_IF_MACVLAN(ifp))
zebra_vxlan_macvlan_down(ifp);
+ if (zif->es_info.es)
+ zebra_evpn_es_if_oper_state_change(zif, false /*up*/);
/* Notify to the protocol daemons. */
zebra_interface_down_update(ifp);
@@ -1236,23 +1242,6 @@ static void nbr_connected_dump_vty(struct vty *vty,
vty_out(vty, "\n");
}
-static const char *zebra_zifslavetype_2str(zebra_slave_iftype_t zif_slave_type)
-{
- switch (zif_slave_type) {
- case ZEBRA_IF_SLAVE_BRIDGE:
- return "Bridge";
- case ZEBRA_IF_SLAVE_VRF:
- return "Vrf";
- case ZEBRA_IF_SLAVE_BOND:
- return "Bond";
- case ZEBRA_IF_SLAVE_OTHER:
- return "Other";
- case ZEBRA_IF_SLAVE_NONE:
- return "None";
- }
- return "None";
-}
-
static const char *zebra_ziftype_2str(zebra_iftype_t zif_type)
{
switch (zif_type) {
@@ -1480,9 +1469,6 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
vty_out(vty, " Interface Type %s\n",
zebra_ziftype_2str(zebra_if->zif_type));
- vty_out(vty, " Interface Slave Type %s\n",
- zebra_zifslavetype_2str(zebra_if->zif_slave_type));
-
if (IS_ZEBRA_IF_BRIDGE(ifp)) {
struct zebra_l2info_bridge *bridge_info;
@@ -1550,6 +1536,8 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
}
}
+ zebra_evpn_if_es_print(vty, zebra_if);
+
if (zebra_if->link_ifindex != IFINDEX_INTERNAL) {
if (zebra_if->link)
vty_out(vty, " Parent interface: %s\n", zebra_if->link->name);
@@ -1625,14 +1613,12 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
#ifdef HAVE_PROC_NET_DEV
/* Statistics print out using proc file system. */
vty_out(vty,
- " %lu input packets (%lu multicast), %lu bytes, "
- "%lu dropped\n",
+ " %lu input packets (%lu multicast), %lu bytes, %lu dropped\n",
ifp->stats.rx_packets, ifp->stats.rx_multicast,
ifp->stats.rx_bytes, ifp->stats.rx_dropped);
vty_out(vty,
- " %lu input errors, %lu length, %lu overrun,"
- " %lu CRC, %lu frame\n",
+ " %lu input errors, %lu length, %lu overrun, %lu CRC, %lu frame\n",
ifp->stats.rx_errors, ifp->stats.rx_length_errors,
ifp->stats.rx_over_errors, ifp->stats.rx_crc_errors,
ifp->stats.rx_frame_errors);
@@ -1645,8 +1631,7 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
ifp->stats.tx_dropped);
vty_out(vty,
- " %lu output errors, %lu aborted, %lu carrier,"
- " %lu fifo, %lu heartbeat\n",
+ " %lu output errors, %lu aborted, %lu carrier, %lu fifo, %lu heartbeat\n",
ifp->stats.tx_errors, ifp->stats.tx_aborted_errors,
ifp->stats.tx_carrier_errors, ifp->stats.tx_fifo_errors,
ifp->stats.tx_heartbeat_errors);
@@ -1658,8 +1643,7 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
#ifdef HAVE_NET_RT_IFLIST
/* Statistics print out using sysctl (). */
vty_out(vty,
- " input packets %llu, bytes %llu, dropped %llu,"
- " multicast packets %llu\n",
+ " input packets %llu, bytes %llu, dropped %llu, multicast packets %llu\n",
(unsigned long long)ifp->stats.ifi_ipackets,
(unsigned long long)ifp->stats.ifi_ibytes,
(unsigned long long)ifp->stats.ifi_iqdrops,
@@ -1669,8 +1653,7 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
(unsigned long long)ifp->stats.ifi_ierrors);
vty_out(vty,
- " output packets %llu, bytes %llu,"
- " multicast packets %llu\n",
+ " output packets %llu, bytes %llu, multicast packets %llu\n",
(unsigned long long)ifp->stats.ifi_opackets,
(unsigned long long)ifp->stats.ifi_obytes,
(unsigned long long)ifp->stats.ifi_omcasts);
@@ -3596,7 +3579,7 @@ static int if_config_write(struct vty *vty)
}
hook_call(zebra_if_config_wr, vty, ifp);
-
+ zebra_evpn_mh_if_write(vty, ifp);
link_params_config_write(vty, ifp);
vty_endframe(vty, "!\n");
@@ -3672,4 +3655,7 @@ void zebra_if_init(void)
install_element(LINK_PARAMS_NODE, &link_params_use_bw_cmd);
install_element(LINK_PARAMS_NODE, &no_link_params_use_bw_cmd);
install_element(LINK_PARAMS_NODE, &exit_link_params_cmd);
+
+ /* setup EVPN MH elements */
+ zebra_evpn_interface_init();
}