diff mbox series

[ipsec-next,v2] xfrm: fix bug with DSCP copy to v6 from v4 tunnel

Message ID 20230126163350.1520752-1-chopps@chopps.org (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [ipsec-next,v2] xfrm: fix bug with DSCP copy to v6 from v4 tunnel | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 5 this patch: 5
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 1 this patch: 1
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes fail Problems with Fixes tag: 1
netdev/build_allmodconfig_warn success Errors and warnings before: 5 this patch: 5
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Christian Hopps Jan. 26, 2023, 4:33 p.m. UTC
When copying the DSCP bits for decap-dscp into IPv6 don't assume the
outer encap is always IPv6. Instead, as with the inner IPv4 case, copy
the DSCP bits from the correctly saved "tos" value in the control block.

Fixes: 227620e29509 ("[IPSEC]: Separate inner/outer mode processing on input")

Signed-off-by: Christian Hopps <chopps@chopps.org>
---
 net/xfrm/xfrm_input.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Herbert Xu Jan. 27, 2023, 10:37 a.m. UTC | #1
On Thu, Jan 26, 2023 at 11:33:50AM -0500, Christian Hopps wrote:
> When copying the DSCP bits for decap-dscp into IPv6 don't assume the
> outer encap is always IPv6. Instead, as with the inner IPv4 case, copy
> the DSCP bits from the correctly saved "tos" value in the control block.
> 
> Fixes: 227620e29509 ("[IPSEC]: Separate inner/outer mode processing on input")

Please fix this Fixes header as that commit did not introduce
this bug.

Thanks,
Christian Hopps Jan. 27, 2023, 12:22 p.m. UTC | #2
Herbert Xu <herbert@gondor.apana.org.au> writes:

> On Thu, Jan 26, 2023 at 11:33:50AM -0500, Christian Hopps wrote:
>> When copying the DSCP bits for decap-dscp into IPv6 don't assume the
>> outer encap is always IPv6. Instead, as with the inner IPv4 case, copy
>> the DSCP bits from the correctly saved "tos" value in the control block.
>>
>> Fixes: 227620e29509 ("[IPSEC]: Separate inner/outer mode processing on input")
>
> Please fix this Fixes header as that commit did not introduce
> this bug.

This was a suggested add from Eyal that I was initially hesitant to add. He justified it b/c this commit purported to add support for mixed versions and this is a bug in that new functionality. It is useful to have that tracked which is why I added it. Is there a better way to track that?

Thanks,
Chris.
Herbert Xu Jan. 28, 2023, 1:42 a.m. UTC | #3
On Thu, Jan 26, 2023 at 11:33:50AM -0500, Christian Hopps wrote:
> When copying the DSCP bits for decap-dscp into IPv6 don't assume the
> outer encap is always IPv6. Instead, as with the inner IPv4 case, copy
> the DSCP bits from the correctly saved "tos" value in the control block.
> 
> Fixes: 227620e29509 ("[IPSEC]: Separate inner/outer mode processing on input")
> 
> Signed-off-by: Christian Hopps <chopps@chopps.org>
> ---
>  net/xfrm/xfrm_input.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Steffen Klassert Feb. 1, 2023, 8:21 a.m. UTC | #4
On Sat, Jan 28, 2023 at 09:42:26AM +0800, Herbert Xu wrote:
> On Thu, Jan 26, 2023 at 11:33:50AM -0500, Christian Hopps wrote:
> > When copying the DSCP bits for decap-dscp into IPv6 don't assume the
> > outer encap is always IPv6. Instead, as with the inner IPv4 case, copy
> > the DSCP bits from the correctly saved "tos" value in the control block.
> > 
> > Fixes: 227620e29509 ("[IPSEC]: Separate inner/outer mode processing on input")
> > 
> > Signed-off-by: Christian Hopps <chopps@chopps.org>
> > ---
> >  net/xfrm/xfrm_input.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

I've applied the version with the 'Fixes' tag to the
ipsec tree, thanks everyone!
diff mbox series

Patch

diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index c06e54a10540..436d29640ac2 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -279,8 +279,7 @@  static int xfrm6_remove_tunnel_encap(struct xfrm_state *x, struct sk_buff *skb)
 		goto out;
 
 	if (x->props.flags & XFRM_STATE_DECAP_DSCP)
-		ipv6_copy_dscp(ipv6_get_dsfield(ipv6_hdr(skb)),
-			       ipipv6_hdr(skb));
+		ipv6_copy_dscp(XFRM_MODE_SKB_CB(skb)->tos, ipipv6_hdr(skb));
 	if (!(x->props.flags & XFRM_STATE_NOECN))
 		ipip6_ecn_decapsulate(skb);