projects
/
l2tpns.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
733f582
)
*** empty log message ***
author
Brendan O'Dea
<bod@optus.net>
Tue, 13 Sep 2005 14:27:14 +0000
(14:27 +0000)
committer
Brendan O'Dea
<bod@optus.net>
Tue, 13 Sep 2005 14:27:14 +0000
(14:27 +0000)
l2tpns.c
patch
|
blob
|
history
diff --git
a/l2tpns.c
b/l2tpns.c
index
ed9424c
..
6839c25
100644
(file)
--- 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
// 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.13
0 2005-09-13 14:23:07
bodea Exp $";
+char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.13
1 2005-09-13 14:27:14
bodea Exp $";
#include <arpa/inet.h>
#include <assert.h>
#include <arpa/inet.h>
#include <assert.h>
@@
-2418,7
+2418,7
@@
void processudp(uint8_t *buf, int len, struct sockaddr_in *addr)
}
else
{ // data
}
else
{ // data
- uint16_t prot;
+ uint16_t prot
o
;
LOG_HEX(5, "Receive Tunnel Data", p, l);
if (l > 2 && p[0] == 0xFF && p[1] == 0x03)
LOG_HEX(5, "Receive Tunnel Data", p, l);
if (l > 2 && p[0] == 0xFF && p[1] == 0x03)
@@
-2434,12
+2434,12
@@
void processudp(uint8_t *buf, int len, struct sockaddr_in *addr)
}
if (*p & 1)
{
}
if (*p & 1)
{
- prot = *p++;
+ prot
o
= *p++;
l--;
}
else
{
l--;
}
else
{
- prot = ntohs(*(uint16_t *) p);
+ prot
o
= ntohs(*(uint16_t *) p);
p += 2;
l -= 2;
}
p += 2;
l -= 2;
}
@@
-2459,43
+2459,43
@@
void processudp(uint8_t *buf, int len, struct sockaddr_in *addr)
return;
}
return;
}
- if (prot == PPPPAP)
+ if (prot
o
== PPPPAP)
{
session[s].last_packet = time_now;
if (!config->cluster_iam_master) { master_forward_packet(buf, len, addr->sin_addr.s_addr, addr->sin_port); return; }
processpap(s, t, p, l);
}
{
session[s].last_packet = time_now;
if (!config->cluster_iam_master) { master_forward_packet(buf, len, addr->sin_addr.s_addr, addr->sin_port); return; }
processpap(s, t, p, l);
}
- else if (prot == PPPCHAP)
+ else if (prot
o
== PPPCHAP)
{
session[s].last_packet = time_now;
if (!config->cluster_iam_master) { master_forward_packet(buf, len, addr->sin_addr.s_addr, addr->sin_port); return; }
processchap(s, t, p, l);
}
{
session[s].last_packet = time_now;
if (!config->cluster_iam_master) { master_forward_packet(buf, len, addr->sin_addr.s_addr, addr->sin_port); return; }
processchap(s, t, p, l);
}
- else if (prot == PPPLCP)
+ else if (prot
o
== PPPLCP)
{
session[s].last_packet = time_now;
if (!config->cluster_iam_master) { master_forward_packet(buf, len, addr->sin_addr.s_addr, addr->sin_port); return; }
processlcp(s, t, p, l);
}
{
session[s].last_packet = time_now;
if (!config->cluster_iam_master) { master_forward_packet(buf, len, addr->sin_addr.s_addr, addr->sin_port); return; }
processlcp(s, t, p, l);
}
- else if (prot == PPPIPCP)
+ else if (prot
o
== PPPIPCP)
{
session[s].last_packet = time_now;
if (!config->cluster_iam_master) { master_forward_packet(buf, len, addr->sin_addr.s_addr, addr->sin_port); return; }
processipcp(s, t, p, l);
}
{
session[s].last_packet = time_now;
if (!config->cluster_iam_master) { master_forward_packet(buf, len, addr->sin_addr.s_addr, addr->sin_port); return; }
processipcp(s, t, p, l);
}
- else if (prot == PPPIPV6CP && config->ipv6_prefix.s6_addr[0])
+ else if (prot
o
== PPPIPV6CP && config->ipv6_prefix.s6_addr[0])
{
session[s].last_packet = time_now;
if (!config->cluster_iam_master) { master_forward_packet(buf, len, addr->sin_addr.s_addr, addr->sin_port); return; }
processipv6cp(s, t, p, l);
}
{
session[s].last_packet = time_now;
if (!config->cluster_iam_master) { master_forward_packet(buf, len, addr->sin_addr.s_addr, addr->sin_port); return; }
processipv6cp(s, t, p, l);
}
- else if (prot == PPPCCP)
+ else if (prot
o
== PPPCCP)
{
session[s].last_packet = time_now;
if (!config->cluster_iam_master) { master_forward_packet(buf, len, addr->sin_addr.s_addr, addr->sin_port); return; }
processccp(s, t, p, l);
}
{
session[s].last_packet = time_now;
if (!config->cluster_iam_master) { master_forward_packet(buf, len, addr->sin_addr.s_addr, addr->sin_port); return; }
processccp(s, t, p, l);
}
- else if (prot == PPPIP)
+ else if (prot
o
== PPPIP)
{
if (session[s].die)
{
{
if (session[s].die)
{
@@
-2512,7
+2512,7
@@
void processudp(uint8_t *buf, int len, struct sockaddr_in *addr)
processipin(s, t, p, l);
}
processipin(s, t, p, l);
}
- else if (prot == PPPIPV6 && config->ipv6_prefix.s6_addr[0])
+ else if (prot
o
== PPPIPV6 && config->ipv6_prefix.s6_addr[0])
{
if (session[s].die)
{
{
if (session[s].die)
{
@@
-2531,17
+2531,17
@@
void processudp(uint8_t *buf, int len, struct sockaddr_in *addr)
}
else if (session[s].ppp.lcp == Opened)
{
}
else if (session[s].ppp.lcp == Opened)
{
- uint8_t
+ uint8_t
buf[MAXETHER];
uint8_t *q;
int mru = session[s].mru;
if (!mru) mru = MAXMRU;
uint8_t *q;
int mru = session[s].mru;
if (!mru) mru = MAXMRU;
- if (mru > size
) mru = size
;
+ if (mru > size
of(buf)) mru = sizeof(buf)
;
l += 6;
if (l > mru) l = mru;
l += 6;
if (l > mru) l = mru;
- q = makeppp(buf, size, 0, 0, s, t, proto);
+ q = makeppp(buf, size
of(buf)
, 0, 0, s, t, proto);
if (!q) return;
*q = CodeRej;
if (!q) return;
*q = CodeRej;
@@
-2550,19
+2550,17
@@
void processudp(uint8_t *buf, int len, struct sockaddr_in *addr)
*(uint16_t *)(q + 4) = htons(proto);
memcpy(q + 6, p, l - 6);
*(uint16_t *)(q + 4) = htons(proto);
memcpy(q + 6, p, l - 6);
- if (prot == PPPIPV6CP)
+ if (prot
o
== PPPIPV6CP)
LOG(3, s, t, "LCP: send ProtocolRej (IPV6CP: not configured)\n");
else
LOG(3, s, t, "LCP: send ProtocolRej (IPV6CP: not configured)\n");
else
- LOG(2, s, t, "LCP: sent ProtocolRej (0x%04X: unsupported)\n", prot);
-
- if (config->debug > 3) dumplcp(q, l);
+ LOG(2, s, t, "LCP: sent ProtocolRej (0x%04X: unsupported)\n", proto);
tunnelsend(buf, l + (q - buf), t);
}
else
{
LOG(2, s, t, "Unknown PPP protocol 0x%04X received in LCP %s state\n",
tunnelsend(buf, l + (q - buf), t);
}
else
{
LOG(2, s, t, "Unknown PPP protocol 0x%04X received in LCP %s state\n",
- prot, ppp_state(session[s].ppp.lcp));
+ prot
o
, ppp_state(session[s].ppp.lcp));
}
}
}
}
}
}