@@ -271,6 +271,7 @@ int parse_ipmi_interface_override(struct config *config, uint8_t *buf,
/* Hardware Address */
memcpy(ifconf->hwaddr, &buf[i], hwsize);
+ ifconf->hwaddr_len = hwsize;
i += hwsize;
/* Check 1-byte ignore and method flags */
@@ -686,6 +686,7 @@ void network_mark_interface_ready(struct device_handler *handler,
interface->ifindex = ifindex;
interface->state = IFSTATE_NEW;
memcpy(interface->hwaddr, mac, hwsize);
+ interface->hwaddr_len = hwsize;
strncpy(interface->name, ifname, sizeof(interface->name) - 1);
list_for_each_entry(&network->interfaces, tmp, list)
@@ -266,6 +266,8 @@ static int parse_hwaddr(struct interface_config *ifconf, char *str)
if (strlen(str) != strlen("00:00:00:00:00:00"))
return -1;
+ ifconf->hwaddr_len = strlen(str) / 3 + 1;
+
for (i = 0; i < HWADDR_SIZE; i++) {
char byte[3], *endp;
unsigned long x;
@@ -14,6 +14,7 @@ static struct interface_config *config_copy_interface(struct config *ctx,
struct interface_config);
memcpy(dest->hwaddr, src->hwaddr, sizeof(src->hwaddr));
+ dest->hwaddr_len = src->hwaddr_len;
dest->ignore = src->ignore;
if (dest->ignore)
@@ -278,6 +278,7 @@ static int screen_process_form(struct config_screen *screen)
idx = widget_select_get_value(screen->widgets.iface_f);
memcpy(iface->hwaddr, sysinfo->interfaces[idx]->hwaddr,
sizeof(iface->hwaddr));
+ iface->hwaddr_len = sysinfo->interfaces[idx]->hwaddr_size;
}
if (net_conf_type == NET_CONF_TYPE_DHCP_ONE) {
The new hwaddr_len field should be set any time the hwaddr field is set to indicate the true length of hwaddr. In the future, the buffer size may not be indicative of the actual address length. Signed-off-by: Daniel M. Weeks <weeksd2@rpi.edu> --- discover/ipmi.c | 1 + discover/network.c | 1 + discover/platform-powerpc.c | 2 ++ lib/pb-config/pb-config.c | 1 + ui/ncurses/nc-config.c | 1 + 5 files changed, 6 insertions(+)