What:
This is a patch to allow adding ppp options on a call-by-call basis.
Currently, it only allows "auth".
How:
It intercepts "pppoption auth" on the FIFO. It then adds this
argument when it forks pppd, and clears it. Note: it clears it
regardless.
Why:
To enable two-way pppd calls between the Linux machine and a central
location, working around a ppp problem common in ISP routers (peer
refused to authenticate).
Who:
People who wish to have two-way connections controlled by diald
(dial-and-answerd?)
How to use it:
Inside diald-login, which gets called by mgetty, simply add:
echo pppoption auth > DIALD_FIFO/user
before
echo connect > DIALD_FIFO/user
Disclaimer:
I've thought a whole 5 seconds about where to put the patch in the
code. This seemed the most reliable, as it clears the option
regardless. Previous patches have caused infinite dials, and this one
is still in testing.
Future:
Could be more general, or allow more options.
Its been tested on Linux 2.0.29/libc5/diald-0.99.1/pppd-2.2.0f
--
Kind regards,
Berend
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Berend De Schouwer, +27-11-339-6111, UCS
--- access.h.orig Thu Oct 21 15:13:54 1999
+++ access.h Thu Oct 21 15:14:32 1999
@@ -49,6 +49,9 @@
#define ACCESS_NODEMAND 0x00040000 /* Allow demand dialling to be
* disabled.
*/
+#define ACCESS_TEMP 0x00080000 /* Allow temporary ppp flags
+ * to be set.
+ */
#define ACCESS_AUTH 0x80000000 /* Allow the access flags for the
* connection to be changed with
* the "auth" command.
--- diald.c.orig Thu Oct 21 14:59:03 1999
+++ diald.c Thu Oct 21 15:43:04 1999
@@ -348,7 +348,7 @@
if ((fifo_fd = open(fifoname, O_RDWR)) >= 0) {
fifo_pipe = (PIPE *)malloc(sizeof(PIPE));
if (fifo_pipe) {
- if (debug&DEBUG_VERBOSE)
+ /*if (debug&DEBUG_VERBOSE)*/
syslog(LOG_INFO,"Using fifo %s",fifoname);
pipe_init("FIFO", 0x7fffffff, fifo_fd, fifo_pipe, 1);
FD_SET(fifo_fd, &ctrl_fds);
@@ -737,6 +737,10 @@
pipe->name, req_dev);
}
}
+ } else if ((pipe->access & ACCESS_TEMP)
+ && strncmp(buf,"pppoption auth",8) == 0) {
+ mon_syslog(LOG_NOTICE, "%s: temporary ppp option", pipe->name);
+ auth_ppp = 1;
} else {
mon_syslog(LOG_ERR,"%s: Ignored request '%s'",
pipe->name, buf);
--- diald.h.orig Thu Oct 21 15:35:51 1999
+++ diald.h Thu Oct 21 15:36:03 1999
@@ -244,6 +244,7 @@
int modem;
int rotate_devices;
int crtscts;
+int auth_ppp;
int daemon_flag;
int strict_forwarding;
int dynamic_addrs;
--- options.c.orig Thu Oct 21 14:50:07 1999
+++ options.c Thu Oct 21 14:51:24 1999
@@ -68,6 +68,7 @@
int debug = 0;
int modem = 0;
int crtscts = 0;
+int auth_ppp = 0;
int daemon_flag = 1;
int slip_encap = 0;
int lock_dev = 0;
--- ppp.c.orig Thu Oct 21 14:51:37 1999
+++ ppp.c Thu Oct 21 14:58:59 1999
@@ -68,6 +68,10 @@
ADD_ARG("netmask");
ADD_ARG(netmask);
}
+ if (auth_ppp) {
+ mon_syslog(LOG_INFO,"Adding temporary pppd options.");
+ ADD_ARG("auth");
+ }
for (j = 0; j < pppd_argc; j++) {
ADD_ARG(pppd_argv[j]);
}
@@ -101,6 +105,12 @@
mon_syslog(LOG_ERR, "could not exec %s: %m",path_pppd);
_exit(99);
/* NOTREACHED */
+ } else {
+ /* We have forked, and pppd is being started.
+ * We need to clear temporary ppp options.
+ */
+ mon_syslog(LOG_INFO,"Clearing temporary pppd options.");
+ auth_ppp = 0;
}
unblock_signals();
mon_syslog(LOG_INFO,"Running pppd (pid = %d).",link_pid);