lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180701110804.32415-10-afaerber@suse.de>
Date:   Sun,  1 Jul 2018 13:07:58 +0200
From:   Andreas Färber <afaerber@...e.de>
To:     netdev@...r.kernel.org
Cc:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Jian-Hong Pan <starnight@...cu.edu.tw>,
        Jiri Pirko <jiri@...nulli.us>,
        Marcel Holtmann <marcel@...tmann.org>,
        "David S . Miller" <davem@...emloft.net>,
        Matthias Brugger <mbrugger@...e.com>,
        Janus Piwek <jpiwek@...oweurope.com>,
        Michael Röder <michael.roeder@...et.eu>,
        Dollar Chen <dollar.chen@...ec.com>,
        Ken Yu <ken.yu@...wireless.com>,
        Andreas Färber <afaerber@...e.de>
Subject: [RFC net-next 09/15] net: lora: Prepare EUI helpers

These will be used by the RN2483 and other LoRaWAN capable modules.

Signed-off-by: Andreas Färber <afaerber@...e.de>
---
 include/linux/lora/dev.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/include/linux/lora/dev.h b/include/linux/lora/dev.h
index 531e68f0c9a6..153f9b2992ca 100644
--- a/include/linux/lora/dev.h
+++ b/include/linux/lora/dev.h
@@ -9,6 +9,27 @@
 
 #include <linux/netdevice.h>
 
+typedef u8 lora_eui[8];
+
+#define PRIxLORAEUI "%02x%02x%02x%02x%02x%02x%02x%02x"
+#define PRIXLORAEUI "%02X%02X%02X%02X%02X%02X%02X%02X"
+#define LORA_EUI(x) x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]
+
+static inline int lora_strtoeui(const char *str, lora_eui *val)
+{
+        char buf[3];
+        int i, ret;
+
+        for (i = 0; i < 8; i++) {
+                strncpy(buf, str + i * 2, 2);
+                buf[2] = 0;
+                ret = kstrtou8(buf, 16, &(*val)[i]);
+                if (ret)
+                        return ret;
+        }
+        return 0;
+}
+
 struct net_device *alloc_loradev(int sizeof_priv);
 void free_loradev(struct net_device *dev);
 int register_loradev(struct net_device *dev);
-- 
2.16.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ