summaryrefslogtreecommitdiff
path: root/zebra/interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/interface.c')
-rw-r--r--zebra/interface.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index a68d00d55c..49a1e49175 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -1026,7 +1026,7 @@ void if_up(struct interface *ifp)
zif = ifp->info;
zif->up_count++;
- quagga_timestamp(2, zif->up_last, sizeof(zif->up_last));
+ frr_timestamp(2, zif->up_last, sizeof(zif->up_last));
/* Notify the protocol daemons. */
if (ifp->ptm_enable && (ifp->ptm_status == ZEBRA_PTM_STATUS_DOWN)) {
@@ -1090,7 +1090,7 @@ void if_down(struct interface *ifp)
zif = ifp->info;
zif->down_count++;
- quagga_timestamp(2, zif->down_last, sizeof(zif->down_last));
+ frr_timestamp(2, zif->down_last, sizeof(zif->down_last));
if_down_nhg_dependents(ifp);
@@ -1616,7 +1616,6 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
struct listnode *node;
struct route_node *rn;
struct zebra_if *zebra_if;
- struct vrf *vrf;
char pd_buf[ZEBRA_PROTODOWN_RC_STR_LEN];
zebra_if = ifp->info;
@@ -1644,8 +1643,7 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
zebra_ptm_show_status(vty, NULL, ifp);
- vrf = vrf_lookup_by_id(ifp->vrf_id);
- vty_out(vty, " vrf: %s\n", vrf->name);
+ vty_out(vty, " vrf: %s\n", ifp->vrf->name);
if (ifp->desc)
vty_out(vty, " Description: %s\n", ifp->desc);
@@ -1941,7 +1939,6 @@ static void if_dump_vty_json(struct vty *vty, struct interface *ifp,
struct listnode *node;
struct route_node *rn;
struct zebra_if *zebra_if;
- struct vrf *vrf;
char pd_buf[ZEBRA_PROTODOWN_RC_STR_LEN];
char buf[BUFSIZ];
json_object *json_if;
@@ -1979,8 +1976,7 @@ static void if_dump_vty_json(struct vty *vty, struct interface *ifp,
zebra_ptm_show_status(vty, json, ifp);
- vrf = vrf_lookup_by_id(ifp->vrf_id);
- json_object_string_add(json_if, "vrfName", vrf->name);
+ json_object_string_add(json_if, "vrfName", ifp->vrf->name);
if (ifp->desc)
json_object_string_add(json_if, "description", ifp->desc);
@@ -2485,12 +2481,24 @@ DEFPY (show_interface_name_vrf_all,
VRF_ALL_CMD_HELP_STR
JSON_STR)
{
- struct interface *ifp;
+ struct interface *ifp = NULL;
+ struct interface *ifptmp;
+ struct vrf *vrf;
json_object *json = NULL;
+ int count = 0;
interface_update_stats();
- ifp = if_lookup_by_name_all_vrf(ifname);
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+ ifptmp = if_lookup_by_name_vrf(ifname, vrf);
+ if (ifptmp) {
+ ifp = ifptmp;
+ count++;
+ if (!vrf_is_backend_netns())
+ break;
+ }
+ }
+
if (ifp == NULL) {
if (uj)
vty_out(vty, "{}\n");
@@ -2498,6 +2506,17 @@ DEFPY (show_interface_name_vrf_all,
vty_out(vty, "%% Can't find interface %s\n", ifname);
return CMD_WARNING;
}
+ if (count > 1) {
+ if (uj) {
+ vty_out(vty, "{}\n");
+ } else {
+ vty_out(vty,
+ "%% There are multiple interfaces with name %s\n",
+ ifname);
+ vty_out(vty, "%% You must specify the VRF name\n");
+ }
+ return CMD_WARNING;
+ }
if (uj)
json = json_object_new_object();
@@ -4206,21 +4225,19 @@ static int link_params_config_write(struct vty *vty, struct interface *ifp)
static int if_config_write(struct vty *vty)
{
- struct vrf *vrf0;
+ struct vrf *vrf;
struct interface *ifp;
zebra_ptm_write(vty);
- RB_FOREACH (vrf0, vrf_name_head, &vrfs_by_name)
- FOR_ALL_INTERFACES (vrf0, ifp) {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ FOR_ALL_INTERFACES (vrf, ifp) {
struct zebra_if *if_data;
struct listnode *addrnode;
struct connected *ifc;
struct prefix *p;
- struct vrf *vrf;
if_data = ifp->info;
- vrf = vrf_lookup_by_id(ifp->vrf_id);
if (ifp->vrf_id == VRF_DEFAULT)
vty_frame(vty, "interface %s\n", ifp->name);