diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2018-08-22 09:19:04 +0200 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2018-08-22 09:19:04 +0200 |
commit | 3d4c0b49dacb454dbcf4dc3b56f8ccd8bb5202e5 (patch) | |
tree | 31e9a6f19b54d7585e1d89507ec04babc89df6e8 /lib | |
parent | Merge pull request #2881 from donaldsharp/external_removal (diff) | |
download | frr-3d4c0b49dacb454dbcf4dc3b56f8ccd8bb5202e5.tar.xz frr-3d4c0b49dacb454dbcf4dc3b56f8ccd8bb5202e5.zip |
lib: change vrf_is_mapped_on_netns API
The function handles not a vrf pointer instead of a vrf_id value.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/if.c | 3 | ||||
-rw-r--r-- | lib/vrf.c | 6 | ||||
-rw-r--r-- | lib/vrf.h | 2 |
3 files changed, 5 insertions, 6 deletions
@@ -393,7 +393,8 @@ struct interface *if_get_by_name(const char *name, vrf_id_t vrf_id, int vty) * this should not be considered as an update * then create the new interface */ - if (ifp->vrf_id != vrf_id && vrf_is_mapped_on_netns(vrf_id)) + if (ifp->vrf_id != vrf_id && vrf_is_mapped_on_netns( + vrf_lookup_by_id(vrf_id))) return if_create(name, vrf_id); /* If it came from the kernel * or by way of zclient, believe it and update @@ -682,10 +682,8 @@ int vrf_netns_handler_create(struct vty *vty, struct vrf *vrf, char *pathname, return CMD_SUCCESS; } -int vrf_is_mapped_on_netns(vrf_id_t vrf_id) +int vrf_is_mapped_on_netns(struct vrf *vrf) { - struct vrf *vrf = vrf_lookup_by_id(vrf_id); - if (!vrf || vrf->data.l.netns_name[0] == '\0') return 0; if (vrf->vrf_id == VRF_DEFAULT) @@ -887,7 +885,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_id)) + if (vrf_is_mapped_on_netns(vrf_lookup_by_id(vrf_id))) return fd; #ifdef SO_BINDTODEVICE ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, name, strlen(name)+1); @@ -237,7 +237,7 @@ extern vrf_id_t vrf_get_default_id(void); #define VRF_DEFAULT vrf_get_default_id() /* VRF is mapped on netns or not ? */ -int vrf_is_mapped_on_netns(vrf_id_t vrf_id); +int vrf_is_mapped_on_netns(struct vrf *vrf); /* VRF switch from NETNS */ extern int vrf_switch_to_netns(vrf_id_t vrf_id); |