make MRU configurable, NAK config requests for larger values
This commit is contained in:
parent
90a81d13b5
commit
0c678c5a03
8 changed files with 39 additions and 11 deletions
3
Changes
3
Changes
|
|
@ -1,7 +1,8 @@
|
||||||
* Wed Sep 14 2005 Brendan O'Dea <bod@optus.net> 2.1.6
|
* Thu Sep 15 2005 Brendan O'Dea <bod@optus.net> 2.1.6
|
||||||
- Any traffic on a tunnel resets lastrec, not just control messages.
|
- Any traffic on a tunnel resets lastrec, not just control messages.
|
||||||
- Use a unique identifier for LCP.
|
- Use a unique identifier for LCP.
|
||||||
- Fix Code-Reject/Protocol-Reject.
|
- Fix Code-Reject/Protocol-Reject.
|
||||||
|
- Make MRU configurable, NAK config requests for larger values.
|
||||||
|
|
||||||
* Sat Sep 3 2005 Brendan O'Dea <bod@optus.net> 2.1.5
|
* Sat Sep 3 2005 Brendan O'Dea <bod@optus.net> 2.1.5
|
||||||
- Avoid Code-Reject loop.
|
- Avoid Code-Reject loop.
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,10 @@ PPP counter and timer values, as described in §4.1 of
|
||||||
<a href="ftp://ftp.rfc-editor.org/in-notes/rfc1661.txt">RFC1661</a>.
|
<a href="ftp://ftp.rfc-editor.org/in-notes/rfc1661.txt">RFC1661</a>.
|
||||||
</LI>
|
</LI>
|
||||||
|
|
||||||
|
<LI><B>ppp_mru</B> (int)<BR>
|
||||||
|
PPP link MRU (default: 1452).
|
||||||
|
</LI>
|
||||||
|
|
||||||
<LI><B>primary_dns</B> (ip address)
|
<LI><B>primary_dns</B> (ip address)
|
||||||
<LI><B>secondary_dns</B> (ip address)<BR>
|
<LI><B>secondary_dns</B> (ip address)<BR>
|
||||||
Whenever a PPP connection is established, DNS servers will be sent to the
|
Whenever a PPP connection is established, DNS servers will be sent to the
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
.de Id
|
.de Id
|
||||||
.ds Dt \\$4 \\$5
|
.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"
|
.TH STARTUP-CONFIG 5 "\*(Dt" L2TPNS "File Formats and Conventions"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
startup\-config \- configuration file for l2tpns
|
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
|
Number of Configure-Nak requests to send before sending a
|
||||||
Configure-Reject (default: 5).
|
Configure-Reject (default: 5).
|
||||||
.TP
|
.TP
|
||||||
|
.B ppp_mru
|
||||||
|
PPP link MRU (default: 1452).
|
||||||
|
.TP
|
||||||
.BR primary_dns , " secondary_dns"
|
.BR primary_dns , " secondary_dns"
|
||||||
Whenever a PPP connection is established, DNS servers will be sent to the
|
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
|
user, both a primary and a secondary. If either is set to 0.0.0.0, then that
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,9 @@ set l2tp_secret "secret"
|
||||||
#set ppp_max_configure 10
|
#set ppp_max_configure 10
|
||||||
#set ppp_max_failure 5
|
#set ppp_max_failure 5
|
||||||
|
|
||||||
|
# Link MRU
|
||||||
|
#set ppp_mru 1452
|
||||||
|
|
||||||
# Only 2 DNS server entries are allowed
|
# Only 2 DNS server entries are allowed
|
||||||
set primary_dns 10.0.0.1
|
set primary_dns 10.0.0.1
|
||||||
set secondary_dns 10.0.0.2
|
set secondary_dns 10.0.0.2
|
||||||
|
|
|
||||||
8
l2tpns.c
8
l2tpns.c
|
|
@ -4,7 +4,7 @@
|
||||||
// Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced
|
// Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced
|
||||||
// vim: sw=8 ts=8
|
// 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 <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
@ -108,6 +108,7 @@ config_descriptt config_values[] = {
|
||||||
CONFIG("ppp_restart_time", ppp_restart_time, INT),
|
CONFIG("ppp_restart_time", ppp_restart_time, INT),
|
||||||
CONFIG("ppp_max_configure", ppp_max_configure, INT),
|
CONFIG("ppp_max_configure", ppp_max_configure, INT),
|
||||||
CONFIG("ppp_max_failure", ppp_max_failure, INT),
|
CONFIG("ppp_max_failure", ppp_max_failure, INT),
|
||||||
|
CONFIG("ppp_mru", ppp_mru, INT),
|
||||||
CONFIG("primary_dns", default_dns1, IPv4),
|
CONFIG("primary_dns", default_dns1, IPv4),
|
||||||
CONFIG("secondary_dns", default_dns2, IPv4),
|
CONFIG("secondary_dns", default_dns2, IPv4),
|
||||||
CONFIG("primary_radius", radiusserver[0], 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;
|
if (amagic == 0) amagic = time_now;
|
||||||
session[s].magic = amagic; // set magic number
|
session[s].magic = amagic; // set magic number
|
||||||
session[s].l2tp_flags = aflags; // set flags received
|
session[s].l2tp_flags = aflags; // set flags received
|
||||||
session[s].mru = DEFAULT_MRU;
|
session[s].mru = config->ppp_mru;
|
||||||
controlnull(t); // ack
|
controlnull(t); // ack
|
||||||
|
|
||||||
// start LCP
|
// start LCP
|
||||||
|
|
@ -3500,6 +3501,7 @@ static void initdata(int optdebug, char *optconfig)
|
||||||
config->ppp_restart_time = 3;
|
config->ppp_restart_time = 3;
|
||||||
config->ppp_max_configure = 10;
|
config->ppp_max_configure = 10;
|
||||||
config->ppp_max_failure = 5;
|
config->ppp_max_failure = 5;
|
||||||
|
config->ppp_mru = DEFAULT_MRU;
|
||||||
strcpy(config->random_device, RANDOMDEVICE);
|
strcpy(config->random_device, RANDOMDEVICE);
|
||||||
|
|
||||||
log_stream = stderr;
|
log_stream = stderr;
|
||||||
|
|
@ -4248,6 +4250,8 @@ static void update_config()
|
||||||
setbuf(log_stream, NULL);
|
setbuf(log_stream, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config->ppp_mru < 0) config->ppp_mru = 0;
|
||||||
|
|
||||||
// Update radius
|
// Update radius
|
||||||
config->numradiusservers = 0;
|
config->numradiusservers = 0;
|
||||||
for (i = 0; i < MAXRADSERVER; i++)
|
for (i = 0; i < MAXRADSERVER; i++)
|
||||||
|
|
|
||||||
5
l2tpns.h
5
l2tpns.h
|
|
@ -1,5 +1,5 @@
|
||||||
// L2TPNS Global Stuff
|
// 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__
|
#ifndef __L2TPNS_H__
|
||||||
#define __L2TPNS_H__
|
#define __L2TPNS_H__
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <libcli.h>
|
#include <libcli.h>
|
||||||
|
|
||||||
#define VERSION "2.1.6"
|
#define VERSION "2.1.7"
|
||||||
|
|
||||||
// Limits
|
// Limits
|
||||||
#define MAXTUNNEL 500 // could be up to 65535
|
#define MAXTUNNEL 500 // could be up to 65535
|
||||||
|
|
@ -519,6 +519,7 @@ typedef struct
|
||||||
int ppp_restart_time; // timeout for PPP restart
|
int ppp_restart_time; // timeout for PPP restart
|
||||||
int ppp_max_configure; // max lcp configure requests to send
|
int ppp_max_configure; // max lcp configure requests to send
|
||||||
int ppp_max_failure; // max lcp configure naks to send
|
int ppp_max_failure; // max lcp configure naks to send
|
||||||
|
int ppp_mru; // MRU to advertise
|
||||||
|
|
||||||
char radiussecret[64];
|
char radiussecret[64];
|
||||||
int radius_accounting;
|
int radius_accounting;
|
||||||
|
|
|
||||||
|
|
@ -43,5 +43,5 @@ rm -rf %{buildroot}
|
||||||
%attr(644,root,root) /usr/share/man/man[58]/*
|
%attr(644,root,root) /usr/share/man/man[58]/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed Sep 14 2005 Brendan O'Dea <bod@optus.net> 2.1.6-1
|
* Thu Sep 15 2005 Brendan O'Dea <bod@optus.net> 2.1.6-1
|
||||||
- 2.1.6 release, see /usr/share/doc/l2tpns-2.1.6/Changes
|
- 2.1.6 release, see /usr/share/doc/l2tpns-2.1.6/Changes
|
||||||
|
|
|
||||||
20
ppp.c
20
ppp.c
|
|
@ -1,6 +1,6 @@
|
||||||
// L2TPNS PPP Stuff
|
// 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 <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -577,7 +577,18 @@ void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 1: // Maximum-Receive-Unit
|
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;
|
break;
|
||||||
|
|
||||||
case 2: // Async-Control-Character-Map
|
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
|
case 1: // Maximum-Receive-Unit
|
||||||
if (*p == ConfigNak)
|
if (*p == ConfigNak)
|
||||||
{
|
{
|
||||||
session[s].mru = ntohs(*(uint16_t *)(o + 2));
|
session[s].mru = 0;
|
||||||
LOG(3, s, t, " Remote requested MRU of %u\n", session[s].mru);
|
LOG(3, s, t, " Remote requested MRU of %u; removing option\n",
|
||||||
|
ntohs(*(uint16_t *)(o + 2)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue