Support the up and coming dhcpcd-9.
authorRoy Marples <roy@marples.name>
Fri, 29 Nov 2019 01:00:33 +0000 (01:00 +0000)
committerRoy Marples <roy@marples.name>
Fri, 29 Nov 2019 01:00:33 +0000 (01:00 +0000)
src/libdhcpcd/dhcpcd.c
src/libdhcpcd/dhcpcd.h

index 1a25636261966e7630f1fb97bf7197a161674812..c4c1f5d2bc0ce63de1509273e47e090e9b5b6cd0 100644 (file)
@@ -1020,10 +1020,18 @@ dhcpcd_open(DHCPCD_CONNECTION *con, bool privileged)
                errno = EISCONN;
                return -1;
        }
                errno = EISCONN;
                return -1;
        }
+
        /* We need to block the command fd */
        con->command_fd = dhcpcd_connect(path, 0);
        /* We need to block the command fd */
        con->command_fd = dhcpcd_connect(path, 0);
-       if (con->command_fd == -1)
-               goto err_exit;
+       if (con->command_fd == -1) {
+               if (errno == ENOENT) {
+                       path = privileged ?
+                           DHCPCD_OSOCKET : DHCPCD_UNPRIV_OSOCKET;
+                       con->command_fd = dhcpcd_connect(path, 0);
+               }
+               if (con->command_fd == -1)
+                       goto err_exit;
+       }
 
        con->terminate_commands = false;
        if (dhcpcd_ctrl_command(con, "--version", &con->version) <= 0)
 
        con->terminate_commands = false;
        if (dhcpcd_ctrl_command(con, "--version", &con->version) <= 0)
index ed9eb5431ea3f79426e8e85562fd297ac5a782e7..7f4709662961a85857784f82103589f0329d6c7a 100644 (file)
@@ -37,10 +37,16 @@ extern "C" {
 #endif
 
 #ifndef DHCPCD_SOCKET
 #endif
 
 #ifndef DHCPCD_SOCKET
-#define DHCPCD_SOCKET          "/var/run/dhcpcd.sock"
+#define DHCPCD_SOCKET          "/var/run/dhcpcd/sock"
 #endif
 #ifndef DHCPCD_UNPRIV_SOCKET
 #endif
 #ifndef DHCPCD_UNPRIV_SOCKET
-#define DHCPCD_UNPRIV_SOCKET   "/var/run/dhcpcd.unpriv.sock"
+#define DHCPCD_UNPRIV_SOCKET   "/var/run/dhcpcd/unpriv.sock"
+#endif
+#ifndef DHCPCD_OSOCKET
+#define DHCPCD_OSOCKET         "/var/run/dhcpcd.sock"
+#endif
+#ifndef DHCPCD_UNPRIV_OSOCKET
+#define DHCPCD_UNPRIV_OSOCKET  "/var/run/dhcpcd.unpriv.sock"
 #endif
 
 #ifndef WPA_CTRL_DIR
 #endif
 
 #ifndef WPA_CTRL_DIR