summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Kellner <christian@kellner.me>2018-04-19 14:05:52 +0200
committerChristian Kellner <christian@kellner.me>2018-04-19 14:20:04 +0200
commit89af7fbfa6cc4f43446b2f38c3ddd885b5be79f1 (patch)
tree5a0a2a15e1445968a8b4c84f151dbf409ae35ff4 /src
parent8cbce0e18fda921bf0e20b28e9b7a7dd7cdbf9b4 (diff)
downloadNetworkManager-89af7fbfa6cc4f43446b2f38c3ddd885b5be79f1.tar.gz
all: add support for thunderbolt networking
Load the thunderbolt-net module if we see a host-to-host connection and configure the resulting ethernet connection automatically to be a link-local only one. The latter is done by setting a new udev property "NM_AUTO_DEFAULT_LINK_LOCAL_ONLY" which is picked up when we configure the connection for the device. https://github.com/NetworkManager/NetworkManager/pull/97
Diffstat (limited to 'src')
-rw-r--r--src/devices/nm-device-ethernet.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c
index eb8620a877..9b46545b98 100644
--- a/src/devices/nm-device-ethernet.c
+++ b/src/devices/nm-device-ethernet.c
@@ -50,6 +50,7 @@
#include "nm-device-factory.h"
#include "nm-core-internal.h"
#include "NetworkManagerUtils.h"
+#include "nm-utils/nm-udev-utils.h"
#include "nm-device-logging.h"
_LOG_DECLARE_SELF(NMDeviceEthernet);
@@ -1436,7 +1437,9 @@ new_default_connection (NMDevice *self)
NMConnection *connection;
NMSettingsConnection *const*connections;
NMSetting *setting;
+ struct udev_device *dev;
const char *perm_hw_addr;
+ const char *uprop = "0";
gs_free char *defname = NULL;
gs_free char *uuid = NULL;
gs_free char *machine_id = NULL;
@@ -1481,6 +1484,26 @@ new_default_connection (NMDevice *self)
g_object_set (setting, NM_SETTING_WIRED_MAC_ADDRESS, perm_hw_addr, NULL);
nm_connection_add_setting (connection, setting);
+ /* Check if we should create a Link-Local only connection */
+ dev = nm_platform_link_get_udev_device (nm_device_get_platform (NM_DEVICE (self)), nm_device_get_ip_ifindex (self));
+ if (dev)
+ uprop = udev_device_get_property_value (dev, "NM_AUTO_DEFAULT_LINK_LOCAL_ONLY");
+
+ if (nm_udev_utils_property_as_boolean (uprop)) {
+ setting = nm_setting_ip4_config_new ();
+ g_object_set (setting,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
+ NULL);
+ nm_connection_add_setting (connection, setting);
+
+ setting = nm_setting_ip6_config_new ();
+ g_object_set (setting,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
+ NULL);
+ nm_connection_add_setting (connection, setting);
+ }
+
return connection;
}