summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-03-11 07:30:52 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-03-15 10:36:38 -0400
commit92a57eb206d51a6e9a28c9ffa1066557a18da9b2 (patch)
treec5f7e2a22b0de5059500a76385bdfd95d96d73a0
parent1306c09a1b6996f7afa3ac651659c40146117834 (diff)
*: Refactor if_get_by_name to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--lib/if.c8
-rw-r--r--lib/if.h6
-rw-r--r--ospf6d/ospf6_top.c2
-rw-r--r--ospfd/ospf_vty.c4
-rw-r--r--zebra/if_netlink.c4
5 files changed, 8 insertions, 16 deletions
diff --git a/lib/if.c b/lib/if.c
index 4f2eb3a1c5..3deec8025b 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -427,7 +427,7 @@ if_lookup_prefix (struct prefix *prefix, vrf_id_t vrf_id)
/* Get interface by name if given name interface doesn't exist create
one. */
struct interface *
-if_get_by_name_vrf (const char *name, vrf_id_t vrf_id)
+if_get_by_name (const char *name, vrf_id_t vrf_id)
{
struct interface *ifp;
@@ -436,12 +436,6 @@ if_get_by_name_vrf (const char *name, vrf_id_t vrf_id)
}
struct interface *
-if_get_by_name (const char *name)
-{
- return if_get_by_name_vrf (name, VRF_DEFAULT);
-}
-
-struct interface *
if_get_by_name_len_vrf (const char *name, size_t namelen, vrf_id_t vrf_id, int vty)
{
struct interface *ifp;
diff --git a/lib/if.h b/lib/if.h
index 262e292ac5..aeb3d340ee 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -402,14 +402,12 @@ extern struct connected *if_lookup_address (void *matchaddr, int family,
extern struct interface *if_lookup_prefix (struct prefix *prefix,
vrf_id_t vrf_id);
-/* These 2 functions are to be used when the ifname argument is terminated
+/* These 3 functions are to be used when the ifname argument is terminated
by a '\0' character: */
-extern struct interface *if_get_by_name (const char *ifname);
-
extern struct interface *if_lookup_by_name_all_vrf (const char *ifname);
extern struct interface *if_lookup_by_name (const char *ifname,
vrf_id_t vrf_id);
-extern struct interface *if_get_by_name_vrf (const char *ifname,
+extern struct interface *if_get_by_name (const char *ifname,
vrf_id_t vrf_id);
/* For these 2 functions, the namelen argument should be the precise length
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 9e741d07d2..a367d1e141 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -668,7 +668,7 @@ DEFUN (ospf6_interface_area,
u_int32_t area_id;
/* find/create ospf6 interface */
- ifp = if_get_by_name (argv[idx_ifname]->arg);
+ ifp = if_get_by_name (argv[idx_ifname]->arg, VRF_DEFAULT);
oi = (struct ospf6_interface *) ifp->info;
if (oi == NULL)
oi = ospf6_interface_create (ifp);
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index cc3b47c0c4..059a17fa9f 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -387,7 +387,7 @@ DEFUN (ospf_passive_interface,
return CMD_SUCCESS;
}
- ifp = if_get_by_name (argv[1]->arg);
+ ifp = if_get_by_name (argv[1]->arg, VRF_DEFAULT);
params = IF_DEF_PARAMS (ifp);
@@ -457,7 +457,7 @@ DEFUN (no_ospf_passive_interface,
return CMD_SUCCESS;
}
- ifp = if_get_by_name (argv[2]->arg);
+ ifp = if_get_by_name (argv[2]->arg, VRF_DEFAULT);
params = IF_DEF_PARAMS (ifp);
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index 65fc8789f9..2572320cce 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -375,7 +375,7 @@ netlink_interface (struct sockaddr_nl *snl, struct nlmsghdr *h,
}
/* Add interface. */
- ifp = if_get_by_name_vrf (name, vrf_id);
+ ifp = if_get_by_name (name, vrf_id);
set_ifindex(ifp, ifi->ifi_index, zns);
ifp->flags = ifi->ifi_flags & 0x0000fffff;
if (vrf_device)
@@ -722,7 +722,7 @@ netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h,
if (ifp == NULL)
{
/* unknown interface */
- ifp = if_get_by_name_vrf (name, vrf_id);
+ ifp = if_get_by_name (name, vrf_id);
}
else
{