From: bodea Date: Thu, 15 Sep 2005 09:34:46 +0000 (+0000) Subject: make MRU configurable, NAK config requests for larger values X-Git-Tag: release_2_1_6~8 X-Git-Url: http://git.sameswireless.fr/l2tpns.git/commitdiff_plain/667a8bc42060ce5d62ff93058586ce7925ba4449?ds=inline;hp=596f98ff5a964b0be5c0d5aee8b5ffed5fa90b30 make MRU configurable, NAK config requests for larger values --- diff --git a/Changes b/Changes index bcdfb4e..a4cf2da 100644 --- a/Changes +++ b/Changes @@ -1,7 +1,8 @@ -* Wed Sep 14 2005 Brendan O'Dea 2.1.6 +* Thu Sep 15 2005 Brendan O'Dea 2.1.6 - Any traffic on a tunnel resets lastrec, not just control messages. - Use a unique identifier for LCP. - Fix Code-Reject/Protocol-Reject. +- Make MRU configurable, NAK config requests for larger values. * Sat Sep 3 2005 Brendan O'Dea 2.1.5 - Avoid Code-Reject loop. diff --git a/Docs/manual.html b/Docs/manual.html index bebc7c8..a963e19 100644 --- a/Docs/manual.html +++ b/Docs/manual.html @@ -192,6 +192,10 @@ PPP counter and timer values, as described in §4.1 of RFC1661. +
  • ppp_mru (int)
    +PPP link MRU (default: 1452). +
  • +
  • primary_dns (ip address)
  • secondary_dns (ip address)
    Whenever a PPP connection is established, DNS servers will be sent to the diff --git a/Docs/startup-config.5 b/Docs/startup-config.5 index 601d992..61d1386 100644 --- a/Docs/startup-config.5 +++ b/Docs/startup-config.5 @@ -2,7 +2,7 @@ .de Id .ds Dt \\$4 \\$5 .. -.Id $Id: startup-config.5,v 1.13 2005/09/02 23:59:56 bodea Exp $ +.Id $Id: startup-config.5,v 1.14 2005/09/15 09:34:49 bodea Exp $ .TH STARTUP-CONFIG 5 "\*(Dt" L2TPNS "File Formats and Conventions" .SH NAME startup\-config \- configuration file for l2tpns @@ -73,6 +73,9 @@ Number of configure requests to send before giving up (default: 10). Number of Configure-Nak requests to send before sending a Configure-Reject (default: 5). .TP +.B ppp_mru +PPP link MRU (default: 1452). +.TP .BR primary_dns , " secondary_dns" Whenever a PPP connection is established, DNS servers will be sent to the user, both a primary and a secondary. If either is set to 0.0.0.0, then that diff --git a/etc/startup-config.default b/etc/startup-config.default index 7c788c3..85f8bd1 100644 --- a/etc/startup-config.default +++ b/etc/startup-config.default @@ -15,6 +15,9 @@ set l2tp_secret "secret" #set ppp_max_configure 10 #set ppp_max_failure 5 +# Link MRU +#set ppp_mru 1452 + # Only 2 DNS server entries are allowed set primary_dns 10.0.0.1 set secondary_dns 10.0.0.2 diff --git a/l2tpns.c b/l2tpns.c index 24cd6b3..94b76b7 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -4,7 +4,7 @@ // Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced // vim: sw=8 ts=8 -char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.131 2005/09/13 14:27:14 bodea Exp $"; +char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.132 2005/09/15 09:34:48 bodea Exp $"; #include #include @@ -108,6 +108,7 @@ config_descriptt config_values[] = { CONFIG("ppp_restart_time", ppp_restart_time, INT), CONFIG("ppp_max_configure", ppp_max_configure, INT), CONFIG("ppp_max_failure", ppp_max_failure, INT), + CONFIG("ppp_mru", ppp_mru, INT), CONFIG("primary_dns", default_dns1, IPv4), CONFIG("secondary_dns", default_dns2, IPv4), CONFIG("primary_radius", radiusserver[0], IPv4), @@ -2381,7 +2382,7 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr) if (amagic == 0) amagic = time_now; session[s].magic = amagic; // set magic number session[s].l2tp_flags = aflags; // set flags received - session[s].mru = DEFAULT_MRU; + session[s].mru = config->ppp_mru; controlnull(t); // ack // start LCP @@ -3500,6 +3501,7 @@ static void initdata(int optdebug, char *optconfig) config->ppp_restart_time = 3; config->ppp_max_configure = 10; config->ppp_max_failure = 5; + config->ppp_mru = DEFAULT_MRU; strcpy(config->random_device, RANDOMDEVICE); log_stream = stderr; @@ -4248,6 +4250,8 @@ static void update_config() setbuf(log_stream, NULL); } + if (config->ppp_mru < 0) config->ppp_mru = 0; + // Update radius config->numradiusservers = 0; for (i = 0; i < MAXRADSERVER; i++) diff --git a/l2tpns.h b/l2tpns.h index 2f63803..e60ed4a 100644 --- a/l2tpns.h +++ b/l2tpns.h @@ -1,5 +1,5 @@ // L2TPNS Global Stuff -// $Id: l2tpns.h,v 1.89 2005/09/13 14:23:07 bodea Exp $ +// $Id: l2tpns.h,v 1.90 2005/09/15 09:34:49 bodea Exp $ #ifndef __L2TPNS_H__ #define __L2TPNS_H__ @@ -15,7 +15,7 @@ #include #include -#define VERSION "2.1.6" +#define VERSION "2.1.7" // Limits #define MAXTUNNEL 500 // could be up to 65535 @@ -519,6 +519,7 @@ typedef struct int ppp_restart_time; // timeout for PPP restart int ppp_max_configure; // max lcp configure requests to send int ppp_max_failure; // max lcp configure naks to send + int ppp_mru; // MRU to advertise char radiussecret[64]; int radius_accounting; diff --git a/l2tpns.spec b/l2tpns.spec index f6d74e2..2acc203 100644 --- a/l2tpns.spec +++ b/l2tpns.spec @@ -43,5 +43,5 @@ rm -rf %{buildroot} %attr(644,root,root) /usr/share/man/man[58]/* %changelog -* Wed Sep 14 2005 Brendan O'Dea 2.1.6-1 +* Thu Sep 15 2005 Brendan O'Dea 2.1.6-1 - 2.1.6 release, see /usr/share/doc/l2tpns-2.1.6/Changes diff --git a/ppp.c b/ppp.c index 62e16e8..590a52b 100644 --- a/ppp.c +++ b/ppp.c @@ -1,6 +1,6 @@ // L2TPNS PPP Stuff -char const *cvs_id_ppp = "$Id: ppp.c,v 1.80 2005/09/13 14:23:07 bodea Exp $"; +char const *cvs_id_ppp = "$Id: ppp.c,v 1.81 2005/09/15 09:34:49 bodea Exp $"; #include #include @@ -577,7 +577,18 @@ void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l) switch (type) { case 1: // Maximum-Receive-Unit - session[s].mru = ntohs(*(uint16_t *)(o + 2)); + { + uint16_t mru = ntohs(*(uint16_t *)(o + 2)); + if (!config->ppp_mru || mru <= config->ppp_mru) + { + session[s].mru = mru; + break; + } + + LOG(3, s, t, " Remote requesting MRU of %u. Rejecting.\n", mru); + mru = htons(config->ppp_mru); + q = ppp_conf_nak(s, b, sizeof(b), PPPLCP, &response, q, p, o, (uint8_t *) &mru, sizeof(mru)); + } break; case 2: // Async-Control-Character-Map @@ -738,8 +749,9 @@ void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l) case 1: // Maximum-Receive-Unit if (*p == ConfigNak) { - session[s].mru = ntohs(*(uint16_t *)(o + 2)); - LOG(3, s, t, " Remote requested MRU of %u\n", session[s].mru); + session[s].mru = 0; + LOG(3, s, t, " Remote requested MRU of %u; removing option\n", + ntohs(*(uint16_t *)(o + 2))); } else {