]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/rp-pppoe/plugin.c
PPPoE updates: don't exit if discovery fails, cope with both
[ppp.git] / pppd / plugins / rp-pppoe / plugin.c
index 6885751bbebd7aba6cecdabc4e23a3c618816a47..00316ae5050979482e2c8f2925ec8d354f0c2f63 100644 (file)
@@ -22,7 +22,7 @@
 ***********************************************************************/
 
 static char const RCSID[] =
-"$Id: plugin.c,v 1.8 2003/03/04 05:21:38 fcusack Exp $";
+"$Id: plugin.c,v 1.10 2004/01/13 04:03:58 paulus Exp $";
 
 #define _GNU_SOURCE 1
 #include "pppoe.h"
@@ -144,7 +144,8 @@ PPPOEConnectDevice(void)
     } else {
        discovery(conn);
        if (conn->discoveryState != STATE_SESSION) {
-           fatal("Unable to complete PPPoE Discovery");
+           error("Unable to complete PPPoE Discovery");
+           return -1;
        }
     }
 
@@ -180,7 +181,7 @@ PPPOEConnectDevice(void)
     return conn->sessionSocket;
 }
 
-static int
+static void
 PPPOESendConfig(int mtu,
                u_int32_t asyncmap,
                int pcomp,
@@ -196,30 +197,26 @@ PPPOESendConfig(int mtu,
     sock = socket(AF_INET, SOCK_DGRAM, 0);
     if (sock < 0) {
        error("Couldn't create IP socket: %m");
-       return -1;
+       return;
     }
     strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
     ifr.ifr_mtu = mtu;
     if (ioctl(sock, SIOCSIFMTU, &ifr) < 0) {
-       error("ioctl(SIOCSIFMTU): %m");
-       return -1;
+       error("Couldn't set interface MTU to %d: %m", mtu);
+       return;
     }
     (void) close (sock);
-    return 0;
 }
 
 
-static int
+static void
 PPPOERecvConfig(int mru,
                u_int32_t asyncmap,
                int pcomp,
                int accomp)
 {
-    if (mru > MAX_PPPOE_MTU) {
-       error("Couldn't increase MRU to %d", mru);
-       return -1;
-    }
-    return 0;
+    if (mru > MAX_PPPOE_MTU)
+       warn("Couldn't increase MRU to %d", mru);
 }
 
 /**********************************************************************
@@ -280,13 +277,14 @@ PPPoEDevnameHook(char *cmd, char **argv, int doit)
     int fd;
     struct ifreq ifr;
 
-    /* Only do it if name is "ethXXX" or "nic-XXXX.  In latter case,
-       strip off the "nic-" */
+    /* Only do it if name is "ethXXX", "nasXXX", "tapXXX" or "nic-XXXX.
+       In latter case strip off the "nic-" */
     /* Thanks to Russ Couturier for this fix */
     if (strlen(cmd) > 4 && !strncmp(cmd, "nic-", 4)) {
        /* Strip off "nic-" */
        cmd += 4;
-    } else if (strlen(cmd) < 4 || strncmp(cmd, "eth", 3)) {
+    } else if (strlen(cmd) < 4 || (strncmp(cmd, "eth", 3) &&
+               strncmp(cmd, "nas", 3) && strncmp(cmd, "tap", 3))) {
        if (OldDevnameHook) return OldDevnameHook(cmd, argv, doit);
        return 0;
     }