Dear Brian and Hackers,
Please find updated proposed version of the patch. As suggested by
Warner option has been renamed to 'force-sripts' and now works for
both 'direct' and 'dedicated' modes. Also as suggested by Terry the
man page has been updated to document side effect of 'direct'.
-direct
This is used for receiving incoming connections. ppp ignores the
``set device'' line and uses descriptor 0 as the link. ppp will
never use any configured chat scripts unless ``force-scripts''
option has been enabled.
If callback is configured, ppp will use the ``set device'' infor-
mation when dialing back.
-dedicated
This option is designed for machines connected with a dedicated
wire. ppp will always keep the device open and will never use
any configured chat scripts unless ``force-scripts'' option has
been enabled.
force-scripts
Default: Disabled. Forces execution of the configured chat
scripts in direct and dedicated modes.
Please find attached patch that adds new option to the PPP.
run-scripts-in-direct-mode
Default: Disabled. This allows to run chat scripts in
direct mode.
did i miss anything? objections? comments? reviews?
First comment: run it past Brian Somers <[EMAIL PROTECTED]>; it's
his baby, and he's the active maintainer.
I have sent him e-mail.
Rest of comments:
Actually, why doesn't "-direct" allow a chat script by default?
The man page doesn't document that as a side-effect of "-direct",
only of "-dedicated", but it's been there since the import.
Should this really be a "negotiate" section command, rather than
just a command or a "set" command?
Also, there are only two other commands even have a "-" in them,
and both of them only have one (just seems a little long, compared
to, say, "rsid" or "direct-with-script", or even "force-script").
Personal preference: don't make it conditional on "-direct", let
it also work with "-dedicated", and call it "force-script" or
something, instead.
done
The man page should be updated -- including the undocumented
side-effect of "-direct" disabling scripts).
done
thanks
max
diff -ru8 ppp.orig/bundle.h ppp/bundle.h
--- ppp.orig/bundle.h Mon Feb 3 10:34:44 2003
+++ ppp/bundle.h Mon Feb 3 14:08:06 2003
@@ -44,16 +44,17 @@
#define OPT_LOOPBACK 0x0040
#define OPT_PASSWDAUTH 0x0080
#define OPT_PROXY 0x0100
#define OPT_PROXYALL 0x0200
#define OPT_SROUTES 0x0400
#define OPT_TCPMSSFIXUP 0x0800
#define OPT_THROUGHPUT 0x1000
#define OPT_UTMP 0x2000
+#define OPT_FORCE_SCRIPTS 0x4000 /* force chat scripts */
#define MAX_ENDDISC_CLASS 5
#define Enabled(b, o) ((b)->cfg.opt & (o))
/* AutoAdjust() values */
#define AUTO_UP 1
#define AUTO_DOWN 2
diff -ru8 ppp.orig/command.c ppp/command.c
--- ppp.orig/command.c Mon Feb 3 10:34:45 2003
+++ ppp/command.c Mon Feb 3 14:26:37 2003
@@ -2830,16 +2830,19 @@
return 0;
}
static struct cmdtab const NegotiateCommands[] = {
{"filter-decapsulation", NULL, OptSet, LOCAL_AUTH,
"filter on PPPoUDP payloads", "disable|enable",
(const void *)OPT_FILTERDECAP},
+ {"force-scripts", NULL, OptSet, LOCAL_AUTH,
+ "Force execution of the configured chat scripts", "disable|enable",
+ (const void *)OPT_FORCE_SCRIPTS},
{"idcheck", NULL, OptSet, LOCAL_AUTH, "Check FSM reply ids",
"disable|enable", (const void *)OPT_IDCHECK},
{"iface-alias", NULL, IfaceAliasOptSet, LOCAL_AUTH,
"retain interface addresses", "disable|enable",
(const void *)OPT_IFACEALIAS},
#ifndef NOINET6
{"ipcp", NULL, OptSet, LOCAL_AUTH, "IP Network Control Protocol",
"disable|enable", (const void *)OPT_IPCP},
@@ -2861,19 +2864,19 @@
{"tcpmssfixup", "mssfixup", OptSet, LOCAL_AUTH, "Modify MSS options",
"disable|enable", (const void *)OPT_TCPMSSFIXUP},
{"throughput", NULL, OptSet, LOCAL_AUTH, "Rolling throughput",
"disable|enable", (const void *)OPT_THROUGHPUT},
{"utmp", NULL, OptSet, LOCAL_AUTH, "Log connections in utmp",
"disable|enable", (const void *)OPT_UTMP},
#ifndef NOINET6
-#define OPT_MAX 13 /* accept/deny allowed below and not above */
+#define OPT_MAX 14 /* accept/deny allowed below and not above */
#else
-#define OPT_MAX 11
+#define OPT_MAX 12
#endif
{"acfcomp", NULL, NegotiateSet, LOCAL_AUTH | LOCAL_CX,
"Address & Control field compression", "accept|deny|disable|enable",
(const void *)NEG_ACFCOMP},
{"chap", "chap05", NegotiateSet, LOCAL_AUTH | LOCAL_CX,
"Challenge Handshake Authentication Protocol", "accept|deny|disable|enable",
(const void *)NEG_CHAP05},
diff -ru8 ppp.orig/datalink.c ppp/datalink.c
--- ppp.orig/datalink.c Mon Feb 3 10:34:45 2003
+++ ppp/datalink.c Mon Feb 3 14:17:52 2003
@@ -956,17 +956,18 @@
free(dl);
return result;
}
void
datalink_Up(struct datalink *dl, int runscripts, int packetmode)
{
- if (dl->physical->type & (PHYS_DIRECT|PHYS_DEDICATED))
+ if (!Enabled(dl->bundle, OPT_FORCE_SCRIPTS) &&
+ (dl->physical->type & (PHYS_DIRECT|PHYS_DEDICATED)))
/* Ignore scripts */
runscripts = 0;
switch (dl->state) {
case DATALINK_CLOSED:
if (bundle_Phase(dl->bundle) == PHASE_DEAD ||
bundle_Phase(dl->bundle) == PHASE_TERMINATE)
bundle_NewPhase(dl->bundle, PHASE_ESTABLISH);
diff -ru8 ppp.orig/ppp.8.m4 ppp/ppp.8.m4
--- ppp.orig/ppp.8.m4 Mon Feb 3 10:34:46 2003
+++ ppp/ppp.8.m4 Mon Feb 3 14:22:21 2003
@@ -154,28 +154,34 @@
.Nm Ns No 's
invocation from another process.
.It Fl direct
This is used for receiving incoming connections.
.Nm
ignores the
.Dq set device
line and uses descriptor 0 as the link.
+.Nm
+will never use any configured chat scripts unless
+.Dq force-scripts
+option has been enabled.
.Pp
If callback is configured,
.Nm
will use the
.Dq set device
information when dialing back.
.It Fl dedicated
This option is designed for machines connected with a dedicated
wire.
.Nm
will always keep the device open and will never use any configured
-chat scripts.
+chat scripts unless
+.Dq force-scripts
+option has been enabled.
.It Fl ddial
This mode is equivalent to
.Fl auto
mode except that
.Nm
will bring the link back up any time it's dropped for any reason.
.It Fl interactive
This is a no-op, and gives the same behaviour as if none of the above
@@ -2931,16 +2937,22 @@
will not be able to interpret it.
It's therefore recommended that you
.Ic disable vj pred1 deflate
and
.Ic deny vj pred1 deflate
in the configuration for the
.Nm
invocation with the udp link.
+.It force-scripts
+Default: Disabled. Forces execution of the configured chat scripts in
+.Dv direct
+and
+.Dv dedicated
+modes.
.It idcheck
Default: Enabled.
When
.Nm
exchanges low-level LCP, CCP and IPCP configuration traffic, the
.Em Identifier
field of any replies is expected to be the same as that of the request.
By default,