ports/173533: mpd5 PPTP server race condition with some clients
Brett Glass
freebsd-prs at brettglass.com
Sat Dec 8 06:10:01 UTC 2012
The following reply was made to PR ports/173533; it has been noted by GNATS.
From: Brett Glass <freebsd-prs at brettglass.com>
To: bug-followup at FreeBSD.org, freebsd-prs at brettglass.com
Cc:
Subject: Re: ports/173533: mpd5 PPTP server race condition with some
clients
Date: Fri, 07 Dec 2012 23:01:29 -0700
Because altering the PPP state machine would technically violate
the RFC (even though one might argue that the RFC is flawed because
it does not provide for a delay), I've developed patches that do
not alter the state machine code. Rather, the code in link.c is
modified so that a delay can be introduced before the finite state
machine which performs the LCP negotation is started. A new
command, "link set lcp-delay {ms]", is added to set this delay,
which is 250 ms by default and can be set to any value from 0 to
30000. (Experimentation has shown that the default of a quarter of
a second is ample time for the routers we have tested to set up a
PPTP, PPPoE, or L2TP call, so the problem we experienced is fixed
by default.) If the peer attempts to initiate negotiations during
the delay, the request is ignored but no harm is done.
Diff for link.c:
45a46
> SET_LCP_DELAY,
64a66
> static void LinkLcpDelayTimeout(void *arg);
108c110,112
< LinkSetCommand, NULL, 2, (void *) SET_IDENT },
---
> LinkSetCommand, NULL, 2, (void *) SET_LCP_DELAY },
> { "lcp-delay {ms}", "Delay before LCP start",
> LinkSetCommand, NULL, 2, (void *) SET_NO },
248a253,273
>
> if (l->conf.lcp_delay == 0) {
> LcpUp(l);
> } else {
> TimerStop(&l->lcpDelayTimer);
> TimerInit(&l->lcpDelayTimer, "LcpOpen",
> l->conf.lcp_delay, LinkLcpDelayTimeout, l);
> TimerStart(&l->lcpDelayTimer);
> Log(LG_LINK, ("[%s] Link: delaying %d ms before initiating
LCP negotiation",
> l->name, l->conf.lcp_delay));
> }
> }
>
> static void
> LinkLcpDelayTimeout(void *arg)
> {
> Link const l = (Link)arg;
>
> if (gShutdownInProgress)
> return;
>
431a457
> l->conf.lcp_delay = LINK_DEFAULT_LCP_DELAY;
1567a1594,1605
> case SET_LCP_DELAY:
> if (ac != 1)
> return(-1);
> val = atoi(*av);
> if (val < 0)
> Error("lcp-delay cannot be negative");
> else if (val > MP_MAX_MRRU)
> Error("max lcp-delay is %d", LINK_MAX_LCP_DELAY);
> else
> l->conf.lcp_delay = val;
> break;
>
Diff for link.h:
38a39,42
> /* Default delay before starting LCP configuration negotiation */
> #define LINK_DEFAULT_LCP_DELAY 250 /* 250 ms,
or 1/4 second */
> #define LINK_MAX_LCP_DELAY 30000 /* 30 seconds */
>
82a87
> uint16_t lcp_delay; /* Delay before initiating LCP */
152a158
> struct pppTimer lcpDelayTimer; /* LCP delay timer */
More information about the freebsd-ports-bugs
mailing list