slackware-current/source/n/rp-pppoe/rp-pppoe-3.12-ip-allocation.patch
Patrick J Volkerding 646a5c1cbf Mon May 28 19:12:29 UTC 2018
a/pkgtools-15.0-noarch-13.txz:  Rebuilt.
  installpkg: default line length for --terselength is the number of columns.
  removepkg: added --terse mode.
  upgradepkg: default line length for --terselength is the number of columns.
  upgradepkg: accept -option in addition to --option.
ap/vim-8.1.0026-x86_64-1.txz:  Upgraded.
d/bison-3.0.5-x86_64-1.txz:  Upgraded.
e/emacs-26.1-x86_64-1.txz:  Upgraded.
kde/kopete-4.14.3-x86_64-8.txz:  Rebuilt.
  Recompiled against libidn-1.35.
n/conntrack-tools-1.4.5-x86_64-1.txz:  Upgraded.
n/libnetfilter_conntrack-1.0.7-x86_64-1.txz:  Upgraded.
n/libnftnl-1.1.0-x86_64-1.txz:  Upgraded.
n/links-2.16-x86_64-2.txz:  Rebuilt.
  Rebuilt to enable X driver for -g mode.
n/lynx-2.8.9dev.19-x86_64-1.txz:  Upgraded.
n/nftables-0.8.5-x86_64-1.txz:  Upgraded.
n/p11-kit-0.23.11-x86_64-1.txz:  Upgraded.
n/ulogd-2.0.7-x86_64-1.txz:  Upgraded.
n/whois-5.3.1-x86_64-1.txz:  Upgraded.
xap/network-manager-applet-1.8.12-x86_64-1.txz:  Upgraded.
xap/vim-gvim-8.1.0026-x86_64-1.txz:  Upgraded.
2018-05-31 23:39:35 +02:00

111 lines
4.3 KiB
Diff

diff -up rp-pppoe-3.12/man/pppoe-server.8.ip-allocation rp-pppoe-3.12/man/pppoe-server.8
--- rp-pppoe-3.12/man/pppoe-server.8.ip-allocation 2015-11-11 16:10:01.000000000 +0100
+++ rp-pppoe-3.12/man/pppoe-server.8 2015-11-16 16:48:52.457927211 +0100
@@ -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.12/src/pppoe-server.c.ip-allocation rp-pppoe-3.12/src/pppoe-server.c
--- rp-pppoe-3.12/src/pppoe-server.c.ip-allocation 2015-11-11 16:10:04.000000000 +0100
+++ rp-pppoe-3.12/src/pppoe-server.c 2015-11-16 16:50:53.209195100 +0100
@@ -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;
@@ -241,8 +244,8 @@ childHandler(pid_t pid, int status, void
memset(&conn, 0, sizeof(conn));
conn.hostUniq = NULL;
-
- syslog(LOG_INFO,
+ 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),
@@ -251,6 +254,15 @@ childHandler(pid_t pid, int status, void
(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 +1146,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 +1213,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 +1414,10 @@ main(int argc, char **argv)
}
break;
+ case 'D':
+ DelegateIPAllocation = 1;
+ break;
+
case 'T':
case 'm':
/* These just get passed to pppoe */
@@ -1915,6 +1932,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 +1948,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);