]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
vxlan: In vxlan_rcv(), access flags through the vxlan netdevice
authorPetr Machata <petrm@nvidia.com>
Thu, 5 Dec 2024 15:40:50 +0000 (16:40 +0100)
committerJakub Kicinski <kuba@kernel.org>
Mon, 9 Dec 2024 22:47:02 +0000 (14:47 -0800)
vxlan_sock.flags is constructed from vxlan_dev.cfg.flags, as the subset of
flags (named VXLAN_F_RCV_FLAGS) that is important from the point of view of
socket sharing. Attempts to reconfigure these flags during the vxlan netdev
lifetime are also bounced. It is therefore immaterial whether we access the
flags through the vxlan_dev or through the socket.

Convert the socket accesses to netdevice accesses in this separate patch to
make the conversions that take place in the following patches more obvious.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://patch.msgid.link/5d237ffd731055e524d7b7c436de43358d8743d2.1733412063.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/vxlan/vxlan_core.c

index b46a799bd3904c4183775cb2e86172a0b127bb4f..1ac2dcdd493efe956ed39cee99e09f3f66b35f44 100644 (file)
@@ -1717,7 +1717,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
        /* For backwards compatibility, only allow reserved fields to be
         * used by VXLAN extensions if explicitly requested.
         */
-       if (vs->flags & VXLAN_F_GPE) {
+       if (vxlan->cfg.flags & VXLAN_F_GPE) {
                if (!vxlan_parse_gpe_proto(&unparsed, &protocol))
                        goto drop;
                unparsed.vx_flags &= ~VXLAN_GPE_USED_BITS;
@@ -1730,8 +1730,8 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
                goto drop;
        }
 
-       if (vs->flags & VXLAN_F_REMCSUM_RX) {
-               reason = vxlan_remcsum(&unparsed, skb, vs->flags);
+       if (vxlan->cfg.flags & VXLAN_F_REMCSUM_RX) {
+               reason = vxlan_remcsum(&unparsed, skb, vxlan->cfg.flags);
                if (unlikely(reason))
                        goto drop;
        }
@@ -1756,8 +1756,8 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
                memset(md, 0, sizeof(*md));
        }
 
-       if (vs->flags & VXLAN_F_GBP)
-               vxlan_parse_gbp_hdr(&unparsed, skb, vs->flags, md);
+       if (vxlan->cfg.flags & VXLAN_F_GBP)
+               vxlan_parse_gbp_hdr(&unparsed, skb, vxlan->cfg.flags, md);
        /* Note that GBP and GPE can never be active together. This is
         * ensured in vxlan_dev_configure.
         */