diff options
author | Jack Miller <jack@codezen.org> | 2015-12-09 12:03:24 -0600 |
---|---|---|
committer | Jack Miller <jack@codezen.org> | 2015-12-15 12:33:48 -0600 |
commit | cecbe53013e9ed85fd5b2429c230759d59025644 (patch) | |
tree | 06e2cab4d15486b4fbd663411228d80d4d71989c /lib/pb-protocol | |
parent | 2983a122b09ace8de8be19a3e3566aa5deb09b81 (diff) | |
download | petitboot-cecbe53013e9ed85fd5b2429c230759d59025644.zip petitboot-cecbe53013e9ed85fd5b2429c230759d59025644.tar.gz |
Add BMC interface MAC to system info output
Useful for identifying the initial BMC traffic on the network.
Signed-off-by: Jack Miller <jack@codezen.org>
Diffstat (limited to 'lib/pb-protocol')
-rw-r--r-- | lib/pb-protocol/pb-protocol.c | 18 |
1 files changed, 17 insertions, 1 deletions
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; } |