I've been trying to get diald-99 to work on my setup (LRP 2.9.4 with 
kernel 2.2.10 and iproute2) for a couple of months now.  I think I 
finally got it to work (at least it's worked for the past 5 days)!  

I had to make some changes to source code, though (see below). 
You will find the patches at the end of this email.  I hope you find 
them useful.

The patches are intended to fix the following problems:

1. chat fails when you use ethertap
2. diald doesn't work right with iproute2.
a. diald fails to update default route when ppp link is 
brought up (symptom:  "RTNETLINK answers:  File exists" 
in the logs)
b. diald uses ifconfig instead of equivalent iproute2 
commands.
3. diald does not set up routes with correct metric
4. diald does not send buffered packets back out over the proxy 
when using the "dynamic" option

STANDARD DISCLAIMER:  diald is a complicated program and is 
especially sensitive to variations in operating system and hardware 
as well as configuration errors. I am not a programmer, merely a 
user who didn't want to wait for the official patches.  

Your mileage will almost certainly vary.

Ed G.

--- diald-99/options.c  Thu Apr  1 17:42:14 1999
+++ newdiald-99/options.c       Sat Oct 16 11:11:41 1999
@@ -774,8 +774,8 @@
     int flag = 0;
 
     if (!ifsetup || !*ifsetup) {
-       if (!path_ifconfig || !*path_ifconfig)
-           flag = 1, mon_syslog(LOG_ERR, "No ifconfig program found.");
+       if ((!path_ifconfig || !*path_ifconfig) && (!path_ip || !*path_ip))
+           flag = 1, mon_syslog(LOG_ERR, "No ifconfig or ip program found.");
        if ((!path_ip || !*path_ip) && (!path_route || !*path_route))
            flag = 1, mon_syslog(LOG_ERR,"No ip or route programs found.");
        else if (broadcast_ip && inet_addr(broadcast_ip) == -1)
--- diald-99/route.c    Tue Jun  1 18:49:55 1999
+++ newdiald-99/route.c Sat Oct 16 11:16:18 1999
@@ -9,6 +9,8 @@
 
 #include "diald.h"
 
+#define adjmetric(metric) (strcmp(proxyif, iface) ? metric: metric + 1)
+
 static void
 add_routes(char *desc, char *iface, char *lip, char *rip)
 {
@@ -41,14 +43,14 @@
                path_ip, rip, iface,
                lip ? " src " : "",
                lip ? lip : "",
-               metric, win); 
+               adjmetric(metric), win); 
        } else {
            sprintf(buf,"%s add %s metric %d %s dev %s",
-               path_route, rip, metric, win, iface);
+               path_route, rip, adjmetric(metric), win, iface);
        }
        run_shell(SHELL_WAIT, desc, buf, -1);
 
-       if (metric) {
+       if (adjmetric(metric)) {
            if (path_ip && *path_ip) {
                sprintf(buf,"%s route del %s dev %s scope link%s%s metric 0 %s",
                    path_ip, rip, iface,
@@ -71,7 +73,7 @@
                path_ip, iface,
                lip ? " src " : "",
                lip ? lip : "",
-               metric, win); 
+               adjmetric(metric), win); 
        } else {
            sprintf(buf,"%s add default metric %d %s netmask 0.0.0.0 dev %s",
                path_route, metric, win, iface);
@@ -83,7 +85,7 @@
     if (addroute) {
         sprintf(buf,"%s %s %s \"%s\" \"%s\" %d %d",
            addroute, iface, (netmask)?netmask:"default",
-           lip, rip, metric, window);
+           lip, rip, adjmetric(metric), window);
        run_shell(SHELL_WAIT, desc, buf, -1);
     }
 
@@ -106,7 +108,7 @@
         sprintf(buf, "%s %s %s \"%s\" \"%s\" %d",
            delroute, iface,
            (netmask) ? netmask : "default",
-           lip, rip, metric);
+           lip, rip, adjmetric(metric));
         run_shell(SHELL_WAIT, desc, buf, -1);
     }
 
@@ -116,16 +118,15 @@
                path_ip, iface,
                lip ? " src " : "",
                lip ? lip : "",
-               metric); 
+               adjmetric(metric)); 
        } else {
            sprintf(buf, "%s del default metric %d netmask 0.0.0.0 dev %s",
-               path_route, metric, iface);
+               path_route, adjmetric(metric), iface);
        }
         run_shell(SHELL_WAIT, desc, buf, -1);
     }
 }
 
-
 void
 iface_start(char *mode, char *iftype, int ifunit,
     char *lip, char *rip, char *bip)
@@ -150,7 +151,24 @@
     }
 
     /* With no ifsetup script we have to do it all ourselves. */
+
     if (lip) {
+      if (path_ip && *path_ip) { /* don't bother with ifconfig, if iproute2 is 
+installed */
+
+       /* ip addr add */
+               sprintf(buf,"%s addr add dev %s local %s%s%s scope link%s%s",
+                path_ip, iface, lip, 
+               rip ? " peer " : "",
+               rip ? rip : "",
+                bip ? " broadcast " : "",
+                bip ? bip : "");
+       run_shell(SHELL_WAIT, desc, buf, -1);
+       
+       /* ip link set up */
+       sprintf(buf,"%s link set dev %s mtu %d up", path_ip, iface, mtu);
+       run_shell(SHELL_WAIT, desc, buf, -1);
+      }
+      else {
        sprintf(buf,"%s %s %s%s%s%s%s netmask %s metric %d mtu %d up",
            path_ifconfig, iface, lip,
            rip ? " pointopoint " : "",
@@ -158,14 +176,13 @@
            bip ? " broadcast " : "",
            bip ? bip : "",
            netmask ? netmask : "255.255.255.255",
-           metric, mtu);
+           adjmetric(metric), mtu);
        run_shell(SHELL_WAIT, desc, buf, -1);
+      }
     }
-
     add_routes(desc, iface, lip, rip);
 }
 
-
 void
 iface_stop(char *mode, char *iftype, int ifunit,
     char *lip, char *rip, char *bip)
@@ -198,13 +215,48 @@
      * set some of the support scripts to do the right thing.
      */
     del_routes(desc, iface, lip, rip);
+    /* iproute 2 */
+    if (path_ip && *path_ip) {
+      /* for the proxy (or a managed device) we keep the link up 
+      but delete the address */ 
+      if ((strcmp(mode, "proxy") == 0) || (current_mode == MODE_DEV)) {
+        sprintf(buf, "%s addr del %s dev %s", path_ip, lip, iface);
+       run_shell(SHELL_WAIT, desc, buf, -1);
+       return;
+      } else {
+       /* for ppp (or slip), down the interface */
+        sprintf(buf, "%s link set dev %s down", path_ip, iface);
+       run_shell(SHELL_WAIT, desc, buf, -1);
+       return;
+      }
+    }
 
-    sprintf(buf, "%s %s %s",
+    if (strcmp(mode, "proxy") == 0) {
+       sprintf(buf, "%s %s %s",
        path_ifconfig, iface,
 #ifdef HAVE_AF_PACKET
-       (af_packet && current_mode == MODE_DEV) ? "0.0.0.0" : "down");
+       af_packet ? "0.0.0.0" : "127.0.0.2");
 #else
-       current_mode == MODE_DEV ? "0.0.0.0" : "down");
+       "127.0.0.2");
 #endif
-    run_shell(SHELL_WAIT, desc, buf, -1);
+        run_shell(SHELL_WAIT, desc, buf, -1);
+       return;
+    }
+    else {
+       sprintf(buf,"%s %s %s",
+             path_ifconfig, iface,
+#ifdef HAVE_AF_PACKET
+             (af_packet && current_mode == MODE_DEV) ? "0.0.0.0" : "down");
+#else
+             current_mode == MODE_DEV ? "0.0.0.0" : "down");
+#endif
+         run_shell(SHELL_WAIT, desc, buf, -1);
+         return;
+    }
+    
 }
+
+
+
+
+
--- diald-99/shell.c    Thu Apr  1 17:42:15 1999
+++ newdiald-99/shell.c Wed Oct 13 11:08:28 1999
@@ -56,6 +56,11 @@
        /* FIXME: These should not be open to std{in,out,err} anyway
         * unless we are not in daemon mode...
         */
+
+       /* Move modem fd out of way
+          this fixes the ethertap bug
+       */
+       d = dup2(d, 90);
        close(0);
        close(1);
        close(2);


-
To unsubscribe from this list: send the line "unsubscribe linux-diald" in
the body of a message to [EMAIL PROTECTED]

Reply via email to