mirror of
https://github.com/systemd/systemd.git
synced 2024-11-23 18:23:32 +08:00
networkd: Geneve add support configure IP don't fragment
This commit is contained in:
parent
469fd84866
commit
aac350192b
@ -764,7 +764,13 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>Specifies the flow label to use in outgoing packets.</para>
|
<para>Specifies the flow label to use in outgoing packets.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><varname>IPDoNotFragment=</varname></term>
|
||||||
|
<listitem>
|
||||||
|
<para>Accepts the same key in <literal>[VXLAN]</literal> section.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
<refsect1>
|
<refsect1>
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "geneve.h"
|
#include "geneve.h"
|
||||||
#include "netlink-util.h"
|
#include "netlink-util.h"
|
||||||
#include "parse-util.h"
|
#include "parse-util.h"
|
||||||
|
#include "string-table.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
#include "missing.h"
|
#include "missing.h"
|
||||||
@ -18,6 +19,15 @@
|
|||||||
#define GENEVE_FLOW_LABEL_MAX_MASK 0xFFFFFU
|
#define GENEVE_FLOW_LABEL_MAX_MASK 0xFFFFFU
|
||||||
#define DEFAULT_GENEVE_DESTINATION_PORT 6081
|
#define DEFAULT_GENEVE_DESTINATION_PORT 6081
|
||||||
|
|
||||||
|
static const char* const geneve_df_table[_NETDEV_GENEVE_DF_MAX] = {
|
||||||
|
[NETDEV_GENEVE_DF_NO] = "no",
|
||||||
|
[NETDEV_GENEVE_DF_YES] = "yes",
|
||||||
|
[NETDEV_GENEVE_DF_INHERIT] = "inherit",
|
||||||
|
};
|
||||||
|
|
||||||
|
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(geneve_df, GeneveDF, NETDEV_GENEVE_DF_YES);
|
||||||
|
DEFINE_CONFIG_PARSE_ENUM(config_parse_geneve_df, geneve_df, GeneveDF, "Failed to parse Geneve IPDoNotFragment= setting");
|
||||||
|
|
||||||
/* callback for geneve netdev's created without a backing Link */
|
/* callback for geneve netdev's created without a backing Link */
|
||||||
static int geneve_netdev_create_handler(sd_netlink *rtnl, sd_netlink_message *m, NetDev *netdev) {
|
static int geneve_netdev_create_handler(sd_netlink *rtnl, sd_netlink_message *m, NetDev *netdev) {
|
||||||
int r;
|
int r;
|
||||||
@ -126,6 +136,12 @@ static int netdev_geneve_create(NetDev *netdev) {
|
|||||||
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_LABEL attribute: %m");
|
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_LABEL attribute: %m");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (v->geneve_df != _NETDEV_GENEVE_DF_INVALID) {
|
||||||
|
r = sd_netlink_message_append_u8(m, IFLA_GENEVE_DF, v->geneve_df);
|
||||||
|
if (r < 0)
|
||||||
|
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_DF attribute: %m");
|
||||||
|
}
|
||||||
|
|
||||||
r = sd_netlink_message_close_container(m);
|
r = sd_netlink_message_close_container(m);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_netdev_error_errno(netdev, r, "Could not append IFLA_INFO_DATA attribute: %m");
|
return log_netdev_error_errno(netdev, r, "Could not append IFLA_INFO_DATA attribute: %m");
|
||||||
@ -280,6 +296,7 @@ static void geneve_init(NetDev *netdev) {
|
|||||||
assert(v);
|
assert(v);
|
||||||
|
|
||||||
v->id = GENEVE_VID_MAX + 1;
|
v->id = GENEVE_VID_MAX + 1;
|
||||||
|
v->geneve_df = _NETDEV_GENEVE_DF_INVALID;
|
||||||
v->dest_port = DEFAULT_GENEVE_DESTINATION_PORT;
|
v->dest_port = DEFAULT_GENEVE_DESTINATION_PORT;
|
||||||
v->udpcsum = false;
|
v->udpcsum = false;
|
||||||
v->udp6zerocsumtx = false;
|
v->udp6zerocsumtx = false;
|
||||||
|
@ -10,6 +10,14 @@ typedef struct Geneve Geneve;
|
|||||||
|
|
||||||
#define GENEVE_VID_MAX (1u << 24) - 1
|
#define GENEVE_VID_MAX (1u << 24) - 1
|
||||||
|
|
||||||
|
typedef enum GeneveDF {
|
||||||
|
NETDEV_GENEVE_DF_NO = GENEVE_DF_UNSET,
|
||||||
|
NETDEV_GENEVE_DF_YES = GENEVE_DF_SET,
|
||||||
|
NETDEV_GENEVE_DF_INHERIT = GENEVE_DF_INHERIT,
|
||||||
|
_NETDEV_GENEVE_DF_MAX,
|
||||||
|
_NETDEV_GENEVE_DF_INVALID = -1
|
||||||
|
} GeneveDF;
|
||||||
|
|
||||||
struct Geneve {
|
struct Geneve {
|
||||||
NetDev meta;
|
NetDev meta;
|
||||||
|
|
||||||
@ -27,12 +35,17 @@ struct Geneve {
|
|||||||
bool udp6zerocsumtx;
|
bool udp6zerocsumtx;
|
||||||
bool udp6zerocsumrx;
|
bool udp6zerocsumrx;
|
||||||
|
|
||||||
|
GeneveDF geneve_df;
|
||||||
union in_addr_union remote;
|
union in_addr_union remote;
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_NETDEV_CAST(GENEVE, Geneve);
|
DEFINE_NETDEV_CAST(GENEVE, Geneve);
|
||||||
extern const NetDevVTable geneve_vtable;
|
extern const NetDevVTable geneve_vtable;
|
||||||
|
|
||||||
|
const char *geneve_df_to_string(GeneveDF d) _const_;
|
||||||
|
GeneveDF geneve_df_from_string(const char *d) _pure_;
|
||||||
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_geneve_vni);
|
CONFIG_PARSER_PROTOTYPE(config_parse_geneve_vni);
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_geneve_address);
|
CONFIG_PARSER_PROTOTYPE(config_parse_geneve_address);
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_geneve_flow_label);
|
CONFIG_PARSER_PROTOTYPE(config_parse_geneve_flow_label);
|
||||||
|
CONFIG_PARSER_PROTOTYPE(config_parse_geneve_df);
|
||||||
|
@ -135,6 +135,7 @@ GENEVE.UDP6ZeroChecksumRx, config_parse_bool,
|
|||||||
GENEVE.UDP6ZeroCheckSumTx, config_parse_bool, 0, offsetof(Geneve, udp6zerocsumtx)
|
GENEVE.UDP6ZeroCheckSumTx, config_parse_bool, 0, offsetof(Geneve, udp6zerocsumtx)
|
||||||
GENEVE.UDP6ZeroChecksumTx, config_parse_bool, 0, offsetof(Geneve, udp6zerocsumtx)
|
GENEVE.UDP6ZeroChecksumTx, config_parse_bool, 0, offsetof(Geneve, udp6zerocsumtx)
|
||||||
GENEVE.DestinationPort, config_parse_ip_port, 0, offsetof(Geneve, dest_port)
|
GENEVE.DestinationPort, config_parse_ip_port, 0, offsetof(Geneve, dest_port)
|
||||||
|
GENEVE.IPDoNotFragment, config_parse_geneve_df, 0, offsetof(Geneve, geneve_df)
|
||||||
GENEVE.FlowLabel, config_parse_geneve_flow_label, 0, 0
|
GENEVE.FlowLabel, config_parse_geneve_flow_label, 0, 0
|
||||||
MACsec.Port, config_parse_macsec_port, 0, 0
|
MACsec.Port, config_parse_macsec_port, 0, 0
|
||||||
MACsec.Encrypt, config_parse_tristate, 0, offsetof(MACsec, encrypt)
|
MACsec.Encrypt, config_parse_tristate, 0, offsetof(MACsec, encrypt)
|
||||||
|
@ -32,6 +32,7 @@ FlowLabel=
|
|||||||
UDP6ZeroChecksumRx=
|
UDP6ZeroChecksumRx=
|
||||||
Remote=
|
Remote=
|
||||||
UDP6ZeroCheckSumRx=
|
UDP6ZeroCheckSumRx=
|
||||||
|
IPDoNotFragment=
|
||||||
[Bridge]
|
[Bridge]
|
||||||
ForwardDelaySec=
|
ForwardDelaySec=
|
||||||
HelloTimeSec=
|
HelloTimeSec=
|
||||||
|
Loading…
Reference in New Issue
Block a user