All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: dccp: Checksum verification considering skb->ip_summed
@ 2019-02-19 13:59 Markus.Amend
  0 siblings, 0 replies; 5+ messages in thread
From: Markus.Amend @ 2019-02-19 13:59 UTC (permalink / raw)
  To: dccp

Modify checksum verification to allow the validation of skb->ip_summed, in case the checksum has already been verified by another process.

Signed-off-by: Nathalie Romo Moreno <natha.ro.moreno@gmail.com>
Signed-off-by: Markus Amend <markus.amend@telekom.de>
---
 net/dccp/ipv4.c | 8 +++++---
 net/dccp/ipv6.c | 4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 26a21d97b6b0..0d777888efe1 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -763,8 +763,9 @@ int dccp_invalid_packet(struct sk_buff *skb)
 	}
 
 	/* If header checksum is incorrect, drop packet and return.
-	 * (This step is completed in the AF-dependent functions.) */
-	skb->csum = skb_checksum(skb, 0, cscov, 0);
+	 * (This step is completed in the AF-dependent functions.)
+	 * skb->csum = skb_checksum(skb, 0, cscov, 0);
+	 */
 
 	return 0;
 }
@@ -786,7 +787,8 @@ static int dccp_v4_rcv(struct sk_buff *skb)
 
 	iph = ip_hdr(skb);
 	/* Step 1: If header checksum is incorrect, drop packet and return */
-	if (dccp_v4_csum_finish(skb, iph->saddr, iph->daddr)) {
+	if (__skb_checksum_validate(skb, IPPROTO_DCCP,
+		  true, false, 0, inet_compute_pseudo)) {
 		DCCP_WARN("dropped packet with invalid checksum\n");
 		goto discard_it;
 	}
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index d5740bad5b18..7cb7c9f3e5e1 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -695,8 +695,8 @@ static int dccp_v6_rcv(struct sk_buff *skb)
 		goto discard_it;
 
 	/* Step 1: If header checksum is incorrect, drop packet and return. */
-	if (dccp_v6_csum_finish(skb, &ipv6_hdr(skb)->saddr,
-				     &ipv6_hdr(skb)->daddr)) {
+	if (__skb_checksum_validate(skb, IPPROTO_DCCP,
+		true, false, 0, ip6_compute_pseudo)) {
 		DCCP_WARN("dropped packet with invalid checksum\n");
 		goto discard_it;
 	}
--
2.20.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] net: dccp: Checksum verification considering skb->ip_summed
  2019-02-19 13:59 Markus.Amend
@ 2019-03-22 14:34 ` Markus.Amend
  -1 siblings, 0 replies; 5+ messages in thread
From: Markus.Amend @ 2019-03-22 14:34 UTC (permalink / raw)
  To: gerrit; +Cc: linux-kernel, netdev, dccp

Modify checksum verification to allow the validation of skb->ip_summed, in case the checksum has already been verified by another process.

Signed-off-by: Nathalie Romo Moreno <natha.ro.moreno@gmail.com>
Signed-off-by: Markus Amend <markus.amend@telekom.de>
---
 net/dccp/ipv4.c | 8 +++++---
 net/dccp/ipv6.c | 4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 26a21d97b6b0..0d777888efe1 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -763,8 +763,9 @@ int dccp_invalid_packet(struct sk_buff *skb)
 	}
 
 	/* If header checksum is incorrect, drop packet and return.
-	 * (This step is completed in the AF-dependent functions.) */
-	skb->csum = skb_checksum(skb, 0, cscov, 0);
+	 * (This step is completed in the AF-dependent functions.)
+	 * skb->csum = skb_checksum(skb, 0, cscov, 0);
+	 */
 
 	return 0;
 }
@@ -786,7 +787,8 @@ static int dccp_v4_rcv(struct sk_buff *skb)
 
 	iph = ip_hdr(skb);
 	/* Step 1: If header checksum is incorrect, drop packet and return */
-	if (dccp_v4_csum_finish(skb, iph->saddr, iph->daddr)) {
+	if (__skb_checksum_validate(skb, IPPROTO_DCCP,
+		  true, false, 0, inet_compute_pseudo)) {
 		DCCP_WARN("dropped packet with invalid checksum\n");
 		goto discard_it;
 	}
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index d5740bad5b18..7cb7c9f3e5e1 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -695,8 +695,8 @@ static int dccp_v6_rcv(struct sk_buff *skb)
 		goto discard_it;
 
 	/* Step 1: If header checksum is incorrect, drop packet and return. */
-	if (dccp_v6_csum_finish(skb, &ipv6_hdr(skb)->saddr,
-				     &ipv6_hdr(skb)->daddr)) {
+	if (__skb_checksum_validate(skb, IPPROTO_DCCP,
+		true, false, 0, ip6_compute_pseudo)) {
 		DCCP_WARN("dropped packet with invalid checksum\n");
 		goto discard_it;
 	}
--

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] net: dccp: Checksum verification considering skb->ip_summed
@ 2019-03-22 14:34 ` Markus.Amend
  0 siblings, 0 replies; 5+ messages in thread
From: Markus.Amend @ 2019-03-22 14:34 UTC (permalink / raw)
  To: dccp

Modify checksum verification to allow the validation of skb->ip_summed, in case the checksum has already been verified by another process.

Signed-off-by: Nathalie Romo Moreno <natha.ro.moreno@gmail.com>
Signed-off-by: Markus Amend <markus.amend@telekom.de>
---
 net/dccp/ipv4.c | 8 +++++---
 net/dccp/ipv6.c | 4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 26a21d97b6b0..0d777888efe1 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -763,8 +763,9 @@ int dccp_invalid_packet(struct sk_buff *skb)
 	}
 
 	/* If header checksum is incorrect, drop packet and return.
-	 * (This step is completed in the AF-dependent functions.) */
-	skb->csum = skb_checksum(skb, 0, cscov, 0);
+	 * (This step is completed in the AF-dependent functions.)
+	 * skb->csum = skb_checksum(skb, 0, cscov, 0);
+	 */
 
 	return 0;
 }
@@ -786,7 +787,8 @@ static int dccp_v4_rcv(struct sk_buff *skb)
 
 	iph = ip_hdr(skb);
 	/* Step 1: If header checksum is incorrect, drop packet and return */
-	if (dccp_v4_csum_finish(skb, iph->saddr, iph->daddr)) {
+	if (__skb_checksum_validate(skb, IPPROTO_DCCP,
+		  true, false, 0, inet_compute_pseudo)) {
 		DCCP_WARN("dropped packet with invalid checksum\n");
 		goto discard_it;
 	}
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index d5740bad5b18..7cb7c9f3e5e1 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -695,8 +695,8 @@ static int dccp_v6_rcv(struct sk_buff *skb)
 		goto discard_it;
 
 	/* Step 1: If header checksum is incorrect, drop packet and return. */
-	if (dccp_v6_csum_finish(skb, &ipv6_hdr(skb)->saddr,
-				     &ipv6_hdr(skb)->daddr)) {
+	if (__skb_checksum_validate(skb, IPPROTO_DCCP,
+		true, false, 0, ip6_compute_pseudo)) {
 		DCCP_WARN("dropped packet with invalid checksum\n");
 		goto discard_it;
 	}
--

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: dccp: Checksum verification considering skb->ip_summed
  2019-02-19 13:59 Markus.Amend
@ 2019-03-25  0:13   ` David Miller
  -1 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-03-25  0:13 UTC (permalink / raw)
  To: Markus.Amend; +Cc: gerrit, linux-kernel, netdev, dccp

From: <Markus.Amend@telekom.de>
Date: Fri, 22 Mar 2019 14:34:58 +0000

> @@ -786,7 +787,8 @@ static int dccp_v4_rcv(struct sk_buff *skb)
>  
>  	iph = ip_hdr(skb);
>  	/* Step 1: If header checksum is incorrect, drop packet and return */
> -	if (dccp_v4_csum_finish(skb, iph->saddr, iph->daddr)) {
> +	if (__skb_checksum_validate(skb, IPPROTO_DCCP,
> +		  true, false, 0, inet_compute_pseudo)) {

The arguments on the second and subsequent lines of a function call must
begin precisely at the first column after the openning parenthesis of
the first line of the function call.

You must use the appropriate number of TAB, then SPACE, characters
necessary to achieve this.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: dccp: Checksum verification considering skb->ip_summed
@ 2019-03-25  0:13   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-03-25  0:13 UTC (permalink / raw)
  To: dccp

From: <Markus.Amend@telekom.de>
Date: Fri, 22 Mar 2019 14:34:58 +0000

> @@ -786,7 +787,8 @@ static int dccp_v4_rcv(struct sk_buff *skb)
>  
>  	iph = ip_hdr(skb);
>  	/* Step 1: If header checksum is incorrect, drop packet and return */
> -	if (dccp_v4_csum_finish(skb, iph->saddr, iph->daddr)) {
> +	if (__skb_checksum_validate(skb, IPPROTO_DCCP,
> +		  true, false, 0, inet_compute_pseudo)) {

The arguments on the second and subsequent lines of a function call must
begin precisely at the first column after the openning parenthesis of
the first line of the function call.

You must use the appropriate number of TAB, then SPACE, characters
necessary to achieve this.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-25  0:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 14:34 [PATCH] net: dccp: Checksum verification considering skb->ip_summed Markus.Amend
2019-03-22 14:34 ` Markus.Amend
2019-03-25  0:13 ` David Miller
2019-03-25  0:13   ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2019-02-19 13:59 Markus.Amend

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.