summaryrefslogtreecommitdiff
path: root/net/ipv4/netfilter/ipt_TOS.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-10-12 14:08:26 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2006-10-15 23:14:08 -0700
commita9f54596fa20be3edefaa0b24c8714edb945eeaa (patch)
tree735fb43f1fa5b9ad2fd6d49387c279f2f663a5d3 /net/ipv4/netfilter/ipt_TOS.c
parentf603b6ec50faabbabde53ae2e2ce774968524c40 (diff)
[NETFILTER]: ipt_ECN/ipt_TOS: fix incorrect checksum update
Even though the tos field is only a single byte large, the values need to be converted to net-endian for the checkum update so they are in the corrent byte position. Also fix incorrect endian annotations. Reported by Stephane Chazelas <Stephane_Chazelas@yahoo.fr> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/netfilter/ipt_TOS.c')
-rw-r--r--net/ipv4/netfilter/ipt_TOS.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/netfilter/ipt_TOS.c b/net/ipv4/netfilter/ipt_TOS.c
index 6b8b14ccc3d..83b80b3a5d2 100644
--- a/net/ipv4/netfilter/ipt_TOS.c
+++ b/net/ipv4/netfilter/ipt_TOS.c
@@ -30,7 +30,7 @@ target(struct sk_buff **pskb,
{
const struct ipt_tos_target_info *tosinfo = targinfo;
struct iphdr *iph = (*pskb)->nh.iph;
- __be16 oldtos;
+ u_int16_t oldtos;
if ((iph->tos & IPTOS_TOS_MASK) != tosinfo->tos) {
if (!skb_make_writable(pskb, sizeof(struct iphdr)))
@@ -38,8 +38,8 @@ target(struct sk_buff **pskb,
iph = (*pskb)->nh.iph;
oldtos = iph->tos;
iph->tos = (iph->tos & IPTOS_PREC_MASK) | tosinfo->tos;
- iph->check = nf_csum_update(oldtos ^ htons(0xFFFF), iph->tos,
- iph->check);
+ iph->check = nf_csum_update(htons(oldtos) ^ htons(0xFFFF),
+ htons(iph->tos), iph->check);
}
return IPT_CONTINUE;
}