[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [PATCH 7/7] udhcpc: Support gathering Infiniband HW address
From: "Daniel M. Weeks" <weeksd2 () rpi ! edu>
Date: 2020-04-16 20:19:48
Message-ID: c67ec7db87efef45587c35b8d7c02dc3db0d83a8.1587067259.git.weeksd2 () rpi ! edu
[Download RAW message or body]
Signed-off-by: Daniel M. Weeks <weeksd2@rpi.edu>
---
networking/udhcp/socket.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index b165d1b1c..1d2137bff 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -26,6 +26,7 @@
#include <net/if.h>
#include <ifaddrs.h>
#include <netpacket/packet.h>
+#include <net/if_arp.h>
int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t \
*nip, uint8_t *mac, uint8_t *hlen, uint8_t *htype) {
@@ -44,8 +45,23 @@ int FAST_FUNC udhcp_read_interface(const char *interface, int \
*ifindex, uint32_t sip = (struct sockaddr_in*)(ifa->ifa_addr);
sll = (struct sockaddr_ll*)(ifa->ifa_addr);
- memcpy(mac, sll->sll_addr, 6);
- log2("MAC %02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], \
mac[5]); +
+ if (sll->sll_hatype == ARPHRD_ETHER) {
+ memcpy(mac, sll->sll_addr, 6);
+ log2("MAC %02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], \
mac[5]); + } else if (sll->sll_hatype == ARPHRD_INFINIBAND) {
+ memcpy(mac, sll->sll_addr, 20);
+ log2("HW addr "
+ "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:"
+ "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
+ mac[0], mac[1], mac[2], mac[3], mac[4],
+ mac[5], mac[6], mac[7], mac[8], mac[9],
+ mac[10], mac[11], mac[12], mac[13], mac[14],
+ mac[15], mac[16], mac[17], mac[18], mac[19]);
+ } else {
+ break;
+ }
+
*ifindex = sll->sll_ifindex;
log2("ifindex %d", *ifindex);
--
Daniel M. Weeks
--
Daniel M. Weeks
Lead HPC Developer
Center for Computational Innovations
Rensselaer Polytechnic Institute
Troy, NY 12180
518-276-4458
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic