mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 11:20:33 +01:00
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
This commit is contained in:
parent
8cbce0e18f
commit
89af7fbfa6
4 changed files with 41 additions and 2 deletions
|
|
@ -3805,7 +3805,8 @@ if WITH_UDEV_DIR
|
|||
udevrulesdir = $(UDEV_DIR)/rules.d
|
||||
udevrules_DATA = \
|
||||
data/84-nm-drivers.rules \
|
||||
data/85-nm-unmanaged.rules
|
||||
data/85-nm-unmanaged.rules \
|
||||
data/90-nm-thunderbolt.rules
|
||||
endif
|
||||
|
||||
data/server.conf: $(srcdir)/data/server.conf.in
|
||||
|
|
@ -3820,6 +3821,7 @@ EXTRA_DIST += \
|
|||
data/org.freedesktop.NetworkManager.service.in \
|
||||
data/84-nm-drivers.rules \
|
||||
data/85-nm-unmanaged.rules \
|
||||
data/90-nm-thunderbolt.rules \
|
||||
data/server.conf.in \
|
||||
data/meson.build
|
||||
|
||||
|
|
|
|||
13
data/90-nm-thunderbolt.rules
Normal file
13
data/90-nm-thunderbolt.rules
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Do not modify this file, it will get overwritten on updates.
|
||||
# To override or extend the rules place a file in /etc/udev/rules.d
|
||||
|
||||
ACTION!="add", GOTO="nm_thunderbolt_end"
|
||||
|
||||
# Load he thunderbolt-net driver if we a device of type thunderbolt_xdomain
|
||||
# is added.
|
||||
SUBSYSTEM=="thunderbolt", ENV{DEVTYPE}=="thunderbolt_xdomain", RUN{builtin}+="kmod load thunderbolt-net"
|
||||
|
||||
# For all thunderbolt network devices, we want to enable link-local configuration
|
||||
SUBSYSTEM=="net", ENV{ID_NET_DRIVER}=="thunderbolt-net", ENV{NM_AUTO_DEFAULT_LINK_LOCAL_ONLY}="1"
|
||||
|
||||
LABEL="nm_thunderbolt_end"
|
||||
|
|
@ -50,7 +50,8 @@ endif
|
|||
if install_udev_dir
|
||||
data = files(
|
||||
'84-nm-drivers.rules',
|
||||
'85-nm-unmanaged.rules'
|
||||
'85-nm-unmanaged.rules',
|
||||
'90-nm-thunderbolt.rules'
|
||||
)
|
||||
|
||||
install_data(
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue