aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-04-09 14:59:39 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:28:43 -0400
commit604763722c655c7e3f31ecf6f7b4dafcd26a7a15 (patch)
treea5c07f0e22ac86e7ca7a8c80bd3f111116610edd /net/ipv4
parent628592ccdbbb5bb751217cf02e2e7abb500d7ffe (diff)
[NET]: Treat CHECKSUM_PARTIAL as CHECKSUM_UNNECESSARY
When a transmitted packet is looped back directly, CHECKSUM_PARTIAL maps to the semantics of CHECKSUM_UNNECESSARY. Therefore we should treat it as such in the stack. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/ipvs/ip_vs_core.c6
-rw-r--r--net/ipv4/tcp_input.c6
-rw-r--r--net/ipv4/tcp_ipv4.c3
-rw-r--r--net/ipv4/udp.c4
4 files changed, 8 insertions, 11 deletions
diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c
index 62cfbed317bf..f005a2f929f4 100644
--- a/net/ipv4/ipvs/ip_vs_core.c
+++ b/net/ipv4/ipvs/ip_vs_core.c
@@ -681,8 +681,7 @@ static int ip_vs_out_icmp(struct sk_buff **pskb, int *related)
681 } 681 }
682 682
683 /* Ensure the checksum is correct */ 683 /* Ensure the checksum is correct */
684 if (skb->ip_summed != CHECKSUM_UNNECESSARY && 684 if (!skb_csum_unnecessary(skb) && ip_vs_checksum_complete(skb, ihl)) {
685 ip_vs_checksum_complete(skb, ihl)) {
686 /* Failed checksum! */ 685 /* Failed checksum! */
687 IP_VS_DBG(1, "Forward ICMP: failed checksum from %d.%d.%d.%d!\n", 686 IP_VS_DBG(1, "Forward ICMP: failed checksum from %d.%d.%d.%d!\n",
688 NIPQUAD(iph->saddr)); 687 NIPQUAD(iph->saddr));
@@ -921,8 +920,7 @@ ip_vs_in_icmp(struct sk_buff **pskb, int *related, unsigned int hooknum)
921 verdict = NF_DROP; 920 verdict = NF_DROP;
922 921
923 /* Ensure the checksum is correct */ 922 /* Ensure the checksum is correct */
924 if (skb->ip_summed != CHECKSUM_UNNECESSARY && 923 if (!skb_csum_unnecessary(skb) && ip_vs_checksum_complete(skb, ihl)) {
925 ip_vs_checksum_complete(skb, ihl)) {
926 /* Failed checksum! */ 924 /* Failed checksum! */
927 IP_VS_DBG(1, "Incoming ICMP: failed checksum from %d.%d.%d.%d!\n", 925 IP_VS_DBG(1, "Incoming ICMP: failed checksum from %d.%d.%d.%d!\n",
928 NIPQUAD(iph->saddr)); 926 NIPQUAD(iph->saddr));
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 9c3b4c7a50ad..d1604f59d77e 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4009,7 +4009,7 @@ static int tcp_copy_to_iovec(struct sock *sk, struct sk_buff *skb, int hlen)
4009 int err; 4009 int err;
4010 4010
4011 local_bh_enable(); 4011 local_bh_enable();
4012 if (skb->ip_summed==CHECKSUM_UNNECESSARY) 4012 if (skb_csum_unnecessary(skb))
4013 err = skb_copy_datagram_iovec(skb, hlen, tp->ucopy.iov, chunk); 4013 err = skb_copy_datagram_iovec(skb, hlen, tp->ucopy.iov, chunk);
4014 else 4014 else
4015 err = skb_copy_and_csum_datagram_iovec(skb, hlen, 4015 err = skb_copy_and_csum_datagram_iovec(skb, hlen,
@@ -4041,7 +4041,7 @@ static __sum16 __tcp_checksum_complete_user(struct sock *sk, struct sk_buff *skb
4041 4041
4042static inline int tcp_checksum_complete_user(struct sock *sk, struct sk_buff *skb) 4042static inline int tcp_checksum_complete_user(struct sock *sk, struct sk_buff *skb)
4043{ 4043{
4044 return skb->ip_summed != CHECKSUM_UNNECESSARY && 4044 return !skb_csum_unnecessary(skb) &&
4045 __tcp_checksum_complete_user(sk, skb); 4045 __tcp_checksum_complete_user(sk, skb);
4046} 4046}
4047 4047
@@ -4059,7 +4059,7 @@ static int tcp_dma_try_early_copy(struct sock *sk, struct sk_buff *skb, int hlen
4059 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) 4059 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
4060 tp->ucopy.dma_chan = get_softnet_dma(); 4060 tp->ucopy.dma_chan = get_softnet_dma();
4061 4061
4062 if (tp->ucopy.dma_chan && skb->ip_summed == CHECKSUM_UNNECESSARY) { 4062 if (tp->ucopy.dma_chan && skb_csum_unnecessary(skb)) {
4063 4063
4064 dma_cookie = dma_skb_copy_datagram_iovec(tp->ucopy.dma_chan, 4064 dma_cookie = dma_skb_copy_datagram_iovec(tp->ucopy.dma_chan,
4065 skb, hlen, tp->ucopy.iov, chunk, tp->ucopy.pinned_list); 4065 skb, hlen, tp->ucopy.iov, chunk, tp->ucopy.pinned_list);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index a091a99ad263..5a3e7f839fc5 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1638,8 +1638,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
1638 * Packet length and doff are validated by header prediction, 1638 * Packet length and doff are validated by header prediction,
1639 * provided case of th->doff==0 is eliminated. 1639 * provided case of th->doff==0 is eliminated.
1640 * So, we defer the checks. */ 1640 * So, we defer the checks. */
1641 if ((skb->ip_summed != CHECKSUM_UNNECESSARY && 1641 if (!skb_csum_unnecessary(skb) && tcp_v4_checksum_init(skb))
1642 tcp_v4_checksum_init(skb)))
1643 goto bad_packet; 1642 goto bad_packet;
1644 1643
1645 th = tcp_hdr(skb); 1644 th = tcp_hdr(skb);
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 5ad7a26e3091..cec0f2cc49b7 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -848,7 +848,7 @@ try_again:
848 goto csum_copy_err; 848 goto csum_copy_err;
849 } 849 }
850 850
851 if (skb->ip_summed == CHECKSUM_UNNECESSARY) 851 if (skb_csum_unnecessary(skb))
852 err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), 852 err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),
853 msg->msg_iov, copied ); 853 msg->msg_iov, copied );
854 else { 854 else {
@@ -1190,7 +1190,7 @@ static inline int udp4_csum_init(struct sk_buff *skb, struct udphdr *uh,
1190 proto, skb->csum)) 1190 proto, skb->csum))
1191 skb->ip_summed = CHECKSUM_UNNECESSARY; 1191 skb->ip_summed = CHECKSUM_UNNECESSARY;
1192 } 1192 }
1193 if (skb->ip_summed != CHECKSUM_UNNECESSARY) 1193 if (!skb_csum_unnecessary(skb))
1194 skb->csum = csum_tcpudp_nofold(iph->saddr, iph->daddr, 1194 skb->csum = csum_tcpudp_nofold(iph->saddr, iph->daddr,
1195 skb->len, proto, 0); 1195 skb->len, proto, 0);
1196 /* Probably, we should checksum udp header (it should be in cache 1196 /* Probably, we should checksum udp header (it should be in cache