From patchwork Mon May 10 13:24:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18307 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 7625E81465; Mon, 10 May 2021 15:25:04 +0200 (CEST) Received: from dvalin.narfation.org (dvalin.narfation.org [213.160.73.56]) by diktynna.open-mesh.org (Postfix) with ESMTPS id C2F11807D5 for ; Mon, 10 May 2021 15:25:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1620653102; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=UZLYPzEXZ0XknsHSP7cPKepj/bny5Nj2oUpoQiOhKuE=; b=2RteIlB/6RCxO7eYFvomygLLSG3gkMBLKkvVrAqQZkOclpr+n7vJkg+Vbc/eNjUq9sVrwo O9GI5mpbn1l+7oCVAQ4Hd9xZu8U/hMyedu4NcnUPsO1iZMBDlYtNAw4ciZc4a2YvLY0HCn FQThAQKac7SvNakZP1IaxeTavqEW8Uw= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Cc: Sven Eckelmann Subject: [PATCH] batctl: Realign netlink_policy array Date: Mon, 10 May 2021 15:24:59 +0200 Message-Id: <20210510132459.43795-1-sven@narfation.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1620653102; a=rsa-sha256; cv=none; b=MxEvLTvZpKVYvtl1XGLUyufGYerkAwUUpONkA0KovBjD3CWIJqdrzRJuY72FbQTuA6AC2a 2y0sQP/TQUINyc5fmVOvZV5L6nbvbHy7LaI9yUBffO/pollnx5hmcRjimCnyDwAxaxd7r4 jGNPqtGBssFUo6p1kvnKynFiSeOY3Vs= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b="2RteIlB/"; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 213.160.73.56 as permitted sender) smtp.mailfrom=sven@narfation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1620653102; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=UZLYPzEXZ0XknsHSP7cPKepj/bny5Nj2oUpoQiOhKuE=; b=nBYlVfXc8PAQY3vjIcr3GtJ+Cf4PHc9KTgJuwJHu2AfXyPS+1LDxd9nHqiBmqP/u9tXMMt WmKth9FNrJCetO4k733PCigFfG4I+G7gtiQ+iiwkgLLu679aWsU4aPYlFV8SNnEImEMHj3 ctg2Ksdr9CgcnQqvAGjxRs6DRvP0hNs= Message-ID-Hash: EYQBFU5O7E3KKRG2YVPLRGHHN3OFIPYP X-Message-ID-Hash: EYQBFU5O7E3KKRG2YVPLRGHHN3OFIPYP X-MailFrom: sven@narfation.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: The netlink_policy contains an array of structures with several members in it. But the initialization of the entries of this array was not aligned like any other initialization in the batctl code - instead it was tried to have everything on the same same line. This resulted in rather long lines and could result in larger commits which just try to realign the whole table when a new entry with a long identifier was added. Just realign the array to better match the rest of the code. Signed-off-by: Sven Eckelmann --- netlink.c | 280 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 200 insertions(+), 80 deletions(-) diff --git a/netlink.c b/netlink.c index 31c9b01..e0e1e28 100644 --- a/netlink.c +++ b/netlink.c @@ -34,86 +34,206 @@ struct nlquery_opts { }; struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = { - [BATADV_ATTR_VERSION] = { .type = NLA_STRING }, - [BATADV_ATTR_ALGO_NAME] = { .type = NLA_STRING }, - [BATADV_ATTR_MESH_IFINDEX] = { .type = NLA_U32 }, - [BATADV_ATTR_MESH_IFNAME] = { .type = NLA_STRING, - .maxlen = IFNAMSIZ }, - [BATADV_ATTR_MESH_ADDRESS] = { .type = NLA_UNSPEC, - .minlen = ETH_ALEN, - .maxlen = ETH_ALEN }, - [BATADV_ATTR_HARD_IFINDEX] = { .type = NLA_U32 }, - [BATADV_ATTR_HARD_IFNAME] = { .type = NLA_STRING, - .maxlen = IFNAMSIZ }, - [BATADV_ATTR_HARD_ADDRESS] = { .type = NLA_UNSPEC, - .minlen = ETH_ALEN, - .maxlen = ETH_ALEN }, - [BATADV_ATTR_ORIG_ADDRESS] = { .type = NLA_UNSPEC, - .minlen = ETH_ALEN, - .maxlen = ETH_ALEN }, - [BATADV_ATTR_TPMETER_RESULT] = { .type = NLA_U8 }, - [BATADV_ATTR_TPMETER_TEST_TIME] = { .type = NLA_U32 }, - [BATADV_ATTR_TPMETER_BYTES] = { .type = NLA_U64 }, - [BATADV_ATTR_TPMETER_COOKIE] = { .type = NLA_U32 }, - [BATADV_ATTR_PAD] = { .type = NLA_UNSPEC }, - [BATADV_ATTR_ACTIVE] = { .type = NLA_FLAG }, - [BATADV_ATTR_TT_ADDRESS] = { .type = NLA_UNSPEC, - .minlen = ETH_ALEN, - .maxlen = ETH_ALEN }, - [BATADV_ATTR_TT_TTVN] = { .type = NLA_U8 }, - [BATADV_ATTR_TT_LAST_TTVN] = { .type = NLA_U8 }, - [BATADV_ATTR_TT_CRC32] = { .type = NLA_U32 }, - [BATADV_ATTR_TT_VID] = { .type = NLA_U16 }, - [BATADV_ATTR_TT_FLAGS] = { .type = NLA_U32 }, - [BATADV_ATTR_FLAG_BEST] = { .type = NLA_FLAG }, - [BATADV_ATTR_LAST_SEEN_MSECS] = { .type = NLA_U32 }, - [BATADV_ATTR_NEIGH_ADDRESS] = { .type = NLA_UNSPEC, - .minlen = ETH_ALEN, - .maxlen = ETH_ALEN }, - [BATADV_ATTR_TQ] = { .type = NLA_U8 }, - [BATADV_ATTR_THROUGHPUT] = { .type = NLA_U32 }, - [BATADV_ATTR_BANDWIDTH_UP] = { .type = NLA_U32 }, - [BATADV_ATTR_BANDWIDTH_DOWN] = { .type = NLA_U32 }, - [BATADV_ATTR_ROUTER] = { .type = NLA_UNSPEC, - .minlen = ETH_ALEN, - .maxlen = ETH_ALEN }, - [BATADV_ATTR_BLA_OWN] = { .type = NLA_FLAG }, - [BATADV_ATTR_BLA_ADDRESS] = { .type = NLA_UNSPEC, - .minlen = ETH_ALEN, - .maxlen = ETH_ALEN }, - [BATADV_ATTR_BLA_VID] = { .type = NLA_U16 }, - [BATADV_ATTR_BLA_BACKBONE] = { .type = NLA_UNSPEC, - .minlen = ETH_ALEN, - .maxlen = ETH_ALEN }, - [BATADV_ATTR_BLA_CRC] = { .type = NLA_U16 }, - [BATADV_ATTR_DAT_CACHE_IP4ADDRESS] = { .type = NLA_U32 }, - [BATADV_ATTR_DAT_CACHE_HWADDRESS] = { .type = NLA_UNSPEC, - .minlen = ETH_ALEN, - .maxlen = ETH_ALEN }, - [BATADV_ATTR_DAT_CACHE_VID] = { .type = NLA_U16 }, - [BATADV_ATTR_MCAST_FLAGS] = { .type = NLA_U32 }, - [BATADV_ATTR_MCAST_FLAGS_PRIV] = { .type = NLA_U32 }, - [BATADV_ATTR_VLANID] = { .type = NLA_U16 }, - [BATADV_ATTR_AGGREGATED_OGMS_ENABLED] = { .type = NLA_U8 }, - [BATADV_ATTR_AP_ISOLATION_ENABLED] = { .type = NLA_U8 }, - [BATADV_ATTR_ISOLATION_MARK] = { .type = NLA_U32 }, - [BATADV_ATTR_ISOLATION_MASK] = { .type = NLA_U32 }, - [BATADV_ATTR_BONDING_ENABLED] = { .type = NLA_U8 }, - [BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE_ENABLED] = { .type = NLA_U8 }, - [BATADV_ATTR_DISTRIBUTED_ARP_TABLE_ENABLED] = { .type = NLA_U8 }, - [BATADV_ATTR_FRAGMENTATION_ENABLED] = { .type = NLA_U8 }, - [BATADV_ATTR_GW_BANDWIDTH_DOWN] = { .type = NLA_U32 }, - [BATADV_ATTR_GW_BANDWIDTH_UP] = { .type = NLA_U32 }, - [BATADV_ATTR_GW_MODE] = { .type = NLA_U8 }, - [BATADV_ATTR_GW_SEL_CLASS] = { .type = NLA_U32 }, - [BATADV_ATTR_HOP_PENALTY] = { .type = NLA_U8 }, - [BATADV_ATTR_LOG_LEVEL] = { .type = NLA_U32 }, - [BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED] = { .type = NLA_U8 }, - [BATADV_ATTR_MULTICAST_FANOUT] = { .type = NLA_U32 }, - [BATADV_ATTR_NETWORK_CODING_ENABLED] = { .type = NLA_U8 }, - [BATADV_ATTR_ORIG_INTERVAL] = { .type = NLA_U32 }, - [BATADV_ATTR_ELP_INTERVAL] = { .type = NLA_U32 }, - [BATADV_ATTR_THROUGHPUT_OVERRIDE] = { .type = NLA_U32 }, + [BATADV_ATTR_VERSION] = { + .type = NLA_STRING, + }, + [BATADV_ATTR_ALGO_NAME] = { + .type = NLA_STRING, + }, + [BATADV_ATTR_MESH_IFINDEX] = { + .type = NLA_U32, + }, + [BATADV_ATTR_MESH_IFNAME] = { + .type = NLA_STRING, + .maxlen = IFNAMSIZ, + }, + [BATADV_ATTR_MESH_ADDRESS] = { + .type = NLA_UNSPEC, + .minlen = ETH_ALEN, + .maxlen = ETH_ALEN, + }, + [BATADV_ATTR_HARD_IFINDEX] = { + .type = NLA_U32, + }, + [BATADV_ATTR_HARD_IFNAME] = { + .type = NLA_STRING, + .maxlen = IFNAMSIZ, + }, + [BATADV_ATTR_HARD_ADDRESS] = { + .type = NLA_UNSPEC, + .minlen = ETH_ALEN, + .maxlen = ETH_ALEN, + }, + [BATADV_ATTR_ORIG_ADDRESS] = { + .type = NLA_UNSPEC, + .minlen = ETH_ALEN, + .maxlen = ETH_ALEN, + }, + [BATADV_ATTR_TPMETER_RESULT] = { + .type = NLA_U8, + }, + [BATADV_ATTR_TPMETER_TEST_TIME] = { + .type = NLA_U32, + }, + [BATADV_ATTR_TPMETER_BYTES] = { + .type = NLA_U64, + }, + [BATADV_ATTR_TPMETER_COOKIE] = { + .type = NLA_U32, + }, + [BATADV_ATTR_PAD] = { + .type = NLA_UNSPEC, + }, + [BATADV_ATTR_ACTIVE] = { + .type = NLA_FLAG, + }, + [BATADV_ATTR_TT_ADDRESS] = { + .type = NLA_UNSPEC, + .minlen = ETH_ALEN, + .maxlen = ETH_ALEN, + }, + [BATADV_ATTR_TT_TTVN] = { + .type = NLA_U8, + }, + [BATADV_ATTR_TT_LAST_TTVN] = { + .type = NLA_U8, + }, + [BATADV_ATTR_TT_CRC32] = { + .type = NLA_U32, + }, + [BATADV_ATTR_TT_VID] = { + .type = NLA_U16, + }, + [BATADV_ATTR_TT_FLAGS] = { + .type = NLA_U32, + }, + [BATADV_ATTR_FLAG_BEST] = { + .type = NLA_FLAG, + }, + [BATADV_ATTR_LAST_SEEN_MSECS] = { + .type = NLA_U32, + }, + [BATADV_ATTR_NEIGH_ADDRESS] = { + .type = NLA_UNSPEC, + .minlen = ETH_ALEN, + .maxlen = ETH_ALEN, + }, + [BATADV_ATTR_TQ] = { + .type = NLA_U8, + }, + [BATADV_ATTR_THROUGHPUT] = { + .type = NLA_U32, + }, + [BATADV_ATTR_BANDWIDTH_UP] = { + .type = NLA_U32, + }, + [BATADV_ATTR_BANDWIDTH_DOWN] = { + .type = NLA_U32, + }, + [BATADV_ATTR_ROUTER] = { + .type = NLA_UNSPEC, + .minlen = ETH_ALEN, + .maxlen = ETH_ALEN, + }, + [BATADV_ATTR_BLA_OWN] = { + .type = NLA_FLAG, + }, + [BATADV_ATTR_BLA_ADDRESS] = { + .type = NLA_UNSPEC, + .minlen = ETH_ALEN, + .maxlen = ETH_ALEN, + }, + [BATADV_ATTR_BLA_VID] = { + .type = NLA_U16, + }, + [BATADV_ATTR_BLA_BACKBONE] = { + .type = NLA_UNSPEC, + .minlen = ETH_ALEN, + .maxlen = ETH_ALEN, + }, + [BATADV_ATTR_BLA_CRC] = { + .type = NLA_U16, + }, + [BATADV_ATTR_DAT_CACHE_IP4ADDRESS] = { + .type = NLA_U32, + }, + [BATADV_ATTR_DAT_CACHE_HWADDRESS] = { + .type = NLA_UNSPEC, + .minlen = ETH_ALEN, + .maxlen = ETH_ALEN, + }, + [BATADV_ATTR_DAT_CACHE_VID] = { + .type = NLA_U16, + }, + [BATADV_ATTR_MCAST_FLAGS] = { + .type = NLA_U32, + }, + [BATADV_ATTR_MCAST_FLAGS_PRIV] = { + .type = NLA_U32, + }, + [BATADV_ATTR_VLANID] = { + .type = NLA_U16, + }, + [BATADV_ATTR_AGGREGATED_OGMS_ENABLED] = { + .type = NLA_U8, + }, + [BATADV_ATTR_AP_ISOLATION_ENABLED] = { + .type = NLA_U8, + }, + [BATADV_ATTR_ISOLATION_MARK] = { + .type = NLA_U32, + }, + [BATADV_ATTR_ISOLATION_MASK] = { + .type = NLA_U32, + }, + [BATADV_ATTR_BONDING_ENABLED] = { + .type = NLA_U8, + }, + [BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE_ENABLED] = { + .type = NLA_U8, + }, + [BATADV_ATTR_DISTRIBUTED_ARP_TABLE_ENABLED] = { + .type = NLA_U8, + }, + [BATADV_ATTR_FRAGMENTATION_ENABLED] = { + .type = NLA_U8, + }, + [BATADV_ATTR_GW_BANDWIDTH_DOWN] = { + .type = NLA_U32, + }, + [BATADV_ATTR_GW_BANDWIDTH_UP] = { + .type = NLA_U32, + }, + [BATADV_ATTR_GW_MODE] = { + .type = NLA_U8, + }, + [BATADV_ATTR_GW_SEL_CLASS] = { + .type = NLA_U32, + }, + [BATADV_ATTR_HOP_PENALTY] = { + .type = NLA_U8, + }, + [BATADV_ATTR_LOG_LEVEL] = { + .type = NLA_U32, + }, + [BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED] = { + .type = NLA_U8, + }, + [BATADV_ATTR_NETWORK_CODING_ENABLED] = { + .type = NLA_U8, + }, + [BATADV_ATTR_ORIG_INTERVAL] = { + .type = NLA_U32, + }, + [BATADV_ATTR_ELP_INTERVAL] = { + .type = NLA_U32, + }, + [BATADV_ATTR_THROUGHPUT_OVERRIDE] = { + .type = NLA_U32, + }, + [BATADV_ATTR_MULTICAST_FANOUT] = { + .type = NLA_U32, + }, }; int netlink_create(struct state *state)