summaryrefslogtreecommitdiff
path: root/include/linux/inet.h
diff options
context:
space:
mode:
authorSagi Grimberg <sagi@grimberg.me>2017-02-05 21:47:22 +0200
committerJens Axboe <axboe@fb.com>2017-04-04 09:48:23 -0600
commitb1a951fe469eb51646bf2e6d2c5f4a19fe1d4627 (patch)
treeafcdc10098a7e7c099afcf1941fe39b5aa20af83 /include/linux/inet.h
parent297186d640182eff442c3f473cd053c613f3b558 (diff)
downloadlwn-b1a951fe469eb51646bf2e6d2c5f4a19fe1d4627.tar.gz
lwn-b1a951fe469eb51646bf2e6d2c5f4a19fe1d4627.zip
net/utils: generic inet_pton_with_scope helper
Several locations in the stack need to handle ipv4/ipv6 (with scope) and port strings conversion to sockaddr. Add a helper that takes either AF_INET, AF_INET6 or AF_UNSPEC (for wildcard) to centralize this handling. Suggested-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/linux/inet.h')
-rw-r--r--include/linux/inet.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/inet.h b/include/linux/inet.h
index 4cca05c9678e..636ebe87e6f8 100644
--- a/include/linux/inet.h
+++ b/include/linux/inet.h
@@ -43,6 +43,8 @@
#define _LINUX_INET_H
#include <linux/types.h>
+#include <net/net_namespace.h>
+#include <linux/socket.h>
/*
* These mimic similar macros defined in user-space for inet_ntop(3).
@@ -54,4 +56,8 @@
extern __be32 in_aton(const char *str);
extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end);
extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end);
+
+extern int inet_pton_with_scope(struct net *net, unsigned short af,
+ const char *src, const char *port, struct sockaddr_storage *addr);
+
#endif /* _LINUX_INET_H */