Package: ppp
Version: 2.4.6-3
Severity: normal

Using arbitrary interface names for PPPoE server I figured out that it tries to 
rename the new pppX interface
to the name specified by ifname. For this reason I change the previous patch 
ppp-2.4.2-ifname.diff and
I've added interface unit to the new interfaces. If I set "ifname pppoe" in ppp 
options I will get
interfaces like pppoe0, pppoe1.

When PPPoE server tries to create a new interface for a new connection it 
rejects because it founds that the
specified interface is already exist in the system.

This patch should be used after appling the patch ppp-2.4.2-ifname.diff


-- System Information:
Debian Release: 8.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages ppp depends on:
ii  init-system-helpers  1.22
ii  libc6                2.19-13
ii  libpam-modules       1.1.8-3.1
ii  libpam-runtime       1.1.8-3.1
ii  libpam0g             1.1.8-3.1
ii  libpcap0.8           1.6.2-2
ii  procps               2:3.3.9-8

ppp recommends no packages.

ppp suggests no packages.

-- no debconf information
Description: Fix Linux interface rename
 This patch fix renaming interface under Linux using ifname and put interface unit at the end
 Also fix the return of the unit in radius plugin
 .
 ppp (2.4.6-3) unstable; urgency=high
 .
   * Urgency high due to fix for CVE-2014-3158.
   * Cherry-pick patches from 2.4.7 upstream release. These are 9 of 11 patches
     in the 2.4.7 upstream release of PPP, including the fix for CVE-2014-3158.
     The two patches left out were not imported in order to preserve ABI
     stability. (Closes: #762789)
     - ppp-2.4.7-001-pppd-Separate-IPv6-handling-for-sifup-sifdown.patch
     - ppp-2.4.7-002-pppol2tp-Connect-up-down-events-to-notifiers-and-add.patch
     - ppp-2.4.7-003-pppd-Add-declarations-to-eliminate-compile-warnings.patch
     - ppp-2.4.7-004-pppd-Eliminate-some-unnecessary-ifdefs.patch
     - ppp-2.4.7-005-radius-Fix-realms-config-file-option.patch
     - ppp-2.4.7-006-pppd-Eliminate-potential-integer-overflow-in-option-.patch
     - ppp-2.4.7-007-pppd-Eliminate-memory-leak-with-multiple-instances-o.patch
     - ppp-2.4.7-008-pppd-Fix-a-stack-variable-overflow-in-MSCHAP-v2.patch
     - ppp-2.4.7-009-winbind-plugin-Add-DMPPE-1-to-eliminate-compiler-war.patch
   * Refresh debian/patches/cifdefroute.dif
   * Update Standards-Version to 3.9.6 (no changes required).
Author: Chris Boot <deb...@bootc.net>
Bug-Debian: https://bugs.debian.org/762789

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- ppp-2.4.6.orig/pppd/main.c
+++ ppp-2.4.6/pppd/main.c
@@ -734,7 +734,7 @@ set_ifunit(iskey)
     int iskey;
 {
     if (req_ifname[0] != '\0')
-	slprintf(ifname, sizeof(ifname), "%s", req_ifname);
+	slprintf(ifname, sizeof(ifname), "%s%d", req_ifname, ifunit);
     else
 	slprintf(ifname, sizeof(ifname), "%s%d", PPP_DRV_NAME, ifunit);
     info("Using interface %s", ifname);
--- ppp-2.4.6.orig/pppd/plugins/radius/radius.c
+++ ppp-2.4.6/pppd/plugins/radius/radius.c
@@ -1308,9 +1308,13 @@ radius_init(char *msg)
 static int
 get_client_port(char *ifname)
 {
-    int port;
-    if (sscanf(ifname, "ppp%d", &port) == 1) {
-	return port;
+    int c;
+
+    if( strstr(ifname, req_ifname) ) {
+        for (c = 0 ; c < strlen(req_ifname); c++)
+          ifname++;
+    
+        return atoi(ifname);
     }
     return rc_map2id(ifname);
 }
--- ppp-2.4.6.orig/pppd/sys-linux.c
+++ ppp-2.4.6/pppd/sys-linux.c
@@ -654,15 +654,17 @@ static int make_ppp_unit()
 	if (x == 0 && req_ifname[0] != '\0') {
 		struct ifreq ifr;
 		char t[MAXIFNAMELEN];
+		char t1[MAXIFNAMELEN];
 		memset(&ifr, 0, sizeof(struct ifreq));
 		slprintf(t, sizeof(t), "%s%d", PPP_DRV_NAME, ifunit);
 		strncpy(ifr.ifr_name, t, IF_NAMESIZE);
-		strncpy(ifr.ifr_newname, req_ifname, IF_NAMESIZE);
+		slprintf(t1, sizeof(t1), "%s%d", req_ifname, ifunit);
+		strncpy(ifr.ifr_newname, t1, IF_NAMESIZE);
 		x = ioctl(sock_fd, SIOCSIFNAME, &ifr);
 		if (x < 0)
-		    error("Couldn't rename interface %s to %s: %m", t, req_ifname);
+		    error("Couldn't rename interface %s to %s: %m", t, t1);
 		else
-		    info("Renamed interface %s to %s", t, req_ifname);
+		    info("Renamed interface %s to %s", t, t1);
 	}
 
 	return x;

Reply via email to