summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-04-02 21:06:40 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-04-03 16:06:21 +0000
commit1304063a4a7a6faea85d69be907d3ef9fdf80b89 (patch)
tree759c024dd9fd52b853667e9d9d375a0354d7ebcf
parent255724fb4a3633a6091cb22ef8d515387dab5ac5 (diff)
ansible: osmo-gsm-tester: Make modem net ifaces persistent
Currently ofono doesn't catch network interface renaming (takes the name at ofono startup time). If a modem crashes, its net iface is unregistered and registered again, and it can happen that the new name is not the same as before (for instance, wwan8->wwan0 if wwan0 is located on another netns). These udev rules allow creating persistent unique names to prevent modem crashes resulting on interface name changing. dhcpcd is known to race against udev when managing dev interfaces, bringing them up before udev sometimes, and then udev is unable to rename it. By denying dhcpcd from managing modem ifaces (ww* and r* according to kernel/our rules), we get rid of this issue. Related: OS#3881 Change-Id: Ic3ef75285aa84f9aa606562cd2f6166de186c1a6
-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*'