]> git.ozlabs.org Git - ppp.git/commitdiff
pppoe-discovery: Do not set eth0 as default interface
authorPali Rohár <pali@kernel.org>
Tue, 21 Dec 2021 15:00:18 +0000 (16:00 +0100)
committerPali Rohár <pali@kernel.org>
Tue, 21 Dec 2021 15:00:18 +0000 (16:00 +0100)
On most Linux systems there is no network interface with name eth0.

So rather make -I interface option as mandatory and do not rely on some
default hardcoded interface name.

Signed-off-by: Pali Rohár <pali@kernel.org>
pppd/plugins/pppoe/pppoe-discovery.8
pppd/plugins/pppoe/pppoe-discovery.c

index d0a93db02081c1a1f07e0e72e1bbab6885539530..e048f66b5d2f6b4966076bd3a1fcd47cf48d18cb 100644 (file)
@@ -26,7 +26,7 @@ Under Linux, it is typically eth0 or eth1.
 The interface should be \(lqup\(rq before you start
 \fBpppoe\-discovery\fR, but should \fInot\fR be configured to have an
 IP address.
-The default interface is eth0.
+This option is mandatory.
 .RE
 .TP
 .BI \-D " file_name"
index 1fe999dbdf55b16fa7bbefe5ce6557b1f848fa26..4ac51063fc295967e15dc1fa6015710d8613418f 100644 (file)
@@ -251,9 +251,10 @@ int main(int argc, char *argv[])
        }
     }
 
-    /* default interface name */
-    if (!conn->ifName)
-       conn->ifName = xstrdup("eth0");
+    if (!conn->ifName) {
+       fprintf(stderr, "Interface was not specified\n");
+       exit(EXIT_FAILURE);
+    }
 
     conn->sessionSocket = -1;
 
@@ -276,7 +277,7 @@ usage(void)
 {
     fprintf(stderr, "Usage: pppoe-discovery [options]\n");
     fprintf(stderr, "Options:\n");
-    fprintf(stderr, "   -I if_name     -- Specify interface (default eth0)\n");
+    fprintf(stderr, "   -I if_name     -- Specify interface (mandatory option)\n");
     fprintf(stderr, "   -D filename    -- Log debugging information in filename.\n");
     fprintf(stderr,
            "   -t timeout     -- Initial timeout for discovery packets in seconds\n"