tags 627786 + patch upstream
thanks

Hello,

Here is the promised patch to make dibbler use an interface name
of if own to others do get get in its way.

The patch is relative to the one in #627317

Bye,

Joerg

--- lowlevel-options-linux.c    2011-05-27 12:17:38.000000000 +0200
+++ lowlevel-options-linux.c.x2 2011-05-27 12:17:12.000000000 +0200
@@ -12,6 +12,7 @@
 #include <stdio.h>
 #include <linux/types.h>
 #include <sys/socket.h>
+#include <sys/wait.h>
 #include <linux/rtnetlink.h>
 #include <ctype.h>
 #include <errno.h>
@@ -34,14 +35,24 @@
  * @param arg1
  * @param arg2
  * are command line arguments to resolvconf (-a|-d, "IFNAME")
+ * IFNAME will have .dibbler appended
  */
 FILE *resolvconf_open(const char *arg1, const char *arg2)
 {
+#define DIBBLER_PATHLEN 42
+#define DIBBLER_SUFFIX ".dibbler"
     pid_t child;
+    char ifname[DIBBLER_PATHLEN];
+    size_t len;
     int pipefd[2];
 
     if (access(RESOLVCONF, X_OK) != 0)
          return NULL;
+    len=strlen(arg2);
+    if (!((len + strlen(DIBBLER_SUFFIX)) < DIBBLER_PATHLEN))
+        return NULL;
+    strcpy(ifname, arg2); /* long enough as checked before */
+    strcpy(ifname+len, DIBBLER_SUFFIX);
     if (pipe(pipefd) != 0)
         return NULL;
     switch(child=fork()) {
@@ -52,7 +63,7 @@
          close(pipefd[0]);
          /* double fork so init reaps the child */
          if (!fork()) { /* child */
-               execl(RESOLVCONF, RESOLVCONF, arg1, arg2, (char *)NULL);
+               execl(RESOLVCONF, RESOLVCONF, arg1, ifname, (char *)NULL);
          } /* All other cases are meaningless here */
          exit(-1);
          break;

Attachment: signature.asc
Description: Digital signature

Reply via email to