53cb501a13
This work add support to generic netlink to sd-netlink. See https://lwn.net/Articles/208755/ networkd: add support FooOverUDP support to IPIP tunnel netdev https://lwn.net/Articles/614348/ Example conf: /lib/systemd/network/1-fou-tunnel.netdev ``` [NetDev] Name=fou-tun Kind=fou [FooOverUDP] Port=5555 Protocol=4 ``` /lib/systemd/network/ipip-tunnel.netdev ``` [NetDev] Name=ipip-tun Kind=ipip [Tunnel] Independent=true Local=10.65.208.212 Remote=10.65.208.211 FooOverUDP=true FOUDestinationPort=5555 ``` $ ip -d link show ipip-tun ``` 5: ipip-tun@NONE: <POINTOPOINT,NOARP> mtu 1472 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ipip 10.65.208.212 peer 10.65.208.211 promiscuity 0 ipip remote 10.65.208.211 local 10.65.208.212 ttl inherit pmtudisc encap fou encap-sport auto encap-dport 5555 noencap-csum noencap-csum6 noencap-remcsum numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 ```
40 lines
1.2 KiB
C
40 lines
1.2 KiB
C
/* SPDX-License-Identifier: LGPL-2.1+ */
|
|
#pragma once
|
|
|
|
#if HAVE_FOU_CMD_GET
|
|
#include <linux/fou.h>
|
|
#endif
|
|
|
|
#include "in-addr-util.h"
|
|
#include "netdev/netdev.h"
|
|
|
|
typedef enum FooOverUDPEncapType {
|
|
NETDEV_FOO_OVER_UDP_ENCAP_UNSPEC = FOU_ENCAP_UNSPEC,
|
|
NETDEV_FOO_OVER_UDP_ENCAP_DIRECT = FOU_ENCAP_DIRECT,
|
|
NETDEV_FOO_OVER_UDP_ENCAP_GUE = FOU_ENCAP_GUE,
|
|
_NETDEV_FOO_OVER_UDP_ENCAP_MAX,
|
|
_NETDEV_FOO_OVER_UDP_ENCAP_INVALID = -1,
|
|
} FooOverUDPEncapType;
|
|
|
|
typedef struct FouTunnel {
|
|
NetDev meta;
|
|
|
|
uint8_t fou_protocol;
|
|
|
|
uint16_t port;
|
|
|
|
FooOverUDPEncapType fou_encap_type;
|
|
} FouTunnel;
|
|
|
|
DEFINE_NETDEV_CAST(FOU, FouTunnel);
|
|
extern const NetDevVTable foutnl_vtable;
|
|
|
|
const char *fou_encap_type_to_string(FooOverUDPEncapType d) _const_;
|
|
FooOverUDPEncapType fou_encap_type_from_string(const char *d) _pure_;
|
|
|
|
int config_parse_fou_encap_type(const char *unit, const char *filename,
|
|
unsigned line, const char *section,
|
|
unsigned section_line, const char *lvalue,
|
|
int ltype, const char *rvalue, void *data,
|
|
void *userdata);
|