]> git.ozlabs.org Git - ppp.git/commitdiff
Make a consistency in pppoe options
authorPali Rohár <pali@kernel.org>
Thu, 31 Dec 2020 17:49:27 +0000 (18:49 +0100)
committerPali Rohár <pali@kernel.org>
Fri, 1 Jan 2021 01:56:42 +0000 (02:56 +0100)
Remove 'rp_' prefix from all pppoe options and ensure that pppoe options
have 'pppoe-' prefix. Also change underlines to dashes to be consistent
with other pppd options.

To not break a backward compatibility ensure that old option names still
work via (legacy) aliases.

Also document everything in pppd manual page.

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

index e840bef6b43b3b5bb4ea9cb12c4241cf2eb96da5..f705b5facd7392fcc940b89b31c2ee7bb3e9ed3d 100644 (file)
@@ -67,7 +67,7 @@ static char *existingSession = NULL;
 static int printACNames = 0;
 static char *pppoe_reqd_mac = NULL;
 unsigned char pppoe_reqd_mac_addr[6];
-static char *host_uniq;
+static char *pppoe_host_uniq;
 static int pppoe_padi_timeout = PADI_TIMEOUT;
 static int pppoe_padi_attempts = MAX_PADI_ATTEMPTS;
 
@@ -77,18 +77,28 @@ static option_t Options[] = {
       "PPPoE device name",
       OPT_DEVNAM | OPT_PRIVFIX | OPT_NOARG  | OPT_A2STRVAL | OPT_STATIC,
       devnam},
-    { "rp_pppoe_service", o_string, &pppd_pppoe_service,
+    { "pppoe-service", o_string, &pppd_pppoe_service,
       "Desired PPPoE service name" },
-    { "rp_pppoe_ac",      o_string, &acName,
+    { "rp_pppoe_service", o_string, &pppd_pppoe_service,
+      "Legacy alias for pppoe-service", OPT_ALIAS },
+    { "pppoe-ac",      o_string, &acName,
       "Desired PPPoE access concentrator name" },
-    { "rp_pppoe_sess",    o_string, &existingSession,
+    { "rp_pppoe_ac",      o_string, &acName,
+      "Legacy alias for pppoe-ac", OPT_ALIAS },
+    { "pppoe-sess",    o_string, &existingSession,
       "Attach to existing session (sessid:macaddr)" },
+    { "rp_pppoe_sess",    o_string, &existingSession,
+      "Legacy alias for pppoe-sess", OPT_ALIAS },
+    { "pppoe-verbose", o_int, &printACNames,
+      "Be verbose about discovered access concentrators" },
     { "rp_pppoe_verbose", o_int, &printACNames,
-      "Be verbose about discovered access concentrators"},
+      "Legacy alias for pppoe-verbose", OPT_ALIAS },
     { "pppoe-mac", o_string, &pppoe_reqd_mac,
       "Only connect to specified MAC address" },
-    { "host-uniq", o_string, &host_uniq,
+    { "pppoe-host-uniq", o_string, &pppoe_host_uniq,
       "Set the Host-Uniq to the supplied hex string" },
+    { "host-uniq", o_string, &pppoe_host_uniq,
+      "Legacy alias for pppoe-host-uniq", OPT_ALIAS },
     { "pppoe-padi-timeout", o_int, &pppoe_padi_timeout,
       "Initial timeout for discovery packets in seconds" },
     { "pppoe-padi-attempts", o_int, &pppoe_padi_attempts,
@@ -174,9 +184,9 @@ PPPOEConnectDevice(void)
     if (lcp_wantoptions[0].mru > ifr.ifr_mtu - TOTAL_OVERHEAD)
        lcp_wantoptions[0].mru = ifr.ifr_mtu - TOTAL_OVERHEAD;
 
-    if (host_uniq) {
-       if (!parseHostUniq(host_uniq, &conn->hostUniq))
-           fatal("Illegal value for host-uniq option");
+    if (pppoe_host_uniq) {
+       if (!parseHostUniq(pppoe_host_uniq, &conn->hostUniq))
+           fatal("Illegal value for pppoe-host-uniq option");
     } else {
        /* if a custom host-uniq is not supplied, use our PID */
        pid_t pid = getpid();
@@ -194,7 +204,7 @@ PPPOEConnectDevice(void)
        if (sscanf(existingSession, "%d:%x:%x:%x:%x:%x:%x",
                   &ses, &mac[0], &mac[1], &mac[2],
                   &mac[3], &mac[4], &mac[5]) != 7) {
-           fatal("Illegal value for rp_pppoe_sess option");
+           fatal("Illegal value for pppoe-sess option");
        }
        conn->session = htons(ses);
        for (i=0; i<ETH_ALEN; i++) {
index 6a11fcb17b6de7f0ac75bd76e7f790edc9ae7f2e..3b7c28835cd9b87c5a3051029e7b28fbc8d296fc 100644 (file)
@@ -1215,24 +1215,30 @@ by specifying ppp'd option \fBnic-eth0\fR. Prefix \fBnic-\fR for this
 option may be avoided if interface name is unambiguous and does not
 look like any other pppd's option.
 .TP
-.B rp_pppoe_service \fIname
-Connect to specified PPPoE service name.
+.B pppoe-service \fIname
+Connect to specified PPPoE service name. For backward compatibility also
+\fBrp_pppoe_service\fP option name is supported.
 .TP
-.B rp_pppoe_ac \fIname
-Connect to specified PPPoE access concentrator name.
+.B pppoe-ac \fIname
+Connect to specified PPPoE access concentrator name. For backward
+compatibility also \fBrp_pppoe_ac\fP option name is supported.
 .TP
-.B rp_pppoe_sess \fIsessid\fP:\fImacaddr
-Attach to existing PPPoE session.
+.B pppoe-sess \fIsessid\fP:\fImacaddr
+Attach to existing PPPoE session. For backward compatibility also
+\fBrp_pppoe_sess\fP option name is supported.
 .TP
-.B rp_pppoe_verbose \fIn
-Be verbose about discovered access concentrators.
+.B pppoe-verbose \fIn
+Be verbose about discovered access concentrators. For backward
+compatibility also \fBrp_pppoe_verbose\fP option name is supported.
 .TP
 .B pppoe-mac \fImacaddr
 Connect to specified MAC address.
 .TP
-.B host-uniq \fIstring
+.B pppoe-host-uniq \fIstring
 Set the PPPoE Host-Uniq tag to the supplied hex string.
 By default PPPoE Host-Uniq tag is set to the pppd's process PID.
+For backward compatibility this option may be specified without
+\fBpppoe-\fP prefix.
 .TP
 .B pppoe-padi-timeout \fIn
 Initial timeout for discovery packets in seconds (default 5).