summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlegBravo <oleg.bravo.ru@gmail.com>2019-10-15 16:13:37 +0300
committerLubomir Rintel <lkundrak@v3.sk>2019-10-30 16:13:47 +0100
commit12661e2f21e9c8c68d6d174f5ff5b952e394c8a2 (patch)
treec3abfed2cb039540827e66ab322ece8a8dd58235
parent5535dcf51ba759555a8e20504030dc59e526925e (diff)
downloadNetworkManager-contrail/vrouter.tar.gz
Vhost0 management integration.contrail/vrouter
Removing systemd networking configuration at RHEL8 jeopardized Contrail Virtual Router deployment (https://github.com/Juniper/contrail-vrouter ) - multiple CNI are based on this project. Problem is in configuring vhost0 - layer3 interface , used between host OS and Vrouter itself. It is being configured with systemd now , but for newest RHEL major release this functionality should be moved to NetworkManager. This will also benefit recent problems we had with OpenShift which also uses NM. Documentation was added into README.md , for new functinality testing - just follow it , creating of vhost0 interface is expted as successfull result.
-rw-r--r--Makefile.am57
-rw-r--r--README137
-rw-r--r--clients/cli/connections.c3
-rw-r--r--clients/common/nm-client-utils.c1
-rw-r--r--clients/common/nm-meta-setting-desc.c25
-rw-r--r--clients/common/settings-docs.h.in5
-rw-r--r--configure.ac10
-rw-r--r--contrib/fedora/rpm/NetworkManager.spec26
-rw-r--r--data/NetworkManager-contrail.conf2
-rw-r--r--data/meson.build7
-rw-r--r--docs/api/network-manager-docs.xml2
-rw-r--r--docs/libnm/libnm-docs.xml2
-rw-r--r--introspection/meson.build1
-rw-r--r--introspection/org.freedesktop.NetworkManager.Device.ContrailVrouter.xml20
-rw-r--r--libnm-core/meson.build2
-rw-r--r--libnm-core/nm-connection.c21
-rw-r--r--libnm-core/nm-connection.h2
-rw-r--r--libnm-core/nm-core-enum-types.c.template1
-rw-r--r--libnm-core/nm-core-internal.h1
-rw-r--r--libnm-core/nm-core-types.h1
-rw-r--r--libnm-core/nm-dbus-interface.h5
-rw-r--r--libnm-core/nm-setting-contrail-vrouter.c182
-rw-r--r--libnm-core/nm-setting-contrail-vrouter.h41
-rw-r--r--libnm/NetworkManager.h2
-rw-r--r--libnm/libnm.ver10
-rw-r--r--libnm/meson.build3
-rw-r--r--libnm/nm-autoptr.h1
-rw-r--r--libnm/nm-client.c3
-rw-r--r--libnm/nm-device-contrail-vrouter.c83
-rw-r--r--libnm/nm-device-contrail-vrouter.h32
-rw-r--r--libnm/nm-device.c3
-rw-r--r--libnm/nm-enum-types.c.template1
-rw-r--r--libnm/nm-types.h1
-rw-r--r--man/meson.build4
-rw-r--r--man/nm-contrail.xml56
-rw-r--r--meson.build4
-rw-r--r--meson_options.txt1
-rw-r--r--shared/nm-meta-setting.c7
-rw-r--r--shared/nm-meta-setting.h1
-rw-r--r--src/devices/contrail/meson.build34
-rw-r--r--src/devices/contrail/nm-contrail-factory.c116
-rw-r--r--src/devices/contrail/nm-device-contrail-vrouter.c282
-rw-r--r--src/devices/contrail/nm-device-contrail-vrouter.h22
-rw-r--r--src/devices/meson.build4
-rw-r--r--src/devices/nm-device.c2
-rw-r--r--src/nm-types.h1
-rw-r--r--src/platform/nm-linux-platform.c78
47 files changed, 1263 insertions, 42 deletions
diff --git a/Makefile.am b/Makefile.am
index dde8a7b03c..4cebb0da45 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -547,6 +547,8 @@ introspection_sources = \
introspection/org.freedesktop.NetworkManager.Device.Bond.h \
introspection/org.freedesktop.NetworkManager.Device.Bridge.c \
introspection/org.freedesktop.NetworkManager.Device.Bridge.h \
+ introspection/org.freedesktop.NetworkManager.Device.ContrailVrouter.c \
+ introspection/org.freedesktop.NetworkManager.Device.ContrailVrouter.h \
introspection/org.freedesktop.NetworkManager.Device.Dummy.c \
introspection/org.freedesktop.NetworkManager.Device.Dummy.h \
introspection/org.freedesktop.NetworkManager.Device.Generic.c \
@@ -636,6 +638,7 @@ DBUS_INTERFACE_DOCS = \
docs/api/dbus-org.freedesktop.NetworkManager.Device.Bluetooth.xml \
docs/api/dbus-org.freedesktop.NetworkManager.Device.Bond.xml \
docs/api/dbus-org.freedesktop.NetworkManager.Device.Bridge.xml \
+ docs/api/dbus-org.freedesktop.NetworkManager.Device.ContrailVrouter.xml \
docs/api/dbus-org.freedesktop.NetworkManager.Device.Dummy.xml \
docs/api/dbus-org.freedesktop.NetworkManager.Device.Generic.xml \
docs/api/dbus-org.freedesktop.NetworkManager.Device.IPTunnel.xml \
@@ -704,6 +707,7 @@ dbusinterfaces_DATA = \
introspection/org.freedesktop.NetworkManager.Device.Bond.xml \
introspection/org.freedesktop.NetworkManager.Device.Bridge.xml \
introspection/org.freedesktop.NetworkManager.Device.Dummy.xml \
+ introspection/org.freedesktop.NetworkManager.Device.ContrailVrouter.xml \
introspection/org.freedesktop.NetworkManager.Device.Generic.xml \
introspection/org.freedesktop.NetworkManager.Device.IPTunnel.xml \
introspection/org.freedesktop.NetworkManager.Device.Infiniband.xml \
@@ -776,6 +780,7 @@ libnm_core_lib_h_pub_real = \
libnm-core/nm-setting-bridge-port.h \
libnm-core/nm-setting-bridge.h \
libnm-core/nm-setting-cdma.h \
+ libnm-core/nm-setting-contrail-vrouter.h \
libnm-core/nm-setting-connection.h \
libnm-core/nm-setting-dcb.h \
libnm-core/nm-setting-dummy.h \
@@ -850,6 +855,7 @@ libnm_core_lib_c_settings_real = \
libnm-core/nm-setting-bridge-port.c \
libnm-core/nm-setting-bridge.c \
libnm-core/nm-setting-cdma.c \
+ libnm-core/nm-setting-contrail-vrouter.c \
libnm-core/nm-setting-connection.c \
libnm-core/nm-setting-dcb.c \
libnm-core/nm-setting-dummy.c \
@@ -1189,6 +1195,7 @@ libnm_lib_h_pub_real = \
libnm/nm-autoptr.h \
libnm/nm-checkpoint.h \
libnm/nm-client.h \
+ libnm/nm-device-contrail-vrouter.h \
libnm/nm-device-6lowpan.h \
libnm/nm-device-adsl.h \
libnm/nm-device-bond.h \
@@ -1255,6 +1262,7 @@ libnm_lib_c_real = \
libnm/nm-device-bond.c \
libnm/nm-device-bridge.c \
libnm/nm-device-bt.c \
+ libnm/nm-device-contrail-vrouter.c \
libnm/nm-device-dummy.c \
libnm/nm-device-ethernet.c \
libnm/nm-device-generic.c \
@@ -3657,6 +3665,48 @@ EXTRA_DIST += \
src/devices/ovs/meson.build
###############################################################################
+# src/devices/contrail
+###############################################################################
+
+if WITH_CONTRAIL
+
+if HAVE_SYSTEMD
+
+systemdnmunitdir = $(systemdsystemunitdir)/NetworkManager.service.d
+systemdnmunit_DATA = \
+ data/NetworkManager-contrail.conf
+
+endif
+
+core_plugins += src/devices/contrail/libnm-device-plugin-contrail.la
+
+src_devices_contrail_libnm_device_plugin_contrail_la_SOURCES = \
+ src/devices/contrail/nm-contrail-factory.c \
+ src/devices/contrail/nm-device-contrail-vrouter.c \
+ src/devices/contrail/nm-device-contrail-vrouter.h
+
+src_devices_contrail_libnm_device_plugin_contrail_la_CPPFLAGS = \
+ $(src_cppflags_device_plugin) \
+ $(NULL)
+
+src_devices_contrail_libnm_device_plugin_contrail_la_LDFLAGS = \
+ -module -avoid-version \
+ -Wl,--version-script="$(srcdir)/linker-script-devices.ver"
+
+src_devices_contrail_libnm_device_plugin_contrail_la_LIBADD = \
+ $(GLIB_LIBS)
+
+check-local-devices-contrail: src/devices/contrail/libnm-device-plugin-contrail.la
+ $(srcdir)/tools/check-exports.sh $(builddir)/src/devices/contrail/.libs/libnm-device-plugin-contrail.so "$(srcdir)/linker-script-devices.ver"
+ $(call check_so_symbols,$(builddir)/src/devices/contrail/.libs/libnm-device-plugin-contrail.so)
+
+endif
+
+EXTRA_DIST += \
+ data/NetworkManager-contrail.conf \
+ src/devices/contrail/meson.build
+
+###############################################################################
# src/dnsmasq/tests
###############################################################################
@@ -4763,6 +4813,13 @@ EXTRA_DIST += man/nm-openvswitch.7
dist_dependencies += man/nm-openvswitch.7
endif
+if WITH_CONTRAIL
+man_pages += man/nm-contrail.7
+else
+EXTRA_DIST += man/nm-contrail.7
+dist_dependencies += man/nm-contrail.7
+endif
+
if CONFIG_PLUGIN_IFCFG_RH
man_pages_autogen += man/nm-settings-ifcfg-rh.5
else
diff --git a/README b/README
index 1676c2d6e7..bcec1d9385 100644
--- a/README
+++ b/README
@@ -74,6 +74,143 @@ aren't expecting the dynamic requests that NetworkManager and wpa_supplicant
make. Driver bugs should be filed in the bug tracker of the distribution being
run, since often distributions customize their kernel and drivers.
+
+******************
+2008-12-11: NetworkManager core daemon has moved to git.freedesktop.org!
+
+git clone git://git.freedesktop.org/git/NetworkManager/NetworkManager.git
+******************
+
+Environment
+--------------
+RHEL 8.0
+NetworkManager 1.14.0
+installed vrouter.ko for running kernel version (unloaded)
+installed vif utility (contrail-vrouter-utils)
+
+Networking that Just Works
+--------------------------
+How to build RPMs
+------------------
+git clone --single-branch --branch contrail-vrouter https://github.com/progmaticlab/NetworkManager.git
+export PYTHON=python3
+export NM_RPMBUILD_ARGS="--without=adsl --without=bluetooth --without=wwan --without=team --without=wifi --without=ovs"
+NetworkManager/contrib/fedora/REQUIRED_PACKAGES
+NetworkManager/contrib/fedora/rpm/build.sh
+
+NetworkManager attempts to keep an active network connection available at all
+times. The point of NetworkManager is to make networking configuration and
+setup as painless and automatic as possible. NetworkManager is intended to
+replace default route, replace other routes, set IP addresses, and in general
+configure networking as NM sees fit (with the possibility of manual override as
+necessary). In effect, the goal of NetworkManager is to make networking Just
+Work with a minimum of user hassle, but still allow customization and a high
+level of manual network control. If you have special needs, we'd like to hear
+about them, but understand that NetworkManager is not intended for every
+use-case.
+How to apply Contrail vrouter plugin
+------------------
+dnf remove -y NetworkManager-libnm*
+rpm -iv NetworkManager/contrib/fedora/rpm/latest/RPMS/x86_64/NetworkManager-libnm
+rpm -iv NetworkManager/contrib/fedora/rpm/latest/RPMS/x86_64/NetworkManager-1.14.0*
+rpm -iv NetworkManager/contrib/fedora/rpm/latest/RPMS/x86_64/NetworkManager-contrail-1.14*
+systemctl daemon-reload
+systemctl restart NetworkManager
+
+NetworkManager will attempt to keep every network device in the system up and
+active, as long as the device is available for use (has a cable plugged in,
+the killswitch isn't turned on, etc). Network connections can be set to
+'autoconnect', meaning that NetworkManager will make that connection active
+whenever it and the hardware is available.
+Usage
+-------
+nmcli c add type contrail-vrouter physdev enp0s3 conn.interface vhost0 autoconnect no
+nmcli c up contrail-vrouter-vhost0
+nmcli c down contrail-vrouter-vhost0
+
+"Settings services" store lists of user- or administrator-defined "connections",
+which contain all the settings and parameters required to connect to a specific
+network. NetworkManager will _never_ activate a connection that is not in this
+list, or that the user has not directed NetworkManager to connect to.
+Troubleshooting
+----------------
+To set maximum log level:
+nmcli general logging level TRACE domains ALL
+
+To get all system logs regarding the component "NetworkManager" for last hour and get new logs in real time (tail -f):
+journalctl -f --no-tail --since "1 hour ago" -u NetworkManager
+
+How it works:
+To get all system logs regarding the component "NetworkManager" with keyword "CONTRAILl" for last hour and get new logs in real time (tail -f):
+journalctl -f --no-tail -g "CONTRAIL" --since "1 hour ago" -u NetworkManager
+
+The NetworkManager daemon runs as a privileged service (since it must access
+and control hardware), but provides a D-Bus interface on the system bus to
+allow for fine-grained control of networking. NetworkManager does not store
+connections or settings, it is only the mechanism by which those connections
+are selected and activated.
+To load vrouter module or get error message if it's already loaded:
+modprobe -v --first-time vrouter
+
+To store pre-defined network connections, two separate services, the "system
+settings service" and the "user settings service" store connection information
+and provide these to NetworkManager, also via D-Bus. Each settings service
+can determine how and where it persistently stores the connection information;
+for example, the GNOME applet stores its configuration in GConf, and the system
+settings service stores its config in distro-specific formats, or in a distro-
+agnostic format, depending on user/administrator preference.
+To unload vrouter module or get error message if it's already unloaded:
+modprobe -rv --first-time vrouter
+
+A variety of other system services are used by NetworkManager to provide
+network functionality: wpa_supplicant for wireless connections and 802.1x
+wired connections, pppd for PPP and mobile broadband connections, DHCP clients
+for dynamic IP addressing, dnsmasq for proxy nameserver and DHCP server
+functionality for internet connection sharing, and avahi-autoipd for IPv4
+link-local addresses. Most communication with these daemons occurs, again,
+via D-Bus.
+To get log level for core component of NetworkManager:
+nmcli general logging
+
+To get list of network devices (network interfaces):
+nmcli device
+
+Why doesn't my network Just Work?
+To set debug log level for core component of NetworkManager:
+nmcli g log level DEBUG
+
+Driver problems are the #1 cause of why NetworkManager sometimes fails to
+connect to wireless networks. Often, the driver simply doesn't behave in a
+consistent manner, or is just plain buggy. NetworkManager supports _only_
+those drivers that are shipped with the upstream Linux kernel, because only
+those drivers can be easily fixed and debugged. ndiswrapper, vendor binary
+drivers, or other out-of-tree drivers may or may not work well with
+NetworkManager, precisely because they have not been vetted and improved by the
+open-source community, and because problems in these drivers usually cannot
+be fixed.
+To notify NetworkManager about changes after connection profile was manually changed (/etc/NetworkManager/system-connections/), not by nmcli means
+nmcli connection reload
+
+Sometimes, command-line tools like 'iwconfig' will work, but NetworkManager will
+fail. This is again often due to buggy drivers, because these drivers simply
+aren't expecting the dynamic requests that NetworkManager and wpa_supplicant
+make. Driver bugs should be filed in the bug tracker of the distribution being
+run, since often distributions customize their kernel and drivers.
+To delete all connection profiles with keyword "vhost" in their names (by means of nmcli):
+for i in `nmcli -f NAME c show | grep "vhost"`; do nmcli c del $i; done
+
+Sometimes, it really is NetworkManager's fault. If you think that's the case,
+please file a bug at http://bugzilla.gnome.org and choose the NetworkManager
+component. Attaching the output of /var/log/messages or /var/log/daemon.log
+(wherever your distribution directs syslog's 'daemon' facility output) is often
+very helpful, and (if you can get) a working wpa_supplicant config file helps
+enormously.
+
+To delete all connection profiles with keyword "contrail" in their names (manual deleting, not by nmcli means):
+rm -rf /etc/NetworkManager/system-connections/contrail*
+
+
+
Sometimes, it really is NetworkManager's fault. If you think that's
the case, please file a bug at:
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
index 67d9bef772..963aca3dfa 100644
--- a/clients/cli/connections.c
+++ b/clients/cli/connections.c
@@ -855,7 +855,8 @@ const NmcMetaGenericInfo *const metagen_con_active_vpn[_NMC_GENERIC_INFO_TYPE_CO
NM_SETTING_TC_CONFIG_SETTING_NAME"," \
NM_SETTING_SRIOV_SETTING_NAME"," \
NM_SETTING_ETHTOOL_SETTING_NAME"," \
- NM_SETTING_OVS_DPDK_SETTING_NAME \
+ NM_SETTING_OVS_DPDK_SETTING_NAME"," \
+ NM_SETTING_CONTRAIL_VROUTER_SETTING_NAME
// NM_SETTING_DUMMY_SETTING_NAME
// NM_SETTING_WIMAX_SETTING_NAME
diff --git a/clients/common/nm-client-utils.c b/clients/common/nm-client-utils.c
index f63d3c7d30..2882ae906f 100644
--- a/clients/common/nm-client-utils.c
+++ b/clients/common/nm-client-utils.c
@@ -343,6 +343,7 @@ NM_UTILS_LOOKUP_STR_DEFINE (nmc_device_reason_to_string, NMDeviceStateReason,
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_IP_METHOD_UNSUPPORTED, N_("The selected IP method is not supported")),
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_SRIOV_CONFIGURATION_FAILED, N_("Failed to configure SR-IOV parameters")),
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_PEER_NOT_FOUND, N_("The Wi-Fi P2P peer could not be found")),
+ NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_CONTRAIL_VROUTER_FAILED, N_("Contrail vrouter kernel module failed")),
)
NM_UTILS_LOOKUP_STR_DEFINE (nm_active_connection_state_reason_to_string, NMActiveConnectionStateReason,
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index 7021c5280b..58d30185fd 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -5210,6 +5210,19 @@ static const NMMetaPropertyInfo *const property_infos_CONNECTION[] = {
};
#undef _CURRENT_NM_META_SETTING_TYPE
+#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_CONTRAIL_VROUTER
+static const NMMetaPropertyInfo *const property_infos_CONTRAIL_VROUTER[] = {
+ PROPERTY_INFO_WITH_DESC (NM_SETTING_CONTRAIL_VROUTER_PHYSDEV,
+ .is_cli_option = TRUE,
+ .property_alias = "physdev",
+ .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
+ .prompt = N_("Physical device name"),
+ .property_type = &_pt_gobject_string,
+ ),
+ NULL
+};
+
+#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_DCB
static const NMMetaPropertyInfo *const property_infos_DCB[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_FCOE_FLAGS,
@@ -7646,6 +7659,7 @@ _setting_init_fcn_wireless (ARGS_SETTING_INIT_FCN)
#define SETTING_PRETTY_NAME_BRIDGE_PORT N_("Bridge port")
#define SETTING_PRETTY_NAME_CDMA N_("CDMA mobile broadband connection")
#define SETTING_PRETTY_NAME_CONNECTION N_("General settings")
+#define SETTING_PRETTY_NAME_CONTRAIL_VROUTER N_("Contrail vrouter settings")
#define SETTING_PRETTY_NAME_DCB N_("DCB settings")
#define SETTING_PRETTY_NAME_DUMMY N_("Dummy settings")
#define SETTING_PRETTY_NAME_ETHTOOL N_("Ethtool settings")
@@ -7771,6 +7785,17 @@ const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[] = {
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
),
+ SETTING_INFO (CONTRAIL_VROUTER,
+ .alias = "contrail-vrouter",
+ .valid_parts = NM_META_SETTING_VALID_PARTS (
+ NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
+ NM_META_SETTING_VALID_PART_ITEM (CONTRAIL_VROUTER, TRUE),
+ NM_META_SETTING_VALID_PART_ITEM (IP4_CONFIG, TRUE),
+ NM_META_SETTING_VALID_PART_ITEM (IP6_CONFIG, TRUE),
+ NM_META_SETTING_VALID_PART_ITEM (WIRED, TRUE),
+ NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, TRUE),
+ ),
+ ),
SETTING_INFO_EMPTY (GENERIC,
.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 a1b9784af1..87fb0e548c 100644
--- a/clients/common/settings-docs.h.in
+++ b/clients/common/settings-docs.h.in
@@ -65,8 +65,8 @@
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_PEAPLABEL N_("Forces use of the new PEAP label during key derivation. Some RADIUS servers may require forcing the new PEAP label to interoperate with PEAPv1. Set to \"1\" to force use of the new PEAP label. See the wpa_supplicant documentation for more details.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_PEAPVER N_("Forces which PEAP version is used when PEAP is set as the EAP method in the \"eap\" property. When unset, the version reported by the server will be used. Sometimes when using older RADIUS servers, it is necessary to force the client to use a particular PEAP version. To do so, this property may be set to \"0\" or \"1\" to force that specific PEAP version.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES N_("List of strings to be matched against the altSubjectName of the certificate presented by the authentication server during the inner \"phase 2\" authentication. If the list is empty, no verification of the server certificate's altSubjectName is performed.")
-#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_AUTH N_("Specifies the allowed \"phase 2\" inner non-EAP authentication method when an EAP method that uses an inner TLS tunnel is specified in the \"eap\" property. Recognized non-EAP \"phase 2\" methods are \"pap\", \"chap\", \"mschap\", \"mschapv2\", \"gtc\", \"otp\", \"md5\", and \"tls\". Each \"phase 2\" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details.")
-#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_AUTHEAP N_("Specifies the allowed \"phase 2\" inner EAP-based authentication method when an EAP method that uses an inner TLS tunnel is specified in the \"eap\" property. Recognized EAP-based \"phase 2\" methods are \"md5\", \"mschapv2\", \"otp\", \"gtc\", and \"tls\". Each \"phase 2\" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details.")
+#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_AUTH N_("Specifies the allowed \"phase 2\" inner non-EAP authentication methods when an EAP method that uses an inner TLS tunnel is specified in the \"eap\" property. Recognized non-EAP \"phase 2\" methods are \"pap\", \"chap\", \"mschap\", \"mschapv2\", \"gtc\", \"otp\", \"md5\", and \"tls\". Each \"phase 2\" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details.")
+#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_AUTHEAP N_("Specifies the allowed \"phase 2\" inner EAP-based authentication methods when an EAP method that uses an inner TLS tunnel is specified in the \"eap\" property. Recognized EAP-based \"phase 2\" methods are \"md5\", \"mschapv2\", \"otp\", \"gtc\", and \"tls\". Each \"phase 2\" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT N_("Contains the \"phase 2\" CA certificate if used by the EAP method specified in the \"phase2-auth\" or \"phase2-autheap\" properties. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD N_("The password used to access the \"phase2\" CA certificate stored in \"phase2-ca-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"phase2-ca-cert-password\" property.")
@@ -155,6 +155,7 @@
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_UUID N_("A universally unique identifier for the connection, for example generated with libuuid. It should be assigned when the connection is created, and never changed as long as the connection still applies to the same network. For example, it should not be changed when the \"id\" property or NMSettingIP4Config changes, but might need to be re-created when the Wi-Fi SSID, mobile broadband network provider, or \"type\" property changes. The UUID must be in the format \"2815492f-7e56-435e-b2e9-246bd7cdc664\" (ie, contains only hexadecimal characters and \"-\").")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_WAIT_DEVICE_TIMEOUT N_("Timeout in milliseconds to wait for device at startup. During boot, devices may take a while to be detected by the driver. This property will cause to delay NetworkManager-wait-online.service and nm-online to give the device a chance to appear. Note that this property only works together with NMSettingConnection:interface-name to identify the device that will be waited for. The value 0 means no wait time. The default value is -1, which currently has the same meaning as no wait time.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_ZONE N_("The trust level of a the connection. Free form case-insensitive string (for example \"Home\", \"Work\", \"Public\"). NULL or unspecified zone means the connection will be placed in the default zone as defined by the firewall. When updating this property on a currently activated connection, the change takes effect immediately.")
+#define DESCRIBE_DOC_NM_SETTING_CONTRAIL_VROUTER_PHYSDEV N_("The physical device name.")
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_FLAGS N_("Specifies the NMSettingDcbFlags for the DCB FCoE application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).")
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_MODE N_("The FCoE controller mode; either \"fabric\" (default) or \"vn2vn\".")
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_PRIORITY N_("The highest User Priority (0 - 7) which FCoE frames should use, or -1 for default priority. Only used when the \"app-fcoe-flags\" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag.")
diff --git a/configure.ac b/configure.ac
index 41bb76df68..84c5be4c58 100644
--- a/configure.ac
+++ b/configure.ac
@@ -817,6 +817,13 @@ if test "${enable_ovs}" != "no"; then
fi
AM_CONDITIONAL(WITH_OPENVSWITCH, test "${enable_ovs}" = "yes")
+# Contrail vrouter integration
+AC_ARG_ENABLE(contrail, AS_HELP_STRING([--enable-contrail], [enable Contrail vrouter support]))
+if test "${enable_contrail}" != "no"; then
+ enable_contrail='yes'
+fi
+AM_CONDITIONAL(WITH_CONTRAIL, test "${enable_contrail}" = "yes")
+
# DHCP client support
AC_ARG_WITH([dhclient],
AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient support]))
@@ -1229,6 +1236,8 @@ if test "$build_docs" != "yes" -a \
\
-f "$srcdir"/man/nm-openvswitch.7 -a \
\
+ -f "$srcdir"/man/nm-contrail.7 -a \
+ \
-f "$srcdir"/man/nm-settings-ifcfg-rh.5 -a \
-f "$srcdir"/man/nm-settings-keyfile.5 -a \
-f "$srcdir"/man/nm-settings.5 -a \
@@ -1301,6 +1310,7 @@ echo " ofono: $with_ofono"
echo " concheck: $enable_concheck"
echo " libteamdctl: $enable_teamdctl"
echo " ovs: $enable_ovs"
+echo " contrail: $enable_contrail"
echo " nmcli: $build_nmcli"
echo " nmtui: $build_nmtui"
echo " iwd: $ac_with_iwd"
diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec
index 317fe9a82a..8133ec16b9 100644
--- a/contrib/fedora/rpm/NetworkManager.spec
+++ b/contrib/fedora/rpm/NetworkManager.spec
@@ -58,6 +58,7 @@
%bcond_with test
%bcond_with lto
%bcond_with sanitizer
+%bcond_without contrail
%if 0%{?fedora}
%bcond_without connectivity_fedora
%else
@@ -480,6 +481,17 @@ by nm-connection-editor and nm-applet in a non-graphical environment.
%endif
+%if %{with contrail}
+%package contrail
+Summary: Contrail vrouter device plugin for NetworkManager
+Group: System Environment/Base
+Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
+
+%description contrail
+This package contains NetworkManager support for Contrail vrouters.
+%endif
+
+
%prep
%autosetup -p1 -n NetworkManager-%{real_version}
@@ -701,7 +713,11 @@ intltoolize --automake --copy --force
--with-config-dns-rc-manager-default=%{dns_rc_manager_default} \
--with-config-logging-backend-default=%{logging_backend_default} \
--enable-json-validation
-
+%if %{with contrail}
+ --enable-contrail=yes
+%else
+ --enable-contrail=no
+%endif
make %{?_smp_mflags}
%endif # end autotools
@@ -926,6 +942,14 @@ fi
%endif
+%if %{with contrail}
+%files contrail
+%{nmplugindir}/libnm-device-plugin-contrail.so
+%{systemd_dir}/NetworkManager.service.d/NetworkManager-contrail.conf
+%{_mandir}/man7/nm-contrail.7*
+%endif
+
+
%files libnm -f %{name}.lang
%{_libdir}/libnm.so.*
%{_libdir}/girepository-1.0/NM-1.0.typelib
diff --git a/data/NetworkManager-contrail.conf b/data/NetworkManager-contrail.conf
new file mode 100644
index 0000000000..f2ca3e4155
--- /dev/null
+++ b/data/NetworkManager-contrail.conf
@@ -0,0 +1,2 @@
+[Unit]
+After=contrail.service
diff --git a/data/meson.build b/data/meson.build
index c317877070..476a14eac7 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -40,6 +40,13 @@ if install_systemdunitdir
install_dir: join_paths(systemd_systemdsystemunitdir, 'NetworkManager.service.d'),
)
endif
+
+ if enable_contrail
+ install_data(
+ 'NetworkManager-contrail.conf',
+ install_dir: join_paths(systemd_systemdsystemunitdir, 'NetworkManager.service.d')
+ )
+ endif
endif
if install_udevdir
diff --git a/docs/api/network-manager-docs.xml b/docs/api/network-manager-docs.xml
index fd7a1c3ec4..5c818f006c 100644
--- a/docs/api/network-manager-docs.xml
+++ b/docs/api/network-manager-docs.xml
@@ -79,6 +79,7 @@
<xi:include href="../../man/nm-online.xml"/>
<xi:include href="../../man/nm-initrd-generator.xml"/>
<xi:include href="../../man/nm-openvswitch.xml"><xi:fallback /></xi:include>
+ <xi:include href="../../man/nm-contrail.xml"/>
</part>
<part id="ref-settings">
@@ -209,6 +210,7 @@
<xi:include href="dbus-org.freedesktop.NetworkManager.Device.Wireless.xml"/>
<xi:include href="dbus-org.freedesktop.NetworkManager.Device.Wpan.xml"/>
<xi:include href="dbus-org.freedesktop.NetworkManager.PPP.xml"/>
+ <xi:include href="dbus-org.freedesktop.NetworkManager.Device.ContrailVrouter.xml"/>
</chapter>
<chapter id="ref-dbus-active-connections">
diff --git a/docs/libnm/libnm-docs.xml b/docs/libnm/libnm-docs.xml
index 357cfe16d0..4c0091f1b8 100644
--- a/docs/libnm/libnm-docs.xml
+++ b/docs/libnm/libnm-docs.xml
@@ -319,6 +319,7 @@ print ("NetworkManager version " + client.get_version())]]></programlisting></in
<xi:include href="xml/nm-setting-bridge-port.xml"/>
<xi:include href="xml/nm-setting-bridge.xml"/>
<xi:include href="xml/nm-setting-cdma.xml"/>
+ <xi:include href="xml/nm-setting-contrail-vrouter.xml"/>
<xi:include href="xml/nm-setting-dcb.xml"/>
<xi:include href="xml/nm-setting-dummy.xml"/>
<xi:include href="xml/nm-setting-ethtool.xml"/>
@@ -370,6 +371,7 @@ print ("NetworkManager version " + client.get_version())]]></programlisting></in
<xi:include href="xml/nm-device-bond.xml"/>
<xi:include href="xml/nm-device-bridge.xml"/>
<xi:include href="xml/nm-device-bt.xml"/>
+ <xi:include href="xml/nm-device-contrail-vrouter.xml"/>
<xi:include href="xml/nm-device-dummy.xml"/>
<xi:include href="xml/nm-device-ethernet.xml"/>
<xi:include href="xml/nm-device-generic.xml"/>
diff --git a/introspection/meson.build b/introspection/meson.build
index 10b0405053..5f2b0b43d6 100644
--- a/introspection/meson.build
+++ b/introspection/meson.build
@@ -15,6 +15,7 @@ ifaces = [
'org.freedesktop.NetworkManager.Device.Bluetooth',
'org.freedesktop.NetworkManager.Device.Bond',
'org.freedesktop.NetworkManager.Device.Bridge',
+ 'org.freedesktop.NetworkManager.Device.ContrailVrouter',
'org.freedesktop.NetworkManager.Device.Dummy',
'org.freedesktop.NetworkManager.Device.Generic',
'org.freedesktop.NetworkManager.Device.IPTunnel',
diff --git a/introspection/org.freedesktop.NetworkManager.Device.ContrailVrouter.xml b/introspection/org.freedesktop.NetworkManager.Device.ContrailVrouter.xml
new file mode 100644
index 0000000000..65dbb34488
--- /dev/null
+++ b/introspection/org.freedesktop.NetworkManager.Device.ContrailVrouter.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/">
+ <!--
+ org.freedesktop.NetworkManager.Device.ContrailVrouter:
+ @short_description: ContrailVrouter Device
+
+ -->
+ <interface name="org.freedesktop.NetworkManager.Device.ContrailVrouter">
+
+ <!--
+ PropertiesChanged:
+ @properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
+ -->
+ <signal name="PropertiesChanged">
+ <arg name="properties" type="a{sv}"/>
+ </signal>
+ </interface>
+</node>
diff --git a/libnm-core/meson.build b/libnm-core/meson.build
index 4c72590e7b..ce93b00914 100644
--- a/libnm-core/meson.build
+++ b/libnm-core/meson.build
@@ -25,6 +25,7 @@ libnm_core_headers = files(
'nm-setting-bridge.h',
'nm-setting-cdma.h',
'nm-setting-connection.h',
+ 'nm-setting-contrail-vrouter.h',
'nm-setting-dcb.h',
'nm-setting-dummy.h',
'nm-setting-ethtool.h',
@@ -119,6 +120,7 @@ libnm_core_settings_sources = files(
'nm-setting-bridge.c',
'nm-setting-cdma.c',
'nm-setting-connection.c',
+ 'nm-setting-contrail-vrouter.c',
'nm-setting-dcb.c',
'nm-setting-dummy.c',
'nm-setting-ethtool.c',
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c
index 307b9d6234..2d9974b476 100644
--- a/libnm-core/nm-connection.c
+++ b/libnm-core/nm-connection.c
@@ -891,6 +891,8 @@ _supports_addr_family (NMConnection *self, int family)
g_return_val_if_fail (connection_type, TRUE);
if (strcmp (connection_type, NM_SETTING_OVS_INTERFACE_SETTING_NAME) == 0)
return TRUE;
+ if (strcmp (connection_type, NM_SETTING_CONTRAIL_VROUTER_SETTING_NAME) == 0)
+ return TRUE;
if (strcmp (connection_type, NM_SETTING_WPAN_SETTING_NAME) == 0)
return FALSE;
if (strcmp (connection_type, NM_SETTING_6LOWPAN_SETTING_NAME) == 0)
@@ -2694,7 +2696,8 @@ nm_connection_is_virtual (NMConnection *connection)
NM_SETTING_TUN_SETTING_NAME,
NM_SETTING_VLAN_SETTING_NAME,
NM_SETTING_VXLAN_SETTING_NAME,
- NM_SETTING_WIREGUARD_SETTING_NAME))
+ NM_SETTING_WIREGUARD_SETTING_NAME,
+ NM_SETTING_CONTRAIL_VROUTER_SETTING_NAME))
return TRUE;
if (nm_streq (type, NM_SETTING_INFINIBAND_SETTING_NAME)) {
@@ -3339,6 +3342,22 @@ _nm_connection_get_setting_bluetooth_for_nap (NMConnection *connection)
return NULL;
}
+/**
+ * nm_connection_get_setting_contrail_vrouter:
+ * @connection: the #NMConnection
+ *
+ * A shortcut to return any #NMSettingContrailVrouter the connection might contain.
+ *
+ * Returns: (transfer none): an #NMSettingContrailVrouter if the connection contains one, otherwise %NULL
+ *
+ * Since: 1.14
+ **/
+NMSettingContrailVrouter *
+nm_connection_get_setting_contrail_vrouter (NMConnection *connection)
+{
+ return _connection_get_setting_check (connection, NM_TYPE_SETTING_CONTRAIL_VROUTER);
+}
+
/*****************************************************************************/
static void
diff --git a/libnm-core/nm-connection.h b/libnm-core/nm-connection.h
index 86041f3601..d619c8d023 100644
--- a/libnm-core/nm-connection.h
+++ b/libnm-core/nm-connection.h
@@ -190,6 +190,8 @@ NMSettingBridgePort * nm_connection_get_setting_bridge_port (NMConnec
NMSettingCdma * nm_connection_get_setting_cdma (NMConnection *connection);
NMSettingConnection * nm_connection_get_setting_connection (NMConnection *connection);
NMSettingDcb * nm_connection_get_setting_dcb (NMConnection *connection);
+NM_AVAILABLE_IN_1_14
+NMSettingContrailVrouter * nm_connection_get_setting_contrail_vrouter (NMConnection *connection);
NM_AVAILABLE_IN_1_8
NMSettingDummy * nm_connection_get_setting_dummy (NMConnection *connection);
NMSettingGeneric * nm_connection_get_setting_generic (NMConnection *connection);
diff --git a/libnm-core/nm-core-enum-types.c.template b/libnm-core/nm-core-enum-types.c.template
index b6cb38eecc..8f68995f92 100644
--- a/libnm-core/nm-core-enum-types.c.template
+++ b/libnm-core/nm-core-enum-types.c.template
@@ -16,6 +16,7 @@
#include "nm-setting-bridge.h"
#include "nm-setting-cdma.h"
#include "nm-setting-connection.h"
+#include "nm-setting-contrail-vrouter.h"
#include "nm-setting-dcb.h"
#include "nm-setting-dummy.h"
#include "nm-setting-generic.h"
diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h
index cdd9be88fd..403432c877 100644
--- a/libnm-core/nm-core-internal.h
+++ b/libnm-core/nm-core-internal.h
@@ -33,6 +33,7 @@
#include "nm-setting-bridge.h"
#include "nm-setting-cdma.h"
#include "nm-setting-connection.h"
+#include "nm-setting-contrail-vrouter.h"
#include "nm-setting-dcb.h"
#include "nm-setting-dummy.h"
#include "nm-setting-generic.h"
diff --git a/libnm-core/nm-core-types.h b/libnm-core/nm-core-types.h
index d7c1b5b5b7..951a4bd53f 100644
--- a/libnm-core/nm-core-types.h
+++ b/libnm-core/nm-core-types.h
@@ -23,6 +23,7 @@ typedef struct _NMSettingBridge NMSettingBridge;
typedef struct _NMSettingBridgePort NMSettingBridgePort;
typedef struct _NMSettingCdma NMSettingCdma;
typedef struct _NMSettingConnection NMSettingConnection;
+typedef struct _NMSettingContrailVrouter NMSettingContrailVrouter;
typedef struct _NMSettingDcb NMSettingDcb;
typedef struct _NMSettingDummy NMSettingDummy;
typedef struct _NMSettingEthtool NMSettingEthtool;
diff --git a/libnm-core/nm-dbus-interface.h b/libnm-core/nm-dbus-interface.h
index ae3c41a7a4..f914dab185 100644
--- a/libnm-core/nm-dbus-interface.h
+++ b/libnm-core/nm-dbus-interface.h
@@ -34,6 +34,7 @@
#define NM_DBUS_INTERFACE_DEVICE_BLUETOOTH NM_DBUS_INTERFACE_DEVICE ".Bluetooth"
#define NM_DBUS_INTERFACE_DEVICE_BOND NM_DBUS_INTERFACE_DEVICE ".Bond"
#define NM_DBUS_INTERFACE_DEVICE_BRIDGE NM_DBUS_INTERFACE_DEVICE ".Bridge"
+#define NM_DBUS_INTERFACE_DEVICE_CONTRAIL_VROUTER NM_DBUS_INTERFACE_DEVICE ".ContrailVrouter"
#define NM_DBUS_INTERFACE_DEVICE_DUMMY NM_DBUS_INTERFACE_DEVICE ".Dummy"
#define NM_DBUS_INTERFACE_DEVICE_GENERIC NM_DBUS_INTERFACE_DEVICE ".Generic"
#define NM_DBUS_INTERFACE_DEVICE_GRE NM_DBUS_INTERFACE_DEVICE ".Gre"
@@ -209,6 +210,7 @@ typedef enum {
* @NM_DEVICE_TYPE_6LOWPAN: 6LoWPAN interface
* @NM_DEVICE_TYPE_WIREGUARD: a WireGuard interface
* @NM_DEVICE_TYPE_WIFI_P2P: an 802.11 Wi-Fi P2P device (Since: 1.16)
+ * @NM_DEVICE_TYPE_CONTRAIL_VROUTER: a Contrail Vrouter
*
* #NMDeviceType values indicate the type of hardware represented by a
* device object.
@@ -245,6 +247,7 @@ typedef enum {
NM_DEVICE_TYPE_6LOWPAN = 28,
NM_DEVICE_TYPE_WIREGUARD = 29,
NM_DEVICE_TYPE_WIFI_P2P = 30,
+ NM_DEVICE_TYPE_CONTRAIL_VROUTER = 31,
} NMDeviceType;
/**
@@ -565,6 +568,7 @@ typedef enum {
* @NM_DEVICE_STATE_REASON_IP_METHOD_UNSUPPORTED: The selected IP method is not supported
* @NM_DEVICE_STATE_REASON_SRIOV_CONFIGURATION_FAILED: configuration of SR-IOV parameters failed
* @NM_DEVICE_STATE_REASON_PEER_NOT_FOUND: The Wi-Fi P2P peer could not be found
+ * @NM_DEVICE_STATE_REASON_CONTRAIL_VROUTER_FAILED: Contrail Vrouter kernel module failed
*
* Device state change reason codes
*/
@@ -637,6 +641,7 @@ typedef enum {
NM_DEVICE_STATE_REASON_IP_METHOD_UNSUPPORTED = 65,
NM_DEVICE_STATE_REASON_SRIOV_CONFIGURATION_FAILED = 66,
NM_DEVICE_STATE_REASON_PEER_NOT_FOUND = 67,
+ NM_DEVICE_STATE_REASON_CONTRAIL_VROUTER_FAILED = 68,
} NMDeviceStateReason;
/**
diff --git a/libnm-core/nm-setting-contrail-vrouter.c b/libnm-core/nm-setting-contrail-vrouter.c
new file mode 100644
index 0000000000..5cef5e07ce
--- /dev/null
+++ b/libnm-core/nm-setting-contrail-vrouter.c
@@ -0,0 +1,182 @@
+// SPDX-License-Identifier: LGPL-2.1+
+/*
+ * Copyright (C) 2007 - 2013 Red Hat, Inc.
+ * Copyright (C) 2007 - 2008 Novell, Inc.
+ */
+
+#include "nm-default.h"
+
+#include "nm-setting-contrail-vrouter.h"
+
+#include "nm-connection-private.h"
+#include "nm-setting-connection.h"
+#include "nm-setting-private.h"
+
+/**
+ * SECTION:nm-setting-contrail-vrouter
+ * @short_description: Describes connection properties for Contrail vrouter.
+ *
+ * The #NMSettingContrailVrouter object is a #NMSetting subclass that describes properties
+ * necessary for Contrail vrouter.
+ **/
+
+enum {
+ PROP_0,
+ PROP_PHYSDEV,
+ LAST_PROP
+};
+
+/**
+ * NMSettingContrailVrouter:
+ *
+ * Contrail vrouter Settings
+ */
+struct _NMSettingContrailVrouter {
+ NMSetting parent;
+
+ char *physdev;
+};
+
+struct _NMSettingContrailVrouterClass {
+ NMSettingClass parent;
+};
+
+G_DEFINE_TYPE (NMSettingContrailVrouter, nm_setting_contrail_vrouter, NM_TYPE_SETTING)
+
+/*****************************************************************************/
+
+/**
+ * nm_setting_ovs_interface_get_physdev:
+ * @self: the #NMSettingContrailVrouter
+ *
+ * Returns: the #NMSettingContrailVrouter:physdev property of the setting
+ *
+ * Since: 1.14
+ **/
+const char *
+nm_setting_contrail_vrouter_get_physdev (NMSettingContrailVrouter *self)
+{
+ g_return_val_if_fail (NM_IS_SETTING_CONTRAIL_VROUTER (self), NULL);
+
+ return self->physdev;
+}
+
+/*****************************************************************************/
+
+static int
+verify (NMSetting *setting, NMConnection *connection, GError **error)
+{
+
+ if (connection) {
+ NMSettingConnection *s_con;
+
+ s_con = nm_connection_get_setting_connection (connection);
+ if (!s_con) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_MISSING_SETTING,
+ _("missing setting"));
+ g_prefix_error (error, "%s: ", NM_SETTING_CONNECTION_SETTING_NAME);
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+/*****************************************************************************/
+
+static void
+get_property (GObject *object, guint prop_id,
+ GValue *value, GParamSpec *pspec)
+{
+ NMSettingContrailVrouter *self = NM_SETTING_CONTRAIL_VROUTER (object);
+
+ switch (prop_id) {
+ case PROP_PHYSDEV:
+ g_value_set_string (value, self->physdev);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+set_property (GObject *object, guint prop_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ NMSettingContrailVrouter *self = NM_SETTING_CONTRAIL_VROUTER (object);
+
+ switch (prop_id) {
+ case PROP_PHYSDEV:
+ g_free (self->physdev);
+ self->physdev = g_value_dup_string (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+/*****************************************************************************/
+
+static void
+nm_setting_contrail_vrouter_init (NMSettingContrailVrouter *self)
+{
+}
+
+/**
+ * nm_setting_contrail_vrouter_new:
+ *
+ * Creates a new #NMSettingContrailVrouter object with default values.
+ *
+ * Returns: (transfer full): the new empty #NMSettingContrailVrouter object
+ *
+ * Since: 1.14
+ **/
+NMSetting *
+nm_setting_contrail_vrouter_new (void)
+{
+ return (NMSetting *) g_object_new (NM_TYPE_SETTING_CONTRAIL_VROUTER, NULL);
+}
+
+static void
+finalize (GObject *object)
+{
+ NMSettingContrailVrouter *self = NM_SETTING_CONTRAIL_VROUTER (object);
+
+ g_free (self->physdev);
+
+ G_OBJECT_CLASS (nm_setting_contrail_vrouter_parent_class)->finalize (object);
+}
+
+static void
+nm_setting_contrail_vrouter_class_init (NMSettingContrailVrouterClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ NMSettingClass *setting_class = NM_SETTING_CLASS (klass);
+
+ object_class->set_property = set_property;
+ object_class->get_property = get_property;
+ object_class->finalize = finalize;
+
+ setting_class->verify = verify;
+
+ /**
+ * NMSettingContrailVrouter:physdev:
+ *
+ * The physical device name.
+ *
+ * Since: 1.14
+ **/
+ g_object_class_install_property
+ (object_class, PROP_PHYSDEV,
+ g_param_spec_string (NM_SETTING_CONTRAIL_VROUTER_PHYSDEV, "", "",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ NM_SETTING_PARAM_INFERRABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ _nm_setting_class_commit (setting_class, NM_META_SETTING_TYPE_CONTRAIL_VROUTER);
+}
diff --git a/libnm-core/nm-setting-contrail-vrouter.h b/libnm-core/nm-setting-contrail-vrouter.h
new file mode 100644
index 0000000000..82ebb9b769
--- /dev/null
+++ b/libnm-core/nm-setting-contrail-vrouter.h
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: LGPL-2.1+
+/*
+ * Copyright (C) 2007 - 2013 Red Hat, Inc.
+ * Copyright (C) 2007 - 2008 Novell, Inc.
+ */
+
+#ifndef __NM_SETTING_CONTRAIL_VROUTER_H__
+#define __NM_SETTING_CONTRAIL_VROUTER_H__
+
+#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
+#error "Only <NetworkManager.h> can be included directly."
+#endif
+
+#include "nm-setting.h"
+
+G_BEGIN_DECLS
+
+#define NM_TYPE_SETTING_CONTRAIL_VROUTER (nm_setting_contrail_vrouter_get_type ())
+#define NM_SETTING_CONTRAIL_VROUTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_CONTRAIL_VROUTER, NMSettingContrailVrouter))
+#define NM_SETTING_CONTRAIL_VROUTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_CONTRAIL_VROUTERCONFIG, NMSettingContrailVrouterClass))
+#define NM_IS_SETTING_CONTRAIL_VROUTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_CONTRAIL_VROUTER))
+#define NM_IS_SETTING_CONTRAIL_VROUTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_CONTRAIL_VROUTER))
+#define NM_SETTING_CONTRAIL_VROUTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_CONTRAIL_VROUTER, NMSettingContrailVrouterClass))
+
+#define NM_SETTING_CONTRAIL_VROUTER_SETTING_NAME "contrail-vrouter"
+
+#define NM_SETTING_CONTRAIL_VROUTER_PHYSDEV "physdev"
+
+typedef struct _NMSettingContrailVrouterClass NMSettingContrailVrouterClass;
+
+NM_AVAILABLE_IN_1_14
+GType nm_setting_contrail_vrouter_get_type (void);
+NM_AVAILABLE_IN_1_14
+NMSetting *nm_setting_contrail_vrouter_new (void);
+
+NM_AVAILABLE_IN_1_14
+const char *nm_setting_contrail_vrouter_get_physdev (NMSettingContrailVrouter *self);
+
+G_END_DECLS
+
+#endif /* __NM_SETTING_CONTRAIL_VROUTER_H__ */
diff --git a/libnm/NetworkManager.h b/libnm/NetworkManager.h
index 6a0f117865..127336fb9f 100644
--- a/libnm/NetworkManager.h
+++ b/libnm/NetworkManager.h
@@ -19,6 +19,7 @@
#include "nm-device-bond.h"
#include "nm-device-bridge.h"
#include "nm-device-bt.h"
+#include "nm-device-contrail-vrouter.h"
#include "nm-device-dummy.h"
#include "nm-device-ethernet.h"
#include "nm-device-generic.h"
@@ -56,6 +57,7 @@
#include "nm-setting-bridge-port.h"
#include "nm-setting-cdma.h"
#include "nm-setting-connection.h"
+#include "nm-setting-contrail-vrouter.h"
#include "nm-setting-dcb.h"
#include "nm-setting-dummy.h"
#include "nm-setting-ethtool.h"
diff --git a/libnm/libnm.ver b/libnm/libnm.ver
index f43e1ba997..29b72ca65e 100644
--- a/libnm/libnm.ver
+++ b/libnm/libnm.ver
@@ -1387,8 +1387,10 @@ libnm_1_12_2 {
libnm_1_14_0 {
global:
+ nm_connection_get_setting_contrail_vrouter;
nm_connection_multi_connect_get_type;
nm_device_6lowpan_get_type;
+ nm_device_contrail_vrouter_get_type;
nm_device_wireguard_get_fwmark;
nm_device_wireguard_get_listen_port;
nm_device_wireguard_get_public_key;
@@ -1398,6 +1400,9 @@ global:
nm_setting_connection_get_llmnr;
nm_setting_connection_get_multi_connect;
nm_setting_connection_llmnr_get_type;
+ nm_setting_contrail_vrouter_get_physdev;
+ nm_setting_contrail_vrouter_get_type;
+ nm_setting_contrail_vrouter_new;
nm_setting_ethtool_clear_features;
nm_setting_ethtool_get_feature;
nm_setting_ethtool_get_type;
@@ -1638,4 +1643,9 @@ global:
nm_manager_reload_flags_get_type;
nm_setting_802_1x_get_optional;
nm_setting_gsm_get_auto_config;
+ nm_setting_contrail_vrouter_get_physdev;
+ nm_setting_contrail_vrouter_get_type;
+ nm_setting_contrail_vrouter_new;
+ nm_connection_get_setting_contrail_vrouter;
+ nm_device_contrail_vrouter_get_type;
} libnm_1_20_0;
diff --git a/libnm/meson.build b/libnm/meson.build
index 8b68a63679..d8c99f66ef 100644
--- a/libnm/meson.build
+++ b/libnm/meson.build
@@ -23,6 +23,7 @@ libnm_headers = files(
'nm-device-bond.h',
'nm-device-bridge.h',
'nm-device-bt.h',
+ 'nm-device-contrail-vrouter.h',
'nm-device-dummy.h',
'nm-device-ethernet.h',
'nm-device-generic.h',
@@ -88,6 +89,8 @@ libnm_sources = files(
'nm-device-bond.c',
'nm-device-bridge.c',
'nm-device-bt.c',
+ 'nm-device.c',
+ 'nm-device-contrail-vrouter.c',
'nm-device-dummy.c',
'nm-device-ethernet.c',
'nm-device-generic.c',
diff --git a/libnm/nm-autoptr.h b/libnm/nm-autoptr.h
index 78c586d438..2c2fae48ac 100644
--- a/libnm/nm-autoptr.h
+++ b/libnm/nm-autoptr.h
@@ -70,6 +70,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingBridge, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingBridgePort, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingCdma, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingConnection, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingContrailVrouter, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingDcb, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingDummy, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingEthtool, g_object_unref)
diff --git a/libnm/nm-client.c b/libnm/nm-client.c
index 0d84923e28..3b443ea413 100644
--- a/libnm/nm-client.c
+++ b/libnm/nm-client.c
@@ -43,6 +43,7 @@
#include "nm-device-bond.h"
#include "nm-device-bridge.h"
#include "nm-device-bt.h"
+#include "nm-device-contrail-vrouter.h"
#include "nm-device-dummy.h"
#include "nm-device-ethernet.h"
#include "nm-device-generic.h"
@@ -3040,6 +3041,8 @@ obj_nm_for_gdbus_object (NMClient *self, GDBusObject *object, GDBusObjectManager
type = NM_TYPE_DEVICE_BRIDGE;
else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_BLUETOOTH) == 0)
type = NM_TYPE_DEVICE_BT;
+ else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_CONTRAIL_VROUTER) == 0)
+ type = NM_TYPE_DEVICE_CONTRAIL_VROUTER;
else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_DUMMY) == 0)
type = NM_TYPE_DEVICE_DUMMY;
else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_WIRED) == 0)
diff --git a/libnm/nm-device-contrail-vrouter.c b/libnm/nm-device-contrail-vrouter.c
new file mode 100644
index 0000000000..7212bc17d8
--- /dev/null
+++ b/libnm/nm-device-contrail-vrouter.c
@@ -0,0 +1,83 @@
+// SPDX-License-Identifier: LGPL-2.1+
+/*
+ * Copyright (C) 2007 - 2013 Red Hat, Inc.
+ * Copyright (C) 2007 - 2008 Novell, Inc.
+ */
+
+
+#include "nm-default.h"
+
+#include <string.h>
+
+#include "nm-device-contrail-vrouter.h"
+#include "nm-object-private.h"
+#include "nm-setting-contrail-vrouter.h"
+#include "nm-setting-connection.h"
+
+/**
+ * NMDeviceContrailVrouter:
+ */
+struct _NMDeviceContrailVrouter {
+ NMDevice parent;
+};
+
+struct _NMDeviceContrailVrouterClass {
+ NMDeviceClass parent;
+};
+
+G_DEFINE_TYPE (NMDeviceContrailVrouter, nm_device_contrail_vrouter, NM_TYPE_DEVICE)
+
+/*****************************************************************************/
+
+static const char *
+get_type_description (NMDevice *device)
+{
+ return "contrail-vrouter";
+}
+
+static gboolean
+connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
+{
+ const char *iface_name;
+
+ if (!NM_DEVICE_CLASS (nm_device_contrail_vrouter_parent_class)->connection_compatible (device, connection, error))
+ return FALSE;
+
+ if (!nm_connection_is_type (connection, NM_SETTING_CONTRAIL_VROUTER_SETTING_NAME)) {
+ g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
+ _("The connection was not a contrail_vrouter connection."));
+ return FALSE;
+ }
+
+ iface_name = nm_connection_get_interface_name (connection);
+ if (!iface_name) {
+ g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INVALID_CONNECTION,
+ _("The connection did not specify an interface name."));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static GType
+get_setting_type (NMDevice *device)
+{
+ return NM_TYPE_SETTING_CONTRAIL_VROUTER;
+}
+
+/*****************************************************************************/
+
+static void
+nm_device_contrail_vrouter_init (NMDeviceContrailVrouter *device)
+{
+}
+
+static void
+nm_device_contrail_vrouter_class_init (NMDeviceContrailVrouterClass *contrail_vrouter_class)
+{
+ NMDeviceClass *device_class = NM_DEVICE_CLASS (contrail_vrouter_class);
+
+ device_class->get_type_description = get_type_description;
+ device_class->connection_compatible = connection_compatible;
+ device_class->get_setting_type = get_setting_type;
+}
diff --git a/libnm/nm-device-contrail-vrouter.h b/libnm/nm-device-contrail-vrouter.h
new file mode 100644
index 0000000000..ac853f86be
--- /dev/null
+++ b/libnm/nm-device-contrail-vrouter.h
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: LGPL-2.1+
+/*
+ * Copyright (C) 2007 - 2013 Red Hat, Inc.
+ * Copyright (C) 2007 - 2008 Novell, Inc.
+ */
+
+#ifndef __NM_DEVICE_CONTRAIL_VROUTER_H__
+#define __NM_DEVICE_CONTRAIL_VROUTER_H__
+
+#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
+#error "Only <NetworkManager.h> can be included directly."
+#endif
+
+#include "nm-device.h"
+
+G_BEGIN_DECLS
+
+#define NM_TYPE_DEVICE_CONTRAIL_VROUTER (nm_device_contrail_vrouter_get_type ())
+#define NM_DEVICE_CONTRAIL_VROUTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_CONTRAIL_VROUTER, NMDeviceContrailVrouter))
+#define NM_DEVICE_CONTRAIL_VROUTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_CONTRAIL_VROUTER, NMDeviceContrailVrouterClass))
+#define NM_IS_DEVICE_CONTRAIL_VROUTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_CONTRAIL_VROUTER))
+#define NM_IS_DEVICE_CONTRAIL_VROUTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_CONTRAIL_VROUTER))
+#define NM_DEVICE_CONTRAIL_VROUTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_CONTRAIL_VROUTER, NMDeviceContrailVrouterClass))
+
+typedef struct _NMDeviceContrailVrouterClass NMDeviceContrailVrouterClass;
+
+NM_AVAILABLE_IN_1_14
+GType nm_device_contrail_vrouter_get_type (void);
+
+G_END_DECLS
+
+#endif /* __NM_DEVICE_CONTRAIL_VROUTER_H__ */
diff --git a/libnm/nm-device.c b/libnm/nm-device.c
index 96698967b9..eba3cb5e58 100644
--- a/libnm/nm-device.c
+++ b/libnm/nm-device.c
@@ -287,6 +287,7 @@ coerce_type (NMDeviceType type)
case NM_DEVICE_TYPE_6LOWPAN:
case NM_DEVICE_TYPE_WIREGUARD:
case NM_DEVICE_TYPE_WIFI_P2P:
+ case NM_DEVICE_TYPE_CONTRAIL_VROUTER:
return type;
}
return NM_DEVICE_TYPE_UNKNOWN;
@@ -1395,6 +1396,8 @@ get_type_name (NMDevice *device)
return _("WireGuard");
case NM_DEVICE_TYPE_WIFI_P2P:
return _("Wi-Fi P2P");
+ case NM_DEVICE_TYPE_CONTRAIL_VROUTER:
+ return _("Contrail Vrouter");
case NM_DEVICE_TYPE_GENERIC:
case NM_DEVICE_TYPE_UNUSED1:
case NM_DEVICE_TYPE_UNUSED2:
diff --git a/libnm/nm-enum-types.c.template b/libnm/nm-enum-types.c.template
index 5abd5c794c..3f05faf1bb 100644
--- a/libnm/nm-enum-types.c.template
+++ b/libnm/nm-enum-types.c.template
@@ -14,6 +14,7 @@
#include "nm-device-bond.h"
#include "nm-device-bridge.h"
#include "nm-device-bt.h"
+#include "nm-device-contrail-vrouter.h"
#include "nm-device-dummy.h"
#include "nm-device-ethernet.h"
#include "nm-device-generic.h"
diff --git a/libnm/nm-types.h b/libnm/nm-types.h
index 11e9f05570..bfc02c3bdc 100644
--- a/libnm/nm-types.h
+++ b/libnm/nm-types.h
@@ -21,6 +21,7 @@ typedef struct _NMDeviceAdsl NMDeviceAdsl;
typedef struct _NMDeviceBond NMDeviceBond;
typedef struct _NMDeviceBridge NMDeviceBridge;
typedef struct _NMDeviceBt NMDeviceBt;
+typedef struct _NMDeviceContrailVrouter NMDeviceContrailVrouter;
typedef struct _NMDeviceDummy NMDeviceDummy;
typedef struct _NMDeviceEthernet NMDeviceEthernet;
typedef struct _NMDeviceGeneric NMDeviceGeneric;
diff --git a/man/meson.build b/man/meson.build
index 8ba6f4d8a1..e5c956b8f6 100644
--- a/man/meson.build
+++ b/man/meson.build
@@ -47,6 +47,10 @@ if enable_ovs
mans += [['nm-openvswitch', '7']]
endif
+if enable_contrail
+ mans += [['nm-contrail', '7']]
+endif
+
foreach man: mans
input = man[0] + '.xml'
content_files += join_paths(meson.current_source_dir(), input)
diff --git a/man/nm-contrail.xml b/man/nm-contrail.xml
new file mode 100644
index 0000000000..9236c8cb27
--- /dev/null
+++ b/man/nm-contrail.xml
@@ -0,0 +1,56 @@
+<?xml version='1.0'?>
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+<!ENTITY % entities SYSTEM "common.ent" >
+%entities;
+]>
+
+<!--
+ nm-contrail(7) manual page
+
+ Copyright 2019 Red Hat, Inc.
+
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.1
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+ Texts. You may obtain a copy of the GNU Free Documentation License
+ from the Free Software Foundation by visiting their Web site or by
+ writing to:
+
+ Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+-->
+
+<refentry id="nm-contrail">
+ <refentryinfo>
+ <title>nm-contrail</title>
+ <author>NetworkManager Contrail vrouter support</author>
+ </refentryinfo>
+ <refmeta>
+ <refentrytitle>nm-contrail</refentrytitle>
+ <manvolnum>7</manvolnum>
+ <refmiscinfo class="source">NetworkManager</refmiscinfo>
+ <refmiscinfo class="manual">Contrail vrouter support overview</refmiscinfo>
+ <refmiscinfo class="version">&NM_VERSION;</refmiscinfo>
+ </refmeta>
+ <refnamediv>
+ <refname>nm-contrail</refname>
+ <refpurpose>overview of NetworkManager Contrail vrouter support</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Overview</title>
+ </refsect1>
+ <refsect1>
+ <title>Examples</title>
+ <example>
+ </example>
+ </refsect1>
+ <refsect1>
+ <title>Bugs</title>
+ </refsect1>
+ <refsect1>
+ <title>See Also</title>
+ </refsect1>
+</refentry>
diff --git a/meson.build b/meson.build
index f5eb547864..3dbd17dcaa 100644
--- a/meson.build
+++ b/meson.build
@@ -582,6 +582,9 @@ if enable_ovs
assert(jansson_dep.found(), 'jansson is needed for Open vSwitch integration. Use -Dovs=false to disable it')
endif
+# Contrail vrouter integration
+enable_contrail = get_option('contrail_vrouter')
+
# DNS resolv.conf managers
config_dns_rc_manager_default = get_option('config_dns_rc_manager_default')
config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default)
@@ -931,6 +934,7 @@ output += ' ofono: ' + enable_ofono.to_string() + '\n'
output += ' concheck: ' + enable_concheck.to_string() + '\n'
output += ' libteamdctl: ' + enable_teamdctl.to_string() + '\n'
output += ' ovs: ' + enable_ovs.to_string() + '\n'
+output += ' contrail: ' + enable_contrail.to_string() + '\n'
output += ' nmcli: ' + enable_nmcli.to_string() + '\n'
output += ' nmtui: ' + enable_nmtui.to_string() + '\n'
output += '\nConfiguration_plugins (main.plugins=' + config_plugins_default + ')\n'
diff --git a/meson_options.txt b/meson_options.txt
index 3ffd9a54be..f22e1f186a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -38,6 +38,7 @@ option('nmcli', type: 'boolean', value: true, description: 'Build nmcli')
option('nmtui', type: 'boolean', value: true, description: 'Build nmtui')
option('bluez5_dun', type: 'boolean', value: false, description: 'enable Bluez5 DUN support')
option('ebpf', type: 'combo', choices : ['auto', 'true', 'false'], description: 'Enable eBPF support')
+option('contrail_vrouter', type: 'boolean', value: true, description: 'enable Contrail vrouter support')
# configuration plugins
option('config_plugins_default', type: 'string', value: '', description: 'Default configuration option for main.plugins setting, used as fallback if the configuration option is unset')
diff --git a/shared/nm-meta-setting.c b/shared/nm-meta-setting.c
index af5aa8429d..4b15f7ea9e 100644
--- a/shared/nm-meta-setting.c
+++ b/shared/nm-meta-setting.c
@@ -16,6 +16,7 @@
#include "nm-setting-bridge.h"
#include "nm-setting-cdma.h"
#include "nm-setting-connection.h"
+#include "nm-setting-contrail-vrouter.h"
#include "nm-setting-dcb.h"
#include "nm-setting-dummy.h"
#include "nm-setting-ethtool.h"
@@ -207,6 +208,12 @@ const NMMetaSettingInfo nm_meta_setting_infos[] = {
.setting_name = NM_SETTING_CONNECTION_SETTING_NAME,
.get_setting_gtype = nm_setting_connection_get_type,
},
+ [NM_META_SETTING_TYPE_CONTRAIL_VROUTER] = {
+ .meta_type = NM_META_SETTING_TYPE_CONTRAIL_VROUTER,
+ .setting_priority = NM_SETTING_PRIORITY_HW_BASE,
+ .setting_name = NM_SETTING_CONTRAIL_VROUTER_SETTING_NAME,
+ .get_setting_gtype = nm_setting_contrail_vrouter_get_type,
+ },
[NM_META_SETTING_TYPE_DCB] = {
.meta_type = NM_META_SETTING_TYPE_DCB,
.setting_priority = NM_SETTING_PRIORITY_HW_AUX,
diff --git a/shared/nm-meta-setting.h b/shared/nm-meta-setting.h
index 3976bfe19b..5bd968262e 100644
--- a/shared/nm-meta-setting.h
+++ b/shared/nm-meta-setting.h
@@ -113,6 +113,7 @@ typedef enum {
NM_META_SETTING_TYPE_BRIDGE_PORT,
NM_META_SETTING_TYPE_CDMA,
NM_META_SETTING_TYPE_CONNECTION,
+ NM_META_SETTING_TYPE_CONTRAIL_VROUTER,
NM_META_SETTING_TYPE_DCB,
NM_META_SETTING_TYPE_DUMMY,
NM_META_SETTING_TYPE_ETHTOOL,
diff --git a/src/devices/contrail/meson.build b/src/devices/contrail/meson.build
new file mode 100644
index 0000000000..c3bdf80666
--- /dev/null
+++ b/src/devices/contrail/meson.build
@@ -0,0 +1,34 @@
+sources = files(
+ 'nm-device-contrail-vrouter.c',
+ 'nm-contrail-factory.c'
+)
+
+deps = [
+ nm_deps
+]
+
+libnm_device_plugin_contrail = shared_module(
+ 'nm-device-plugin-contrail',
+ sources: sources,
+ dependencies: deps,
+ c_args: daemon_c_flags,
+ link_args: ldflags_linker_script_devices,
+ link_depends: linker_script_devices,
+ install: true,
+ install_dir: nm_plugindir
+)
+
+core_plugins += libnm_device_plugin_contrail
+
+test(
+ 'check-local-devices-contrail',
+ check_exports,
+ args: [libnm_device_plugin_contrail.full_path(), linker_script_devices],
+)
+
+# FIXME: check_so_symbols replacement
+'''
+check-local-devices-contrail: src/devices/contrail/libnm-device-plugin-contrail.la
+ $(srcdir)/tools/check-exports.sh $(builddir)/src/devices/contrail/.libs/libnm-device-plugin-contrail.so "$(srcdir)/linker-script-devices.ver"
+ $(call check_so_symbols,$(builddir)/src/devices/contrail/.libs/libnm-device-plugin-contrail.so)
+'''
diff --git a/src/devices/contrail/nm-contrail-factory.c b/src/devices/contrail/nm-contrail-factory.c
new file mode 100644
index 0000000000..dd8124849b
--- /dev/null
+++ b/src/devices/contrail/nm-contrail-factory.c
@@ -0,0 +1,116 @@
+// SPDX-License-Identifier: LGPL-2.1+
+/*
+ * Copyright (C) 2007 - 2013 Red Hat, Inc.
+ * Copyright (C) 2007 - 2008 Novell, Inc.
+ */
+
+#include "nm-default.h"
+
+#include "nm-manager.h"
+#include "nm-device-contrail-vrouter.h"
+#include "platform/nm-platform.h"
+#include "nm-core-internal.h"
+#include "devices/nm-device-factory.h"
+
+/*****************************************************************************/
+
+typedef struct {
+ NMDeviceFactory parent;
+} NMContrailFactory;
+
+typedef struct {
+ NMDeviceFactoryClass parent;
+} NMContrailFactoryClass;
+
+#define NM_TYPE_CONTRAIL_FACTORY (nm_contrail_factory_get_type ())
+#define NM_CONTRAIL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CONTRAIL_FACTORY, NMContrailFactory))
+#define NM_CONTRAIL_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_CONTRAIL_FACTORY, NMContrailFactoryClass))
+#define NM_IS_CONTRAIL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONTRAIL_FACTORY))
+#define NM_IS_CONTRAIL_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_CONTRAIL_FACTORY))
+#define NM_CONTRAIL_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_CONTRAIL_FACTORY, NMContrailFactoryClass))
+
+static GType nm_contrail_factory_get_type (void);
+G_DEFINE_TYPE (NMContrailFactory, nm_contrail_factory, NM_TYPE_DEVICE_FACTORY)
+
+/*****************************************************************************/
+
+#define _NMLOG_DOMAIN LOGD_DEVICE
+#define _NMLOG(level, ...) __NMLOG_DEFAULT (level, _NMLOG_DOMAIN, "contrail", __VA_ARGS__)
+
+/*****************************************************************************/
+
+NM_DEVICE_FACTORY_DECLARE_TYPES (
+ NM_DEVICE_FACTORY_DECLARE_LINK_TYPES (NM_LINK_TYPE_CONTRAILVROUTER)
+ NM_DEVICE_FACTORY_DECLARE_SETTING_TYPES (NM_SETTING_CONTRAIL_VROUTER_SETTING_NAME)
+)
+
+G_MODULE_EXPORT NMDeviceFactory *
+nm_device_factory_create (GError **error)
+{
+ return (NMDeviceFactory *) g_object_new (NM_TYPE_CONTRAIL_FACTORY, NULL);
+}
+
+static NMDevice *
+new_device_from_type (const char *name, NMDeviceType device_type)
+{
+ GType type;
+ const char *type_desc;
+ NMLinkType link_type = NM_LINK_TYPE_NONE;
+
+ if (nm_manager_get_device (nm_manager_get (), name, device_type))
+ return NULL;
+
+ if (device_type == NM_DEVICE_TYPE_CONTRAIL_VROUTER) {
+ type = NM_TYPE_DEVICE_CONTRAIL_VROUTER;
+ type_desc = "Contrail Vrouter";
+ link_type = NM_LINK_TYPE_CONTRAILVROUTER;
+ } else {
+ return NULL;
+ }
+
+ return g_object_new (type,
+ NM_DEVICE_IFACE, name,
+ NM_DEVICE_DRIVER, "vrouter",
+ NM_DEVICE_DEVICE_TYPE, device_type,
+ NM_DEVICE_TYPE_DESC, type_desc,
+ NM_DEVICE_LINK_TYPE, link_type,
+ NULL);
+}
+
+static NMDevice *
+create_device (NMDeviceFactory *self,
+ const char *iface,
+ const NMPlatformLink *plink,
+ NMConnection *connection,
+ gboolean *out_ignore)
+{
+ NMDeviceType device_type = NM_DEVICE_TYPE_UNKNOWN;
+ const char *connection_type = NULL;
+
+ if (connection)
+ connection_type = nm_connection_get_connection_type (connection);
+
+ if (plink)
+ device_type = NM_DEVICE_TYPE_CONTRAIL_VROUTER;
+ else if (g_strcmp0 (connection_type, NM_SETTING_CONTRAIL_VROUTER_SETTING_NAME) == 0)
+ device_type = NM_DEVICE_TYPE_CONTRAIL_VROUTER;
+
+ return new_device_from_type (iface, device_type);
+}
+
+static void
+nm_contrail_factory_init (NMContrailFactory *self)
+{
+}
+
+static void
+nm_contrail_factory_class_init (NMContrailFactoryClass *klass)
+{
+ NMDeviceFactoryClass *factory_class = NM_DEVICE_FACTORY_CLASS (klass);
+
+ factory_class->get_supported_types = get_supported_types;
+ factory_class->create_device = create_device;
+ // TODO reload funcs:
+// factory_class->device_removed = device_removed;
+// factory_class->device_added = device_added;
+}
diff --git a/src/devices/contrail/nm-device-contrail-vrouter.c b/src/devices/contrail/nm-device-contrail-vrouter.c
new file mode 100644
index 0000000000..773d631855
--- /dev/null
+++ b/src/devices/contrail/nm-device-contrail-vrouter.c
@@ -0,0 +1,282 @@
+// SPDX-License-Identifier: LGPL-2.1+
+/*
+ * Copyright (C) 2007 - 2013 Red Hat, Inc.
+ * Copyright (C) 2007 - 2008 Novell, Inc.
+ */
+
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <unistd.h>
+
+#include "nm-default.h"
+
+#include "nm-device-contrail-vrouter.h"
+
+#include "devices/nm-device-private.h"
+#include "nm-active-connection.h"
+#include "nm-setting-connection.h"
+#include "nm-setting-contrail-vrouter.h"
+
+#include "devices/nm-device-logging.h"
+_LOG_DECLARE_SELF(NMDeviceContrailVrouter);
+
+/*****************************************************************************/
+
+typedef struct {
+ bool waiting_for_interface:1;
+} NMDeviceContrailVrouterPrivate;
+
+struct _NMDeviceContrailVrouter {
+ NMDevice parent;
+ NMDeviceContrailVrouterPrivate _priv;
+};
+
+struct _NMDeviceContrailVrouterClass {
+ NMDeviceClass parent;
+};
+
+G_DEFINE_TYPE (NMDeviceContrailVrouter, nm_device_contrail_vrouter, NM_TYPE_DEVICE)
+
+#define NM_DEVICE_CONTRAIL_VROUTER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDeviceContrailVrouter, NM_IS_DEVICE_CONTRAIL_VROUTER, NMDevice)
+
+/*****************************************************************************/
+
+void _get_command(const char *iface,
+ const char *physdev,
+ char *command,
+ const int command_size);
+
+void
+_get_mac (const char *physdev, char *mac_str);
+
+void
+_get_mac (const char *physdev, char *mac_str)
+{
+ struct ifreq ifr;
+ int fd;
+ unsigned char *mac;
+ int i;
+ char *pos;
+
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: %s %s", __FILE__ , __func__);
+
+ memset(&ifr, 0, sizeof(ifr));
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ ifr.ifr_addr.sa_family = AF_INET;
+ strncpy(ifr.ifr_name , physdev , IFNAMSIZ-1);
+ if (0 == ioctl(fd, SIOCGIFHWADDR, &ifr)) {
+ mac = (unsigned char *)ifr.ifr_hwaddr.sa_data;
+ i = 0;
+ pos = mac_str;
+ for ( ; i < 6; i++) {
+ if (i) {
+ pos += sprintf(pos, ":");
+ }
+ pos += sprintf(pos, "%02X", (unsigned char)mac[i]);
+ }
+ }
+ close(fd);
+}
+
+void
+_get_command (const char *iface,
+ const char *physdev,
+ char *command,
+ const int command_size)
+{
+ char mac_str[19];
+
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: %s %s", __FILE__ , __func__);
+
+ _get_mac(physdev, mac_str);
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: mac address: %s", mac_str);
+
+ snprintf(command, command_size,
+ "modprobe vrouter && "
+ "vif --create %s --mac %s 2>&1 && "
+ "vif --add %s --mac %s --vrf 0 --vhost-phys --type physical 2>&1 && "
+ "vif --add %s --mac %s --vrf 0 --type vhost --xconnect %s 2>&1 && "
+ "ip link set dev %s address %s 2>&1 && "
+ "ip link set dev %s up 2>&1",
+ iface, mac_str,
+ physdev, mac_str,
+ iface, mac_str, physdev,
+ iface, mac_str,
+ iface);
+}
+
+/*********************************************************************************/
+
+static const char *
+get_type_description (NMDevice *device)
+{
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: %s %s", __FILE__ , __func__);
+
+ return "contrail-vrouter";
+}
+
+static gboolean
+create_and_realize (NMDevice *device,
+ NMConnection *connection,
+ NMDevice *parent,
+ const NMPlatformLink **out_plink,
+ GError **error)
+{
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: %s %s", __FILE__ , __func__);
+
+ return TRUE;
+}
+
+static NMDeviceCapabilities
+get_generic_capabilities (NMDevice *device)
+{
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: %s %s", __FILE__ , __func__);
+
+ return NM_DEVICE_CAP_IS_SOFTWARE;
+}
+
+static gboolean
+is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
+{
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: %s %s", __FILE__ , __func__);
+
+ return TRUE;
+}
+
+static gboolean
+check_connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
+{
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: %s %s", __FILE__ , __func__);
+
+ return TRUE;
+}
+
+static void
+link_changed (NMDevice *device,
+ const NMPlatformLink *pllink)
+{
+ NMDeviceContrailVrouterPrivate *priv;
+
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: %s %s", __FILE__ , __func__);
+ priv = NM_DEVICE_CONTRAIL_VROUTER_GET_PRIVATE (device);
+
+ if (pllink && priv->waiting_for_interface) {
+ priv->waiting_for_interface = FALSE;
+ nm_device_bring_up (device, TRUE, NULL);
+ nm_device_activate_schedule_stage3_ip_config_start (device);
+ }
+}
+
+static NMActStageReturn
+act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
+{
+ FILE *fp;
+ int COMMAND_OUTPUT_SIZE = 512;
+ char output[COMMAND_OUTPUT_SIZE];
+ const char *iface;
+ int COMMAND_SIZE = 512;
+ char command[COMMAND_SIZE];
+ const char *physdev;
+ NMConnection *connection;
+
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: %s %s", __FILE__ , __func__);
+
+ if (!device) {
+ nm_log_err (LOGD_DEVICE, "CONTRAIL: device is null");
+ return NM_ACT_STAGE_RETURN_FAILURE;
+ }
+ connection = nm_device_get_applied_connection (device);
+ if (!connection) {
+ nm_log_err (LOGD_DEVICE, "CONTRAIL: connection is null");
+ return NM_ACT_STAGE_RETURN_FAILURE;
+ }
+ nm_connection_dump (connection);
+ iface = nm_connection_get_interface_name (connection);
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: interface name: %s", iface);
+ physdev = nm_setting_contrail_vrouter_get_physdev (nm_connection_get_setting_contrail_vrouter (connection));
+ if (physdev) {
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: physical device name: %s", physdev);
+ _get_command(iface, physdev, command, COMMAND_SIZE);
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: vrouter command: %s", command);
+ fp = popen(command, "r");
+ while (fgets(output, COMMAND_OUTPUT_SIZE, fp) != NULL){
+ nm_log_err (LOGD_DEVICE, "CONTRAIL: %s", output);
+ }
+ pclose(fp);
+ }
+ else {
+ nm_log_err (LOGD_DEVICE, "CONTRAIL: physical device name was not provided.");
+ return NM_ACT_STAGE_RETURN_FAILURE;
+ }
+ return NM_ACT_STAGE_RETURN_SUCCESS;
+}
+
+static NMActStageReturn
+act_stage3_ip_config_start (NMDevice *device,
+ int addr_family,
+ gpointer *out_config,
+ NMDeviceStateReason *out_failure_reason)
+{
+ NMDeviceContrailVrouterPrivate *priv;
+
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: %s %s", __FILE__ , __func__);
+ priv = NM_DEVICE_CONTRAIL_VROUTER_GET_PRIVATE (device);
+
+ if (!nm_device_get_ip_ifindex (device)) {
+ priv->waiting_for_interface = TRUE;
+ return NM_ACT_STAGE_RETURN_POSTPONE;
+ }
+
+ return NM_DEVICE_CLASS (nm_device_contrail_vrouter_parent_class)->act_stage3_ip_config_start (device, addr_family, out_config, out_failure_reason);
+}
+
+static gboolean
+can_unmanaged_external_down (NMDevice *self)
+{
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: %s %s", __FILE__ , __func__);
+
+ return FALSE;
+}
+
+/*****************************************************************************/
+
+static void
+nm_device_contrail_vrouter_init (NMDeviceContrailVrouter *self)
+{
+ nm_log_dbg (LOGD_DEVICE, "CONTRAIL: %s %s", __FILE__ , __func__);
+}
+
+static const NMDBusInterfaceInfoExtended interface_info_device_contrail_vrouter = {
+ .parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
+ NM_DBUS_INTERFACE_DEVICE_CONTRAIL_VROUTER,
+ .signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
+ &nm_signal_info_property_changed_legacy,
+ ),
+ ),
+ .legacy_property_changed = TRUE,
+};
+
+static void
+nm_device_contrail_vrouter_class_init (NMDeviceContrailVrouterClass *klass)
+{
+ NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
+ NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
+
+ dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_contrail_vrouter);
+
+ device_class->connection_type_supported = NM_SETTING_CONTRAIL_VROUTER_SETTING_NAME;
+ device_class->connection_type_check_compatible = NM_SETTING_CONTRAIL_VROUTER_SETTING_NAME;
+ device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_CONTRAILVROUTER);
+
+ device_class->get_type_description = get_type_description;
+ device_class->create_and_realize = create_and_realize;
+ device_class->get_generic_capabilities = get_generic_capabilities;
+ device_class->is_available = is_available;
+ device_class->check_connection_compatible = check_connection_compatible;
+ device_class->link_changed = link_changed;
+ device_class->act_stage1_prepare = act_stage1_prepare;
+ device_class->act_stage3_ip_config_start = act_stage3_ip_config_start;
+ device_class->can_unmanaged_external_down = can_unmanaged_external_down;
+}
diff --git a/src/devices/contrail/nm-device-contrail-vrouter.h b/src/devices/contrail/nm-device-contrail-vrouter.h
new file mode 100644
index 0000000000..05b9dc954a
--- /dev/null
+++ b/src/devices/contrail/nm-device-contrail-vrouter.h
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: LGPL-2.1+
+/*
+ * Copyright (C) 2007 - 2013 Red Hat, Inc.
+ * Copyright (C) 2007 - 2008 Novell, Inc.
+ */
+
+#ifndef __NETWORKMANAGER_DEVICE_CONTRAIL_VROUTER_H__
+#define __NETWORKMANAGER_DEVICE_CONTRAIL_VROUTER_H__
+
+#define NM_TYPE_DEVICE_CONTRAIL_VROUTER (nm_device_contrail_vrouter_get_type ())
+#define NM_DEVICE_CONTRAIL_VROUTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_CONTRAIL_VROUTER, NMDeviceContrailVrouter))
+#define NM_DEVICE_CONTRAIL_VROUTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_CONTRAIL_VROUTER, NMDeviceContrailVrouterClass))
+#define NM_IS_DEVICE_CONTRAIL_VROUTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_CONTRAIL_VROUTER))
+#define NM_IS_DEVICE_CONTRAIL_VROUTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_CONTRAIL_VROUTER))
+#define NM_DEVICE_CONTRAIL_VROUTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_CONTRAIL_VROUTER, NMDeviceContrailVrouterClass))
+
+typedef struct _NMDeviceContrailVrouter NMDeviceContrailVrouter;
+typedef struct _NMDeviceContrailVrouterClass NMDeviceContrailVrouterClass;
+
+GType nm_device_contrail_vrouter_get_type (void);
+
+#endif /* __NETWORKMANAGER_DEVICE_CONTRAIL_VROUTER_H__ */
diff --git a/src/devices/meson.build b/src/devices/meson.build
index 2d874659c7..d29bf5e5ef 100644
--- a/src/devices/meson.build
+++ b/src/devices/meson.build
@@ -20,3 +20,7 @@ endif
if enable_tests
subdir('tests')
endif
+
+if enable_contrail
+ subdir('contrail')
+endif
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 96fc6614ac..6c259f83a0 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -774,6 +774,7 @@ NM_UTILS_LOOKUP_STR_DEFINE (nm_device_state_reason_to_str, NMDeviceStateReason,
NM_UTILS_LOOKUP_STR_ITEM (NM_DEVICE_STATE_REASON_IP_METHOD_UNSUPPORTED, "ip-method-unsupported"),
NM_UTILS_LOOKUP_STR_ITEM (NM_DEVICE_STATE_REASON_SRIOV_CONFIGURATION_FAILED, "sriov-configuration-failed"),
NM_UTILS_LOOKUP_STR_ITEM (NM_DEVICE_STATE_REASON_PEER_NOT_FOUND, "peer-not-found"),
+ NM_UTILS_LOOKUP_STR_ITEM (NM_DEVICE_STATE_REASON_CONTRAIL_VROUTER_FAILED, "contrail-vrouter-failed"),
);
#define reason_to_string_a(reason) NM_UTILS_LOOKUP_STR_A (nm_device_state_reason_to_str, reason)
@@ -2134,6 +2135,7 @@ nm_device_get_route_metric_default (NMDeviceType device_type)
return 10000;
case NM_DEVICE_TYPE_UNUSED1:
case NM_DEVICE_TYPE_UNUSED2:
+ case NM_DEVICE_TYPE_CONTRAIL_VROUTER:
/* omit default: to get compiler warning about missing switch cases */
break;
}
diff --git a/src/nm-types.h b/src/nm-types.h
index 2f1ac2dcd5..034f98a565 100644
--- a/src/nm-types.h
+++ b/src/nm-types.h
@@ -162,6 +162,7 @@ typedef enum {
NM_LINK_TYPE_VLAN,
NM_LINK_TYPE_VXLAN,
NM_LINK_TYPE_WIREGUARD,
+ NM_LINK_TYPE_CONTRAILVROUTER,
/* Software types with slaves */
NM_LINK_TYPE_BRIDGE = 0x10000 | 0x20000,
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 305ae52e3a..8a35e9e979 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -624,43 +624,44 @@ typedef struct {
} LinkDesc;
static const LinkDesc linktypes[] = {
- { NM_LINK_TYPE_NONE, "none", NULL, NULL },
- { NM_LINK_TYPE_UNKNOWN, "unknown", NULL, NULL },
-
- { NM_LINK_TYPE_ETHERNET, "ethernet", NULL, NULL },
- { NM_LINK_TYPE_INFINIBAND, "infiniband", NULL, NULL },
- { NM_LINK_TYPE_OLPC_MESH, "olpc-mesh", NULL, NULL },
- { NM_LINK_TYPE_WIFI, "wifi", NULL, "wlan" },
- { NM_LINK_TYPE_WWAN_NET, "wwan", NULL, "wwan" },
- { NM_LINK_TYPE_WIMAX, "wimax", "wimax", "wimax" },
- { NM_LINK_TYPE_WPAN, "wpan", NULL, NULL },
- { NM_LINK_TYPE_6LOWPAN, "6lowpan", NULL, NULL },
-
- { NM_LINK_TYPE_BNEP, "bluetooth", NULL, "bluetooth" },
- { NM_LINK_TYPE_DUMMY, "dummy", "dummy", NULL },
- { NM_LINK_TYPE_GRE, "gre", "gre", NULL },
- { NM_LINK_TYPE_GRETAP, "gretap", "gretap", NULL },
- { NM_LINK_TYPE_IFB, "ifb", "ifb", NULL },
- { NM_LINK_TYPE_IP6TNL, "ip6tnl", "ip6tnl", NULL },
- { NM_LINK_TYPE_IP6GRE, "ip6gre", "ip6gre", NULL },
- { NM_LINK_TYPE_IP6GRETAP, "ip6gretap", "ip6gretap", NULL },
- { NM_LINK_TYPE_IPIP, "ipip", "ipip", NULL },
- { NM_LINK_TYPE_LOOPBACK, "loopback", NULL, NULL },
- { NM_LINK_TYPE_MACSEC, "macsec", "macsec", NULL },
- { NM_LINK_TYPE_MACVLAN, "macvlan", "macvlan", NULL },
- { NM_LINK_TYPE_MACVTAP, "macvtap", "macvtap", NULL },
- { NM_LINK_TYPE_OPENVSWITCH, "openvswitch", "openvswitch", NULL },
- { NM_LINK_TYPE_PPP, "ppp", NULL, "ppp" },
- { NM_LINK_TYPE_SIT, "sit", "sit", NULL },
- { NM_LINK_TYPE_TUN, "tun", "tun", NULL },
- { NM_LINK_TYPE_VETH, "veth", "veth", NULL },
- { NM_LINK_TYPE_VLAN, "vlan", "vlan", "vlan" },
- { NM_LINK_TYPE_VXLAN, "vxlan", "vxlan", "vxlan" },
- { NM_LINK_TYPE_WIREGUARD, "wireguard", "wireguard", "wireguard" },
-
- { NM_LINK_TYPE_BRIDGE, "bridge", "bridge", "bridge" },
- { NM_LINK_TYPE_BOND, "bond", "bond", "bond" },
- { NM_LINK_TYPE_TEAM, "team", "team", NULL },
+ { NM_LINK_TYPE_NONE, "none", NULL, NULL },
+ { NM_LINK_TYPE_UNKNOWN, "unknown", NULL, NULL },
+
+ { NM_LINK_TYPE_ETHERNET, "ethernet", NULL, NULL },
+ { NM_LINK_TYPE_INFINIBAND, "infiniband", NULL, NULL },
+ { NM_LINK_TYPE_OLPC_MESH, "olpc-mesh", NULL, NULL },
+ { NM_LINK_TYPE_WIFI, "wifi", NULL, "wlan" },
+ { NM_LINK_TYPE_WWAN_NET, "wwan", NULL, "wwan" },
+ { NM_LINK_TYPE_WIMAX, "wimax", "wimax", "wimax" },
+ { NM_LINK_TYPE_WPAN, "wpan", NULL, NULL },
+ { NM_LINK_TYPE_6LOWPAN, "6lowpan", NULL, NULL },
+
+ { NM_LINK_TYPE_BNEP, "bluetooth", NULL, "bluetooth" },
+ { NM_LINK_TYPE_DUMMY, "dummy", "dummy", NULL },
+ { NM_LINK_TYPE_GRE, "gre", "gre", NULL },
+ { NM_LINK_TYPE_GRETAP, "gretap", "gretap", NULL },
+ { NM_LINK_TYPE_IFB, "ifb", "ifb", NULL },
+ { NM_LINK_TYPE_IP6TNL, "ip6tnl", "ip6tnl", NULL },
+ { NM_LINK_TYPE_IP6GRE, "ip6gre", "ip6gre", NULL },
+ { NM_LINK_TYPE_IP6GRETAP, "ip6gretap", "ip6gretap", NULL },
+ { NM_LINK_TYPE_IPIP, "ipip", "ipip", NULL },
+ { NM_LINK_TYPE_LOOPBACK, "loopback", NULL, NULL },
+ { NM_LINK_TYPE_MACSEC, "macsec", "macsec", NULL },
+ { NM_LINK_TYPE_MACVLAN, "macvlan", "macvlan", NULL },
+ { NM_LINK_TYPE_MACVTAP, "macvtap", "macvtap", NULL },
+ { NM_LINK_TYPE_OPENVSWITCH, "openvswitch", "openvswitch", NULL },
+ { NM_LINK_TYPE_PPP, "ppp", NULL, "ppp" },
+ { NM_LINK_TYPE_SIT, "sit", "sit", NULL },
+ { NM_LINK_TYPE_TUN, "tun", "tun", NULL },
+ { NM_LINK_TYPE_VETH, "veth", "veth", NULL },
+ { NM_LINK_TYPE_VLAN, "vlan", "vlan", "vlan" },
+ { NM_LINK_TYPE_VXLAN, "vxlan", "vxlan", "vxlan" },
+ { NM_LINK_TYPE_WIREGUARD, "wireguard", "wireguard", "wireguard" },
+ { NM_LINK_TYPE_CONTRAILVROUTER, "contrailvrouter", "contrailvrouter", NULL },
+
+ { NM_LINK_TYPE_BRIDGE, "bridge", "bridge", "bridge" },
+ { NM_LINK_TYPE_BOND, "bond", "bond", "bond" },
+ { NM_LINK_TYPE_TEAM, "team", "team", NULL },
};
static const char *
@@ -966,6 +967,9 @@ _linktype_get_type (NMPlatform *platform,
if (nm_streq (driver_info.driver, "openvswitch"))
return NM_LINK_TYPE_OPENVSWITCH;
+ if (nm_streq (driver_info.driver, "vrouter"))
+ return NM_LINK_TYPE_CONTRAILVROUTER;
+
if (arptype == 256) {
/* Some s390 CTC-type devices report 256 for the encapsulation type
* for some reason, but we need to call them Ethernet.