]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/ipv4/ip_gre.c
Merge tag '5.6-rc-small-smb3-fix-for-stable' of git://git.samba.org/sfrench/cifs-2.6
[linux.git] / net / ipv4 / ip_gre.c
index 10636fb6093e3cba09cfe6835077edb664e7244d..8274f98c511cc0ca0cfe721f46941680aa9c7378 100644 (file)
@@ -340,6 +340,8 @@ static int __ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
                                  iph->saddr, iph->daddr, tpi->key);
 
        if (tunnel) {
+               const struct iphdr *tnl_params;
+
                if (__iptunnel_pull_header(skb, hdr_len, tpi->proto,
                                           raw_proto, false) < 0)
                        goto drop;
@@ -348,7 +350,9 @@ static int __ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
                        skb_pop_mac_header(skb);
                else
                        skb_reset_mac_header(skb);
-               if (tunnel->collect_md) {
+
+               tnl_params = &tunnel->parms.iph;
+               if (tunnel->collect_md || tnl_params->daddr == 0) {
                        __be16 flags;
                        __be64 tun_id;
 
@@ -1460,8 +1464,8 @@ static const struct nla_policy ipgre_policy[IFLA_GRE_MAX + 1] = {
        [IFLA_GRE_OFLAGS]       = { .type = NLA_U16 },
        [IFLA_GRE_IKEY]         = { .type = NLA_U32 },
        [IFLA_GRE_OKEY]         = { .type = NLA_U32 },
-       [IFLA_GRE_LOCAL]        = { .len = FIELD_SIZEOF(struct iphdr, saddr) },
-       [IFLA_GRE_REMOTE]       = { .len = FIELD_SIZEOF(struct iphdr, daddr) },
+       [IFLA_GRE_LOCAL]        = { .len = sizeof_field(struct iphdr, saddr) },
+       [IFLA_GRE_REMOTE]       = { .len = sizeof_field(struct iphdr, daddr) },
        [IFLA_GRE_TTL]          = { .type = NLA_U8 },
        [IFLA_GRE_TOS]          = { .type = NLA_U8 },
        [IFLA_GRE_PMTUDISC]     = { .type = NLA_U8 },