main/postmarketos-base-ui: Fix growing number of tethering unudhcpd instances (MR 5905)

/usr/lib/NetworkManager/dispatcher.d/50-tethering.sh had a typo in the
"killall" command in the "disable_tethering" function, leading to it
never stopping any unudhcpd process. As a new instance is started each
time a USB cable is connected, so the number of instances kept growing
until reboot. Fix the typo so any old unudhcpd instance is actually
stopped before starting a new one.

To illustrate the bug, a sample with an uptime of 4 days:

$ ps w | grep unudhcpd
 2467 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
 5009 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
 5525 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
 6360 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
 7271 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
 9356 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
11045 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
14779 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
15696 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
17454 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
19119 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
24729 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
25565 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
25691 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
27417 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
30649 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
31690 root      0:00 unudhcpd -i usb0 -s 172.16.42.1 -c 172.16.42.2
[ci:skip-build]: already built successfully in CI
This commit is contained in:
Fiona Klute 2024-12-13 18:02:02 +01:00 committed by Clayton Craft
parent 3becd343af
commit 1b83a7647e
No known key found for this signature in database
GPG Key ID: 4A4CED6D7EDF950A
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
# Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=postmarketos-base-ui
pkgver=30
pkgver=31
pkgrel=0
pkgdesc="Meta package for minimal postmarketOS UI base"
url="https://postmarketos.org"
@ -321,7 +321,7 @@ d4b4c4fed2dee7266f6a87ae266691377593014943e2953e4cd87a59f3110f25bfb5f3f866cc8435
d1ddd43489e6016e3ffd716027ed2bae4a2ab5f213118bdbcb96750e267ab7c0367cd0e0e386300aa5550352653144f5caeddd790621fe0879f83ca1995bb65c rootfs-etc-tinydm.d-env-wayland.d-50-firefox-wayland.sh
ecaa57d033a119a53a6574c27636b7c89d659d75ea48a973a6a4ff6f90e5d07202529fd489bfc9dfc7430f5b60f40612f6d5c06f7fab47e681b0a3112a874058 rootfs-etc-tinydm.d-env-wayland.d-50-sdl-wayland.sh
36e0037f6d26a99db7b47831263be610d594e2c1c4a8ee7f6fc8b41092f501d3064d80b80ddf6a82b616bd2da09aa4da896074ad9f7fd53aba7e397da4190d22 rootfs-usr-lib-NetworkManager-dispatcher.d-50-dns-filter.sh
9dcf698c729e6a3d05201aa74c1618169f344f9c973e6a074591b0b4f352470235decbbc658393f44c62b6b1508c68f3c1787a640f219dbcc136e9335f3994c4 rootfs-usr-lib-NetworkManager-dispatcher.d-50-tethering.sh
82f6818031021fe777848bcbe328cdb04d508b9c4b19d4c9162bf6f07f62f75d21798f7cf859cb44a3321a375dc9fb5d29402c5624b7bc42e92a698fae482b7c rootfs-usr-lib-NetworkManager-dispatcher.d-50-tethering.sh
bf8db527c49fa724e640a90269ba2648a2555f5867b2adbfbd88d1f685261f757339757c09ee08f590c76de4bd3d0c73a47dea9bd340644dd4707e76152cefd1 rootfs-etc-profile.d-qt-mobile-controls.sh
6e193eca3961a78d47b4656892eae34d019d9317a255a201f5ea61e3300caff04c526a27cd98d0edc072b36e3eaf3a1768f4cd27c5e2be8b19c167d535c820a6 rootfs-etc-profile.d-qt-wayland.sh
"

View File

@ -68,8 +68,8 @@ disable_tethering() {
nmcli connection modify "$con_uuid" ipv6.method "link-local"
nmcli connection modify "$con_uuid" connection.autoconnect "true"
# Restart unudhpcd and configure it similar to initfs
killall unudhpcd || true
# Restart unudhcpd and configure it similar to initfs
killall unudhcpd || true
(unudhcpd -i "$interface" -s "$host_ip" -c "$client_ip") &
logger -t nm-tethering "unudhcpd started"