aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tun.h
AgeCommit message (Collapse)AuthorFilesLines
2018-11-22properly store IPv6 addresses in struct tun_tStefan Sperling1-2/+2
All addresses in struct tun_t were stored as an in_addr. But IPv6 addresses need an in6_addr, so switch tun_t addresses to the in64_addr wrapper struct. This is an ABI break, as documented in TODO-RELEASE. Fixes an out of bounds memcpy() identified by Coverity. Change-Id: Idd2431ad25d7fa182e52e2bd5231ceb04d427c34 Related: CID#174278
2018-04-25Move kernel GTP support from ggsn/ to lib/Harald Welte1-1/+2
This way, the IP address / route handling between TUN devices and kernel GTP can be shared, which will provide not only a unified codebase but also a more consistent behavior. This also paves the road for to use kernel GTP from sgsnemu in the future. Related: OS#3214 Change-Id: Ic53a971136edd0d8871fbd6746d7b0090ce3a188
2018-04-25lib/tun: Remove tun_setaddr() API, as everyone is using tun_addaddr() nowHarald Welte1-3/+0
Change-Id: I02e057d30b6773c17ea6bc31094e53587971e9e7
2018-04-25lib/tun: split generic network device related stuff to lib/netdevHarald Welte1-41/+2
Change-Id: Ib021e392637a43d5cf1b40e0d50621fe7e854ba5
2018-04-25lib/tun.c: generalize tun_*route() to netdev_*route()Harald Welte1-2/+1
There's nothing specific to tun devices in adding a route to the kernel. Change-Id: Ib077934aa5f3c9bed06e2cf16a980c965a7a046d
2017-12-14Set tun_addaddr ipv agnostic and add support for ipv6Pau Espin Pedrol1-2/+2
sgsnemu (the only user of this API so far) has been modified to use the new API with in46_addr. FreeBSD code for IPv6 has not been tested. Change-Id: Ie36afe6eaf393855a4a708000ef4ad0192bf4767
2017-11-13factor out netdev_ip_local_get() from tun_ip_local_get()Harald Welte1-0/+3
netdev_ip_local_get() is a generalized version of tun_ip_local_get() which supports the net device as argument, rather than a tun_t. Change-Id: I072aa1a55e7bf110706e9207021b776d9b977fb6
2017-10-16tun: Convert tun_ipv6_linklocal_get to be more genericPau Espin Pedrol1-1/+12
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
2017-10-13Remove trailing whitespacePau Espin Pedrol1-3/+3
Change-Id: I8e24f95a88bef3a59006a89c219871e6156963d7
2017-09-24ICMPv6: Send router advertisement from own link-local addressHarald Welte1-0/+2
I'm not quite sure how I ended up doing this, but for some strange reason the code before this commit is sending the ICMPv6 Router Advertisements from some weird non-standard source address. This is a violation of RFC4861 which clearly states that the source address of router advertisements "MUST be the link-local address assigned to the interface from which this message is sent." Change-Id: Ib444af70fc8f0b433d371281601fd5a37b29039e
2017-09-06Introduce a VTY, factually turning OpenGGSN into an Osmocom programHarald Welte1-1/+1
Change-Id: I9613ca3436e77ea132c47f0096df7c5050d7e826
2017-09-05lib/tun: Add 'void *priv' pointer to tun_tHarald Welte1-0/+2
This allows the application to attach some private state to the tun device, such as the context from which it was created/allocated Change-Id: Ief43b9b5fab5830fa8e28362c795f88f0b4d353b
2017-09-05lib/tun: Add missing #include to net/if.h for IFNAMSIZHarald Welte1-0/+2
Change-Id: I979867d643c9fa912884fe55105333dbad39ab97
2017-08-11Support setting TUN device IPv6 address + prefixHarald Welte1-2/+5
As we can now have PDP contexts with IPv6 user IP payload, it is useful to extend the TUN related code to be able to configure the tun device IPv6 address + prefix length Change-Id: I899d21e52d02e0b8384af29ddd489ff19c8f2cf6
2017-08-09lib/tun.h: Remove non-endian-safe redefinition of IP headerHarald Welte1-15/+25
We can simply use 'struct iphdr' from netinet/ip.h to achieve the same goal (and be portable). Change-Id: Ieece22e127dc14a7ffdc3b05656628989ad00b32
2011-11-02Convert all code to Linux coding styleHarald Welte1-32/+29
After so many years of silence, we don't expect the original author to return to the project. To make things a bit simpler for us, we convert the coding style to what we are used to (Linux style). The conversion was made using the 'Lindent' script which is part of the Linux kernel.
2010-10-20IFNAMSIZ includes terminating 0Emmanuel Bretelle1-1/+1
http://www.delorie.com/gnu/docs/glibc/libc_308.html thus reverting devname to IFNAMSIZ and making sure (*tun)->devname[IFNAMSIZ-1] = 0; Signed-off-by: Emmanuel Bretelle <chantra@debuntu.org>
2010-10-20Set tun devname to IFNAMESIZ+1 to avoid warningEmmanuel Bretelle1-1/+1
Relevant output from make: ../lib/tun.c: In function ‘tun_new’: ../lib/tun.c:688: warning: array subscript is above array bounds Caused by assignement: (*tun)->devname[IFNAMSIZ] = 0; while devname defined as: char devname[IFNAMSIZ]; Signed-off-by: Emmanuel Bretelle <chantra@debuntu.org>
2010-10-20Move common sgsnemu/ggsn files to directory "lib"Emmanuel Bretelle1-0/+74
Some files like in sgsnemu and ggsn directory where exactly the same. They are now moved to the same directory for easier maintenance Signed-off-by: Emmanuel Bretelle <chantra@debuntu.org>