summaryrefslogtreecommitdiff
path: root/zebra/interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/interface.c')
-rw-r--r--zebra/interface.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index b8426c6890..78ba8cdde8 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -680,6 +680,8 @@ if_delete_connected (struct interface *ifp)
void
if_delete_update (struct interface *ifp)
{
+ struct zebra_if *zif;
+
if (if_is_up(ifp))
{
zlog_err ("interface %s vrf %u index %d is still up while being deleted.",
@@ -713,6 +715,16 @@ if_delete_update (struct interface *ifp)
/* if the ifp is in a vrf, move it to default so vrf can be deleted if desired */
if (ifp->vrf_id)
if_handle_vrf_change (ifp, VRF_DEFAULT);
+
+ /* Reset some zebra interface params to default values. */
+ zif = ifp->info;
+ if (zif)
+ {
+ zif->zif_type = ZEBRA_IF_OTHER;
+ zif->zif_slave_type = ZEBRA_IF_SLAVE_NONE;
+ memset (&zif->l2info, 0, sizeof (union zebra_l2if_info));
+ memset (&zif->brslave_info, 0, sizeof (struct zebra_l2info_brslave));
+ }
}
/* VRF change for an interface */
@@ -904,6 +916,17 @@ if_refresh (struct interface *ifp)
if_get_flags (ifp);
}
+void
+zebra_if_update_link (struct interface *ifp, ifindex_t link_ifindex)
+{
+ struct zebra_if *zif;
+
+ zif = (struct zebra_if *)ifp->info;
+ zif->link_ifindex = link_ifindex;
+ zif->link = if_lookup_by_index_per_ns (zebra_ns_lookup (NS_DEFAULT),
+ link_ifindex);
+}
+
/* Output prefix string to vty. */
static int
@@ -1020,6 +1043,37 @@ nd_dump_vty (struct vty *vty, struct interface *ifp)
}
#endif /* HAVE_RTADV */
+static const char *
+zebra_ziftype_2str (zebra_iftype_t zif_type)
+{
+ switch (zif_type)
+ {
+ case ZEBRA_IF_OTHER:
+ return "Other";
+ break;
+
+ case ZEBRA_IF_BRIDGE:
+ return "Bridge";
+ break;
+
+ case ZEBRA_IF_VLAN:
+ return "Vlan";
+ break;
+
+ case ZEBRA_IF_VXLAN:
+ return "Vxlan";
+ break;
+
+ case ZEBRA_IF_VRF:
+ return "VRF";
+ break;
+
+ default:
+ return "Unknown";
+ break;
+ }
+}
+
/* Interface's information print out to vty interface. */
static void
if_dump_vty (struct vty *vty, struct interface *ifp)
@@ -1115,6 +1169,51 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
connected_dump_vty (vty, connected);
}
+ vty_out(vty, " Interface Type %s%s",
+ zebra_ziftype_2str (zebra_if->zif_type), VTY_NEWLINE);
+ if (IS_ZEBRA_IF_BRIDGE (ifp))
+ {
+ struct zebra_l2info_bridge *bridge_info;
+
+ bridge_info = &zebra_if->l2info.br;
+ vty_out(vty, " Bridge VLAN-aware: %s%s",
+ bridge_info->vlan_aware ? "yes" : "no", VTY_NEWLINE);
+ }
+ else if (IS_ZEBRA_IF_VLAN(ifp))
+ {
+ struct zebra_l2info_vlan *vlan_info;
+
+ vlan_info = &zebra_if->l2info.vl;
+ vty_out(vty, " VLAN Id %u%s",
+ vlan_info->vid, VTY_NEWLINE);
+ }
+ else if (IS_ZEBRA_IF_VXLAN (ifp))
+ {
+ struct zebra_l2info_vxlan *vxlan_info;
+
+ vxlan_info = &zebra_if->l2info.vxl;
+ vty_out(vty, " VxLAN Id %u", vxlan_info->vni);
+ if (vxlan_info->vtep_ip.s_addr != INADDR_ANY)
+ vty_out(vty, " VTEP IP: %s", inet_ntoa (vxlan_info->vtep_ip));
+ if (vxlan_info->access_vlan)
+ vty_out(vty, " Access VLAN Id %u", vxlan_info->access_vlan);
+ vty_out(vty, "%s", VTY_NEWLINE);
+ }
+
+ if (IS_ZEBRA_IF_BRIDGE_SLAVE (ifp))
+ {
+ struct zebra_l2info_brslave *br_slave;
+
+ br_slave = &zebra_if->brslave_info;
+ if (br_slave->bridge_ifindex != IFINDEX_INTERNAL)
+ vty_out(vty, " Master (bridge) ifindex %u%s",
+ br_slave->bridge_ifindex, VTY_NEWLINE);
+ }
+
+ if (zebra_if->link_ifindex != IFINDEX_INTERNAL)
+ vty_out(vty, " Link ifindex %u%s",
+ zebra_if->link_ifindex, VTY_NEWLINE);
+
if (HAS_LINK_PARAMS(ifp))
{
int i;