From cecbe53013e9ed85fd5b2429c230759d59025644 Mon Sep 17 00:00:00 2001 From: Jack Miller Date: Wed, 9 Dec 2015 12:03:24 -0600 Subject: Add BMC interface MAC to system info output Useful for identifying the initial BMC traffic on the network. Signed-off-by: Jack Miller --- lib/pb-protocol/pb-protocol.c | 18 +++++++++++++++++- lib/types/types.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c index 7d45f51..ab5ea8a 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -239,6 +239,9 @@ int pb_protocol_system_info_len(const struct system_info *sysinfo) 4 + optional_strlen(bd_info->mountpoint); } + /* BMC MAC */ + len += HWADDR_SIZE; + return len; } @@ -420,6 +423,9 @@ int pb_protocol_serialise_system_info(const struct system_info *sysinfo, pos += pb_protocol_serialise_string(pos, bd_info->mountpoint); } + memcpy(pos, sysinfo->bmc_mac, HWADDR_SIZE); + pos += HWADDR_SIZE; + assert(pos <= buf + buf_len); (void)buf_len; @@ -850,8 +856,18 @@ int pb_protocol_deserialise_system_info(struct system_info *sysinfo, sysinfo->blockdevs[i] = bd_info; } - rc = 0; + for (i = 0; i < HWADDR_SIZE; i++) { + if (pos[i] != 0) { + sysinfo->bmc_mac = talloc_memdup(sysinfo, pos, HWADDR_SIZE); + break; + } + } + + pos += HWADDR_SIZE; + len -= HWADDR_SIZE; + + rc = 0; out: return rc; } diff --git a/lib/types/types.h b/lib/types/types.h index 6a2c258..702b6f5 100644 --- a/lib/types/types.h +++ b/lib/types/types.h @@ -93,6 +93,7 @@ struct blockdev_info { struct system_info { char *type; char *identifier; + uint8_t *bmc_mac; struct interface_info **interfaces; unsigned int n_interfaces; struct blockdev_info **blockdevs; -- cgit v1.2.1