[PATCH 2/5] New function to append raw hardware addr to string
Daniel M. Weeks
weeksd2 at rpi.edu
Fri Apr 17 04:02:10 AEST 2020
It may be necessary to append a raw hardware address to another string.
For example, the defacto standard for identifying hosts during DHCP over
IB involves appending the IB adapter GUID to a particular prefix.
Signed-off-by: Daniel M. Weeks <weeksd2 at rpi.edu>
---
discover/network.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/discover/network.c b/discover/network.c
index ad7eced..bb76109 100644
--- a/discover/network.c
+++ b/discover/network.c
@@ -72,6 +72,13 @@ struct network {
bool dry_run;
};
+static void append_hwaddr_str(uint8_t *hwaddr, size_t hwaddr_len, char *dest)
+{
+ size_t i;
+ for (i = 0; i < hwaddr_len; i++)
+ sprintf(dest + (i * 2), "%02x", hwaddr[i]);
+}
+
static char *mac_bytes_to_string(void *ctx, uint8_t *addr, int len)
{
const int l = strlen("xx:");
--
Daniel M. Weeks
--
Daniel M. Weeks
Lead HPC Developer
Center for Computational Innovations
Rensselaer Polytechnic Institute
Troy, NY 12180
518-276-4458
More information about the Petitboot
mailing list