- Reset restart counters correctly.
- Reset timers on sending ConfigReq. - Only send one RADIUS Start record, even if IPCP is restarted.
This commit is contained in:
parent
149c87a729
commit
4caf4199d1
6 changed files with 41 additions and 30 deletions
5
Changes
5
Changes
|
|
@ -1,7 +1,10 @@
|
||||||
* Wed Oct 19 2005 Brendan O'Dea <bod@optus.net> 2.1.10
|
* Sat Nov 5 2005 Brendan O'Dea <bod@optus.net> 2.1.10
|
||||||
- Add scripts/l2tpns-capture.
|
- Add scripts/l2tpns-capture.
|
||||||
- Fix LCP Echo frequency.
|
- Fix LCP Echo frequency.
|
||||||
- Add Framed-Route entries to RADIUS records.
|
- Add Framed-Route entries to RADIUS records.
|
||||||
|
- Reset restart counters correctly.
|
||||||
|
- Reset timers on sending ConfigReq.
|
||||||
|
- Only send one RADIUS Start record, even if IPCP is restarted.
|
||||||
|
|
||||||
* Tue Oct 11 2005 Brendan O'Dea <bod@optus.net> 2.1.9
|
* Tue Oct 11 2005 Brendan O'Dea <bod@optus.net> 2.1.9
|
||||||
- Fix Calling-Station-Id in RADIUS accounting records (Slobodan Tomic).
|
- Fix Calling-Station-Id in RADIUS accounting records (Slobodan Tomic).
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// L2TPNS Clustering Stuff
|
// L2TPNS Clustering Stuff
|
||||||
|
|
||||||
char const *cvs_id_cluster = "$Id: cluster.c,v 1.46 2005/09/02 23:59:56 bodea Exp $";
|
char const *cvs_id_cluster = "$Id: cluster.c,v 1.47 2005/11/04 14:41:50 bodea Exp $";
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
@ -1268,7 +1268,7 @@ static uint8_t *convert_session(struct oldsession *old)
|
||||||
new.next = old->next;
|
new.next = old->next;
|
||||||
new.far = old->far;
|
new.far = old->far;
|
||||||
new.tunnel = old->tunnel;
|
new.tunnel = old->tunnel;
|
||||||
new.l2tp_flags = old->l2tp_flags;
|
new.flags = old->l2tp_flags;
|
||||||
new.ip = old->ip;
|
new.ip = old->ip;
|
||||||
new.ip_pool_index = old->ip_pool_index;
|
new.ip_pool_index = old->ip_pool_index;
|
||||||
new.unique_id = old->unique_id;
|
new.unique_id = old->unique_id;
|
||||||
|
|
|
||||||
25
l2tpns.c
25
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.145 2005/10/18 07:19:28 bodea Exp $";
|
char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.146 2005/11/04 14:41:50 bodea Exp $";
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
@ -1682,6 +1682,7 @@ void sendipcp(sessionidt s, tunnelidt t)
|
||||||
my_address; // send my IP
|
my_address; // send my IP
|
||||||
|
|
||||||
tunnelsend(buf, 10 + (q - buf), t); // send it
|
tunnelsend(buf, 10 + (q - buf), t); // send it
|
||||||
|
restart_timer(s, ipcp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendipv6cp(sessionidt s, tunnelidt t)
|
void sendipv6cp(sessionidt s, tunnelidt t)
|
||||||
|
|
@ -1707,6 +1708,7 @@ void sendipv6cp(sessionidt s, tunnelidt t)
|
||||||
q[13] = 1;
|
q[13] = 1;
|
||||||
|
|
||||||
tunnelsend(buf, 14 + (q - buf), t); // send it
|
tunnelsend(buf, 14 + (q - buf), t); // send it
|
||||||
|
restart_timer(s, ipv6cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sessionclear(sessionidt s)
|
static void sessionclear(sessionidt s)
|
||||||
|
|
@ -2327,9 +2329,9 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr)
|
||||||
if (*p == 5 && p[1] == 6) // Magic-Number
|
if (*p == 5 && p[1] == 6) // Magic-Number
|
||||||
amagic = ntohl(*(uint32_t *) (p + 2));
|
amagic = ntohl(*(uint32_t *) (p + 2));
|
||||||
else if (*p == 7) // Protocol-Field-Compression
|
else if (*p == 7) // Protocol-Field-Compression
|
||||||
aflags |= SESSIONPFC;
|
aflags |= SESSION_PFC;
|
||||||
else if (*p == 8) // Address-and-Control-Field-Compression
|
else if (*p == 8) // Address-and-Control-Field-Compression
|
||||||
aflags |= SESSIONACFC;
|
aflags |= SESSION_ACFC;
|
||||||
p += p[1];
|
p += p[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2456,20 +2458,17 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr)
|
||||||
case 12: // ICCN
|
case 12: // ICCN
|
||||||
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].flags = aflags; // set flags received
|
||||||
session[s].mru = PPPMTU; // default
|
session[s].mru = PPPMTU; // default
|
||||||
controlnull(t); // ack
|
controlnull(t); // ack
|
||||||
|
|
||||||
// start LCP
|
// start LCP
|
||||||
sess_local[s].lcp.restart = time_now + config->ppp_restart_time;
|
|
||||||
sess_local[s].lcp.conf_sent = 1;
|
|
||||||
sess_local[s].lcp.nak_sent = 0;
|
|
||||||
sess_local[s].lcp_authtype = config->radius_authprefer;
|
sess_local[s].lcp_authtype = config->radius_authprefer;
|
||||||
sess_local[s].ppp_mru = MRU;
|
sess_local[s].ppp_mru = MRU;
|
||||||
session[s].ppp.lcp = RequestSent;
|
|
||||||
sendlcp(s, t);
|
sendlcp(s, t);
|
||||||
|
change_state(s, lcp, RequestSent);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 14: // CDN
|
case 14: // CDN
|
||||||
controlnull(t); // ack
|
controlnull(t); // ack
|
||||||
sessionshutdown(s, "Closed (Received CDN).", 0, 0);
|
sessionshutdown(s, "Closed (Received CDN).", 0, 0);
|
||||||
|
|
@ -2817,8 +2816,6 @@ static void regular_cleanups(double period)
|
||||||
if (sess_local[s].lcp.conf_sent < config->ppp_max_configure)
|
if (sess_local[s].lcp.conf_sent < config->ppp_max_configure)
|
||||||
{
|
{
|
||||||
LOG(3, s, session[s].tunnel, "No ACK for LCP ConfigReq... resending\n");
|
LOG(3, s, session[s].tunnel, "No ACK for LCP ConfigReq... resending\n");
|
||||||
sess_local[s].lcp.restart = time_now + config->ppp_restart_time;
|
|
||||||
sess_local[s].lcp.conf_sent++;
|
|
||||||
sendlcp(s, session[s].tunnel);
|
sendlcp(s, session[s].tunnel);
|
||||||
change_state(s, lcp, next_state);
|
change_state(s, lcp, next_state);
|
||||||
}
|
}
|
||||||
|
|
@ -2848,8 +2845,6 @@ static void regular_cleanups(double period)
|
||||||
if (sess_local[s].ipcp.conf_sent < config->ppp_max_configure)
|
if (sess_local[s].ipcp.conf_sent < config->ppp_max_configure)
|
||||||
{
|
{
|
||||||
LOG(3, s, session[s].tunnel, "No ACK for IPCP ConfigReq... resending\n");
|
LOG(3, s, session[s].tunnel, "No ACK for IPCP ConfigReq... resending\n");
|
||||||
sess_local[s].ipcp.restart = time_now + config->ppp_restart_time;
|
|
||||||
sess_local[s].ipcp.conf_sent++;
|
|
||||||
sendipcp(s, session[s].tunnel);
|
sendipcp(s, session[s].tunnel);
|
||||||
change_state(s, ipcp, next_state);
|
change_state(s, ipcp, next_state);
|
||||||
}
|
}
|
||||||
|
|
@ -2879,8 +2874,6 @@ static void regular_cleanups(double period)
|
||||||
if (sess_local[s].ipv6cp.conf_sent < config->ppp_max_configure)
|
if (sess_local[s].ipv6cp.conf_sent < config->ppp_max_configure)
|
||||||
{
|
{
|
||||||
LOG(3, s, session[s].tunnel, "No ACK for IPV6CP ConfigReq... resending\n");
|
LOG(3, s, session[s].tunnel, "No ACK for IPV6CP ConfigReq... resending\n");
|
||||||
sess_local[s].ipv6cp.restart = time_now + config->ppp_restart_time;
|
|
||||||
sess_local[s].ipv6cp.conf_sent++;
|
|
||||||
sendipv6cp(s, session[s].tunnel);
|
sendipv6cp(s, session[s].tunnel);
|
||||||
change_state(s, ipv6cp, next_state);
|
change_state(s, ipv6cp, next_state);
|
||||||
}
|
}
|
||||||
|
|
@ -2907,8 +2900,6 @@ static void regular_cleanups(double period)
|
||||||
if (sess_local[s].ccp.conf_sent < config->ppp_max_configure)
|
if (sess_local[s].ccp.conf_sent < config->ppp_max_configure)
|
||||||
{
|
{
|
||||||
LOG(3, s, session[s].tunnel, "No ACK for CCP ConfigReq... resending\n");
|
LOG(3, s, session[s].tunnel, "No ACK for CCP ConfigReq... resending\n");
|
||||||
sess_local[s].ccp.restart = time_now + config->ppp_restart_time;
|
|
||||||
sess_local[s].ccp.conf_sent++;
|
|
||||||
sendccp(s, session[s].tunnel);
|
sendccp(s, session[s].tunnel);
|
||||||
change_state(s, ccp, next_state);
|
change_state(s, ccp, next_state);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
19
l2tpns.h
19
l2tpns.h
|
|
@ -1,5 +1,5 @@
|
||||||
// L2TPNS Global Stuff
|
// L2TPNS Global Stuff
|
||||||
// $Id: l2tpns.h,v 1.96 2005/10/18 07:19:29 bodea Exp $
|
// $Id: l2tpns.h,v 1.97 2005/11/04 14:41:50 bodea Exp $
|
||||||
|
|
||||||
#ifndef __L2TPNS_H__
|
#ifndef __L2TPNS_H__
|
||||||
#define __L2TPNS_H__
|
#define __L2TPNS_H__
|
||||||
|
|
@ -148,7 +148,14 @@ enum {
|
||||||
|
|
||||||
// reset state machine counters
|
// reset state machine counters
|
||||||
#define initialise_restart_count(_s, _fsm) \
|
#define initialise_restart_count(_s, _fsm) \
|
||||||
sess_local[_s]._fsm.conf_sent = sess_local[_s]._fsm.nak_sent
|
sess_local[_s]._fsm.conf_sent = sess_local[_s]._fsm.nak_sent = 0
|
||||||
|
|
||||||
|
// increment ConfReq counter and reset timer
|
||||||
|
#define restart_timer(_s, _fsm) ({ \
|
||||||
|
sess_local[_s]._fsm.conf_sent++; \
|
||||||
|
sess_local[_s]._fsm.restart = \
|
||||||
|
time_now + config->ppp_restart_time; \
|
||||||
|
})
|
||||||
|
|
||||||
// stop timer on change to state where timer does not run
|
// stop timer on change to state where timer does not run
|
||||||
#define change_state(_s, _fsm, _new) ({ \
|
#define change_state(_s, _fsm, _new) ({ \
|
||||||
|
|
@ -221,7 +228,7 @@ typedef struct
|
||||||
sessionidt next; // next session in linked list
|
sessionidt next; // next session in linked list
|
||||||
sessionidt far; // far end session ID
|
sessionidt far; // far end session ID
|
||||||
tunnelidt tunnel; // near end tunnel ID
|
tunnelidt tunnel; // near end tunnel ID
|
||||||
uint8_t l2tp_flags; // various bit flags from the ICCN on the l2tp tunnel.
|
uint8_t flags; // session flags: see SESSION_*
|
||||||
struct {
|
struct {
|
||||||
uint8_t phase; // PPP phase
|
uint8_t phase; // PPP phase
|
||||||
uint8_t lcp:4; // LCP state
|
uint8_t lcp:4; // LCP state
|
||||||
|
|
@ -312,8 +319,10 @@ typedef struct
|
||||||
time_t last_echo;
|
time_t last_echo;
|
||||||
} sessionlocalt;
|
} sessionlocalt;
|
||||||
|
|
||||||
#define SESSIONPFC 1 // PFC negotiated flags
|
// session flags
|
||||||
#define SESSIONACFC 2 // ACFC negotiated flags
|
#define SESSION_PFC (1 << 0) // use Protocol-Field-Compression
|
||||||
|
#define SESSION_ACFC (1 << 1) // use Address-and-Control-Field-Compression
|
||||||
|
#define SESSION_STARTED (1 << 2) // RADIUS Start record sent
|
||||||
|
|
||||||
// 168 bytes per tunnel
|
// 168 bytes per tunnel
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
||||||
|
|
@ -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 Oct 19 2005 Brendan O'Dea <bod@optus.net> 2.1.10-1
|
* Sat Nov 5 2005 Brendan O'Dea <bod@optus.net> 2.1.10-1
|
||||||
- 2.1.10 release, see /usr/share/doc/l2tpns-2.1.10/Changes
|
- 2.1.10 release, see /usr/share/doc/l2tpns-2.1.10/Changes
|
||||||
|
|
|
||||||
16
ppp.c
16
ppp.c
|
|
@ -1,6 +1,6 @@
|
||||||
// L2TPNS PPP Stuff
|
// L2TPNS PPP Stuff
|
||||||
|
|
||||||
char const *cvs_id_ppp = "$Id: ppp.c,v 1.84 2005/09/16 13:20:39 bodea Exp $";
|
char const *cvs_id_ppp = "$Id: ppp.c,v 1.85 2005/11/04 14:41:50 bodea Exp $";
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -903,11 +903,17 @@ static void ipcp_open(sessionidt s, tunnelidt t)
|
||||||
|
|
||||||
change_state(s, ipcp, Opened);
|
change_state(s, ipcp, Opened);
|
||||||
|
|
||||||
if (!session[s].walled_garden)
|
if (!(session[s].walled_garden || session[s].flags & SESSION_STARTED))
|
||||||
{
|
{
|
||||||
uint16_t r = radiusnew(s);
|
uint16_t r = radiusnew(s);
|
||||||
if (r)
|
if (r)
|
||||||
|
{
|
||||||
radiussend(r, RADIUSSTART); // send radius start
|
radiussend(r, RADIUSSTART); // send radius start
|
||||||
|
|
||||||
|
// don't send further Start records if IPCP is restarted
|
||||||
|
session[s].flags |= SESSION_STARTED;
|
||||||
|
cluster_send_session(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// start IPv6 if configured and still in passive state
|
// start IPv6 if configured and still in passive state
|
||||||
|
|
@ -1747,12 +1753,12 @@ uint8_t *makeppp(uint8_t *b, int size, uint8_t *p, int l, sessionidt s, tunnelid
|
||||||
*(uint16_t *) (b + 2) = htons(tunnel[t].far); // tunnel
|
*(uint16_t *) (b + 2) = htons(tunnel[t].far); // tunnel
|
||||||
*(uint16_t *) (b + 4) = htons(session[s].far); // session
|
*(uint16_t *) (b + 4) = htons(session[s].far); // session
|
||||||
b += 6;
|
b += 6;
|
||||||
if (mtype == PPPLCP || !(session[s].l2tp_flags & SESSIONACFC))
|
if (mtype == PPPLCP || !(session[s].flags & SESSION_ACFC))
|
||||||
{
|
{
|
||||||
*(uint16_t *) b = htons(0xFF03); // HDLC header
|
*(uint16_t *) b = htons(0xFF03); // HDLC header
|
||||||
b += 2;
|
b += 2;
|
||||||
}
|
}
|
||||||
if (mtype < 0x100 && session[s].l2tp_flags & SESSIONPFC)
|
if (mtype < 0x100 && session[s].flags & SESSION_PFC)
|
||||||
*b++ = mtype;
|
*b++ = mtype;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1839,6 +1845,7 @@ void sendlcp(sessionidt s, tunnelidt t)
|
||||||
if (config->debug > 3) dumplcp(q, l - q);
|
if (config->debug > 3) dumplcp(q, l - q);
|
||||||
|
|
||||||
tunnelsend(b, (l - b), t);
|
tunnelsend(b, (l - b), t);
|
||||||
|
restart_timer(s, lcp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send CCP request for no compression
|
// Send CCP request for no compression
|
||||||
|
|
@ -1857,4 +1864,5 @@ void sendccp(sessionidt s, tunnelidt t)
|
||||||
|
|
||||||
LOG_HEX(5, "PPPCCP", q, 4);
|
LOG_HEX(5, "PPPCCP", q, 4);
|
||||||
tunnelsend(b, (q - b) + 4 , t);
|
tunnelsend(b, (q - b) + 4 , t);
|
||||||
|
restart_timer(s, ccp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue