summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ansible/roles/gsm-tester/files/70-net-setup-link-modems.rules10
-rw-r--r--ansible/roles/gsm-tester/tasks/main.yml12
2 files changed, 22 insertions, 0 deletions
diff --git a/ansible/roles/gsm-tester/files/70-net-setup-link-modems.rules b/ansible/roles/gsm-tester/files/70-net-setup-link-modems.rules
new file mode 100644
index 0000000..a9826e2
--- /dev/null
+++ b/ansible/roles/gsm-tester/files/70-net-setup-link-modems.rules
@@ -0,0 +1,10 @@
+SUBSYSTEM!="net", GOTO="net_setup_link_end"
+ACTION!="add", GOTO="net_setup_link_end"
+
+IMPORT{builtin}="net_id"
+
+# If dev paths are too long (too many usb hubs in the path) (>IFNAMSIZ), ID_NET_NAME_PATH is not populated.
+ENV{DEVTYPE}=="wwan", ENV{ID_NET_NAME_PATH}!="", NAME="$env{ID_NET_NAME_PATH}"
+ENV{DEVTYPE}=="wwan", ENV{ID_NET_NAME_PATH}=="", PROGRAM="/bin/sh -ec 'echo ${DEVPATH} | sha1sum | head -c14'", NAME="r$result"
+
+LABEL="net_setup_link_end"
diff --git a/ansible/roles/gsm-tester/tasks/main.yml b/ansible/roles/gsm-tester/tasks/main.yml
index 8a854bd..c9b7429 100644
--- a/ansible/roles/gsm-tester/tasks/main.yml
+++ b/ansible/roles/gsm-tester/tasks/main.yml
@@ -274,3 +274,15 @@
src: 64-limesuite.rules
dest: /etc/udev/rules.d/
notify: restart udev
+
+- name: use persistent naming for modem network interfaces
+ copy:
+ src: 70-net-setup-link-modems.rules
+ dest: /etc/udev/rules.d/
+ notify: restart udev
+
+- name: avoid dhcpcd managing modem interfaces and racing with udev rename
+ lineinfile:
+ path: /etc/dhcpcd.conf
+ regexp: '^denyinterfaces'
+ line: 'denyinterfaces ww* r*'