dccp: do not use ipv6 header for ipv4 flow [Linux 3.16.72]

This Linux kernel change "dccp: do not use ipv6 header for ipv4 flow" is included in the Linux 3.16.72 release. This change is authored by Eric Dumazet <edumazet [at] google.com> on Tue Mar 19 05:46:18 2019 -0700. The commit for this change in Linux stable tree is a9bf207 (patch) which is from upstream commit e0aa677. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream e0aa677.

dccp: do not use ipv6 header for ipv4 flow

commit e0aa67709f89d08c8d8e5bdd9e0b649df61d0090 upstream.

When a dual stack dccp listener accepts an ipv4 flow,
it should not attempt to use an ipv6 header or
inet6_iif() helper.

Fixes: 3df80d9320bc ("[DCCP]: Introduce DCCPv6")
Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Ben Hutchings <[email protected]>

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/dccp/ipv6.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 30455bf..c3ed865 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -491,8 +491,8 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
        newnp->ipv6_mc_list = NULL;
        newnp->ipv6_ac_list = NULL;
        newnp->ipv6_fl_list = NULL;
-       newnp->mcast_oif   = inet6_iif(skb);
-       newnp->mcast_hops  = ipv6_hdr(skb)->hop_limit;
+       newnp->mcast_oif   = inet_iif(skb);
+       newnp->mcast_hops  = ip_hdr(skb)->ttl;

        /*
         * No need to charge this sock to the relevant IPv6 refcnt debug socks count

Leave a Reply

Your email address will not be published. Required fields are marked *