git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vserver 1.9.3
[linux-2.6.git]
/
net
/
ipv4
/
netfilter
/
ipt_ECN.c
diff --git
a/net/ipv4/netfilter/ipt_ECN.c
b/net/ipv4/netfilter/ipt_ECN.c
index
8ca4025
..
120109c
100644
(file)
--- a/
net/ipv4/netfilter/ipt_ECN.c
+++ b/
net/ipv4/netfilter/ipt_ECN.c
@@
-52,34
+52,39
@@
set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
static inline int
set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo, int inward)
{
static inline int
set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo, int inward)
{
- struct tcphdr
tcp
h;
+ struct tcphdr
_tcph, *t
h;
u_int16_t diffs[2];
/* Not enought header? */
u_int16_t diffs[2];
/* Not enought header? */
- if (skb_copy_bits(*pskb, (*pskb)->nh.iph->ihl*4, &tcph, sizeof(tcph))
- < 0)
+ th = skb_header_pointer(*pskb, (*pskb)->nh.iph->ihl*4,
+ sizeof(_tcph), &_tcph);
+ if (th == NULL)
return 0;
return 0;
- diffs[0] = ((u_int16_t *)
&tcp
h)[6];
+ diffs[0] = ((u_int16_t *)
t
h)[6];
if (einfo->operation & IPT_ECN_OP_SET_ECE)
if (einfo->operation & IPT_ECN_OP_SET_ECE)
- t
cph.
ece = einfo->proto.tcp.ece;
+ t
h->
ece = einfo->proto.tcp.ece;
if (einfo->operation & IPT_ECN_OP_SET_CWR)
if (einfo->operation & IPT_ECN_OP_SET_CWR)
- t
cph.
cwr = einfo->proto.tcp.cwr;
- diffs[1] = ((u_int16_t *)&t
cp
h)[6];
+ t
h->
cwr = einfo->proto.tcp.cwr;
+ diffs[1] = ((u_int16_t *)&th)[6];
/* Only mangle if it's changed. */
if (diffs[0] != diffs[1]) {
diffs[0] = diffs[0] ^ 0xFFFF;
if (!skb_ip_make_writable(pskb,
/* Only mangle if it's changed. */
if (diffs[0] != diffs[1]) {
diffs[0] = diffs[0] ^ 0xFFFF;
if (!skb_ip_make_writable(pskb,
- (*pskb)->nh.iph->ihl*4+sizeof(tcph)))
+ (*pskb)->nh.iph->ihl*4+sizeof(
_
tcph)))
return 0;
return 0;
+
+ if (th != &_tcph)
+ memcpy(&_tcph, th, sizeof(_tcph));
+
if ((*pskb)->ip_summed != CHECKSUM_HW)
if ((*pskb)->ip_summed != CHECKSUM_HW)
- tcph.check = csum_fold(csum_partial((char *)diffs,
- sizeof(diffs),
- tcph.check^0xFFFF));
+
_
tcph.check = csum_fold(csum_partial((char *)diffs,
+
sizeof(diffs),
+
_
tcph.check^0xFFFF));
memcpy((*pskb)->data + (*pskb)->nh.iph->ihl*4,
memcpy((*pskb)->data + (*pskb)->nh.iph->ihl*4,
- &
tcph, sizeof(
tcph));
+ &
_tcph, sizeof(_
tcph));
if ((*pskb)->ip_summed == CHECKSUM_HW)
if (skb_checksum_help(pskb, inward))
return 0;
if ((*pskb)->ip_summed == CHECKSUM_HW)
if (skb_checksum_help(pskb, inward))
return 0;