]> git.ozlabs.org Git - petitboot/blobdiff - lib/pb-protocol/pb-protocol.c
ui/common: Free message on return
[petitboot] / lib / pb-protocol / pb-protocol.c
index 7d45f512b0dcb81db6b83ba6223e6eb921dde30f..ab5ea8a376e1500895ba047b3e656e8ac114fd59 100644 (file)
@@ -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;
 }