All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org,
	"Linus Lüssing" <linus.luessing@c0d3.blue>
Cc: Nikolay Aleksandrov <nikolay@nvidia.com>,
	Marek Lindner <mareklindner@neomailbox.ch>,
	Antonio Quartulli <a@unstable.cc>
Subject: Re: [PATCH] net: bridge: mcast: rename br_ip's u member to dst
Date: Mon, 28 Sep 2020 08:59:58 +0200	[thread overview]
Message-ID: <1665109.RXYjxSXZkc@ripper> (raw)
In-Reply-To: <20200927191234.22423-1-linus.luessing@c0d3.blue>

[-- Attachment #1: Type: text/plain, Size: 2103 bytes --]

[...]
> +#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_IF_BRIDGE_H_
> +#define _NET_BATMAN_ADV_COMPAT_LINUX_IF_BRIDGE_H_
> +
> +#include <linux/version.h>
> +#include_next <linux/if_bridge.h>
> +
> +#if LINUX_VERSION_IS_LESS(5, 10, 0)
> +
> +struct batadv_br_ip {
> +	union {
> +		__be32  ip4;
> +#if IS_ENABLED(CONFIG_IPV6)
> +		struct in6_addr ip6;
> +#endif
> +	} dst;
> +	__be16          proto;
> +	__u16           vid;
> +};
> +
> +struct batadv_br_ip_list {
> +	struct list_head list;
> +	struct batadv_br_ip addr;
> +};

Better than my version but the BUILD_BUG_ON for all used fields are missing.

diff --git a/compat-include/linux/if_bridge.h b/compat-include/linux/if_bridge.h
index c4f9bc08..9a4cceca 100644
--- a/compat-include/linux/if_bridge.h
+++ b/compat-include/linux/if_bridge.h
@@ -10,6 +10,7 @@
 #ifndef _NET_BATMAN_ADV_COMPAT_LINUX_IF_BRIDGE_H_
 #define _NET_BATMAN_ADV_COMPAT_LINUX_IF_BRIDGE_H_
 
+#include <linux/bug.h>
 #include <linux/version.h>
 #include_next <linux/if_bridge.h>
 
@@ -31,6 +32,23 @@ struct batadv_br_ip_list {
 	struct batadv_br_ip addr;
 };
 
+/* "static" dropped to force compiler to evaluate it as part of multicast.c
+ * might need to be added again and then called in some kind of dummy
+ * compat.c in case this header is included in multiple files.
+ */
+inline void __batadv_ip_list_check(void)
+{
+	BUILD_BUG_ON(sizeof(struct batadv_br_ip_list) != sizeof(struct br_ip_list));
+	BUILD_BUG_ON(offsetof(struct batadv_br_ip_list, list) != offsetof(struct br_ip_list, list));
+	BUILD_BUG_ON(offsetof(struct batadv_br_ip_list, addr) != offsetof(struct br_ip_list, addr));
+
+	BUILD_BUG_ON(sizeof(struct batadv_br_ip) != sizeof(struct br_ip));
+	BUILD_BUG_ON(offsetof(struct batadv_br_ip, dst.ip4) != offsetof(struct br_ip, u.ip4));
+	BUILD_BUG_ON(offsetof(struct batadv_br_ip, dst.ip6) != offsetof(struct br_ip, u.ip6));
+	BUILD_BUG_ON(offsetof(struct batadv_br_ip, proto) != offsetof(struct br_ip, proto));
+	BUILD_BUG_ON(offsetof(struct batadv_br_ip, vid) != offsetof(struct br_ip, vid));
+}
+
 #define br_ip batadv_br_ip
 #define br_ip_list batadv_br_ip_list
 


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2020-09-28  6:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27 19:12 [PATCH] net: bridge: mcast: rename br_ip's u member to dst Linus Lüssing
2020-09-28  6:59 ` Sven Eckelmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1665109.RXYjxSXZkc@ripper \
    --to=sven@narfation.org \
    --cc=a@unstable.cc \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=linus.luessing@c0d3.blue \
    --cc=mareklindner@neomailbox.ch \
    --cc=nikolay@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.