summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-11-29 01:00:33 +0000
committerRoy Marples <roy@marples.name>2019-11-29 01:00:33 +0000
commitfb8eafb71188bf30bee4c4a0e76bfbcbf4d387a1 (patch)
tree32cd25eb271e6897a7ecfab16d0da598a21fb00d
parent4f8eeb986d8fc429c2e1ed68ba59edc84137a843 (diff)
downloaddhcpcd-ui-fb8eafb71188bf30bee4c4a0e76bfbcbf4d387a1.tar.xz
Support the up and coming dhcpcd-9.
-rw-r--r--src/libdhcpcd/dhcpcd.c12
-rw-r--r--src/libdhcpcd/dhcpcd.h10
2 files changed, 18 insertions, 4 deletions
diff --git a/src/libdhcpcd/dhcpcd.c b/src/libdhcpcd/dhcpcd.c
index 1a25636..c4c1f5d 100644
--- a/src/libdhcpcd/dhcpcd.c
+++ b/src/libdhcpcd/dhcpcd.c
@@ -1020,10 +1020,18 @@ dhcpcd_open(DHCPCD_CONNECTION *con, bool privileged)
errno = EISCONN;
return -1;
}
+
/* 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)
diff --git a/src/libdhcpcd/dhcpcd.h b/src/libdhcpcd/dhcpcd.h
index ed9eb54..7f47096 100644
--- a/src/libdhcpcd/dhcpcd.h
+++ b/src/libdhcpcd/dhcpcd.h
@@ -37,10 +37,16 @@ extern "C" {
#endif
#ifndef DHCPCD_SOCKET
-#define DHCPCD_SOCKET "/var/run/dhcpcd.sock"
+#define DHCPCD_SOCKET "/var/run/dhcpcd/sock"
#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