summaryrefslogtreecommitdiffstats
path: root/ospfd
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_interface.c4
-rw-r--r--ospfd/ospf_te.c19
-rw-r--r--ospfd/ospf_vty.c41
-rw-r--r--ospfd/ospf_zebra.c5
-rw-r--r--ospfd/ospfd.c11
5 files changed, 40 insertions, 40 deletions
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 67ce6f171..34a1e6f6d 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -798,7 +798,7 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf,
{
struct ospf_interface *voi;
struct interface *vi;
- char ifname[INTERFACE_NAMSIZ + 1];
+ char ifname[INTERFACE_NAMSIZ];
struct ospf_area *area;
struct in_addr area_id;
struct connected *co;
@@ -819,7 +819,7 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf,
ospf->vrf_id);
snprintf(ifname, sizeof(ifname), "VLINK%d", vlink_count);
- vi = if_create(ifname, strnlen(ifname, sizeof(ifname)), ospf->vrf_id);
+ vi = if_create(ifname, ospf->vrf_id);
/*
* if_create sets ZEBRA_INTERFACE_LINKDETECTION
* virtual links don't need this.
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index 392df5fb4..b13e833af 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -2535,9 +2535,10 @@ DEFUN (show_ip_ospf_mpls_te_link,
"Interface information\n"
"Interface name\n")
{
+ struct vrf *vrf;
int idx_interface = 5;
struct interface *ifp;
- struct listnode *node, *nnode, *n1;
+ struct listnode *node;
char *vrf_name = NULL;
bool all_vrf;
int inst = 0;
@@ -2552,11 +2553,11 @@ DEFUN (show_ip_ospf_mpls_te_link,
/* vrf input is provided could be all or specific vrf*/
if (vrf_name) {
if (all_vrf) {
- for (ALL_LIST_ELEMENTS_RO(om->ospf, n1, ospf)) {
+ for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) {
if (!ospf->oi_running)
continue;
- for (ALL_LIST_ELEMENTS(vrf_iflist(ospf->vrf_id),
- node, nnode, ifp))
+ vrf = vrf_lookup_by_id(ospf->vrf_id);
+ FOR_ALL_INTERFACES (vrf, ifp)
show_mpls_te_link_sub(vty, ifp);
}
return CMD_SUCCESS;
@@ -2564,18 +2565,18 @@ DEFUN (show_ip_ospf_mpls_te_link,
ospf = ospf_lookup_by_inst_name (inst, vrf_name);
if (ospf == NULL || !ospf->oi_running)
return CMD_SUCCESS;
- for (ALL_LIST_ELEMENTS(vrf_iflist(ospf->vrf_id), node,
- nnode, ifp))
+ vrf = vrf_lookup_by_id(ospf->vrf_id);
+ FOR_ALL_INTERFACES (vrf, ifp)
show_mpls_te_link_sub(vty, ifp);
return CMD_SUCCESS;
}
/* Show All Interfaces. */
if (argc == 5) {
- for (ALL_LIST_ELEMENTS_RO(om->ospf, n1, ospf)) {
+ for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) {
if (!ospf->oi_running)
continue;
- for (ALL_LIST_ELEMENTS(vrf_iflist(ospf->vrf_id), node,
- nnode, ifp))
+ vrf = vrf_lookup_by_id(ospf->vrf_id);
+ FOR_ALL_INTERFACES (vrf, ifp)
show_mpls_te_link_sub(vty, ifp);
}
}
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 7b7a53baa..f53efa435 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -345,13 +345,14 @@ DEFPY (no_ospf_router_id,
static void ospf_passive_interface_default(struct ospf *ospf, u_char newval)
{
+ struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
struct listnode *ln;
struct interface *ifp;
struct ospf_interface *oi;
ospf->passive_interface_default = newval;
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(ospf->vrf_id), ln, ifp)) {
+ FOR_ALL_INTERFACES (vrf, ifp) {
if (ifp && OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp),
passive_interface))
UNSET_IF_PARAM(IF_DEF_PARAMS(ifp), passive_interface);
@@ -425,7 +426,7 @@ DEFUN (ospf_passive_interface,
return CMD_SUCCESS;
}
- ifp = if_get_by_name(argv[1]->arg, ospf->vrf_id);
+ ifp = if_get_by_name(argv[1]->arg, ospf->vrf_id, 0);
if (ifp == NULL) {
vty_out(vty, "interface %s not found.\n",
(char *)argv[1]->arg);
@@ -497,7 +498,7 @@ DEFUN (no_ospf_passive_interface,
return CMD_SUCCESS;
}
- ifp = if_get_by_name(argv[2]->arg, ospf->vrf_id);
+ ifp = if_get_by_name(argv[2]->arg, ospf->vrf_id, 0);
if (ifp == NULL) {
vty_out(vty, "interface %s not found.\n",
(char *)argv[1]->arg);
@@ -2469,9 +2470,9 @@ DEFUN (ospf_auto_cost_reference_bandwidth,
"The reference bandwidth in terms of Mbits per second\n")
{
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
+ struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
int idx_number = 2;
u_int32_t refbw;
- struct listnode *node;
struct interface *ifp;
refbw = strtol(argv[idx_number]->arg, NULL, 10);
@@ -2485,7 +2486,7 @@ DEFUN (ospf_auto_cost_reference_bandwidth,
return CMD_SUCCESS;
ospf->ref_bandwidth = refbw;
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(ospf->vrf_id), node, ifp))
+ FOR_ALL_INTERFACES (vrf, ifp)
ospf_if_recalculate_output_cost(ifp);
return CMD_SUCCESS;
@@ -2500,7 +2501,7 @@ DEFUN (no_ospf_auto_cost_reference_bandwidth,
"The reference bandwidth in terms of Mbits per second\n")
{
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
- struct listnode *node, *nnode;
+ struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
struct interface *ifp;
if (ospf->ref_bandwidth == OSPF_DEFAULT_REF_BANDWIDTH)
@@ -2511,7 +2512,7 @@ DEFUN (no_ospf_auto_cost_reference_bandwidth,
vty_out(vty,
" Please ensure reference bandwidth is consistent across all routers\n");
- for (ALL_LIST_ELEMENTS(vrf_iflist(ospf->vrf_id), node, nnode, ifp))
+ FOR_ALL_INTERFACES (vrf, ifp)
ospf_if_recalculate_output_cost(ifp);
return CMD_SUCCESS;
@@ -3569,7 +3570,7 @@ static int show_ip_ospf_interface_common(struct vty *vty, struct ospf *ospf,
int iface_argv, u_char use_json)
{
struct interface *ifp;
- struct listnode *node;
+ struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
json_object *json = NULL;
json_object *json_interface_sub = NULL;
@@ -3587,8 +3588,7 @@ static int show_ip_ospf_interface_common(struct vty *vty, struct ospf *ospf,
if (argc == iface_argv) {
/* Show All Interfaces.*/
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(ospf->vrf_id),
- node, ifp)) {
+ FOR_ALL_INTERFACES (vrf, ifp) {
if (ospf_oi_count(ifp)) {
if (use_json)
json_interface_sub =
@@ -8665,22 +8665,20 @@ const char *ospf_int_type_str[] = {"unknown", /* should never be used. */
static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
{
- struct listnode *n1, *n2;
+ struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
+ struct listnode *node;
struct interface *ifp;
struct crypt_key *ck;
struct route_node *rn = NULL;
struct ospf_if_params *params;
int write = 0;
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(ospf->vrf_id), n1, ifp)) {
+ FOR_ALL_INTERFACES (vrf, ifp) {
struct vrf *vrf = NULL;
if (memcmp(ifp->name, "VLINK", 5) == 0)
continue;
- if (ifp->ifindex == IFINDEX_DELETED)
- continue;
-
vrf = vrf_lookup_by_id(ifp->vrf_id);
vty_frame(vty, "!\n");
@@ -8761,7 +8759,7 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
/* Cryptographic Authentication Key print. */
if (params && params->auth_crypt) {
for (ALL_LIST_ELEMENTS_RO(params->auth_crypt,
- n2, ck)) {
+ node, ck)) {
vty_out(vty,
" ip ospf message-digest-key %d md5 %s",
ck->key_id, ck->auth_key);
@@ -9266,6 +9264,7 @@ static int config_write_ospf_distance(struct vty *vty, struct ospf *ospf)
static int ospf_config_write_one(struct vty *vty, struct ospf *ospf)
{
+ struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
struct interface *ifp;
struct ospf_interface *oi;
struct listnode *node = NULL;
@@ -9360,7 +9359,7 @@ static int ospf_config_write_one(struct vty *vty, struct ospf *ospf)
if (ospf->passive_interface_default == OSPF_IF_PASSIVE)
vty_out(vty, " passive-interface default\n");
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(ospf->vrf_id), node, ifp))
+ FOR_ALL_INTERFACES (vrf, ifp)
if (OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp),
passive_interface)
&& IF_DEF_PARAMS(ifp)->passive_interface
@@ -9623,14 +9622,14 @@ DEFUN (clear_ip_ospf_interface,
{
int idx_ifname = 4;
struct interface *ifp;
- struct listnode *node, *n1;
+ struct listnode *node;
struct ospf *ospf = NULL;
if (argc == 4) /* Clear all the ospfv2 interfaces. */
{
- for (ALL_LIST_ELEMENTS_RO(om->ospf, n1, ospf)) {
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(ospf->vrf_id),
- node, ifp))
+ for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) {
+ struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
+ FOR_ALL_INTERFACES (vrf, ifp)
ospf_interface_clear(ifp);
}
} else {
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 16f87735b..7e6146e0d 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -166,7 +166,7 @@ static int ospf_interface_delete(int command, struct zclient *zclient,
if (rn->info)
ospf_if_free((struct ospf_interface *)rn->info);
- ifp->ifindex = IFINDEX_DELETED;
+ if_set_index(ifp, IFINDEX_INTERNAL);
return 0;
}
@@ -179,8 +179,7 @@ static struct interface *zebra_interface_if_lookup(struct stream *s,
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
/* And look it up. */
- return if_lookup_by_name_len(
- ifname_tmp, strnlen(ifname_tmp, INTERFACE_NAMSIZ), vrf_id);
+ return if_lookup_by_name(ifname_tmp, vrf_id);
}
static int ospf_interface_state_up(int command, struct zclient *zclient,
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 88833e64d..9e1cf8116 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -86,6 +86,7 @@ static void ospf_finish_final(struct ospf *);
void ospf_router_id_update(struct ospf *ospf)
{
+ struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
struct in_addr router_id, router_id_old;
struct ospf_interface *oi;
struct interface *ifp;
@@ -209,7 +210,7 @@ void ospf_router_id_update(struct ospf *ospf)
ospf_router_lsa_update(ospf);
/* update ospf_interface's */
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(ospf->vrf_id), node, ifp))
+ FOR_ALL_INTERFACES (vrf, ifp)
ospf_if_update(ospf, ifp);
}
}
@@ -581,6 +582,7 @@ void ospf_finish(struct ospf *ospf)
/* Final cleanup of ospf instance */
static void ospf_finish_final(struct ospf *ospf)
{
+ struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
struct route_node *rn;
struct ospf_nbr_nbma *nbr_nbma;
struct ospf_lsa *lsa;
@@ -591,7 +593,6 @@ static void ospf_finish_final(struct ospf *ospf)
struct listnode *node, *nnode;
int i;
u_short instance = 0;
- struct vrf *vrf = NULL;
QOBJ_UNREG(ospf);
@@ -623,7 +624,7 @@ static void ospf_finish_final(struct ospf *ospf)
list_delete_and_null(&ospf->vlinks);
/* Remove any ospf interface config params */
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(ospf->vrf_id), node, ifp)) {
+ FOR_ALL_INTERFACES (vrf, ifp) {
struct ospf_if_params *params;
params = IF_DEF_PARAMS(ifp);
@@ -1254,15 +1255,15 @@ static void ospf_network_run_interface(struct ospf *ospf, struct interface *ifp,
static void ospf_network_run(struct prefix *p, struct ospf_area *area)
{
+ struct vrf *vrf = vrf_lookup_by_id(area->ospf->vrf_id);
struct interface *ifp;
- struct listnode *node;
/* Schedule Router ID Update. */
if (area->ospf->router_id.s_addr == 0)
ospf_router_id_update(area->ospf);
/* Get target interface. */
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(area->ospf->vrf_id), node, ifp))
+ FOR_ALL_INTERFACES (vrf, ifp)
ospf_network_run_interface(area->ospf, ifp, p, area);
}