]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
udev: Ensure we have a subsystem, action and ifname
authorRoy Marples <roy@marples.name>
Sat, 20 Jun 2026 22:00:57 +0000 (23:00 +0100)
committerGitHub <noreply@github.com>
Sat, 20 Jun 2026 22:00:57 +0000 (23:00 +0100)
As udev could return NULL for them.

Reported by NVIDIA Project Vanessa

.github/workflows/build.yml
src/dev/udev.c

index 84a4015d5e3193330699ae4ca1660dacacc57f41..c8ce6aa24b8c5c385cac7c69f2a3a1ad7b8f7bf1 100644 (file)
@@ -35,6 +35,9 @@ jobs:
         os: [ ubuntu-latest, ubuntu-22.04 ]
     runs-on: ${{ matrix.os }}
 
+    - name: Install libudev-dev
+      run: sudo apt install -y pkg-config libudev-dev
+
     steps:
     - uses: actions/checkout@v6
     
index 5a6735b584698a81a56b02aba83ad62c793b8cc5..0e43b169542b382782dd7849b08ef267c0b07fe2 100644 (file)
@@ -90,9 +90,12 @@ udev_handle_device(void *ctx)
        action = udev_device_get_action(device);
 
        /* udev filter documentation says "usually" so double check */
-       if (strcmp(subsystem, "net") == 0) {
+       if (subsystem != NULL && strcmp(subsystem, "net") == 0) {
                logdebugx("%s: libudev: %s", ifname, action);
-               if (strcmp(action, "add") == 0 || strcmp(action, "move") == 0)
+               if (action == NULL || ifname == NULL)
+                       ;
+               else if (strcmp(action, "add") == 0 ||
+                   strcmp(action, "move") == 0)
                        dhcpcd.handle_interface(ctx, 1, ifname);
                else if (strcmp(action, "remove") == 0)
                        dhcpcd.handle_interface(ctx, -1, ifname);