From 72844dd1064711193bc59cad41b046e453a24749 Mon Sep 17 00:00:00 2001 From: joerg Date: Thu, 27 Dec 2001 21:20:33 +0000 Subject: Userland part of making the LCP restart timer configurable. Obtained from: i4b (with changes) --- sbin/spppcontrol/spppcontrol.8 | 5 +++++ sbin/spppcontrol/spppcontrol.c | 20 ++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'sbin/spppcontrol') diff --git a/sbin/spppcontrol/spppcontrol.8 b/sbin/spppcontrol/spppcontrol.8 index 8db48bc..ca227c9 100644 --- a/sbin/spppcontrol/spppcontrol.8 +++ b/sbin/spppcontrol/spppcontrol.8 @@ -164,6 +164,10 @@ through approximately 800 seconds.) This is the default, and will not be explicitly displayed in .Ql list mode. +.It Ar lcp-timeout Ns \&= Ns Em timeout-value +Allows to change the value of the LCP restart timer. Values are +specified in milliseconds. The value must be between 10 and 20000 ms, +defaulting to 3000 ms. .It Ar enable-vj Enable negotiation of Van Jacobsen header compression. (Enabled by default.) .It Ar disable-vj @@ -175,6 +179,7 @@ Disable negotiation of Van Jacobsen header compression. bppp0: phase=dead myauthproto=chap myauthname="uriah" hisauthproto=chap hisauthname="ifb-gw" norechallenge + lcp-timeout=3000 enable-vj .Ed .Pp diff --git a/sbin/spppcontrol/spppcontrol.c b/sbin/spppcontrol/spppcontrol.c index e1ddfff..111ac0d 100644 --- a/sbin/spppcontrol/spppcontrol.c +++ b/sbin/spppcontrol/spppcontrol.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 Joerg Wunsch + * Copyright (c) 1997, 2001 Joerg Wunsch * * All rights reserved. * @@ -65,6 +65,8 @@ main(int argc, char **argv) int s, c; int errs = 0, verbose = 0; size_t off; + long to; + char *endp; const char *ifname, *cp; struct ifreq ifr; struct spppreq spr; @@ -165,7 +167,20 @@ main(int argc, char **argv) spr.defs.hisauth.flags |= AUTHFLAG_NORECHALLENGE; else if (strcmp(argv[0], "rechallenge") == 0) spr.defs.hisauth.flags &= ~AUTHFLAG_NORECHALLENGE; - else if (strcmp(argv[0], "enable-vj") == 0) + else if (startswith("lcp-timeout=")) { + cp = argv[0] + off; + to = strtol(cp, &endp, 10); + if (*cp == '\0' || *endp != '\0' || + /* + * NB: 10 ms is the minimal possible value for + * hz=100. We assume no kernel has less clock + * frequency than that... + */ + to < 10 || to > 20000) + errx(EX_DATAERR, "bad lcp timeout value: %s", + cp); + spr.defs.lcp.timeout = to; + } else if (strcmp(argv[0], "enable-vj") == 0) spr.defs.enable_vj = 1; else if (strcmp(argv[0], "disable-vj") == 0) spr.defs.enable_vj = 0; @@ -211,6 +226,7 @@ print_vals(const char *ifname, struct spppreq *sp) AUTHNAMELEN, sp->defs.hisauth.name, authflags(sp->defs.hisauth.flags)); } + printf("\tlcp-timeout=%d ms\n", sp->defs.lcp.timeout); printf("\t%sable-vj\n", sp->defs.enable_vj? "en": "dis"); } -- cgit v1.1