^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ========================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) Bare UDP Tunnelling Module Documentation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) ========================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) There are various L3 encapsulation standards using UDP being discussed to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) leverage the UDP based load balancing capability of different networks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) MPLSoUDP (__ https://tools.ietf.org/html/rfc7510) is one among them.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) The Bareudp tunnel module provides a generic L3 encapsulation support for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) tunnelling different L3 protocols like MPLS, IP, NSH etc. inside a UDP tunnel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) Special Handling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) ----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) The bareudp device supports special handling for MPLS & IP as they can have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) multiple ethertypes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) MPLS procotcol can have ethertypes ETH_P_MPLS_UC (unicast) & ETH_P_MPLS_MC (multicast).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) IP protocol can have ethertypes ETH_P_IP (v4) & ETH_P_IPV6 (v6).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) This special handling can be enabled only for ethertypes ETH_P_IP & ETH_P_MPLS_UC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) with a flag called multiproto mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) Usage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) ------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 1) Device creation & deletion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) This creates a bareudp tunnel device which tunnels L3 traffic with ethertype
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 0x8847 (MPLS traffic). The destination port of the UDP header will be set to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 6635.The device will listen on UDP port 6635 to receive traffic.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) b) ip link delete bareudp0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 2) Device creation with multiproto mode enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) The multiproto mode allows bareudp tunnels to handle several protocols of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) same family. It is currently only available for IP and MPLS. This mode has to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) be enabled explicitly with the "multiproto" flag.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype ipv4 multiproto
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) For an IPv4 tunnel the multiproto mode allows the tunnel to also handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) IPv6.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) b) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc multiproto
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) For MPLS, the multiproto mode allows the tunnel to handle both unicast
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) and multicast MPLS packets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 3) Device Usage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) The bareudp device could be used along with OVS or flower filter in TC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) The OVS or TC flower layer must set the tunnel information in SKB dst field before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) sending packet buffer to the bareudp device for transmission. On reception the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) bareudp device extracts and stores the tunnel information in SKB dst field before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) passing the packet buffer to the network stack.