aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tun.h
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-10-16 14:41:37 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-10-16 17:45:48 +0200
commita037e5908a84e8f438f8faef662f6bfcec305b16 (patch)
tree1d32b511c1e24bed412bc1350e2167537f38bc53 /lib/tun.h
parent2e7b9ff891a0d4c84a4be3fffbac1b9502fe267c (diff)
tun: Convert tun_ipv6_linklocal_get to be more generic
Add support for IPv4 and IPv6 global IPs. Also return the prefix length of the IP address by using a in46_prefix. Change-Id: I277af191dc611b6bbcb83479f4ae338083740322
Diffstat (limited to 'lib/tun.h')
-rw-r--r--lib/tun.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/tun.h b/lib/tun.h
index f63be50..0b960e5 100644
--- a/lib/tun.h
+++ b/lib/tun.h
@@ -23,6 +23,16 @@
#define TUN_NLBUFSIZE 1024
#include "config.h"
+
+/* ipv6 ip type flags for tun_ipv6_local_get() */
+enum {
+ IP_TYPE_IPv4 = 1,
+ IP_TYPE_IPv6_LINK = 2,
+ IP_TYPE_IPv6_NONLINK = 4,
+};
+#define IP_TYPE_IPv6 (IP_TYPE_IPv6_LINK | IP_TYPE_IPv6_NONLINK)
+
+
#ifndef HAVE_IPHDR
struct iphdr
{
@@ -85,6 +95,7 @@ extern int tun_set_cb_ind(struct tun_t *this,
extern int tun_runscript(struct tun_t *tun, char *script);
-int tun_ipv6_linklocal_get(const struct tun_t *tun, struct in6_addr *ia);
+int tun_ip_local_get(const struct tun_t *tun, struct in46_prefix *prefix_list,
+ size_t prefix_size, int flags);
#endif /* !_TUN_H */