aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/roles/gsm-tester/files/70-net-setup-link-modems.rules
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 /ansible/roles/gsm-tester/files/70-net-setup-link-modems.rules
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
Diffstat (limited to 'ansible/roles/gsm-tester/files/70-net-setup-link-modems.rules')
-rw-r--r--ansible/roles/gsm-tester/files/70-net-setup-link-modems.rules10
1 files changed, 10 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"