[NET]: Replace CHECKSUM_HW by CHECKSUM_PARTIAL/CHECKSUM_COMPLETE
Replace CHECKSUM_HW by CHECKSUM_PARTIAL (for outgoing packets, whose checksum still needs to be completed) and CHECKSUM_COMPLETE (for incoming packets, device supplied full checksum). Patch originally from Herbert Xu, updated by myself for 2.6.18-rc3. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
8584d6df39
commit
84fa7933a3
@@ -865,8 +865,7 @@ static int tcp_error(struct sk_buff *skb,
|
||||
|
||||
/* Checksum invalid? Ignore.
|
||||
* We skip checking packets on the outgoing path
|
||||
* because the semantic of CHECKSUM_HW is different there
|
||||
* and moreover root might send raw packets.
|
||||
* because it is assumed to be correct.
|
||||
*/
|
||||
/* FIXME: Source route IP option packets --RR */
|
||||
if (ip_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING &&
|
||||
|
@@ -117,8 +117,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
|
||||
|
||||
/* Checksum invalid? Ignore.
|
||||
* We skip checking packets on the outgoing path
|
||||
* because the semantic of CHECKSUM_HW is different there
|
||||
* and moreover root might send raw packets.
|
||||
* because the checksum is assumed to be correct.
|
||||
* FIXME: Source route IP option packets --RR */
|
||||
if (ip_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING &&
|
||||
nf_ip_checksum(skb, hooknum, iph->ihl * 4, IPPROTO_UDP)) {
|
||||
|
@@ -111,8 +111,9 @@ ip_nat_fn(unsigned int hooknum,
|
||||
& htons(IP_MF|IP_OFFSET)));
|
||||
|
||||
/* If we had a hardware checksum before, it's now invalid */
|
||||
if ((*pskb)->ip_summed == CHECKSUM_HW)
|
||||
if (skb_checksum_help(*pskb, (out == NULL)))
|
||||
if ((*pskb)->ip_summed == CHECKSUM_PARTIAL ||
|
||||
(*pskb)->ip_summed == CHECKSUM_COMPLETE)
|
||||
if (skb_checksum_help(*pskb))
|
||||
return NF_DROP;
|
||||
|
||||
ct = ip_conntrack_get(*pskb, &ctinfo);
|
||||
|
@@ -208,9 +208,9 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
|
||||
break;
|
||||
|
||||
case IPQ_COPY_PACKET:
|
||||
if (entry->skb->ip_summed == CHECKSUM_HW &&
|
||||
(*errp = skb_checksum_help(entry->skb,
|
||||
entry->info->outdev == NULL))) {
|
||||
if ((entry->skb->ip_summed == CHECKSUM_PARTIAL ||
|
||||
entry->skb->ip_summed == CHECKSUM_COMPLETE) &&
|
||||
(*errp = skb_checksum_help(entry->skb))) {
|
||||
read_unlock_bh(&queue_lock);
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
|
||||
|
||||
/* Return 0 if there was an error. */
|
||||
static inline int
|
||||
set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo, int inward)
|
||||
set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
|
||||
{
|
||||
struct tcphdr _tcph, *tcph;
|
||||
u_int16_t diffs[2];
|
||||
@@ -70,8 +70,9 @@ set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo, int inward)
|
||||
return 0;
|
||||
tcph = (void *)(*pskb)->nh.iph + (*pskb)->nh.iph->ihl*4;
|
||||
|
||||
if ((*pskb)->ip_summed == CHECKSUM_HW &&
|
||||
skb_checksum_help(*pskb, inward))
|
||||
if (((*pskb)->ip_summed == CHECKSUM_PARTIAL ||
|
||||
(*pskb)->ip_summed == CHECKSUM_COMPLETE) &&
|
||||
skb_checksum_help(*pskb))
|
||||
return 0;
|
||||
|
||||
diffs[0] = ((u_int16_t *)tcph)[6];
|
||||
@@ -106,7 +107,7 @@ target(struct sk_buff **pskb,
|
||||
|
||||
if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR)
|
||||
&& (*pskb)->nh.iph->protocol == IPPROTO_TCP)
|
||||
if (!set_ect_tcp(pskb, einfo, (out == NULL)))
|
||||
if (!set_ect_tcp(pskb, einfo))
|
||||
return NF_DROP;
|
||||
|
||||
return IPT_CONTINUE;
|
||||
|
@@ -62,8 +62,9 @@ ipt_tcpmss_target(struct sk_buff **pskb,
|
||||
if (!skb_make_writable(pskb, (*pskb)->len))
|
||||
return NF_DROP;
|
||||
|
||||
if ((*pskb)->ip_summed == CHECKSUM_HW &&
|
||||
skb_checksum_help(*pskb, out == NULL))
|
||||
if (((*pskb)->ip_summed == CHECKSUM_PARTIAL ||
|
||||
(*pskb)->ip_summed == CHECKSUM_COMPLETE) &&
|
||||
skb_checksum_help(*pskb))
|
||||
return NF_DROP;
|
||||
|
||||
iph = (*pskb)->nh.iph;
|
||||
|
Reference in New Issue
Block a user