systemd/SOURCES/0929-hwdb-rules-mark-host-to-host-network-devices-as-only.patch

66 lines
2.3 KiB
Diff

From e5422e8537639fedba7efdcf82a75ab617990879 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 30 Oct 2023 16:53:59 +0100
Subject: [PATCH] hwdb,rules: mark host-to-host network devices as only
requiring link local addressing
This is a generalization of this logic:
https://github.com/NetworkManager/NetworkManager/blob/main/data/90-nm-thunderbolt.rules
It applies not just to thunderbolt, but to any kind of device, even
matched by vendor/product, via hwdb.
I added two entries for Prolific PC-to-PC devices (of which I have one
lying around).
(cherry picked from commit ec541c569bd19bbb81791139371111a9a7f1a3d8)
Related: RHEL-5950
---
hwdb.d/82-net-auto-link-local.hwdb | 12 ++++++++++++
rules.d/82-net-auto-link-local.rules | 15 +++++++++++++++
2 files changed, 27 insertions(+)
create mode 100644 hwdb.d/82-net-auto-link-local.hwdb
create mode 100644 rules.d/82-net-auto-link-local.rules
diff --git a/hwdb.d/82-net-auto-link-local.hwdb b/hwdb.d/82-net-auto-link-local.hwdb
new file mode 100644
index 0000000000..4057378f4f
--- /dev/null
+++ b/hwdb.d/82-net-auto-link-local.hwdb
@@ -0,0 +1,12 @@
+# This file is part of systemd.
+
+# Network interfaces for which only Link-Local communication (i.e. IPv4LL, …)
+# makes sense, because they almost certainy will point to another host, not an
+# internet router.
+
+# (Note: matches against drivers go into 82-net-auto-link-local.rules instead)
+
+# Prolific USB-to-USB links (https://www.prolific.com.tw/US/ShowProduct.aspx?pcid=43)
+usb:v067Bp25A1*
+usb:v067Bp27A1*
+ ID_NET_AUTO_LINK_LOCAL_ONLY=1
diff --git a/rules.d/82-net-auto-link-local.rules b/rules.d/82-net-auto-link-local.rules
new file mode 100644
index 0000000000..88ac7bc1be
--- /dev/null
+++ b/rules.d/82-net-auto-link-local.rules
@@ -0,0 +1,15 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION=="remove", GOTO="net_link_local_end"
+SUBSYSTEM!="net", GOTO="net_link_local_end"
+
+# Network interfaces for which only Link-Local communication (i.e. IPv4LL, …)
+# makes sense, because they almost certainy will point to another host, not an
+# internet router.
+
+# (Note: matches against VID/PID go into 82-net-auto-link-local.hwdb instead)
+
+# Thunderbolt host-to-host connections
+DRIVERS=="thunderbolt-net", ENV{ID_NET_AUTO_LINK_LOCAL_ONLY}="1"
+
+LABEL="net_link_local_end"