From: Simon Wunderlich <sw@simonwunderlich.de>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Simon Horman" <horms@kernel.org>,
b.a.t.m.a.n@lists.open-mesh.org,
"Linus Lüssing" <linus.luessing@c0d3.blue>,
"Sven Eckelmann" <sven@narfation.org>,
"Simon Wunderlich" <sw@simonwunderlich.de>
Subject: [PATCH net-next 03/15] batman-adv: uapi: add note/clarification on access of reserved bytes/bits
Date: Wed, 11 Nov 2026 11:27:17 +0100 [thread overview]
Message-ID: <20261111102729.2096241-4-sw@simonwunderlich.de> (raw)
In-Reply-To: <20261111102729.2096241-1-sw@simonwunderlich.de>
From: Linus Lüssing <linus.luessing@c0d3.blue>
Similar to the note in include/uapi/linux/ethtool.h, add a note regarding
reserved fields to include/uapi/linux/batadv_packet.h.
Userspace must not access these fields directly, as they may be renamed or
repurposed in the future. When creating packets, userspace should zero the
whole struct (e.g. via memset or a struct initializer). When parsing
packets, reserved fields must be ignored.
While at it, unify the kernel-doc text of all @reserved members.
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Acked-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
include/uapi/linux/batadv_packet.h | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/include/uapi/linux/batadv_packet.h b/include/uapi/linux/batadv_packet.h
index 32436560ecc8b..67e2bad7407b6 100644
--- a/include/uapi/linux/batadv_packet.h
+++ b/include/uapi/linux/batadv_packet.h
@@ -12,6 +12,14 @@
#include <linux/stddef.h>
#include <linux/types.h>
+/* Note on reserved space.
+ * Reserved fields must not be accessed directly by user space because
+ * they may be replaced by a different field in the future. They must
+ * be initialized to zero before making the request, e.g. via memset
+ * of the entire structure or implicitly by not being set in a structure
+ * initializer.
+ */
+
/**
* batadv_tp_is_error() - Check throughput meter return code for error
* @n: throughput meter return code
@@ -216,7 +224,7 @@ struct batadv_bla_claim_dst {
* @seqno: sequence identification
* @orig: address of the source node
* @prev_sender: address of the previous sender
- * @reserved: reserved byte for alignment
+ * @reserved: reserved for alignment; also see note on reserved space
* @tq: transmission quality
* @tvlv_len: length of tvlv data following the ogm header
*/
@@ -312,7 +320,7 @@ struct batadv_icmp_header {
* @dst: address of the destination node
* @orig: address of the source node
* @uid: local ICMP socket identifier
- * @reserved: not used - useful for alignment
+ * @reserved: reserved for alignment; also see note on reserved space
* @seqno: ICMP sequence number
*/
struct batadv_icmp_packet {
@@ -433,7 +441,7 @@ struct batadv_unicast_packet {
* @u: common unicast packet header
* @src: address of the source
* @subtype: packet subtype
- * @reserved: reserved byte for alignment
+ * @reserved: reserved for alignment; also see note on reserved space
*/
struct batadv_unicast_4addr_packet {
struct batadv_unicast_packet u;
@@ -454,7 +462,7 @@ struct batadv_unicast_4addr_packet {
* @orig: originator of the fragment used when merging the packet
* @no: fragment number within this sequence
* @priority: priority of frame, from ToS IP precedence or 802.1p
- * @reserved: reserved byte for alignment
+ * @reserved: reserved for alignment; also see note on reserved space
* @seqno: sequence identification
* @total_size: size of the merged packet
*/
@@ -484,7 +492,7 @@ struct batadv_frag_packet {
* @packet_type: batman-adv packet type, part of the general header
* @version: batman-adv protocol version, part of the general header
* @ttl: time to live for this packet, part of the general header
- * @reserved: reserved byte for alignment
+ * @reserved: reserved for alignment; also see note on reserved space
* @seqno: sequence identification
* @orig: originator of the broadcast packet
*/
@@ -505,7 +513,7 @@ struct batadv_bcast_packet {
* @packet_type: batman-adv packet type, part of the general header
* @version: batman-adv protocol version, part of the general header
* @ttl: time to live for this packet, part of the general header
- * @reserved: reserved byte for alignment
+ * @reserved: reserved for alignment; also see note on reserved space
* @tvlv_len: length of the appended tvlv buffer (in bytes)
*/
struct batadv_mcast_packet {
@@ -559,7 +567,7 @@ struct batadv_coded_packet {
* @packet_type: batman-adv packet type, part of the general header
* @version: batman-adv protocol version, part of the general header
* @ttl: time to live for this packet, part of the general header
- * @reserved: reserved field (for packet alignment)
+ * @reserved: reserved for alignment; also see note on reserved space
* @dst: address of the destination
* @src: address of the source
* @tvlv_len: length of tvlv data following the unicast tvlv header
@@ -604,7 +612,7 @@ struct batadv_tvlv_gateway_data {
* the tt tvlv container
* @crc: crc32 checksum of the entries belonging to this vlan
* @vid: vlan identifier
- * @reserved: unused, useful for alignment purposes
+ * @reserved: reserved for alignment; also see note on reserved space
*/
struct batadv_tvlv_tt_vlan_data {
__be32 crc;
@@ -631,7 +639,7 @@ struct batadv_tvlv_tt_data {
* struct batadv_tvlv_tt_change - translation table diff data
* @flags: status indicators concerning the non-mesh client (see
* batadv_tt_client_flags)
- * @reserved: reserved field - useful for alignment purposes only
+ * @reserved: reserved for alignment; also see note on reserved space
* @addr: mac address of non-mesh client that triggered this tt change
* @vid: VLAN identifier
*/
@@ -655,7 +663,7 @@ struct batadv_tvlv_roam_adv {
/**
* struct batadv_tvlv_mcast_data - payload of a multicast tvlv
* @flags: multicast flags announced by the orig node
- * @reserved: reserved field
+ * @reserved: reserved for alignment; also see note on reserved space
*/
struct batadv_tvlv_mcast_data {
__u8 flags;
--
2.47.3
next prev parent reply other threads:[~2026-11-11 10:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 10:27 [PATCH net-next 00/15] pull request for net-next: batman-adv 2026-11-11 Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 01/15] batman-adv: mcast: explicitly initialize mcast.num_want_all_rtr{4,6) Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 02/15] batman-adv: mcast: explicitly initialize mcast.want_all_rtr{4,6}_list Simon Wunderlich
2026-11-11 10:27 ` Simon Wunderlich [this message]
2026-11-11 10:27 ` [PATCH net-next 04/15] batman-adv: avoid torn u64 counter reads on 32-bit systems Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 05/15] batman-adv: bat_v: initialize last_unicast_tx on neighbor creation Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 06/15] batman-adv: dat: annotate last_update with READ/WRITE_ONCE Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 07/15] batman-adv: bla: avoid negative reported BATADV_ATTR_LAST_SEEN_MSECS Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 08/15] batman-adv: tt: annotate last_seen with READ/WRITE_ONCE Simon Wunderlich
[not found] ` <sashiko-outbox-210958@kernel.org>
2026-11-12 10:57 ` Sven Eckelmann
2026-11-11 10:27 ` [PATCH net-next 09/15] batman-adv: annotate originator " Simon Wunderlich
[not found] ` <sashiko-outbox-210959@kernel.org>
2026-11-12 10:57 ` Sven Eckelmann
2026-11-11 10:27 ` [PATCH net-next 10/15] batman-adv: annotate neigh_node " Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 11/15] batman-adv: annotate hardif_neigh_node " Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 12/15] batman-adv: use matching return types for bool and void functions Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 13/15] batman-adv: mark read-only MAC address parameters as const Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 14/15] batman-adv: use bool for boolean flags Simon Wunderlich
2026-11-11 10:27 ` [PATCH net-next 15/15] batman-adv: mcast: document the value stored in is_routable Simon Wunderlich
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=20261111102729.2096241-4-sw@simonwunderlich.de \
--to=sw@simonwunderlich.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linus.luessing@c0d3.blue \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sven@narfation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox