[RP-PPPoE] Enable HURL and MOTD messages with custom content
Luca Piccirillo
luca.piccirillo at gmail.com
Sun May 14 16:55:57 EDT 2017
Here is a really simple patch to allow sending HURL and MOTD messages
after peer connection. It also adds command line support for both and
allow https as well as HURL content.
--- rp-pppoe-3.12/src/pppoe-server.c
+++ rp-pppoe-3.12_patch/src/pppoe-server.c
@@ -141,6 +141,9 @@
static char *pppd_path = PPPD_PATH;
static char *pppoe_path = PPPOE_PATH;
+
+static char *motd_string = NULL;
+static char *hurl_string = NULL;
static int Debug = 0;
static int CheckPoolSyntax = 0;
@@ -1082,6 +1085,11 @@
pads.length = htons(plen);
sendPacket(NULL, sock, &pads, (int) (plen + HDR_SIZE));
+ if(hurl_string != NULL)
+ sendHURLorMOTM(&conn, hurl_string, TAG_HURL);
+ if(motd_string != NULL)
+ sendHURLorMOTM(&conn, motd_string, TAG_MOTM);
+
/* Close sock; don't need it any more */
close(sock);
@@ -1200,9 +1208,9 @@
#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:T:m:FN:f:O:o:sp:lrudPc:S:1q:Q:H:M:";
#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:T:m:FN:f:O:o:skp:lrudPc:S:1q:Q:H:M:";
#endif
if (getuid() != geteuid() ||
@@ -1270,6 +1278,22 @@
}
break;
+ case 'M':
+ motd_string = strdup(optarg);
+ if (!motd_string) {
+ fprintf(stderr, "Out of memory");
+ exit(1);
+ }
+ break;
+
+ case 'H':
+ hurl_string = strdup(optarg);
+ if (!hurl_string) {
+ fprintf(stderr, "Out of memory");
+ exit(1);
+ }
+ break;
+
case 'c':
#ifndef HAVE_LICENSE
fprintf(stderr, "Clustering capability not available.\n");
@@ -2310,8 +2334,10 @@
if (tag == TAG_HURL) {
if (strncmp(url, "http://", 7)) {
- syslog(LOG_WARNING, "sendHURL(%s): URL must begin with http://", url);
+ if (strncmp(url, "https://", 8)) {
+ syslog(LOG_WARNING, "sendHURL(%s): URL must begin with http://
or https://", url);
return;
+ }
}
} else {
tag = TAG_MOTM;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hurl_motd.patch
Type: application/octet-stream
Size: 1854 bytes
Desc: not available
URL: <http://lists.roaringpenguin.com/pipermail/rp-pppoe/attachments/20170514/5dd8fe83/attachment.obj>
More information about the RP-PPPoE
mailing list