Change in osmo-ci[master]: ansible: osmo-gsm-tester: Make modem net ifaces persistent

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Wed Apr 3 16:06:21 UTC 2019


Pau Espin Pedrol has submitted this change and it was merged. ( https://gerrit.osmocom.org/13495 )

Change subject: ansible: osmo-gsm-tester: Make modem net ifaces persistent
......................................................................

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
---
A ansible/roles/gsm-tester/files/70-net-setup-link-modems.rules
M ansible/roles/gsm-tester/tasks/main.yml
2 files changed, 22 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Pau Espin Pedrol: Verified



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*'

-- 
To view, visit https://gerrit.osmocom.org/13495
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic3ef75285aa84f9aa606562cd2f6166de186c1a6
Gerrit-Change-Number: 13495
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190403/dab302ee/attachment.htm>


More information about the gerrit-log mailing list