]> git.ozlabs.org Git - ppp.git/commitdiff
Fix an fd leak on the discovery socket.
authorPaul Mackerras <paulus@samba.org>
Thu, 4 Nov 2004 10:07:37 +0000 (10:07 +0000)
committerPaul Mackerras <paulus@samba.org>
Thu, 4 Nov 2004 10:07:37 +0000 (10:07 +0000)
Remove some unused code.

pppd/plugins/rp-pppoe/discovery.c
pppd/plugins/rp-pppoe/plugin.c
pppd/plugins/rp-pppoe/pppoe.h

index e05b77301ee35d186ba4feb96f3ef3ab121762e7..937ea5228b49b83cbaf07f4425c3ff88b99e743f 100644 (file)
@@ -9,7 +9,7 @@
 ***********************************************************************/
 
 static char const RCSID[] =
-"$Id: discovery.c,v 1.2 2004/01/13 04:03:58 paulus Exp $";
+"$Id: discovery.c,v 1.3 2004/11/04 10:07:37 paulus Exp $";
 
 #include "pppoe.h"
 
@@ -592,10 +592,6 @@ discovery(PPPoEConnection *conn)
     /* Skip discovery? */
     if (conn->skipDiscovery) {
        conn->discoveryState = STATE_SESSION;
-       if (conn->killSession) {
-           sendPADT(conn, "RP-PPPoE: Session killed manually");
-           exit(0);
-       }
        return;
     }
 
@@ -603,6 +599,8 @@ discovery(PPPoEConnection *conn)
        padiAttempts++;
        if (padiAttempts > MAX_PADI_ATTEMPTS) {
            warn("Timeout waiting for PADO packets");
+           close(conn->discoverySocket);
+           conn->discoverySocket = -1;
            return;
        }
        sendPADI(conn);
@@ -622,8 +620,7 @@ discovery(PPPoEConnection *conn)
 
     /* If we're only printing access concentrator names, we're done */
     if (conn->printACNames) {
-       printf("--------------------------------------------------\n");
-       exit(0);
+       die(0);
     }
 
     timeout = PADI_TIMEOUT;
@@ -631,6 +628,8 @@ discovery(PPPoEConnection *conn)
        padrAttempts++;
        if (padrAttempts > MAX_PADI_ATTEMPTS) {
            warn("Timeout waiting for PADS packets");
+           close(conn->discoverySocket);
+           conn->discoverySocket = -1;
            return;
        }
        sendPADR(conn);
index 3fa669c0d315a34a3e3702d9b43154c9a800b2eb..cd93bfa1887dcd30bf6bcb508305dc3bae5e78ca 100644 (file)
@@ -22,7 +22,7 @@
 ***********************************************************************/
 
 static char const RCSID[] =
-"$Id: plugin.c,v 1.11 2004/10/24 23:06:31 paulus Exp $";
+"$Id: plugin.c,v 1.12 2004/11/04 10:07:37 paulus Exp $";
 
 #define _GNU_SOURCE 1
 #include "pppoe.h"
@@ -244,6 +244,8 @@ PPPOEDisconnectDevice(void)
        return;
     }
     close(conn->sessionSocket);
+    /* don't send PADT?? */
+    close(conn->discoverySocket);
 }
 
 static void
index 35c98c8232dac6fb9f61f39f7852d48dda255e34..2309ad3e01bec8e5236fd037d1a0a35e8bc62aae 100644 (file)
@@ -9,7 +9,7 @@
 * This program may be distributed according to the terms of the GNU
 * General Public License, version 2 or (at your option) any later version.
 *
-* $Id: pppoe.h,v 1.1 2001/12/14 02:55:20 mostrows Exp $
+* $Id: pppoe.h,v 1.2 2004/11/04 10:07:37 paulus Exp $
 *
 ***********************************************************************/
 
@@ -263,7 +263,6 @@ typedef struct PPPoEConnectionStruct {
     int printACNames;          /* Just print AC names */
     int skipDiscovery;         /* Skip discovery */
     int noDiscoverySocket;     /* Don't even open discovery socket */
-    int killSession;           /* Kill session and exit */
     FILE *debugFile;           /* Debug file for dumping packets */
     int numPADOs;              /* Number of PADO packets received */
     PPPoETag cookie;           /* We have to send this if we get it */