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-next>] [day] [month] [year] [list]
Message-ID: <20190423224138.1295-1-taoren@fb.com>
Date:   Tue, 23 Apr 2019 22:41:56 +0000
From:   Tao Ren <taoren@...com>
To:     "David S . Miller" <davem@...emloft.net>,
        Maxim Mikityanskiy <maximmi@...lanox.com>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Jakub Kicinski <jakub.kicinski@...ronome.com>,
        Samuel Mendoza-Jonas <sam@...dozajonas.com>,
        Joel Stanley <joel@....id.au>,
        Andrew Jeffery <andrew@...id.au>,
        "openbmc@...ts.ozlabs.org" <openbmc@...ts.ozlabs.org>
CC:     Tao Ren <taoren@...com>
Subject: [PATCH net 1/2] net: add eth_addr_inc in etherdevice.h

Add eth_addr_inc function in etherdevice.h to increment MAC address. One
of the use cases is in ncsi stack, where the host's MAC address needs to
be incremented to get BMC's MAC address.

Signed-off-by: Tao Ren <taoren@...com>
---
 include/linux/etherdevice.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index e2f3b21cd72a..d48e3a724c54 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -448,6 +448,19 @@ static inline void eth_addr_dec(u8 *addr)
 	u64_to_ether_addr(u, addr);
 }
 
+/**
+ * eth_addr_inc - Increment the given MAC address
+ *
+ * @addr: Pointer to a six-byte array containing Ethernet address to increment
+ */
+static inline void eth_addr_inc(u8 *addr)
+{
+	u64 u = ether_addr_to_u64(addr);
+
+	u++;
+	u64_to_ether_addr(u, addr);
+}
+
 /**
  * is_etherdev_addr - Tell if given Ethernet address belongs to the device.
  * @dev: Pointer to a device structure
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ