summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospf6d/ospf6_interface.c')
-rw-r--r--ospf6d/ospf6_interface.c48
1 files changed, 14 insertions, 34 deletions
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 4205be38ba..a0c921f419 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -127,7 +127,7 @@ static uint8_t ospf6_default_iftype(struct interface *ifp)
{
if (if_is_pointopoint(ifp))
return OSPF_IFTYPE_POINTOPOINT;
- else if (if_is_loopback_or_vrf(ifp))
+ else if (if_is_loopback(ifp))
return OSPF_IFTYPE_LOOPBACK;
else
return OSPF_IFTYPE_BROADCAST;
@@ -150,7 +150,7 @@ static uint32_t ospf6_interface_get_cost(struct ospf6_interface *oi)
: OSPF6_INTERFACE_BANDWIDTH;
}
- ospf6 = ospf6_lookup_by_vrf_id(oi->interface->vrf_id);
+ ospf6 = oi->interface->vrf->info;
refbw = ospf6 ? ospf6->ref_bandwidth : OSPF6_REFERENCE_BANDWIDTH;
/* A specifed ip ospf cost overrides a calculated one. */
@@ -387,7 +387,7 @@ void ospf6_interface_state_update(struct interface *ifp)
if (if_is_operative(ifp)
&& (ospf6_interface_get_linklocal_address(oi->interface)
- || if_is_loopback_or_vrf(oi->interface)))
+ || if_is_loopback(oi->interface)))
thread_execute(master, interface_up, oi, 0);
else
thread_execute(master, interface_down, oi, 0);
@@ -750,7 +750,7 @@ int interface_up(struct thread *thread)
/* check interface has a link-local address */
if (!(ospf6_interface_get_linklocal_address(oi->interface)
- || if_is_loopback_or_vrf(oi->interface))) {
+ || if_is_loopback(oi->interface))) {
zlog_warn(
"Interface %s has no link local address, can't execute [InterfaceUp]",
oi->interface->name);
@@ -819,7 +819,7 @@ int interface_up(struct thread *thread)
/* Schedule Hello */
if (!CHECK_FLAG(oi->flag, OSPF6_INTERFACE_PASSIVE)
- && !if_is_loopback_or_vrf(oi->interface)) {
+ && !if_is_loopback(oi->interface)) {
thread_add_event(master, ospf6_hello_send, oi, 0,
&oi->thread_send_hello);
}
@@ -1277,10 +1277,7 @@ static int show_ospf6_interface_common(struct vty *vty, vrf_id_t vrf_id,
if (ifp == NULL) {
json_object_string_add(json, "noSuchInterface",
argv[idx_ifname]->arg);
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
+ vty_json(vty, json);
json_object_free(json_int);
return CMD_WARNING;
}
@@ -1294,10 +1291,7 @@ static int show_ospf6_interface_common(struct vty *vty, vrf_id_t vrf_id,
json_int);
}
}
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
+ vty_json(vty, json);
} else {
if (argc == intf_idx) {
ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf_id);
@@ -1361,11 +1355,6 @@ static int ospf6_interface_show_traffic(struct vty *vty,
struct ospf6_interface *oi = NULL;
json_object *json_interface;
- if (intf_ifp)
- vrf = vrf_lookup_by_id(intf_ifp->vrf_id);
- else
- vrf = vrf_lookup_by_id(vrf_id);
-
if (!display_once && !use_json) {
vty_out(vty, "\n");
vty_out(vty, "%-12s%-17s%-17s%-17s%-17s%-17s\n", "Interface",
@@ -1379,6 +1368,7 @@ static int ospf6_interface_show_traffic(struct vty *vty,
}
if (intf_ifp == NULL) {
+ vrf = vrf_lookup_by_id(vrf_id);
FOR_ALL_INTERFACES (vrf, ifp) {
if (ifp->info)
oi = (struct ospf6_interface *)ifp->info;
@@ -1488,10 +1478,7 @@ static int ospf6_interface_show_traffic_common(struct vty *vty, int argc,
"No Such Interface");
json_object_string_add(json, "interface",
intf_name);
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
+ vty_json(vty, json);
return CMD_WARNING;
}
if (ifp->info == NULL) {
@@ -1500,10 +1487,7 @@ static int ospf6_interface_show_traffic_common(struct vty *vty, int argc,
"OSPF not enabled on this interface");
json_object_string_add(json, "interface",
intf_name);
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
+ vty_json(vty, json);
return 0;
}
} else {
@@ -1523,12 +1507,8 @@ static int ospf6_interface_show_traffic_common(struct vty *vty, int argc,
ospf6_interface_show_traffic(vty, ifp, display_once, json, uj, vrf_id);
- if (uj) {
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
- }
+ if (uj)
+ vty_json(vty, json);
return CMD_SUCCESS;
}
@@ -1685,7 +1665,7 @@ void ospf6_interface_start(struct ospf6_interface *oi)
if (oi->area)
return;
- ospf6 = ospf6_lookup_by_vrf_id(oi->interface->vrf_id);
+ ospf6 = oi->interface->vrf->info;
if (!ospf6)
return;
@@ -2315,7 +2295,7 @@ DEFUN (no_ipv6_ospf6_passive,
THREAD_OFF(oi->thread_sso);
/* don't send hellos over loopback interface */
- if (!if_is_loopback_or_vrf(oi->interface))
+ if (!if_is_loopback(oi->interface))
thread_add_event(master, ospf6_hello_send, oi, 0,
&oi->thread_send_hello);