tuntap | tuntap library supports both Linux and OS X | Runtime Evironment library

 by   liudanking Go Version: Current License: No License

kandi X-RAY | tuntap Summary

kandi X-RAY | tuntap Summary

tuntap is a Go library typically used in Server, Runtime Evironment applications. tuntap has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

A tuntap library supports both Linux and OS X written in Golang
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              tuntap has a low active ecosystem.
              It has 11 star(s) with 0 fork(s). There are no watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 0 open issues and 1 have been closed. On average issues are closed in 1 days. 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 no bugs reported.

            kandi-Security Security

              tuntap has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              tuntap does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              tuntap releases are not available. You will need to build from source code and install.

            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.
            • This is the main function for testing
            • createInterface creates an interface
            • Open opens a device interface
            • Checksum returns the checksum of data .
            • exeCmd runs the exe command
            • MACT tagging
            • checkError is used to check an error
            • setTunDarwin is used to set the unix socket
            • setTunLinux sets the unix socket
            • MACEthertype returns the ethertype for a MAC frame
            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

            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 read TCP packets on a tun/tap interface?
            Asked 2020-Mar-07 at 12:58

            I'm working on a simple project that listens on a tun interface and modified the packets then re-sends them to the real interface.

            I have tried songgao/water, pkg/tuntap and even writing my own based on some C code floating around but no matter what I tried, I can't receive TCP packets (ICMP/UDP works fine).

            I feel like i'm missing something extremely obvious but I can't figure it for the life of me...

            The code:

            ...

            ANSWER

            Answered 2020-Mar-07 at 12:58

            Your code works for me. If I run it, then I can see TCP packets after I initiate some TCP-related activity. For this instance, I used "ssh 10.2.0.11". Here is what I got:

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

            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

            QUESTION

            Why qemu failled to create private network with private virtual bridge? I got "network script /etc/qemu-ifup failed with status 256""
            Asked 2019-Oct-08 at 01:10

            I want to create one vm on a private network.

            I am following this website http://www.linux-kvm.org/page/Networking to help in configuring my qemu.

            I used the following command to create a vm:
            sudo qemu-system-x86_64 -hda image.qcow2 -enable-kvm -netdev tap,id=tap1 -device rtl8139,netdev=tap1
            and I got:
            qemu-system-x86_64: -netdev tap,id=tap1: network script /etc/qemu-ifup failed with status 256

            I am using arch. I create a bridge: sudo ip link add br0 type bridge

            By default, I didn't have file in /etc/qemu-ifup:
            So, I created my own, like recommanded on this website http://www.linux-kvm.org/page/Networking:

            ...

            ANSWER

            Answered 2017-Mar-02 at 19:45

            I needed to add executable permission to qemu-ifup. So it works now. Thank Karthik Prasad.

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

            QUESTION

            Requested registry access is not allowed. even with signed exe and admin Privileged in manifest
            Asked 2019-May-29 at 05:00

            I am trying to access HKEY_LOCAL_MACHINE registry,

            This is the manifest file:

            ...

            ANSWER

            Answered 2019-May-29 at 05:00

            I found the problem but I don't know why access to this address is impossible

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

            QUESTION

            How to read/write from existing TAP interface in C
            Asked 2019-Mar-21 at 09:58

            I have an existing tap device (tap0) that I created on command line.

            ...

            ANSWER

            Answered 2019-Mar-21 at 09:58

            Open the existing tun/tap interface similar way than creating a new one. Just give name for the interface when ioctl(TUNSETIFF) is used:

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

            QUESTION

            How to Create a virtual network interface and connect it to a bridge
            Asked 2019-Mar-10 at 11:50

            I am trying to create a network of virtal qemu machines and the host using a bridge on Arch Linux to test a distributed program I wrote. I have found many howtos on using the physical NIC of the host on the bridge to connect to the VMs. This works fine. However, I don't want the VMs to be visible to the outside network but rather create a virtual interface on the host to connect to the VMs. This is what I have tried so far after creating the bridge and starting the VMs on it:

            ...

            ANSWER

            Answered 2019-Mar-10 at 11:50

            Setting up another virtual interface is not necessary since one can assign an IP to the bridge:

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

            QUESTION

            What is the need for "maxfd" when creating a tunnel?
            Asked 2018-Dec-02 at 04:06

            In this link, https://backreference.org/2010/03/26/tuntap-interface-tutorial/, there's a code sample that uses tun/tap interface to create a TCP tunnel as below.

            ...

            ANSWER

            Answered 2018-Dec-02 at 04:06

            It's an artifact of the way the dangerous and obsolete select function works. It requires an argument that is a bound on the size (in bits) of the fd_set objects passed to it, and cannot work with fd numbers larger than an arbitrary limit imposed by FD_SETSIZE. If you fail to meet these requirements, Undefined Behavior results.

            Wherever you see select, you should replace it by poll which does not suffer from these limitations, has an easier-to-use interface, and has more features.

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

            QUESTION

            Convert `ip tuntap add` system() call to C code
            Asked 2018-Apr-02 at 18:33

            I'm trying to convert a system() call I have in C that calls ip tuntap add ... to C code that doesn't rely on the system() call.

            Basically, it's a problem that the tunnel adapter that I use the system("ip tuntap add ...") call to bring up is left there when my application is forcibly terminated.

            I've been told I can use rtnetlink to achieve my goal. I'd like to convert the following line into C code that doesn't rely on the system() call. I believe if I use rtnetlink that the tunnel adapter I bring up will be destroyed by the kernel when my application is terminated, which is the main reason I want to do this.

            This is my current line in C:

            ...

            ANSWER

            Answered 2018-Apr-02 at 18:33

            @Jonathon Reinhart answered this in the comments:

            What you're looking for is a non-persistent TUN adapter. Instead of using

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

            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/liudanking/tuntap.git

          • CLI

            gh repo clone liudanking/tuntap

          • sshUrl

            git@github.com:liudanking/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