From patchwork Thu May 5 11:09:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 16080 X-Patchwork-Delegate: mareklindner@neomailbox.ch Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id 7B598826FE; Thu, 5 May 2016 13:11:29 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=none header.from=open-mesh.com Authentication-Results: open-mesh.org; dkim=fail reason="verification failed; unprotected key" header.d=open-mesh-com.20150623.gappssmtp.com header.i=@open-mesh-com.20150623.gappssmtp.com header.b=hsNB2GP5; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received-SPF: Neutral (access neither permitted nor denied) identity=mailfrom; client-ip=2a00:1450:400c:c09::22d; helo=mail-wm0-x22d.google.com; envelope-from=sven.eckelmann@open-mesh.com; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=none header.from=open-mesh.com Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) by open-mesh.org (Postfix) with ESMTPS id AF4E4826C2 for ; Thu, 5 May 2016 13:10:10 +0200 (CEST) Received: by mail-wm0-x22d.google.com with SMTP id a17so21816469wme.0 for ; Thu, 05 May 2016 04:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=VFSmOy7AFt6oNzvBMMECpYyetML0zfPCGHvCzzSs5LY=; b=hsNB2GP5UGKQE1Y7r1wQQl5b3G7dOyxDD/4AZoDtwMm6PtqM5vl2Zn44gT1rHVCoue EbnZf4qrXWaHNM+VMKVn3SXPf/f4fHBbPU//tYpLqUb3LB6nqpGMfQ+0yrVwnNak1HuX wU9a8nT3uTI2FUO62R0sl7rpVbBt8MMN79oaMotqUmR+XsDF9mqkrzRyIJ58SFot+l3u CIhFNAQFCSjl49ff6E2c5bEhAe+AWfvdQbS9EzRXoFvWoVsE2nh0YXMM5l8RvaHQvQE/ pO4WR0MadkGM+3/ri5n5A80XEVbMU838lNydKUcfp3gHkyAVRn5yMfe7M1AH1z2dNMtv axfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=VFSmOy7AFt6oNzvBMMECpYyetML0zfPCGHvCzzSs5LY=; b=E/5CPUMHeDnV6RlcuS+UfKj4IGZcvAgcaQVYBhIXTKDMisF8kJzVGvafKGMy/weaJB d1+oS/zaX+WK6z2CIPlTCihv/B1cqd60xAPH7OiZftLQJEgzeegqeQ9++g3TWg6n+M3H UTxTahX/aEpBXDWbB79nCMeqMlmCIUfBHq1/LqDcztyMQDcEAeSYU+k1MbcQO9ZSyqYt D9qayKBrS/t/kWJx/CXpPCIcDpir0N5H5sju7qqwdqStDmN8wuJopWHFa/YFxy+tKB6a dhKuNWKvLgOVae23GQAo0szdEHceJl1wKkPLNgQDpfv0eh83BB5mFP0ksj2tLksejhf+ I+Kw== X-Gm-Message-State: AOPr4FU3/iCFVYX1Gur+Y9PzW9IxmkTk2rtrLXW1SO3zG9rLk33LZu+POsb9NXfvC9wxChYc X-Received: by 10.28.184.22 with SMTP id i22mr2809029wmf.41.1462446609725; Thu, 05 May 2016 04:10:09 -0700 (PDT) Received: from sven-desktop.home.narfation.org (p200300C593C34EFD0000000000002E16.dip0.t-ipconnect.de. [2003:c5:93c3:4efd::2e16]) by smtp.gmail.com with ESMTPSA id gr4sm9205909wjd.23.2016.05.05.04.10.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 May 2016 04:10:09 -0700 (PDT) From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 5 May 2016 13:09:46 +0200 Message-Id: <1462446587-5304-9-git-send-email-sven.eckelmann@open-mesh.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1462446587-5304-1-git-send-email-sven.eckelmann@open-mesh.com> References: <1462446587-5304-1-git-send-email-sven.eckelmann@open-mesh.com> Subject: [B.A.T.M.A.N.] [PATCH v5 3/4] batctl: Add attributes/command for BATADV_CMD_GET_MESH_INFO X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" BATADV_CMD_GET_MESH_INFO will be used as common function to retrieve information from the kernel. This information can be used to display a header for debugfs tables. Signed-off-by: Sven Eckelmann --- batman_adv.h | 18 ++++++++++++++++++ netlink.c | 14 ++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/batman_adv.h b/batman_adv.h index ba611a7..a908140 100644 --- a/batman_adv.h +++ b/batman_adv.h @@ -24,12 +24,28 @@ * enum batadv_nl_attrs - batman-adv netlink attributes * * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors + * @BATADV_ATTR_VERSION: batman-adv version string + * @BATADV_ATTR_ALGO_NAME: name of routing algorithm + * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface + * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface + * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface + * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface + * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface + * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv interface * @__BATADV_ATTR_AFTER_LAST: internal use * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available * @BATADV_ATTR_MAX: highest attribute number currently defined */ enum batadv_nl_attrs { BATADV_ATTR_UNSPEC, + BATADV_ATTR_VERSION, + BATADV_ATTR_ALGO_NAME, + BATADV_ATTR_MESH_IFINDEX, + BATADV_ATTR_MESH_IFNAME, + BATADV_ATTR_MESH_ADDRESS, + BATADV_ATTR_HARD_IFINDEX, + BATADV_ATTR_HARD_IFNAME, + BATADV_ATTR_HARD_ADDRESS, /* add attributes above here, update the policy in netlink.c */ __BATADV_ATTR_AFTER_LAST, NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST, @@ -40,11 +56,13 @@ enum batadv_nl_attrs { * enum batadv_nl_commands - supported batman-adv netlink commands * * @BATADV_CMD_UNSPEC: unspecified command to catch errors + * @BATADV_CMD_GET_MESH_INFO: Query basic information about batman-adv device * @__BATADV_CMD_AFTER_LAST: internal use * @BATADV_CMD_MAX: highest used command number */ enum batadv_nl_commands { BATADV_CMD_UNSPEC, + BATADV_CMD_GET_MESH_INFO, /* add new commands above here */ __BATADV_CMD_AFTER_LAST, BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1 diff --git a/netlink.c b/netlink.c index 409953a..2404a25 100644 --- a/netlink.c +++ b/netlink.c @@ -22,7 +22,21 @@ #include "netlink.h" #include "main.h" +#include + #include "batman_adv.h" 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 }, + [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 }, + [BATADV_ATTR_HARD_ADDRESS] = { .type = NLA_UNSPEC, + .minlen = ETH_ALEN, + .maxlen = ETH_ALEN }, };