xfrm: choose protocol family by skb protocol
[firefly-linux-kernel-4.4.55.git] / include / net / xfrm.h
index b41d2d10ff0e2088b14ba3513b5483bb3df6786c..ac5b02515355eb172b01c378eece62012e008b93 100644 (file)
@@ -1728,9 +1728,9 @@ static inline int xfrm_skb_dst_mtu(struct sk_buff *skb)
 {
        struct sock *sk = skb->sk;
 
-       if (sk && sk->sk_family == AF_INET6)
+       if (sk && skb->protocol == htons(ETH_P_IPV6))
                return ip6_skb_dst_mtu(skb);
-       else if (sk && sk->sk_family == AF_INET)
+       else if (sk && skb->protocol == htons(ETH_P_IP))
                return ip_skb_dst_mtu(skb);
        return dst_mtu(skb_dst(skb));
 }