summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_network.c3
-rw-r--r--lib/vrf.c9
-rw-r--r--lib/vrf.h3
-rw-r--r--staticd/static_vty.c24
4 files changed, 14 insertions, 25 deletions
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index e15b8f4ec..4153da5a6 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -670,8 +670,7 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen,
listener->fd = sock;
/* this socket needs a change of ns. record bgp back pointer */
- if (bgp->vrf_id != VRF_DEFAULT && vrf_is_mapped_on_netns(
- vrf_lookup_by_id(bgp->vrf_id)))
+ if (bgp->vrf_id != VRF_DEFAULT && vrf_is_backend_netns())
listener->bgp = bgp;
memcpy(&listener->su, sa, salen);
diff --git a/lib/vrf.c b/lib/vrf.c
index 0c82f6a3c..f9f14822c 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -716,13 +716,6 @@ int vrf_netns_handler_create(struct vty *vty, struct vrf *vrf, char *pathname,
return CMD_SUCCESS;
}
-int vrf_is_mapped_on_netns(struct vrf *vrf)
-{
- if (!vrf || vrf->data.l.netns_name[0] == '\0')
- return 0;
- return 1;
-}
-
/* vrf CLI commands */
DEFUN_NOSH(vrf_exit,
vrf_exit_cmd,
@@ -953,7 +946,7 @@ int vrf_bind(vrf_id_t vrf_id, int fd, char *name)
if (fd < 0 || name == NULL)
return fd;
- if (vrf_is_mapped_on_netns(vrf_lookup_by_id(vrf_id)))
+ if (vrf_is_backend_netns())
return fd;
#ifdef SO_BINDTODEVICE
ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, name, strlen(name)+1);
diff --git a/lib/vrf.h b/lib/vrf.h
index fe4fc7725..e80796f48 100644
--- a/lib/vrf.h
+++ b/lib/vrf.h
@@ -240,9 +240,6 @@ extern void vrf_set_default_name(const char *default_name, bool force);
extern const char *vrf_get_default_name(void);
#define VRF_DEFAULT_NAME vrf_get_default_name()
-/* VRF is mapped on netns or not ? */
-int vrf_is_mapped_on_netns(struct vrf *vrf);
-
/* VRF switch from NETNS */
extern int vrf_switch_to_netns(vrf_id_t vrf_id);
extern int vrf_switchback_to_initial(void);
diff --git a/staticd/static_vty.c b/staticd/static_vty.c
index ae0026cc9..f09c30435 100644
--- a/staticd/static_vty.c
+++ b/staticd/static_vty.c
@@ -775,7 +775,7 @@ DEFPY(ip_route_blackhole,
"Table to configure\n"
"The table number to configure\n")
{
- if (table_str && vrf && !vrf_is_mapped_on_netns(vrf_lookup_by_name(vrf))) {
+ if (table_str && vrf && !vrf_is_backend_netns()) {
vty_out(vty,
"%% table param only available when running on netns-based vrfs\n");
return CMD_WARNING_CONFIG_FAILED;
@@ -814,7 +814,7 @@ DEFPY(ip_route_blackhole_vrf,
VTY_DECLVAR_CONTEXT(vrf, vrf);
struct static_vrf *svrf = vrf->info;
- if (table_str && !vrf_is_mapped_on_netns(vrf)) {
+ if (table_str && !vrf_is_backend_netns()) {
vty_out(vty,
"%% table param only available when running on netns-based vrfs\n");
return CMD_WARNING_CONFIG_FAILED;
@@ -880,7 +880,7 @@ DEFPY(ip_route_address_interface,
return CMD_WARNING_CONFIG_FAILED;
}
- if (table_str && vrf && !vrf_is_mapped_on_netns(vrf_lookup_by_name(vrf))) {
+ if (table_str && vrf && !vrf_is_backend_netns()) {
vty_out(vty,
"%% table param only available when running on netns-based vrfs\n");
return CMD_WARNING_CONFIG_FAILED;
@@ -938,7 +938,7 @@ DEFPY(ip_route_address_interface_vrf,
struct static_vrf *svrf = vrf->info;
struct static_vrf *nh_svrf;
- if (table_str && !vrf_is_mapped_on_netns(vrf)) {
+ if (table_str && !vrf_is_backend_netns()) {
vty_out(vty,
"%% table param only available when running on netns-based vrfs\n");
return CMD_WARNING_CONFIG_FAILED;
@@ -999,7 +999,7 @@ DEFPY(ip_route,
struct static_vrf *nh_svrf;
const char *flag = NULL;
- if (table_str && vrf && !vrf_is_mapped_on_netns(vrf_lookup_by_name(vrf))) {
+ if (table_str && vrf && !vrf_is_backend_netns()) {
vty_out(vty,
"%% table param only available when running on netns-based vrfs\n");
return CMD_WARNING_CONFIG_FAILED;
@@ -1065,7 +1065,7 @@ DEFPY(ip_route_vrf,
struct static_vrf *nh_svrf;
const char *flag = NULL;
- if (table_str && !vrf_is_mapped_on_netns(vrf)) {
+ if (table_str && !vrf_is_backend_netns()) {
vty_out(vty,
"%% table param only available when running on netns-based vrfs\n");
return CMD_WARNING_CONFIG_FAILED;
@@ -1119,7 +1119,7 @@ DEFPY(ipv6_route_blackhole,
"Table to configure\n"
"The table number to configure\n")
{
- if (table_str && vrf && !vrf_is_mapped_on_netns(vrf_lookup_by_name(vrf))) {
+ if (table_str && vrf && !vrf_is_backend_netns()) {
vty_out(vty,
"%% table param only available when running on netns-based vrfs\n");
return CMD_WARNING_CONFIG_FAILED;
@@ -1158,7 +1158,7 @@ DEFPY(ipv6_route_blackhole_vrf,
VTY_DECLVAR_CONTEXT(vrf, vrf);
struct static_vrf *svrf = vrf->info;
- if (table_str && !vrf_is_mapped_on_netns(vrf)) {
+ if (table_str && !vrf_is_backend_netns()) {
vty_out(vty,
"%% table param only available when running on netns-based vrfs\n");
return CMD_WARNING_CONFIG_FAILED;
@@ -1213,7 +1213,7 @@ DEFPY(ipv6_route_address_interface,
struct static_vrf *nh_svrf;
const char *flag = NULL;
- if (table_str && vrf && !vrf_is_mapped_on_netns(vrf_lookup_by_name(vrf))) {
+ if (table_str && vrf && !vrf_is_backend_netns()) {
vty_out(vty,
"%% table param only available when running on netns-based vrfs\n");
return CMD_WARNING_CONFIG_FAILED;
@@ -1282,7 +1282,7 @@ DEFPY(ipv6_route_address_interface_vrf,
struct static_vrf *nh_svrf;
const char *flag = NULL;
- if (table_str && !vrf_is_mapped_on_netns(vrf)) {
+ if (table_str && !vrf_is_backend_netns()) {
vty_out(vty,
"%% table param only available when running on netns-based vrfs\n");
return CMD_WARNING_CONFIG_FAILED;
@@ -1343,7 +1343,7 @@ DEFPY(ipv6_route,
struct static_vrf *nh_svrf;
const char *flag = NULL;
- if (table_str && vrf && !vrf_is_mapped_on_netns(vrf_lookup_by_name(vrf))) {
+ if (table_str && vrf && !vrf_is_backend_netns()) {
vty_out(vty,
"%% table param only available when running on netns-based vrfs\n");
return CMD_WARNING_CONFIG_FAILED;
@@ -1409,7 +1409,7 @@ DEFPY(ipv6_route_vrf,
struct static_vrf *nh_svrf;
const char *flag = NULL;
- if (table_str && !vrf_is_mapped_on_netns(vrf)) {
+ if (table_str && !vrf_is_backend_netns()) {
vty_out(vty,
"%% table param only available when running on netns-based vrfs\n");
return CMD_WARNING_CONFIG_FAILED;