summaryrefslogtreecommitdiff
path: root/lib/vrf.h
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2018-01-26 12:28:27 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2018-02-27 11:11:24 +0100
commit2e0d2b3d9c4f2681d00ec2607319f3bb8078e31d (patch)
tree05903e6601393cce616c981bcedd4a62282628d4 /lib/vrf.h
parent40289934f1b07acf934f26aec63ed523e6889a1d (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.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/vrf.h b/lib/vrf.h
index 9553d43808..08c53484ee 100644
--- a/lib/vrf.h
+++ b/lib/vrf.h
@@ -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
*/