summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorFernando Fernandez Mancera <ffmancera@riseup.net>2020-11-12 21:58:13 +0100
committerThomas Haller <thaller@redhat.com>2020-11-27 10:12:36 +0100
commitcd0cf9229d49a05c4e8afbb9b87b5d621c23ea00 (patch)
tree58c45b04d3d46f1da748db2712f1814f7d720058 /clients
parentde1d849f173dfa8d271720b396cb27e570ede7e9 (diff)
downloadNetworkManager-cd0cf9229d49a05c4e8afbb9b87b5d621c23ea00.tar.gz
veth: add support to configure veth interfaces
NetworkManager is now able to configure veth interfaces throught the NMSettingVeth. Veth interfaces only have "peer" property. In order to support Veth interfaces in NetworkManager the design need to pass the following requirements: * Veth setting only has "peer" attribute. * Ethernet profiles must be applicable to Veth interfaces. * When creating a veth interface, the peer will be managed by NetworkManager but will not have a profile. * Veth connection can reapply only if the peer has not been modified. * In order to modify the veth peer, NetworkManager must deactivate the connection and create a new one with peer modified. In general, it should support the basis of veth interfaces but without breaking any existing feature or use case. The users that are using veth interfaces as ethernet should not notice anything changed unless they specified the veth peer setting. Creating a Veth interface in NetworkManager is useful even without the support for namespaces for some use cases, e.g "connecting one side of the veth to an OVS bridge and the other side to a Linux bridge" this is done when using OVN kubernetes [1][2]. In addition, it would provide persistent configuration and rollback support for Veth interfaces. [1] https://bugzilla.redhat.com/show_bug.cgi?id=1885605 [2] https://bugzilla.redhat.com/show_bug.cgi?id=1894139 Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
Diffstat (limited to 'clients')
-rw-r--r--clients/cli/connections.c48
-rw-r--r--clients/cli/generate-docs-nm-settings-nmcli.xml.in5
-rw-r--r--clients/common/nm-meta-setting-desc.c22
-rw-r--r--clients/common/settings-docs.h.in1
4 files changed, 52 insertions, 24 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
index 3fbf14d577..5b8929b997 100644
--- a/clients/cli/connections.c
+++ b/clients/cli/connections.c
@@ -858,30 +858,30 @@ const NmcMetaGenericInfo
/*****************************************************************************/
-#define NMC_FIELDS_SETTINGS_NAMES_ALL \
- NM_SETTING_CONNECTION_SETTING_NAME \
- "," NM_SETTING_MATCH_SETTING_NAME "," NM_SETTING_WIRED_SETTING_NAME \
- "," NM_SETTING_802_1X_SETTING_NAME "," NM_SETTING_WIRELESS_SETTING_NAME \
- "," NM_SETTING_WIRELESS_SECURITY_SETTING_NAME "," NM_SETTING_IP4_CONFIG_SETTING_NAME \
- "," NM_SETTING_IP6_CONFIG_SETTING_NAME "," NM_SETTING_SERIAL_SETTING_NAME \
- "," NM_SETTING_WIFI_P2P_SETTING_NAME "," NM_SETTING_PPP_SETTING_NAME \
- "," NM_SETTING_PPPOE_SETTING_NAME "," NM_SETTING_ADSL_SETTING_NAME \
- "," NM_SETTING_GSM_SETTING_NAME "," NM_SETTING_CDMA_SETTING_NAME \
- "," NM_SETTING_BLUETOOTH_SETTING_NAME "," NM_SETTING_OLPC_MESH_SETTING_NAME \
- "," NM_SETTING_VPN_SETTING_NAME "," NM_SETTING_INFINIBAND_SETTING_NAME \
- "," NM_SETTING_BOND_SETTING_NAME "," NM_SETTING_VLAN_SETTING_NAME \
- "," NM_SETTING_BRIDGE_SETTING_NAME "," NM_SETTING_BRIDGE_PORT_SETTING_NAME \
- "," NM_SETTING_TEAM_SETTING_NAME "," NM_SETTING_TEAM_PORT_SETTING_NAME \
- "," NM_SETTING_OVS_BRIDGE_SETTING_NAME "," NM_SETTING_OVS_INTERFACE_SETTING_NAME \
- "," NM_SETTING_OVS_PATCH_SETTING_NAME "," NM_SETTING_OVS_PORT_SETTING_NAME \
- "," NM_SETTING_DCB_SETTING_NAME "," NM_SETTING_TUN_SETTING_NAME \
- "," NM_SETTING_IP_TUNNEL_SETTING_NAME "," NM_SETTING_MACSEC_SETTING_NAME \
- "," NM_SETTING_MACVLAN_SETTING_NAME "," NM_SETTING_VXLAN_SETTING_NAME \
- "," NM_SETTING_VRF_SETTING_NAME "," NM_SETTING_WPAN_SETTING_NAME \
- "," NM_SETTING_6LOWPAN_SETTING_NAME "," NM_SETTING_WIREGUARD_SETTING_NAME \
- "," NM_SETTING_PROXY_SETTING_NAME "," NM_SETTING_TC_CONFIG_SETTING_NAME \
- "," NM_SETTING_SRIOV_SETTING_NAME "," NM_SETTING_ETHTOOL_SETTING_NAME \
- "," NM_SETTING_OVS_DPDK_SETTING_NAME \
+#define NMC_FIELDS_SETTINGS_NAMES_ALL \
+ NM_SETTING_CONNECTION_SETTING_NAME \
+ "," NM_SETTING_MATCH_SETTING_NAME "," NM_SETTING_WIRED_SETTING_NAME \
+ "," NM_SETTING_VETH_SETTING_NAME "," NM_SETTING_802_1X_SETTING_NAME \
+ "," NM_SETTING_WIRELESS_SETTING_NAME "," NM_SETTING_WIRELESS_SECURITY_SETTING_NAME \
+ "," NM_SETTING_IP4_CONFIG_SETTING_NAME "," NM_SETTING_IP6_CONFIG_SETTING_NAME \
+ "," NM_SETTING_SERIAL_SETTING_NAME "," NM_SETTING_WIFI_P2P_SETTING_NAME \
+ "," NM_SETTING_PPP_SETTING_NAME "," NM_SETTING_PPPOE_SETTING_NAME \
+ "," NM_SETTING_ADSL_SETTING_NAME "," NM_SETTING_GSM_SETTING_NAME \
+ "," NM_SETTING_CDMA_SETTING_NAME "," NM_SETTING_BLUETOOTH_SETTING_NAME \
+ "," NM_SETTING_OLPC_MESH_SETTING_NAME "," NM_SETTING_VPN_SETTING_NAME \
+ "," NM_SETTING_INFINIBAND_SETTING_NAME "," NM_SETTING_BOND_SETTING_NAME \
+ "," NM_SETTING_VLAN_SETTING_NAME "," NM_SETTING_BRIDGE_SETTING_NAME \
+ "," NM_SETTING_BRIDGE_PORT_SETTING_NAME "," NM_SETTING_TEAM_SETTING_NAME \
+ "," NM_SETTING_TEAM_PORT_SETTING_NAME "," NM_SETTING_OVS_BRIDGE_SETTING_NAME \
+ "," NM_SETTING_OVS_INTERFACE_SETTING_NAME "," NM_SETTING_OVS_PATCH_SETTING_NAME \
+ "," NM_SETTING_OVS_PORT_SETTING_NAME "," NM_SETTING_DCB_SETTING_NAME \
+ "," NM_SETTING_TUN_SETTING_NAME "," NM_SETTING_IP_TUNNEL_SETTING_NAME \
+ "," NM_SETTING_MACSEC_SETTING_NAME "," NM_SETTING_MACVLAN_SETTING_NAME \
+ "," NM_SETTING_VXLAN_SETTING_NAME "," NM_SETTING_VRF_SETTING_NAME \
+ "," NM_SETTING_WPAN_SETTING_NAME "," NM_SETTING_6LOWPAN_SETTING_NAME \
+ "," NM_SETTING_WIREGUARD_SETTING_NAME "," NM_SETTING_PROXY_SETTING_NAME \
+ "," NM_SETTING_TC_CONFIG_SETTING_NAME "," NM_SETTING_SRIOV_SETTING_NAME \
+ "," NM_SETTING_ETHTOOL_SETTING_NAME "," NM_SETTING_OVS_DPDK_SETTING_NAME \
"," NM_SETTING_HOSTNAME_SETTING_NAME /* NM_SETTING_DUMMY_SETTING_NAME NM_SETTING_WIMAX_SETTING_NAME */
const NmcMetaGenericInfo *const nmc_fields_con_active_details_groups[] = {
diff --git a/clients/cli/generate-docs-nm-settings-nmcli.xml.in b/clients/cli/generate-docs-nm-settings-nmcli.xml.in
index 997d3c19ce..1d1a09ba4a 100644
--- a/clients/cli/generate-docs-nm-settings-nmcli.xml.in
+++ b/clients/cli/generate-docs-nm-settings-nmcli.xml.in
@@ -986,6 +986,11 @@
</setting>
<setting name="user" >
</setting>
+ <setting name="veth" >
+ <property name="peer"
+ alias="peer"
+ description="This property specifies the peer interface name of the veth. This property is mandatory." />
+ </setting>
<setting name="vlan" >
<property name="parent"
alias="dev"
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index c18035de83..e4b74751cb 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -7085,6 +7085,19 @@ static const NMMetaPropertyInfo *const property_infos_TUN[] = {
};
#undef _CURRENT_NM_META_SETTING_TYPE
+#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_VETH
+static const NMMetaPropertyInfo *const property_infos_VETH[] = {
+ PROPERTY_INFO_WITH_DESC (NM_SETTING_VETH_PEER,
+ .is_cli_option = TRUE,
+ .property_alias = "peer",
+ .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
+ .prompt = N_("veth peer"),
+ .property_type = &_pt_gobject_string,
+ ),
+ NULL
+};
+
+#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_VLAN
static const NMMetaPropertyInfo *const property_infos_VLAN[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_VLAN_PARENT,
@@ -7984,6 +7997,7 @@ _setting_init_fcn_wireless (ARGS_SETTING_INIT_FCN)
#define SETTING_PRETTY_NAME_TEAM_PORT N_("Team port")
#define SETTING_PRETTY_NAME_TUN N_("Tun device")
#define SETTING_PRETTY_NAME_USER N_("User settings")
+#define SETTING_PRETTY_NAME_VETH N_("Veth connection")
#define SETTING_PRETTY_NAME_VLAN N_("VLAN connection")
#define SETTING_PRETTY_NAME_VPN N_("VPN connection")
#define SETTING_PRETTY_NAME_VRF N_("VRF connection")
@@ -8224,6 +8238,14 @@ const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[] = {
.setting_init_fcn = _setting_init_fcn_tun,
),
SETTING_INFO_EMPTY (USER),
+ SETTING_INFO (VETH,
+ .valid_parts = NM_META_SETTING_VALID_PARTS (
+ NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
+ NM_META_SETTING_VALID_PART_ITEM (VETH, TRUE),
+ NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE),
+ NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
+ ),
+ ),
SETTING_INFO (VLAN,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
diff --git a/clients/common/settings-docs.h.in b/clients/common/settings-docs.h.in
index 14d83ff4cd..9e42d99d6e 100644
--- a/clients/common/settings-docs.h.in
+++ b/clients/common/settings-docs.h.in
@@ -374,6 +374,7 @@
#define DESCRIBE_DOC_NM_SETTING_TUN_PI N_("If TRUE the interface will prepend a 4 byte header describing the physical interface to the packets.")
#define DESCRIBE_DOC_NM_SETTING_TUN_VNET_HDR N_("If TRUE the IFF_VNET_HDR the tunnel packets will include a virtio network header.")
#define DESCRIBE_DOC_NM_SETTING_USER_DATA N_("A dictionary of key/value pairs with user data. This data is ignored by NetworkManager and can be used at the users discretion. The keys only support a strict ascii format, but the values can be arbitrary UTF8 strings up to a certain length.")
+#define DESCRIBE_DOC_NM_SETTING_VETH_PEER N_("This property specifies the peer interface name of the veth. This property is mandatory.")
#define DESCRIBE_DOC_NM_SETTING_VLAN_EGRESS_PRIORITY_MAP N_("For outgoing packets, a list of mappings from Linux SKB priorities to 802.1p priorities. The mapping is given in the format \"from:to\" where both \"from\" and \"to\" are unsigned integers, ie \"7:3\".")
#define DESCRIBE_DOC_NM_SETTING_VLAN_FLAGS N_("One or more flags which control the behavior and features of the VLAN interface. Flags include NM_VLAN_FLAG_REORDER_HEADERS (0x1) (reordering of output packet headers), NM_VLAN_FLAG_GVRP (0x2) (use of the GVRP protocol), and NM_VLAN_FLAG_LOOSE_BINDING (0x4) (loose binding of the interface to its master device's operating state). NM_VLAN_FLAG_MVRP (0x8) (use of the MVRP protocol). The default value of this property is NM_VLAN_FLAG_REORDER_HEADERS, but it used to be 0. To preserve backward compatibility, the default-value in the D-Bus API continues to be 0 and a missing property on D-Bus is still considered as 0.")
#define DESCRIBE_DOC_NM_SETTING_VLAN_ID N_("The VLAN identifier that the interface created by this connection should be assigned. The valid range is from 0 to 4094, without the reserved id 4095.")