mirror of
https://github.com/systemd/systemd.git
synced 2024-11-23 10:13:34 +08:00
networkd: Add support to configure ISATAP tunnel
Let's just reuse the code of sit tunnel to create a ISATAP tunnel. Matter of turning a flag Please see https://elixir.bootlin.com/linux/v4.19.6/source/net/ipv6/sit.c#L208
This commit is contained in:
parent
b2ac2b01c8
commit
918049ad53
@ -924,6 +924,13 @@
|
||||
applicable to SIT tunnels.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>ISATAP=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes a boolean. If set, configures the tunnel as Intra-Site Automatic Tunnel Addressing Protocol (ISATAP) tunnel.
|
||||
Only applicable to SIT tunnels. When unset, the kernel's default will be used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>SerializeTunneledPackets=</varname></term>
|
||||
<listitem>
|
||||
|
@ -73,6 +73,7 @@ Tunnel.Encapsulation, config_parse_fou_encap_type, 0,
|
||||
Tunnel.IPv6RapidDeploymentPrefix, config_parse_6rd_prefix, 0, 0
|
||||
Tunnel.ERSPANIndex, config_parse_uint32, 0, offsetof(Tunnel, erspan_index)
|
||||
Tunnel.SerializeTunneledPackets, config_parse_tristate, 0, offsetof(Tunnel, erspan_sequence)
|
||||
Tunnel.ISATAP, config_parse_tristate, 0, offsetof(Tunnel, isatap)
|
||||
FooOverUDP.Protocol, config_parse_uint8, 0, offsetof(FouTunnel, fou_protocol)
|
||||
FooOverUDP.Encapsulation, config_parse_fou_encap_type, 0, offsetof(FouTunnel, fou_encap_type)
|
||||
FooOverUDP.Port, config_parse_ip_port, 0, offsetof(FouTunnel, port)
|
||||
|
@ -118,6 +118,7 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_netlink
|
||||
r = sd_netlink_message_append_in6_addr(m, IFLA_IPTUN_6RD_PREFIX, &t->sixrd_prefix);
|
||||
if (r < 0)
|
||||
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_6RD_PREFIX attribute: %m");
|
||||
|
||||
/* u16 is deliberate here, even though we're passing a netmask that can never be >128. The kernel is
|
||||
* expecting to receive the prefixlen as a u16.
|
||||
*/
|
||||
@ -126,6 +127,16 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_netlink
|
||||
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_6RD_PREFIXLEN attribute: %m");
|
||||
}
|
||||
|
||||
if (t->isatap >= 0) {
|
||||
uint16_t flags = 0;
|
||||
|
||||
SET_FLAG(flags, SIT_ISATAP, t->isatap);
|
||||
|
||||
r = sd_netlink_message_append_u16(m, IFLA_IPTUN_FLAGS, flags);
|
||||
if (r < 0)
|
||||
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_FLAGS attribute: %m");
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -761,6 +772,7 @@ static void sit_init(NetDev *n) {
|
||||
assert(t);
|
||||
|
||||
t->pmtudisc = true;
|
||||
t->isatap = -1;
|
||||
}
|
||||
|
||||
static void vti_init(NetDev *n) {
|
||||
|
@ -30,6 +30,7 @@ typedef struct Tunnel {
|
||||
int ipv6_flowlabel;
|
||||
int allow_localremote;
|
||||
int erspan_sequence;
|
||||
int isatap;
|
||||
|
||||
unsigned ttl;
|
||||
unsigned tos;
|
||||
|
@ -76,6 +76,7 @@ FOUSourcePort=
|
||||
IPv6RapidDeploymentPrefix=
|
||||
ERSPANIndex=
|
||||
SerializeTunneledPackets=
|
||||
ISATAP=
|
||||
[VXLAN]
|
||||
UDP6ZeroChecksumRx=
|
||||
ARPProxy=
|
||||
|
Loading…
Reference in New Issue
Block a user