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