Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for TUN-based Channels (kqueue/epoll) #12960

Open
wants to merge 11 commits into
base: 4.1
Choose a base branch
from

Commits on Nov 2, 2022

  1. Add Support for TUN-based Channels (kqueue/epoll)

    Motivation:
    
    I want to develop a mesh VPN. Since I love netty, I would love to use it for this project. Therefore I need a TUN-based Channel implementation.
    
    Modifications:
    
    - Added native methods to io.netty.channel.kqueue.BsdSocket and io.netty.channel.epoll.LinuxSocket, allowing the creation of TUN devices and setting/getting the network interface MTU on macOS and Linux.
    - Implemented io.netty.channel.kqueue.KQueueTunChannel and io.netty.channel.epoll.EpollTunChannel, allowing the creation of TUN-based channels using epoll and kqueue.
    - Defined and implemented io.netty.channel.socket.TunChannelConfig, allowing setting/getting the network interface MTU.
    - Modified io.netty.channel.unix.Socket to avoid Socket#isIPv6(fd) call that is not supported on TUN sockets.
    - Modified io.netty.channel.epoll.AbstractEpollChannel allowing to set AbstractEpollChannel#local in EpollTunChannel#doBind as io.netty.channel.kqueue.Native#epollCtlAdd must be called after TUN device has been bound.
    - Renamed io.netty.channel.kqueue.AbstractKQueueDatagramChannel to io.netty.channel.kqueue.AbstractKQueueMessageChannel because KQueueTunChannel needs to implement this class but is not datagram related. As this rename may break the API, I re-added AbstractKQueueDatagramChannel for legacy reasons.
    - Added io.netty.channel.socket.Tun4Packet and io.netty.channel.socket.Tun6Packet to help work with IPv4 and IPv6 packets.
    - Added io.netty.example.tun.TunPingDevice example creating a TUN device that will reply to IPMC/IPv6-ICMP echo ping requests.
    - Added io.netty.example.tun.TunEchoDevice example that echoes all received IP packets (e.g., suitable for performance tests).
    - Added native dependencies to example/pom.xml (might require changes to your release workflow).
    - Modified run-example.sh to activate platform-dependent native transport maven profile.
    
    Result:
    
    Support for TUN-based Channels on kqueue- and epoll-enabled platforms.
    
    Co-authored-by: Kevin Röbert <dev@roebert.eu>
    HeikoBornholdt and KevinRoebert committed Nov 2, 2022
    Configuration menu
    Copy the full SHA
    3264f9a View commit details
    Browse the repository at this point in the history

Commits on Nov 8, 2022

  1. Remove redundant javadoc

    Co-authored-by: Kevin Röbert <dev@roebert.eu>
    HeikoBornholdt and KevinRoebert committed Nov 8, 2022
    Configuration menu
    Copy the full SHA
    e0e9f63 View commit details
    Browse the repository at this point in the history
  2. Change return type of TunPacket#version to InternetProtocolFamily

    Co-authored-by: Kevin Röbert <dev@roebert.eu>
    HeikoBornholdt and KevinRoebert committed Nov 8, 2022
    Configuration menu
    Copy the full SHA
    c3f3230 View commit details
    Browse the repository at this point in the history
  3. Change TunAddress#toString

    Co-authored-by: Kevin Röbert <dev@roebert.eu>
    HeikoBornholdt and KevinRoebert committed Nov 8, 2022
    Configuration menu
    Copy the full SHA
    90388e0 View commit details
    Browse the repository at this point in the history
  4. Fix bug with tun device name off by 1 on macOS

    Co-authored-by: Kevin Röbert <dev@roebert.eu>
    HeikoBornholdt and KevinRoebert committed Nov 8, 2022
    Configuration menu
    Copy the full SHA
    525fd88 View commit details
    Browse the repository at this point in the history
  5. Add javadoc to TunAddress describing implications of null value

    Co-authored-by: Kevin Röbert <dev@roebert.eu>
    HeikoBornholdt and KevinRoebert committed Nov 8, 2022
    Configuration menu
    Copy the full SHA
    c4987b6 View commit details
    Browse the repository at this point in the history

Commits on Nov 11, 2022

  1. Add support for IFF_MULTI_QUEUE

    Co-authored-by: Kevin Röbert <dev@roebert.eu>
    HeikoBornholdt and KevinRoebert committed Nov 11, 2022
    Configuration menu
    Copy the full SHA
    94022b7 View commit details
    Browse the repository at this point in the history

Commits on Nov 21, 2022

  1. Check if IFF_MULTI_QUEUE is supported

    Co-authored-by: Kevin Röbert <dev@roebert.eu>
    HeikoBornholdt and KevinRoebert committed Nov 21, 2022
    Configuration menu
    Copy the full SHA
    31a553e View commit details
    Browse the repository at this point in the history
  2. Fix bug in TunEchoDevice

    Co-authored-by: Kevin Röbert <dev@roebert.eu>
    HeikoBornholdt and KevinRoebert committed Nov 21, 2022
    Configuration menu
    Copy the full SHA
    10129c2 View commit details
    Browse the repository at this point in the history
  3. Fix bug with macOS choosing the tun device name

    Co-authored-by: Kevin Röbert <dev@roebert.eu>
    HeikoBornholdt and KevinRoebert committed Nov 21, 2022
    Configuration menu
    Copy the full SHA
    9f60b89 View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2022

  1. Add tests for EpollTunChannel and KqueueTunChannel (and helper classes)

    Co-authored-by: Kevin Röbert <dev@roebert.eu>
    HeikoBornholdt and KevinRoebert committed Nov 23, 2022
    Configuration menu
    Copy the full SHA
    21ccd38 View commit details
    Browse the repository at this point in the history