tuntap | Native Go Wrapper for TUN/TAP devices on Linux and Mac OS X | iOS library

 by   jamescun Go Version: Current License: Non-SPDX

kandi X-RAY | tuntap Summary

kandi X-RAY | tuntap Summary

tuntap is a Go library typically used in Mobile, iOS applications. tuntap has no bugs, it has no vulnerabilities and it has low support. However tuntap has a Non-SPDX License. You can download it from GitHub.

Native Go Wrapper for TUN/TAP devices on Linux and Mac OS X
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              tuntap has a low active ecosystem.
              It has 39 star(s) with 7 fork(s). There are 2 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 2 open issues and 0 have been closed. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of tuntap is current.

            kandi-Quality Quality

              tuntap has 0 bugs and 0 code smells.

            kandi-Security Security

              tuntap has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              tuntap code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              tuntap has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              tuntap releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.
              It has 226 lines of code, 23 functions and 5 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed tuntap and discovered the below as its top functions. This is intended to give you an instant insight into tuntap implemented functionality, and help decide if they suit your requirements.
            • tunt is the main loop
            • newTAP creates a TUNAP interface .
            • createTuntapInterface creates a tuntapInterface .
            • isNotReady returns true if err is not ready
            • isBusy returns true if the given error indicates an exclusive lock .
            • newDevice returns a new interface .
            • Tap returns a TAP interface .
            • TUN returns a TUN interface .
            • newTUN returns a new interface .
            • String returns the device name .
            Get all kandi verified functions for this library.

            tuntap Key Features

            No Key Features are available at this moment for tuntap.

            tuntap Examples and Code Snippets

            No Code Snippets are available at this moment for tuntap.

            Community Discussions

            QUESTION

            Dummy Ethernet Device in Linux Not Working With ARP
            Asked 2022-Jan-18 at 10:57

            I want a dummy ethernet device in Linux that responds as a normal ethernet device would, but that I can connect to in software. I attempted to generate a dummy device using the following commands:

            ...

            ANSWER

            Answered 2022-Jan-18 at 10:57

            The answer appears to be that you can't do this like a normal ethernet device. You have to create a TAP device, as follows:

            Source https://stackoverflow.com/questions/70753798

            QUESTION

            How to connect a tap interface to the internet?
            Asked 2021-Jul-17 at 18:34

            As a personal project I want to build a TCP/IP stack using C/C++ and using a tap interface. I have a wlan0 interface (wireless) that is connected to the internet. And now I want to send and receive packets from the internet through this wlan0 interface.

            How can I do this?

            These are the commands I used to create my tap interface:

            ...

            ANSWER

            Answered 2021-Jul-17 at 18:33

            The tap device is only a virtual ethernet interface - what you send on it, you can read it back on a device file (/dev/tap), and what you write into this device, you get as incoming packet on tap0.

            What you can do:

            1. You can do this by netlink or raw sockets. Essentially, it is a special socket type, you can send and receive raw ethernet packets on it.

            2. You can bridge tap0 and wlan0 into a br0 bridge with the brctl command. Wifi and ethernet interfaces can not be bridged together (they are different on the ethernet level, a 802.11 packet is meaningless on 802.3 and vice versa).

            Probably you can not create a well-working tcp implementation below a hundred kB of C code. It is because tcp is only simple on the user level.

            Source https://stackoverflow.com/questions/68423236

            QUESTION

            Can I ping with Tun/Tap interface
            Asked 2021-May-27 at 10:32

            I am learning routing with tuntap interfaces... and I had created a tun0 interface and configured Ip address with ifconfig command on different subnet and adding the gateway with ip route command and I have also used masquerading rule ... my doubt is can i ping with tuntap interface or they are only used to route the traffic or something I don't know about these interface or may be misconfiguration..

            May be this question sounds me new bie and I am but give please give me correct direction..

            Ok Gerhardh,

            Edit: I had created tun dev like this:

            ...

            ANSWER

            Answered 2021-May-27 at 10:32

            Standard network interfaces have a piece of hardware behind them (a network card).

            Tuntap don't:

            https://www.kernel.org/doc/Documentation/networking/tuntap.txt

            tl;dr: packets sent to a tuntap interface are handed over to a user-space program for processing. This program takes on the role of the network card in some way (example: openvpn). Unless there is a program taking packets out of the device and doing something meaningful with them, they will vanish into the void (like a network card with a disconnected cable).

            Source https://stackoverflow.com/questions/67716753

            QUESTION

            Should the kernel pass data from a tap interface to an application listening on INADDR_ANY?
            Asked 2020-Sep-25 at 12:29

            I have an application that creates, listens on and writes to a tap interface. The software will read(tun_fd,...) and perform some action on that data, and it will return data to the system as UDP packets via write(tun_fd,...).

            I assign an IP to the interface, 10.10.10.10\24 so that a socket application can bind to it and so that the kernel will pass any packets for the virtual subnet to the tap interface.

            The software generate frames with IP/UDP packets with the destination IP being that assigned to the interface, and a source IP existing in the same subnet. The source and dest mac address match that of the tap device. Those frames are written back to the kernel with write(tun_fd,...).

            If I open said tap interface in wireshark I will see my frames/packets as I expect to, properly formatted, expected ports, expected macs and IPs. But if I try to read those packets with netcat -lvu 0.0.0.0 ${MY_UDP_PORT} I don't see anything.

            Is this expected behavior?

            Update 1

            INADDR_ANY is a red herring. I have the problem even when explicitly binding to an interface / port as in this pseudo code:

            ...

            ANSWER

            Answered 2020-Sep-25 at 12:29

            Yes, data written into the tuntap device via write(tun_fd...) should get passed to the kernel protocol stack and distributed to listening sockets with matching packet information just like the frame had arrived over a wire attached to a physical ethernet device.

            It requires that the packets be properly formed (IP checksum is good, UDP checksum is good or 0). It requires that the kernel know how to handle the packet (is there an interface on the system with a matching destination IP?). If it's a tap device it may also require that your application is properly ARP'ing (although this might not be necessary for a 'received' packet from the perspective of a socket application listening to an address assigned to the tap device).

            In my case the problem was silly. While I had turned on UDP checksum verification in wireshark I forgot to turn on IP header verification. An extra byteswap was breaking that checksum. After fixing that I was immediately able to see packets written into the TAP device in a socket application listening on the address assigned to that interface.

            Source https://stackoverflow.com/questions/63996520

            QUESTION

            How to tell where linux kernel is parsing MLD joins on tuntap interface?
            Asked 2020-Jan-28 at 23:31

            I have been working on a program which uses a TUNTAP interface (in TUN mode) on a routing device which runs on top of the Linux kernel. It is a multicast tunneling protocol, and I am trying to send MLD joins to the kernel through my application so it can be recieved elsewhere. However, even though I have quadruple-checked my packets being sent on the interface, the linux kernel is dropping the packet before it gets passed on.

            Tediously I have been tracing the path of the packet through the linuxkernel trying to figure out why it is being dropped and I think I have figured out to some extent why it is not being processed. The Hop-by-Hop options (containing the Router-Alert option which is necessary for MLD) is being parsed in net/ipv6/ip6_input.c in the ipv6_rcv function, but instead of continuing to process the packet in ip6_rcv_finish, the packet is dropped since the NF_HOOK at the end of the ipv6_rcv function is somehow interpreting the packet as being processed by something else. (NF_STOLEN instead of NF_ACCEPT)

            Once the ipv6_rcv function finishes executing, something else executes ip6_mc_input, (in net/ipv6/ip6_input.c still) but from here the Hop-by-Hop options are not processed, which means when the kernel ends up processing the Layer-4 protocol, it has nothing to handle the protocol since the Hop-by-Hop options were meant to be processed beforehand. This means that the kernel drops the packet due to an unknown protocol.

            What I am trying to figure out is what is calling ip6_mc_input. I have looked quite a bit on elixir for what could call it, but there are so many possibilities since it is called from a pointer in a rt6_info struct which is difficult to trace since so many things use it. Does anyone know anything that could help me in my search?

            IGMP joins work fine, but the IPv4 stuff is probably quite similar so information from that context would probably be helpful too.

            For reference, the linux kernel version in use is v4.4.6

            ...

            ANSWER

            Answered 2020-Jan-28 at 23:31

            I figured out what was going on.

            Using a macro that printed out the file location of the caller of the ip6_mc_input, i found that the packet came from my ipt_netmap.c file. It looks like the packet was being taken by the IPTables, which were not programmed to handle the hop options. It turns out I had a configuration option set which didn't need to be set though, so disabling that fixed the issue for me.

            Source https://stackoverflow.com/questions/59924294

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install tuntap

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/jamescun/tuntap.git

          • CLI

            gh repo clone jamescun/tuntap

          • sshUrl

            git@github.com:jamescun/tuntap.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular iOS Libraries

            swift

            by apple

            ionic-framework

            by ionic-team

            awesome-ios

            by vsouza

            fastlane

            by fastlane

            glide

            by bumptech

            Try Top Libraries by jamescun

            switcher

            by jamescunGo

            wg-api

            by jamescunGo

            iPG

            by jamescunJavaScript

            legit

            by jamescunGo

            ssltest

            by jamescunGo