[rp-pppoe] - 3.11 - bz#540763, add IP allocation by pppd ability to pppoe-server

Than Ngo than at fedoraproject.org
Mon Aug 20 10:44:08 UTC 2012


commit 8e16410652921f3e86a2431e0650646ae56994a3
Author: Than Ngo <than at redhat.com>
Date:   Mon Aug 20 12:43:32 2012 +0200

    - 3.11
    - bz#540763, add IP allocation by pppd ability to pppoe-server

 .gitignore                        |    1 +
 rp-pppoe-3.11-ip-allocation.patch |  119 +++++++++++++++++++++++++++++++++++++
 rp-pppoe.spec                     |   10 +++-
 sources                           |    2 +-
 4 files changed, 129 insertions(+), 3 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 0ddd3d9..52466ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ ppp.tgz
 rp-pppoe-3.5.tar.gz
 rp-pppoe-3.8.tar.gz
 rp-pppoe-3.10.tar.gz
+/rp-pppoe-3.11.tar.gz
diff --git a/rp-pppoe-3.11-ip-allocation.patch b/rp-pppoe-3.11-ip-allocation.patch
new file mode 100644
index 0000000..4bc0215
--- /dev/null
+++ b/rp-pppoe-3.11-ip-allocation.patch
@@ -0,0 +1,119 @@
+diff -up rp-pppoe-3.11/man/pppoe-server.8.orig rp-pppoe-3.11/man/pppoe-server.8
+--- rp-pppoe-3.11/man/pppoe-server.8.orig	2012-08-17 20:31:25.000000000 +0200
++++ rp-pppoe-3.11/man/pppoe-server.8	2012-08-20 12:32:45.008870731 +0200
+@@ -96,6 +96,11 @@ valid remote IP address to \fBpppd\fR.
+ of 10.67.15.1 is used.
+ 
+ .TP
++.B \-D
++Delegate the allocation of IP addresses to \fBpppd\fR.  If specified, no
++local and remote addresses passed to pppd.
++
++.TP
+ .B \-N \fInum\fR
+ Allows at most \fInum\fR concurrent PPPoE sessions.  If not specified,
+ the default is 64.
+diff -up rp-pppoe-3.11/src/pppoe-server.c.orig rp-pppoe-3.11/src/pppoe-server.c
+--- rp-pppoe-3.11/src/pppoe-server.c.orig	2012-08-17 20:31:25.000000000 +0200
++++ rp-pppoe-3.11/src/pppoe-server.c	2012-08-20 12:34:25.348145846 +0200
+@@ -176,6 +176,9 @@ char PppoeOptions[SMALLBUF] = "";
+ unsigned char LocalIP[IPV4ALEN] = {10, 0, 0, 1}; /* Counter optionally STARTS here */
+ unsigned char RemoteIP[IPV4ALEN] = {10, 67, 15, 1}; /* Counter STARTS here */
+ 
++/* Delegates the allocation of IP addresses to pppd (as the pptpd doing) */
++int DelegateIPAllocation = 0;
++
+ /* Do we increment local IP for each connection? */
+ int IncrLocalIP = 0;
+ 
+@@ -242,15 +245,25 @@ childHandler(pid_t pid, int status, void
+     memset(&conn, 0, sizeof(conn));
+     conn.useHostUniq = 0;
+ 
+-    syslog(LOG_INFO,
+-	   "Session %u closed for client "
+-	   "%02x:%02x:%02x:%02x:%02x:%02x (%d.%d.%d.%d) on %s",
+-	   (unsigned int) ntohs(session->sess),
+-	   session->eth[0], session->eth[1], session->eth[2],
+-	   session->eth[3], session->eth[4], session->eth[5],
+-	   (int) session->realpeerip[0], (int) session->realpeerip[1],
+-	   (int) session->realpeerip[2], (int) session->realpeerip[3],
+-	   session->ethif->name);
++    if (!DelegateIPAllocation) {
++	syslog(LOG_INFO,
++	    "Session %u closed for client "
++	    "%02x:%02x:%02x:%02x:%02x:%02x (%d.%d.%d.%d) on %s",
++	    (unsigned int) ntohs(session->sess),
++	    session->eth[0], session->eth[1], session->eth[2],
++	    session->eth[3], session->eth[4], session->eth[5],
++	    (int) session->realpeerip[0], (int) session->realpeerip[1],
++	    (int) session->realpeerip[2], (int) session->realpeerip[3],
++	    session->ethif->name);
++    } else {
++	syslog(LOG_INFO,
++	    "Session %u closed for client "
++	    "%02x:%02x:%02x:%02x:%02x:%02x on %s",
++	    (unsigned int) ntohs(session->sess),
++	    session->eth[0], session->eth[1], session->eth[2],
++	    session->eth[3], session->eth[4], session->eth[5],
++	    session->ethif->name);
++    }
+     memcpy(conn.myEth, session->ethif->mac, ETH_ALEN);
+     conn.discoverySocket = session->ethif->sock;
+     conn.session = session->sess;
+@@ -1134,6 +1147,7 @@ usage(char const *argv0)
+     fprintf(stderr, "   -L ip          -- Set local IP address.\n");
+     fprintf(stderr, "   -l             -- Increment local IP address for each session.\n");
+     fprintf(stderr, "   -R ip          -- Set start address of remote IP pool.\n");
++    fprintf(stderr, "   -D             -- Delegates the allocation of IP addresses to pppd.\n");
+     fprintf(stderr, "   -S name        -- Advertise specified service-name.\n");
+     fprintf(stderr, "   -O fname       -- Use PPPD options from specified file\n");
+     fprintf(stderr, "                     (default %s).\n", PPPOE_SERVER_OPTIONS);
+@@ -1200,9 +1214,9 @@ main(int argc, char **argv)
+ #endif
+ 
+ #ifndef HAVE_LINUX_KERNEL_PPPOE
+-    char *options = "X:ix:hI:C:L:R:T:m:FN:f:O:o:sp:lrudPc:S:1q:Q:";
++    char *options = "X:ix:hI:C:L:R:DT:m:FN:f:O:o:sp:lrudPc:S:1q:Q:";
+ #else
+-    char *options = "X:ix:hI:C:L:R:T:m:FN:f:O:o:skp:lrudPc:S:1q:Q:";
++    char *options = "X:ix:hI:C:L:R:DT:m:FN:f:O:o:skp:lrudPc:S:1q:Q:";
+ #endif
+ 
+     if (getuid() != geteuid() ||
+@@ -1401,6 +1415,10 @@ main(int argc, char **argv)
+ 	    }
+ 	    break;
+ 
++	case 'D':
++	    DelegateIPAllocation = 1;
++	    break;
++
+ 	case 'T':
+ 	case 'm':
+ 	    /* These just get passed to pppoe */
+@@ -1915,6 +1933,7 @@ startPPPDUserMode(ClientSession *session
+     argv[c++] = "file";
+     argv[c++] = pppoptfile;
+ 
++    if (!DelegateIPAllocation) {
+     snprintf(buffer, SMALLBUF, "%d.%d.%d.%d:%d.%d.%d.%d",
+ 	    (int) session->myip[0], (int) session->myip[1],
+ 	    (int) session->myip[2], (int) session->myip[3],
+@@ -1930,6 +1949,16 @@ startPPPDUserMode(ClientSession *session
+ 	   session->ethif->name,
+ 	   session->serviceName);
+     argv[c++] = strdup(buffer);
++    } else {
++	syslog(LOG_INFO,
++	    "Session %u created for client %02x:%02x:%02x:%02x:%02x:%02x on %s using Service-Name '%s'",
++	    (unsigned int) ntohs(session->sess),
++	    session->eth[0], session->eth[1], session->eth[2],
++	    session->eth[3], session->eth[4], session->eth[5],
++	    session->ethif->name,
++	    session->serviceName);
++    }
++    
+     if (!argv[c-1]) {
+ 	/* TODO: Send a PADT */
+ 	exit(EXIT_FAILURE);
diff --git a/rp-pppoe.spec b/rp-pppoe.spec
index 8187303..c0c8504 100644
--- a/rp-pppoe.spec
+++ b/rp-pppoe.spec
@@ -1,7 +1,7 @@
 Summary: A PPP over Ethernet client (for xDSL support).
 Name: rp-pppoe
-Version: 3.10
-Release: 13%{?dist}
+Version: 3.11
+Release: 1%{?dist}
 License: GPLv2+
 Group: System Environment/Daemons
 Url: http://www.roaringpenguin.com/pppoe/
@@ -14,6 +14,7 @@ Source5: pppoe-stop
 Source6: pppoe-server.service
 
 Patch0: rp-pppoe-3.8-redhat.patch
+Patch1: rp-pppoe-3.11-ip-allocation.patch
 
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -49,6 +50,7 @@ the official PPPoE specification.
 %prep
 %setup -q
 %patch0 -p1 -b .config
+%patch1 -p1 -b .ip-allocation
 
 %build
 cd src
@@ -113,6 +115,10 @@ triggerun -- %{name} < 3.10-9
 %{_mandir}/man?/*
 
 %changelog
+* Mon Aug 20 2012 Than Ngo <than at redhat.com> - 3.11-1
+- 3.11
+- bz#540763, add IP allocation by pppd ability to pppoe-server
+
 * Sat Jul 21 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.10-13
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
 
diff --git a/sources b/sources
index 31c49b2..6a70650 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-d58a13cc4185bca6121a606ff456dec0  rp-pppoe-3.10.tar.gz
+13b5900c56bd602df6cc526e5e520722  rp-pppoe-3.11.tar.gz


More information about the scm-commits mailing list