diff options
-rw-r--r-- | lib/netns_linux.c | 14 | ||||
-rw-r--r-- | lib/netns_other.c | 7 | ||||
-rw-r--r-- | lib/ns.h | 5 | ||||
-rw-r--r-- | lib/vrf.c | 16 | ||||
-rw-r--r-- | lib/vrf.h | 6 | ||||
-rw-r--r-- | zebra/zebra_netns_id.c | 9 | ||||
-rw-r--r-- | zebra/zebra_ns.c | 2 |
7 files changed, 8 insertions, 51 deletions
diff --git a/lib/netns_linux.c b/lib/netns_linux.c index e8d549b4e..c68843398 100644 --- a/lib/netns_linux.c +++ b/lib/netns_linux.c @@ -43,9 +43,6 @@ DEFINE_MTYPE_STATIC(LIB, NS, "NetNS Context") DEFINE_MTYPE_STATIC(LIB, NS_NAME, "NetNS Name") -/* default NS ID value used when VRF backend is not NETNS */ -#define NS_DEFAULT_INTERNAL 0 - static inline int ns_compare(const struct ns *ns, const struct ns *ns2); static struct ns *ns_lookup_name_internal(const char *name); @@ -101,9 +98,6 @@ static inline int setns(int fd, int nstype) static int have_netns_enabled = -1; #endif /* HAVE_NETNS */ -/* default NS ID value used when VRF backend is not NETNS */ -#define NS_DEFAULT_INTERNAL 0 - static int have_netns(void) { #ifdef HAVE_NETNS @@ -612,15 +606,7 @@ ns_id_t ns_id_get_absolute(ns_id_t ns_id_reference, ns_id_t link_nsid) return ns->ns_id; } -ns_id_t ns_get_default_id(void) -{ - if (default_ns) - return default_ns->ns_id; - return NS_DEFAULT_INTERNAL; -} - struct ns *ns_get_default(void) { return default_ns; } - diff --git a/lib/netns_other.c b/lib/netns_other.c index 740d2b621..dc6bbbe47 100644 --- a/lib/netns_other.c +++ b/lib/netns_other.c @@ -110,13 +110,6 @@ void ns_init(void) { } -/* API to retrieve default NS */ -ns_id_t ns_get_default_id(void) -{ - return NS_UNKNOWN; -} - - /* API that can be used to change from NS */ int ns_switchback_to_initial(void) { @@ -161,10 +161,7 @@ extern ns_id_t ns_map_nsid_with_external(ns_id_t ns_id, bool map); */ extern void ns_init(void); -/* API to retrieve default NS */ -extern ns_id_t ns_get_default_id(void); - -#define NS_DEFAULT ns_get_default_id() +#define NS_DEFAULT 0 /* API that can be used to change from NS */ extern int ns_switchback_to_initial(void); @@ -39,8 +39,7 @@ #include "northbound.h" #include "northbound_cli.h" -/* default VRF ID value used when VRF backend is not NETNS */ -#define VRF_DEFAULT_INTERNAL 0 +/* default VRF name value used when VRF backend is not NETNS */ #define VRF_DEFAULT_NAME_INTERNAL "default" DEFINE_MTYPE_STATIC(LIB, VRF, "VRF") @@ -521,7 +520,7 @@ void vrf_init(int (*create)(struct vrf *), int (*enable)(struct vrf *), strlcpy(default_vrf->data.l.netns_name, VRF_DEFAULT_NAME, NS_NAMSIZ); - ns = ns_lookup(ns_get_default_id()); + ns = ns_lookup(NS_DEFAULT); ns->vrf_ctxt = default_vrf; default_vrf->ns_ctxt = ns; } @@ -949,17 +948,6 @@ const char *vrf_get_default_name(void) return vrf_default_name; } -vrf_id_t vrf_get_default_id(void) -{ - /* backend netns is only known by zebra - * for other daemons, we return VRF_DEFAULT_INTERNAL - */ - if (vrf_is_backend_netns()) - return ns_get_default_id(); - else - return VRF_DEFAULT_INTERNAL; -} - int vrf_bind(vrf_id_t vrf_id, int fd, const char *name) { int ret = 0; @@ -262,12 +262,8 @@ extern int vrf_getaddrinfo(const char *node, const char *service, extern int vrf_ioctl(vrf_id_t vrf_id, int d, unsigned long request, char *args); -/* function called by macro VRF_DEFAULT - * to get the default VRF_ID - */ -extern vrf_id_t vrf_get_default_id(void); /* The default VRF ID */ -#define VRF_DEFAULT vrf_get_default_id() +#define VRF_DEFAULT 0 extern void vrf_set_default_name(const char *default_name, bool force); extern const char *vrf_get_default_name(void); diff --git a/zebra/zebra_netns_id.c b/zebra/zebra_netns_id.c index 79121bb08..3201c438c 100644 --- a/zebra/zebra_netns_id.c +++ b/zebra/zebra_netns_id.c @@ -39,9 +39,6 @@ #include "zebra/zebra_netns_id.h" #include "zebra/zebra_errors.h" -/* default NS ID value used when VRF backend is not NETNS */ -#define NS_DEFAULT_INTERNAL 0 - /* in case NEWNSID not available, the NSID will be locally obtained */ #define NS_BASE_NSID 0 @@ -362,14 +359,14 @@ ns_id_t zebra_ns_id_get_default(void) fd = open(NS_DEFAULT_NAME, O_RDONLY); if (fd == -1) - return NS_DEFAULT_INTERNAL; + return NS_DEFAULT; if (!vrf_is_backend_netns()) { close(fd); - return NS_DEFAULT_INTERNAL; + return NS_DEFAULT; } close(fd); return zebra_ns_id_get((char *)NS_DEFAULT_NAME, -1); #else /* HAVE_NETNS */ - return NS_DEFAULT_INTERNAL; + return NS_DEFAULT; #endif /* !HAVE_NETNS */ } diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c index 6462daf68..e9ff3fcc0 100644 --- a/zebra/zebra_ns.c +++ b/zebra/zebra_ns.c @@ -199,7 +199,7 @@ int zebra_ns_init(const char *optional_default_name) if (ns) ns->relative_default_ns = ns_id; - default_ns = ns_lookup(ns_get_default_id()); + default_ns = ns_lookup(NS_DEFAULT); if (!default_ns) { flog_err(EC_ZEBRA_NS_NO_DEFAULT, "%s: failed to find default ns", __func__); |