diff options
| author | Philippe Guibert <philippe.guibert@6wind.com> | 2018-01-26 12:28:27 +0100 |
|---|---|---|
| committer | Philippe Guibert <philippe.guibert@6wind.com> | 2018-02-27 11:11:24 +0100 |
| commit | 2e0d2b3d9c4f2681d00ec2607319f3bb8078e31d (patch) | |
| tree | 05903e6601393cce616c981bcedd4a62282628d4 /lib/vrf.h | |
| parent | 40289934f1b07acf934f26aec63ed523e6889a1d (diff) | |
lib: add two APIs to handle socket operations with VRF NETNS
The vrf_sockunion_socket() wraps sockunion_socket() with vrf_id as
additional parameter. The creation of socket forces the user to
transparently move to new NETNS for doing the operation.
The vrf_getaddr_info() wraps getaddr_info() with vrf_id as additional
parameter. That API relies on the underlying system. Then there may be
need to switch to an other netns in that case too.
Also, the vrf_socket() implementation is simplified.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib/vrf.h')
| -rw-r--r-- | lib/vrf.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -222,6 +222,15 @@ int vrf_is_mapped_on_netns(vrf_id_t vrf_id); extern int vrf_switch_to_netns(vrf_id_t vrf_id); extern int vrf_switchback_to_initial(void); +/* VRF ioctl operations */ +extern int vrf_getaddrinfo(const char *node, const char *service, + const struct addrinfo *hints, + struct addrinfo **res, vrf_id_t vrf_id); +extern int vrf_sockunion_socket(const union sockunion *su, vrf_id_t vrf_id); +/* VRF switch from NETNS */ +extern int vrf_switch_to_netns(vrf_id_t vrf_id); +extern int vrf_switchback_to_initial(void); + /* used by NS when vrf backend is NS. * Notify a change in the VRF ID of the VRF */ |
