--- zzzz-none-000/linux-4.4.271/net/ipv6/ip6_gre.c 2021-06-03 06:22:09.000000000 +0000 +++ hawkeye-5590-750/linux-4.4.271/net/ipv6/ip6_gre.c 2023-04-19 10:22:30.000000000 +0000 @@ -57,7 +57,6 @@ #include #include - static bool log_ecn_error = true; module_param(log_ecn_error, bool, 0644); MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN"); @@ -370,7 +369,6 @@ dev_put(dev); } - static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, u8 type, u8 code, int offset, __be32 info) { @@ -402,7 +400,7 @@ key = key_off ? *(__be32 *)(skb->data + key_off) : 0; t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr, - key, greh->protocol); + key, greh->protocol); if (!t) return; @@ -486,11 +484,11 @@ offset += 4; } if (flags&GRE_KEY) { - key = *(__be32 *)(h + offset); + key = net_hdr_word(h + offset); offset += 4; } if (flags&GRE_SEQ) { - seqno = ntohl(*(__be32 *)(h + offset)); + seqno = ntohl(net_hdr_word(h + offset)); offset += 4; } } @@ -752,7 +750,7 @@ if (tunnel->parms.o_flags&GRE_SEQ) { ++tunnel->o_seqno; - *ptr = htonl(tunnel->o_seqno); + net_hdr_word(ptr) = htonl(tunnel->o_seqno); ptr--; } if (tunnel->parms.o_flags&GRE_KEY) { @@ -767,7 +765,7 @@ } skb_set_inner_protocol(skb, protocol); - + skb->skb_iif = dev->ifindex; ip6tunnel_xmit(NULL, skb, dev); return 0; tx_err_link_failure: @@ -804,6 +802,8 @@ if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK) fl6.flowi6_mark = skb->mark; + fl6.flowi6_uid = sock_net_uid(dev_net(dev), NULL); + err = ip6gre_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu); if (err != 0) { /* XXX: send ICMP error even if DF is not set. */ @@ -848,12 +848,14 @@ dsfield = ipv6_get_dsfield(ipv6h); if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS) - fl6.flowlabel |= (*(__be32 *) ipv6h & IPV6_TCLASS_MASK); + fl6.flowlabel |= net_hdr_word(ipv6h) & IPV6_TCLASS_MASK; if (t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL) fl6.flowlabel |= ip6_flowlabel(ipv6h); if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK) fl6.flowi6_mark = skb->mark; + fl6.flowi6_uid = sock_net_uid(dev_net(dev), NULL); + err = ip6gre_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu); if (err != 0) { if (err == -EMSGSIZE) @@ -1311,7 +1313,6 @@ tunnel->hlen = sizeof(struct ipv6hdr) + 4; } - static struct inet6_protocol ip6gre_protocol __read_mostly = { .handler = ip6gre_rcv, .err_handler = ip6gre_err, @@ -1368,7 +1369,6 @@ */ ign->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL; - ip6gre_fb_tunnel_init(ign->fb_tunnel_dev); ign->fb_tunnel_dev->rtnl_link_ops = &ip6gre_link_ops; @@ -1445,7 +1445,6 @@ return ip6gre_tunnel_validate(tb, data); } - static void ip6gre_netlink_parms(struct nlattr *data[], struct __ip6_tnl_parm *parms) { @@ -1522,7 +1521,7 @@ dev->netdev_ops = &ip6gre_tap_netdev_ops; dev->destructor = ip6gre_dev_free; - + dev->priv_flags_ext |= IFF_EXT_GRE_V6_TAP; dev->features |= NETIF_F_NETNS_LOCAL; }