diff options
author | Donatas Abraitis <donatas.abraitis@gmail.com> | 2020-09-23 07:45:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-23 07:45:09 +0200 |
commit | 0ce5baaab1cefb0cd89cd526ab5225cd3a58a921 (patch) | |
tree | b2107db6725811ab8e04468adc7317d22c631c0d /lib | |
parent | Merge pull request #7116 from AnuradhaKaruppiah/mh-neigh-fixes (diff) | |
parent | vrf: VRF_DEFAULT must be 0, remove useless code (diff) | |
download | frr-0ce5baaab1cefb0cd89cd526ab5225cd3a58a921.tar.xz frr-0ce5baaab1cefb0cd89cd526ab5225cd3a58a921.zip |
Merge pull request #7018 from gouault6wind/show_ip_route
Clean up in vrf management
Diffstat (limited to 'lib')
-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 | 19 | ||||
-rw-r--r-- | lib/vrf.h | 6 |
5 files changed, 7 insertions, 44 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 9cf7f1f33..3fc4b8df4 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") @@ -331,6 +330,9 @@ const char *vrf_id_to_name(vrf_id_t vrf_id) { struct vrf *vrf; + if (vrf_id == VRF_DEFAULT) + return VRF_DEFAULT_NAME; + vrf = vrf_lookup_by_id(vrf_id); return VRF_LOGNAME(vrf); } @@ -518,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; } @@ -946,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); |