summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
149c87a)
- Reset timers on sending ConfigReq.
- Only send one RADIUS Start record, even if IPCP is restarted.
-* 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.
- Fix LCP Echo frequency.
- Add Framed-Route entries to RADIUS records.
- Add scripts/l2tpns-capture.
- Fix LCP Echo frequency.
- 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
- Fix Calling-Station-Id in RADIUS accounting records (Slobodan Tomic).
* Tue Oct 11 2005 Brendan O'Dea <bod@optus.net> 2.1.9
- Fix Calling-Station-Id in RADIUS accounting records (Slobodan Tomic).
// 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 <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
new.next = old->next;
new.far = old->far;
new.tunnel = old->tunnel;
new.next = old->next;
new.far = old->far;
new.tunnel = old->tunnel;
- new.l2tp_flags = old->l2tp_flags;
+ new.flags = old->l2tp_flags;
new.ip = old->ip;
new.ip_pool_index = old->ip_pool_index;
new.unique_id = old->unique_id;
new.ip = old->ip;
new.ip_pool_index = old->ip_pool_index;
new.unique_id = old->unique_id;
// Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced
// vim: sw=8 ts=8
// 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.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 <assert.h>
#include <arpa/inet.h>
#include <assert.h>
my_address; // send my IP
tunnelsend(buf, 10 + (q - buf), t); // send it
my_address; // send my IP
tunnelsend(buf, 10 + (q - buf), t); // send it
+ restart_timer(s, ipcp);
}
void sendipv6cp(sessionidt s, tunnelidt t)
}
void sendipv6cp(sessionidt s, tunnelidt t)
q[13] = 1;
tunnelsend(buf, 14 + (q - buf), t); // send it
q[13] = 1;
tunnelsend(buf, 14 + (q - buf), t); // send it
+ restart_timer(s, ipv6cp);
}
static void sessionclear(sessionidt s)
}
static void sessionclear(sessionidt s)
if (*p == 5 && p[1] == 6) // Magic-Number
amagic = ntohl(*(uint32_t *) (p + 2));
else if (*p == 7) // Protocol-Field-Compression
if (*p == 5 && p[1] == 6) // Magic-Number
amagic = ntohl(*(uint32_t *) (p + 2));
else if (*p == 7) // Protocol-Field-Compression
else if (*p == 8) // Address-and-Control-Field-Compression
else if (*p == 8) // Address-and-Control-Field-Compression
+ aflags |= SESSION_ACFC;
case 12: // ICCN
if (amagic == 0) amagic = time_now;
session[s].magic = amagic; // set magic number
case 12: // ICCN
if (amagic == 0) amagic = time_now;
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
controlnull(t); // ack
// start LCP
session[s].mru = PPPMTU; // default
controlnull(t); // ack
// 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].ppp_mru = MRU;
sess_local[s].lcp_authtype = config->radius_authprefer;
sess_local[s].ppp_mru = MRU;
- session[s].ppp.lcp = RequestSent;
+ change_state(s, lcp, RequestSent);
case 14: // CDN
controlnull(t); // ack
sessionshutdown(s, "Closed (Received CDN).", 0, 0);
case 14: // CDN
controlnull(t); // ack
sessionshutdown(s, "Closed (Received CDN).", 0, 0);
if (sess_local[s].lcp.conf_sent < config->ppp_max_configure)
{
LOG(3, s, session[s].tunnel, "No ACK for LCP ConfigReq... resending\n");
if (sess_local[s].lcp.conf_sent < config->ppp_max_configure)
{
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);
change_state(s, lcp, next_state);
}
sendlcp(s, session[s].tunnel);
change_state(s, lcp, next_state);
}
if (sess_local[s].ipcp.conf_sent < config->ppp_max_configure)
{
LOG(3, s, session[s].tunnel, "No ACK for IPCP ConfigReq... resending\n");
if (sess_local[s].ipcp.conf_sent < config->ppp_max_configure)
{
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);
change_state(s, ipcp, next_state);
}
sendipcp(s, session[s].tunnel);
change_state(s, ipcp, next_state);
}
if (sess_local[s].ipv6cp.conf_sent < config->ppp_max_configure)
{
LOG(3, s, session[s].tunnel, "No ACK for IPV6CP ConfigReq... resending\n");
if (sess_local[s].ipv6cp.conf_sent < config->ppp_max_configure)
{
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);
change_state(s, ipv6cp, next_state);
}
sendipv6cp(s, session[s].tunnel);
change_state(s, ipv6cp, next_state);
}
if (sess_local[s].ccp.conf_sent < config->ppp_max_configure)
{
LOG(3, s, session[s].tunnel, "No ACK for CCP ConfigReq... resending\n");
if (sess_local[s].ccp.conf_sent < config->ppp_max_configure)
{
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);
change_state(s, ccp, next_state);
}
sendccp(s, session[s].tunnel);
change_state(s, ccp, next_state);
}
-// $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__
#define __L2TPNS_H__
#ifndef __L2TPNS_H__
#define __L2TPNS_H__
// reset state machine counters
#define initialise_restart_count(_s, _fsm) \
// reset state machine counters
#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
#define change_state(_s, _fsm, _new) ({ \
// stop timer on change to state where timer does not run
#define change_state(_s, _fsm, _new) ({ \
sessionidt next; // next session in linked list
sessionidt far; // far end session ID
tunnelidt tunnel; // near end tunnel ID
sessionidt next; // next session in linked list
sessionidt far; // far end session 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 {
uint8_t phase; // PPP phase
uint8_t lcp:4; // LCP state
struct {
uint8_t phase; // PPP phase
uint8_t lcp:4; // LCP state
time_t last_echo;
} sessionlocalt;
time_t last_echo;
} sessionlocalt;
-#define SESSIONPFC 1 // PFC negotiated flags
-#define SESSIONACFC 2 // ACFC negotiated flags
+// session 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
typedef struct
// 168 bytes per tunnel
typedef struct
%attr(644,root,root) /usr/share/man/man[58]/*
%changelog
%attr(644,root,root) /usr/share/man/man[58]/*
%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
-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 <string.h>
#include <stdio.h>
#include <string.h>
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);
if (r)
{
uint16_t r = radiusnew(s);
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
*(uint16_t *) (b + 2) = htons(tunnel[t].far); // tunnel
*(uint16_t *) (b + 4) = htons(session[s].far); // session
b += 6;
*(uint16_t *) (b + 2) = htons(tunnel[t].far); // tunnel
*(uint16_t *) (b + 4) = htons(session[s].far); // session
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
b += 2;
}
{
*(uint16_t *) b = htons(0xFF03); // HDLC header
b += 2;
}
- if (mtype < 0x100 && session[s].l2tp_flags & SESSIONPFC)
+ if (mtype < 0x100 && session[s].flags & SESSION_PFC)
if (config->debug > 3) dumplcp(q, l - q);
tunnelsend(b, (l - b), t);
if (config->debug > 3) dumplcp(q, l - q);
tunnelsend(b, (l - b), t);
}
// Send CCP request for no compression
}
// Send CCP request for no compression
LOG_HEX(5, "PPPCCP", q, 4);
tunnelsend(b, (q - b) + 4 , t);
LOG_HEX(5, "PPPCCP", q, 4);
tunnelsend(b, (q - b) + 4 , t);