summaryrefslogtreecommitdiffstats
path: root/lib/pb-protocol/pb-protocol.c
diff options
context:
space:
mode:
authorJack Miller <jack@codezen.org>2015-12-09 12:03:24 -0600
committerJack Miller <jack@codezen.org>2015-12-15 12:33:48 -0600
commitcecbe53013e9ed85fd5b2429c230759d59025644 (patch)
tree06e2cab4d15486b4fbd663411228d80d4d71989c /lib/pb-protocol/pb-protocol.c
parent2983a122b09ace8de8be19a3e3566aa5deb09b81 (diff)
downloadtalos-petitboot-cecbe53013e9ed85fd5b2429c230759d59025644.tar.gz
talos-petitboot-cecbe53013e9ed85fd5b2429c230759d59025644.zip
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/pb-protocol.c')
-rw-r--r--lib/pb-protocol/pb-protocol.c18
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;
}
OpenPOWER on IntegriCloud