set acct-disconnect-cause from result code AVP if no disconnect cause AVP is present
This commit is contained in:
parent
65270c4bd2
commit
d2f496f603
3 changed files with 29 additions and 8 deletions
4
Changes
4
Changes
|
|
@ -1,4 +1,4 @@
|
||||||
* Fri Jun 9 2006 Brendan O'Dea <bod@optus.net> 2.2.0
|
* Fri Jun 23 2006 Brendan O'Dea <bod@optus.net> 2.2.0
|
||||||
- Only poll clifd if successfully bound.
|
- Only poll clifd if successfully bound.
|
||||||
- Add "Practical VPNs" document from Liran Tal as Docs/vpn .
|
- Add "Practical VPNs" document from Liran Tal as Docs/vpn .
|
||||||
- Add Multilink support from Khaled Al Hamwi.
|
- Add Multilink support from Khaled Al Hamwi.
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
- Convert manual.html to Docbook.
|
- Convert manual.html to Docbook.
|
||||||
- Kludge around problem with Netgear DM602 authentication.
|
- Kludge around problem with Netgear DM602 authentication.
|
||||||
- Add session/idle timeouts (Graham Maltby).
|
- Add session/idle timeouts (Graham Maltby).
|
||||||
|
- Use result code AVP to set Acct-Terminate-Cause is disconnect cause
|
||||||
|
AVP is not present.
|
||||||
|
|
||||||
* Tue Apr 18 2006 Brendan O'Dea <bod@optus.net> 2.1.18
|
* Tue Apr 18 2006 Brendan O'Dea <bod@optus.net> 2.1.18
|
||||||
- Don't shutdown on TerminateReq, wait for CDN.
|
- Don't shutdown on TerminateReq, wait for CDN.
|
||||||
|
|
|
||||||
31
l2tpns.c
31
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.167 2006-06-11 12:46:18 bodea Exp $";
|
char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.168 2006-06-22 15:30:29 bodea Exp $";
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
@ -2184,9 +2184,10 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr)
|
||||||
int error = 0;
|
int error = 0;
|
||||||
char *msg = 0;
|
char *msg = 0;
|
||||||
|
|
||||||
// default disconnect cause/message on receipt
|
// Default disconnect cause/message on receipt of CDN. Set to
|
||||||
// of CDN (set to more specific value from
|
// more specific value from attribute 1 (result code) or 46
|
||||||
// attribute 46 if present below).
|
// (disconnect cause) if present below.
|
||||||
|
int disc_cause_set = 0;
|
||||||
int disc_cause = TERM_NAS_REQUEST;
|
int disc_cause = TERM_NAS_REQUEST;
|
||||||
char const *disc_reason = "Closed (Received CDN).";
|
char const *disc_reason = "Closed (Received CDN).";
|
||||||
|
|
||||||
|
|
@ -2296,25 +2297,41 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr)
|
||||||
case 1: // result code
|
case 1: // result code
|
||||||
{
|
{
|
||||||
uint16_t rescode = ntohs(*(uint16_t *) b);
|
uint16_t rescode = ntohs(*(uint16_t *) b);
|
||||||
const char* resdesc = "(unknown)";
|
char const *resdesc = "(unknown)";
|
||||||
|
char const *errdesc = NULL;
|
||||||
|
int cause = 0;
|
||||||
|
|
||||||
if (message == 4)
|
if (message == 4)
|
||||||
{ /* StopCCN */
|
{ /* StopCCN */
|
||||||
resdesc = l2tp_stopccn_result_code(rescode);
|
resdesc = l2tp_stopccn_result_code(rescode);
|
||||||
|
cause = TERM_LOST_SERVICE;
|
||||||
}
|
}
|
||||||
else if (message == 14)
|
else if (message == 14)
|
||||||
{ /* CDN */
|
{ /* CDN */
|
||||||
resdesc = l2tp_cdn_result_code(rescode);
|
resdesc = l2tp_cdn_result_code(rescode);
|
||||||
|
if (rescode == 1)
|
||||||
|
cause = TERM_LOST_CARRIER;
|
||||||
|
else
|
||||||
|
cause = TERM_ADMIN_RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(4, s, t, " Result Code %u: %s\n", rescode, resdesc);
|
LOG(4, s, t, " Result Code %u: %s\n", rescode, resdesc);
|
||||||
if (n >= 4)
|
if (n >= 4)
|
||||||
{
|
{
|
||||||
uint16_t errcode = ntohs(*(uint16_t *)(b + 2));
|
uint16_t errcode = ntohs(*(uint16_t *)(b + 2));
|
||||||
LOG(4, s, t, " Error Code %u: %s\n", errcode, l2tp_error_code(errcode));
|
errdesc = l2tp_error_code(errcode);
|
||||||
|
LOG(4, s, t, " Error Code %u: %s\n", errcode, errdesc);
|
||||||
}
|
}
|
||||||
if (n > 4)
|
if (n > 4)
|
||||||
LOG(4, s, t, " Error String: %.*s\n", n-4, b+4);
|
LOG(4, s, t, " Error String: %.*s\n", n-4, b+4);
|
||||||
|
|
||||||
|
if (cause && disc_cause_set < mtype) // take cause from attrib 46 in preference
|
||||||
|
{
|
||||||
|
disc_cause_set = mtype;
|
||||||
|
disc_reason = errdesc ? errdesc : resdesc;
|
||||||
|
disc_cause = cause;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2506,6 +2523,8 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr)
|
||||||
"(code=%u, proto=%04X, dir=%u, msg=\"%.*s\")\n",
|
"(code=%u, proto=%04X, dir=%u, msg=\"%.*s\")\n",
|
||||||
code, proto, dir, n - 5, b + 5);
|
code, proto, dir, n - 5, b + 5);
|
||||||
|
|
||||||
|
disc_cause_set = mtype;
|
||||||
|
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case 1: // admin disconnect
|
case 1: // admin disconnect
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
* Fri Jun 9 2006 Brendan O'Dea <bod@optus.net> 2.2.0-1
|
* Fri Jun 23 2006 Brendan O'Dea <bod@optus.net> 2.2.0-1
|
||||||
- 2.2.0 release, see /usr/share/doc/l2tpns-2.2.0/Changes
|
- 2.2.0 release, see /usr/share/doc/l2tpns-2.2.0/Changes
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue