summaryrefslogtreecommitdiff
path: root/pppd
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2021-12-21 16:00:18 +0100
committerPali Rohár <pali@kernel.org>2021-12-21 16:00:18 +0100
commit199a82df0d026850107ae2a7caff4d5b755413b5 (patch)
treebd453af0bf8a5cbef85a9f5f4e950f8b1677159f /pppd
parentef301cf2637ba85a9d33e368ba0417a9fed190bb (diff)
downloadppp-199a82df0d026850107ae2a7caff4d5b755413b5.tar.gz
pppoe-discovery: Do not set eth0 as default interface
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>
Diffstat (limited to 'pppd')
-rw-r--r--pppd/plugins/pppoe/pppoe-discovery.82
-rw-r--r--pppd/plugins/pppoe/pppoe-discovery.c9
2 files changed, 6 insertions, 5 deletions
diff --git a/pppd/plugins/pppoe/pppoe-discovery.8 b/pppd/plugins/pppoe/pppoe-discovery.8
index d0a93db..e048f66 100644
--- a/pppd/plugins/pppoe/pppoe-discovery.8
+++ b/pppd/plugins/pppoe/pppoe-discovery.8
@@ -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"
diff --git a/pppd/plugins/pppoe/pppoe-discovery.c b/pppd/plugins/pppoe/pppoe-discovery.c
index 1fe999d..4ac5106 100644
--- a/pppd/plugins/pppoe/pppoe-discovery.c
+++ b/pppd/plugins/pppoe/pppoe-discovery.c
@@ -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"