From patchwork Thu Apr 16 17:58:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel M. Weeks" X-Patchwork-Id: 1271837 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4936TV0jS4z9sWT for ; Fri, 17 Apr 2020 04:00:46 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=rpi.edu Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4936TT4FDNzDrgC for ; Fri, 17 Apr 2020 04:00:45 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rpi.edu (client-ip=128.113.2.229; helo=smtp9.server.rpi.edu; envelope-from=weeksd2@rpi.edu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=rpi.edu Received: from smtp9.server.rpi.edu (smtp9.server.rpi.edu [128.113.2.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4936R94S5FzDsGt for ; Fri, 17 Apr 2020 03:58:45 +1000 (AEST) Received: from smtp-auth2.server.rpi.edu (smtp-auth2.server.rpi.edu [128.113.2.232]) by smtp9.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 03GHwfrA116507 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 13:58:41 -0400 Received: from smtp-auth2.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth2.server.rpi.edu (Postfix) with ESMTP id ED4F11A100 for ; Thu, 16 Apr 2020 13:58:40 -0400 (EDT) Received: from dev.danweeks.net (cpe-74-70-107-6.nycap.res.rr.com [74.70.107.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: weeksd2) by smtp-auth2.server.rpi.edu (Postfix) with ESMTPSA id CC6201A0E7 for ; Thu, 16 Apr 2020 13:58:40 -0400 (EDT) Date: Thu, 16 Apr 2020 13:58:39 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 01/11] Expand fixed buffers for pretty-printed hardware addresses Message-ID: <6b00580e0a184ab2392ac9ec124285652f7c95e2.1587059234.git.weeksd2@rpi.edu> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Virus-Scanned: ClamAV using ClamSMTP X-Bayes-Prob: 0.0001 (Score 0, tokens from: outgoing, @@RPTN) X-Spam-Score: 0.00 () [Hold at 10.10] X-CanIt-Incident-Id: 022rtWFf4 X-CanIt-Geo: ip=74.70.107.6; country=US; region=New York; city=Troy; latitude=42.7273; longitude=-73.6696; http://maps.google.com/maps?q=42.7273,-73.6696&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.229 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" This makes the buffers used to generate pretty-printed hardware addresses a consistent length which is long enough to hold an Infiniband GUID. It also serves as a reference point for future cleanup so this can be reduced to a single definition. Signed-off-by: Daniel M. Weeks --- discover/sysinfo.c | 2 +- ui/ncurses/nc-config.c | 8 ++++---- ui/ncurses/nc-menu.c | 2 +- ui/ncurses/nc-sysinfo.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/discover/sysinfo.c b/discover/sysinfo.c index 73012e8..6b3b415 100644 --- a/discover/sysinfo.c +++ b/discover/sysinfo.c @@ -33,7 +33,7 @@ void system_info_set_interface_address(unsigned int hwaddr_size, { struct interface_info *if_info; unsigned int i; - char mac[20]; + char mac[32]; /* at least 24B for IB GUID */ for (i = 0; i < sysinfo->n_interfaces; i++) { if_info = sysinfo->interfaces[i]; diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c index 4eb2499..801e0bb 100644 --- a/ui/ncurses/nc-config.c +++ b/ui/ncurses/nc-config.c @@ -209,7 +209,7 @@ static int screen_process_form(struct config_screen *screen) struct config *config; int i, n_boot_opts, rc; unsigned int *order, idx; - char mac[20]; + char mac[32]; /* at least 24B for IB GUID */ config = config_copy(screen, screen->cui->config); @@ -812,7 +812,7 @@ static int find_autoboot_idx(const struct system_info *sysinfo, for (i = 0; i < sysinfo->n_interfaces; i++) { struct interface_info *info = sysinfo->interfaces[i]; - char mac[20]; + char mac[32]; /* at least 24B for IB GUID */ mac_str(info->hwaddr, info->hwaddr_size, mac, sizeof(mac)); @@ -894,7 +894,7 @@ static void config_screen_setup_widgets(struct config_screen *screen, for (i = 0; i < sysinfo->n_interfaces; i++) { struct interface_info *info = sysinfo->interfaces[i]; - char mac[20]; + char mac[32]; /* at least 24B for IB GUID */ mac_str(info->hwaddr, info->hwaddr_size, mac, sizeof(mac)); @@ -986,7 +986,7 @@ static void config_screen_setup_widgets(struct config_screen *screen, for (i = 0; i < sysinfo->n_interfaces; i++) { struct interface_info *info = sysinfo->interfaces[i]; - char str[50], mac[20]; + char str[50], mac[32]; /* at least 24B for IB GUID */ bool is_default; is_default = ifcfg && !hwaddr_cmp(ifcfg->hwaddr, ifcfg->hwaddr_len, info->hwaddr, diff --git a/ui/ncurses/nc-menu.c b/ui/ncurses/nc-menu.c index a6c2b15..05a0535 100644 --- a/ui/ncurses/nc-menu.c +++ b/ui/ncurses/nc-menu.c @@ -249,7 +249,7 @@ struct pmenu_item *pmenu_find_device(struct pmenu *menu, struct device *dev, struct blockdev_info *bd; struct cui_opt_data *cod; struct system_info *sys; - char hwaddr[32]; + char hwaddr[32]; /* at least 24B for IB GUID */ unsigned int i; char buf[256]; diff --git a/ui/ncurses/nc-sysinfo.c b/ui/ncurses/nc-sysinfo.c index f0f9cb1..ef5d237 100644 --- a/ui/ncurses/nc-sysinfo.c +++ b/ui/ncurses/nc-sysinfo.c @@ -51,7 +51,7 @@ static void if_info_mac_str(struct interface_info *info, static void sysinfo_screen_populate(struct sysinfo_screen *screen, const struct system_info *sysinfo) { - char macbuf[32]; + char macbuf[32]; /* at least 24B for IB GUID */ unsigned int i; text_screen_clear(&screen->text_scr); From patchwork Thu Apr 16 17:58:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel M. Weeks" X-Patchwork-Id: 1271838 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4936Ty63Z8z9sWW for ; Fri, 17 Apr 2020 04:01:10 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=rpi.edu Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4936Tw1sLPzDrgC for ; Fri, 17 Apr 2020 04:01:08 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rpi.edu (client-ip=128.113.2.229; helo=smtp9.server.rpi.edu; envelope-from=weeksd2@rpi.edu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=rpi.edu Received: from smtp9.server.rpi.edu (smtp9.server.rpi.edu [128.113.2.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4936RL5JdWzDqkS for ; Fri, 17 Apr 2020 03:58:54 +1000 (AEST) Received: from smtp-auth3.server.rpi.edu (smtp-auth3.server.rpi.edu [128.113.2.233]) by smtp9.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 03GHwo0A116525 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 13:58:51 -0400 Received: from smtp-auth3.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth3.server.rpi.edu (Postfix) with ESMTP id C4BDE580D7 for ; Thu, 16 Apr 2020 13:58:50 -0400 (EDT) Received: from dev.danweeks.net (cpe-74-70-107-6.nycap.res.rr.com [74.70.107.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: weeksd2) by smtp-auth3.server.rpi.edu (Postfix) with ESMTPSA id ABB73580DC for ; Thu, 16 Apr 2020 13:58:50 -0400 (EDT) Date: Thu, 16 Apr 2020 13:58:49 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 02/11] Display GUID in platform dump_config Message-ID: <4972f3a28ce5d0f1fa87ed21d8e1fc479a5c5fca.1587059234.git.weeksd2@rpi.edu> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Virus-Scanned: ClamAV using ClamSMTP X-Bayes-Prob: 0.0001 (Score 0, tokens from: outgoing, @@RPTN) X-Spam-Score: 0.00 () [Hold at 10.10] X-CanIt-Incident-Id: 022rtWPfa X-CanIt-Geo: ip=74.70.107.6; country=US; region=New York; city=Troy; latitude=42.7273; longitude=-73.6696; http://maps.google.com/maps?q=42.7273,-73.6696&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.229 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" Signed-off-by: Daniel M. Weeks --- discover/platform.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/discover/platform.c b/discover/platform.c index cc6306f..cd35c45 100644 --- a/discover/platform.c +++ b/discover/platform.c @@ -43,10 +43,18 @@ static void dump_config(struct config *config) struct interface_config *ifconf = config->network.interfaces[i]; - pb_log(" interface %02x:%02x:%02x:%02x:%02x:%02x\n", + if (ifconf->hwaddr_len == 6) { + pb_log(" interface %02x:%02x:%02x:%02x:%02x:%02x\n", ifconf->hwaddr[0], ifconf->hwaddr[1], ifconf->hwaddr[2], ifconf->hwaddr[3], ifconf->hwaddr[4], ifconf->hwaddr[5]); + } else if (ifconf->hwaddr_len == 8) { + pb_log(" interface %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", + ifconf->hwaddr[0], ifconf->hwaddr[1], + ifconf->hwaddr[2], ifconf->hwaddr[3], + ifconf->hwaddr[4], ifconf->hwaddr[5], + ifconf->hwaddr[6], ifconf->hwaddr[7]); + } if (ifconf->ignore) { pb_log(" ignore\n"); From patchwork Thu Apr 16 17:58:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel M. Weeks" X-Patchwork-Id: 1271840 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4936VP4DZhz9sWW for ; Fri, 17 Apr 2020 04:01:33 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=rpi.edu Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4936VN6qQ0zDrg6 for ; Fri, 17 Apr 2020 04:01:32 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rpi.edu (client-ip=128.113.2.230; helo=smtp10.server.rpi.edu; envelope-from=weeksd2@rpi.edu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=rpi.edu Received: from smtp10.server.rpi.edu (smtp10.server.rpi.edu [128.113.2.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4936RZ53nYzDsG2 for ; Fri, 17 Apr 2020 03:59:04 +1000 (AEST) Received: from smtp-auth3.server.rpi.edu (smtp-auth3.server.rpi.edu [128.113.2.233]) by smtp10.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 03GHx0kS096830 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 13:59:01 -0400 Received: from smtp-auth3.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth3.server.rpi.edu (Postfix) with ESMTP id D5F38580E3 for ; Thu, 16 Apr 2020 13:59:00 -0400 (EDT) Received: from dev.danweeks.net (cpe-74-70-107-6.nycap.res.rr.com [74.70.107.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: weeksd2) by smtp-auth3.server.rpi.edu (Postfix) with ESMTPSA id B72B7580E1 for ; Thu, 16 Apr 2020 13:59:00 -0400 (EDT) Date: Thu, 16 Apr 2020 13:58:59 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 03/11] Reference MAC as HW address Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Virus-Scanned: ClamAV using ClamSMTP X-Bayes-Prob: 0.0001 (Score 0, tokens from: outgoing, @@RPTN) X-Spam-Score: 0.00 () [Hold at 10.10] X-CanIt-Incident-Id: 032rtX1J2 X-CanIt-Geo: ip=74.70.107.6; country=US; region=New York; city=Troy; latitude=42.7273; longitude=-73.6696; http://maps.google.com/maps?q=42.7273,-73.6696&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.230 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" Change references in logs and menus from "MAC address" to "hwaddr" or "HW Address" to reduce confusion for non-MAC interfaces. Signed-off-by: Daniel M. Weeks --- discover/network.c | 6 +++--- ui/ncurses/nc-sysinfo.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/discover/network.c b/discover/network.c index 338762b..68400a5 100644 --- a/discover/network.c +++ b/discover/network.c @@ -620,7 +620,7 @@ static int network_handle_nlmsg(struct network *network, struct nlmsghdr *nlmsg) list_for_each_entry(&network->interfaces, tmp, list) if (hwaddr_cmp(interface->hwaddr, interface->hwaddr_len, tmp->hwaddr, tmp->hwaddr_len) == 0) { - pb_log("%s: %s has duplicate MAC address, ignoring\n", + pb_log("%s: %s has duplicate hwaddr, ignoring\n", __func__, interface->name); talloc_free(interface); return -1; @@ -693,7 +693,7 @@ void network_mark_interface_ready(struct device_handler *handler, list_for_each_entry(&network->interfaces, tmp, list) if (hwaddr_cmp(interface->hwaddr, interface->hwaddr_len, tmp->hwaddr, tmp->hwaddr_len) == 0) { - pb_log("%s: %s has duplicate MAC address, ignoring\n", + pb_log("%s: %s has duplicate hwaddr, ignoring\n", __func__, interface->name); talloc_free(interface); return; @@ -718,7 +718,7 @@ void network_mark_interface_ready(struct device_handler *handler, if (hwaddr_cmp(interface->hwaddr, interface->hwaddr_len, mac, hwsize) != 0) { macstr = mac_bytes_to_string(interface, mac, hwsize); - pb_log("Warning - new MAC for interface %d does not match: %s\n", + pb_log("Warning - new hwaddr for interface %d does not match: %s\n", ifindex, macstr); talloc_free(macstr); } diff --git a/ui/ncurses/nc-sysinfo.c b/ui/ncurses/nc-sysinfo.c index ef5d237..16faec9 100644 --- a/ui/ncurses/nc-sysinfo.c +++ b/ui/ncurses/nc-sysinfo.c @@ -129,7 +129,7 @@ static void sysinfo_screen_populate(struct sysinfo_screen *screen, if_info_mac_str(info, macbuf, sizeof(macbuf)); line("%s:", info->name); - line(_(" MAC: %s"), macbuf); + line(_(" HW Address: %s"), macbuf); line(_(" IP Address: %s"), info->address ?: _("none")); /* TRANSLATORS: these "up" / "down" strings refer to the * link status for a network connection. */ From patchwork Thu Apr 16 17:59:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel M. Weeks" X-Patchwork-Id: 1271841 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4936Vx4q44z9sWV for ; Fri, 17 Apr 2020 04:02:01 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=rpi.edu Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4936Vx2MpszDsM9 for ; Fri, 17 Apr 2020 04:02:01 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rpi.edu (client-ip=128.113.2.229; helo=smtp9.server.rpi.edu; envelope-from=weeksd2@rpi.edu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=rpi.edu Received: from smtp9.server.rpi.edu (smtp9.server.rpi.edu [128.113.2.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4936Rk1Yc5zDrgC for ; Fri, 17 Apr 2020 03:59:13 +1000 (AEST) Received: from smtp-auth3.server.rpi.edu (route.canit.rpi.edu [128.113.2.233]) by smtp9.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 03GHxAde116579 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 13:59:10 -0400 Received: from smtp-auth3.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth3.server.rpi.edu (Postfix) with ESMTP id 24580580CD for ; Thu, 16 Apr 2020 13:59:10 -0400 (EDT) Received: from dev.danweeks.net (cpe-74-70-107-6.nycap.res.rr.com [74.70.107.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: weeksd2) by smtp-auth3.server.rpi.edu (Postfix) with ESMTPSA id 03DDB580CA for ; Thu, 16 Apr 2020 13:59:09 -0400 (EDT) Date: Thu, 16 Apr 2020 13:59:08 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 04/11] Expand hwaddr buffers Message-ID: <3a568a0093fbd5831780bec3bddf370cfc416e10.1587059235.git.weeksd2@rpi.edu> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Virus-Scanned: ClamAV using ClamSMTP X-Bayes-Prob: 0.0001 (Score 0, tokens from: outgoing, @@RPTN) X-Spam-Score: 0.00 () [Hold at 10.10] X-CanIt-Incident-Id: 022rtXafu X-CanIt-Geo: ip=74.70.107.6; country=US; region=New York; city=Troy; latitude=42.7273; longitude=-73.6696; http://maps.google.com/maps?q=42.7273,-73.6696&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.229 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" This expands the hwaddr buffers to 8 bytes - large enough to store an Infiniband GUID. Signed-off-by: Daniel M. Weeks --- discover/network.c | 4 ++-- lib/types/types.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/discover/network.c b/discover/network.c index 68400a5..6887fc5 100644 --- a/discover/network.c +++ b/discover/network.c @@ -25,7 +25,7 @@ #include "device-handler.h" #include "paths.h" -#define MAC_HWADDR_SIZE 6 +#define MAX_HWADDR_SIZE 8 #define PIDFILE_BASE (LOCAL_STATE_DIR "/petitboot/") #define INITIAL_BUFSIZE 4096 @@ -42,7 +42,7 @@ struct interface { int ifindex; char name[IFNAMSIZ]; - uint8_t hwaddr[MAC_HWADDR_SIZE]; + uint8_t hwaddr[MAX_HWADDR_SIZE]; unsigned int hwaddr_len; enum { diff --git a/lib/types/types.h b/lib/types/types.h index 674a748..ab46a69 100644 --- a/lib/types/types.h +++ b/lib/types/types.h @@ -138,9 +138,11 @@ struct system_info { #define MAC_HWADDR_SIZE 6 +#define MAX_HWADDR_SIZE 8 + struct interface_config { unsigned int hwaddr_len; - uint8_t hwaddr[MAC_HWADDR_SIZE]; + uint8_t hwaddr[MAX_HWADDR_SIZE]; bool ignore; enum { CONFIG_METHOD_DHCP, From patchwork Thu Apr 16 17:59:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel M. Weeks" X-Patchwork-Id: 1271842 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4936Wf2WTmz9sWY for ; Fri, 17 Apr 2020 04:02:38 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=rpi.edu Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4936Wd58xjzDqkS for ; Fri, 17 Apr 2020 04:02:37 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rpi.edu (client-ip=128.113.2.229; helo=smtp9.server.rpi.edu; envelope-from=weeksd2@rpi.edu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=rpi.edu Received: from smtp9.server.rpi.edu (smtp9.server.rpi.edu [128.113.2.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4936Rw3RQmzDsGt for ; Fri, 17 Apr 2020 03:59:24 +1000 (AEST) Received: from smtp-auth1.server.rpi.edu (route.canit.rpi.edu [128.113.2.231]) by smtp9.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 03GHxKcZ116599 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 13:59:20 -0400 Received: from smtp-auth1.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth1.server.rpi.edu (Postfix) with ESMTP id 7DBEA580E6 for ; Thu, 16 Apr 2020 13:59:20 -0400 (EDT) Received: from dev.danweeks.net (cpe-74-70-107-6.nycap.res.rr.com [74.70.107.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: weeksd2) by smtp-auth1.server.rpi.edu (Postfix) with ESMTPSA id 5DFC7580E5 for ; Thu, 16 Apr 2020 13:59:20 -0400 (EDT) Date: Thu, 16 Apr 2020 13:59:18 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 05/11] Parse GUIDs from NVRAM Message-ID: <0d7f3d5b9104ca40d065c49f370846480525f040.1587059235.git.weeksd2@rpi.edu> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Virus-Scanned: ClamAV using ClamSMTP X-Bayes-Prob: 0.0001 (Score 0, tokens from: outgoing, @@RPTN) X-Spam-Score: 0.00 () [Hold at 10.10] X-CanIt-Incident-Id: 022rtXkfE X-CanIt-Geo: ip=74.70.107.6; country=US; region=New York; city=Troy; latitude=42.7273; longitude=-73.6696; http://maps.google.com/maps?q=42.7273,-73.6696&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.229 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" Parse any length hardware address from NVRAM, up to the maximum size of the buffer. Signed-off-by: Daniel M. Weeks --- discover/platform-powerpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c index 29f8003..a6e24fc 100644 --- a/discover/platform-powerpc.c +++ b/discover/platform-powerpc.c @@ -263,7 +263,7 @@ static int parse_hwaddr(struct interface_config *ifconf, char *str) { unsigned int i; - if (strlen(str) != strlen("00:00:00:00:00:00")) + if (strlen(str) > 3*MAX_HWADDR_SIZE-1) return -1; ifconf->hwaddr_len = strlen(str) / 3 + 1; From patchwork Thu Apr 16 17:59:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel M. Weeks" X-Patchwork-Id: 1271843 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4936XR2vzVz9sWb for ; Fri, 17 Apr 2020 04:03:19 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=rpi.edu Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4936XR1Bg9zDrNg for ; Fri, 17 Apr 2020 04:03:19 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rpi.edu (client-ip=128.113.2.230; helo=smtp10.server.rpi.edu; envelope-from=weeksd2@rpi.edu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=rpi.edu Received: from smtp10.server.rpi.edu (smtp10.server.rpi.edu [128.113.2.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4936S62vmczDrq9 for ; Fri, 17 Apr 2020 03:59:33 +1000 (AEST) Received: from smtp-auth2.server.rpi.edu (route.canit.rpi.edu [128.113.2.232]) by smtp10.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 03GHxUt5096909 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 13:59:30 -0400 Received: from smtp-auth2.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth2.server.rpi.edu (Postfix) with ESMTP id 32A6E1A0EA for ; Thu, 16 Apr 2020 13:59:30 -0400 (EDT) Received: from dev.danweeks.net (cpe-74-70-107-6.nycap.res.rr.com [74.70.107.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: weeksd2) by smtp-auth2.server.rpi.edu (Postfix) with ESMTPSA id 10C211A0DF for ; Thu, 16 Apr 2020 13:59:30 -0400 (EDT) Date: Thu, 16 Apr 2020 13:59:28 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 06/11] Write GUIDs to NVRAM Message-ID: <7fe88bbd5fc32ddad101832bac84eb01d0658df2.1587059235.git.weeksd2@rpi.edu> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Virus-Scanned: ClamAV using ClamSMTP X-Bayes-Prob: 0.0001 (Score 0, tokens from: outgoing, @@RPTN) X-Spam-Score: 0.00 () [Hold at 10.10] X-CanIt-Incident-Id: 032rtXuJx X-CanIt-Geo: ip=74.70.107.6; country=US; region=New York; city=Troy; latitude=42.7273; longitude=-73.6696; http://maps.google.com/maps?q=42.7273,-73.6696&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.230 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" Store any hardware address up to the maximum size in NVRAM. Due to the way each octet is appended, a hardware address less than 2 can not be stored. Signed-off-by: Daniel M. Weeks --- discover/platform-powerpc.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c index a6e24fc..08c2b78 100644 --- a/discover/platform-powerpc.c +++ b/discover/platform-powerpc.c @@ -565,13 +565,19 @@ static void populate_config(struct platform_powerpc *platform, static char *iface_config_str(void *ctx, struct interface_config *config) { char *str; + unsigned int i; + + /* never this short but necessary */ + if (config->hwaddr_len < 2) + return NULL; - /* todo: HWADDR size is hardcoded as 6, but we may need to handle - * different hardware address formats */ - str = talloc_asprintf(ctx, "%02x:%02x:%02x:%02x:%02x:%02x,", - config->hwaddr[0], config->hwaddr[1], - config->hwaddr[2], config->hwaddr[3], - config->hwaddr[4], config->hwaddr[5]); + pb_debug("%s: hwaddr len %d", __func__, config->hwaddr_len); + str = talloc_asprintf(ctx, "%02x:", config->hwaddr[0]); + for (i = 1; i < config->hwaddr_len-1; i++) { + str = talloc_asprintf_append(str, "%02x:", config->hwaddr[i]); + } + str = talloc_asprintf_append(str, "%02x,", config->hwaddr[config->hwaddr_len-1]); + pb_debug("%s: hwaddr: %s\n", __func__, str); if (config->ignore) { str = talloc_asprintf_append(str, "ignore"); @@ -639,6 +645,8 @@ static void update_network_config(struct platform_powerpc *platform, for (i = 0; i < config->network.n_interfaces; i++) { char *iface_str = iface_config_str(platform, config->network.interfaces[i]); + if (iface_str == NULL) + continue; val = talloc_asprintf_append(val, "%s%s", *val == '\0' ? "" : " ", iface_str); talloc_free(iface_str); From patchwork Thu Apr 16 17:59:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel M. Weeks" X-Patchwork-Id: 1271844 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4936dX5y2zz9sWY for ; Fri, 17 Apr 2020 04:07:44 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=rpi.edu Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4936dX4CWQzDrhF for ; Fri, 17 Apr 2020 04:07:44 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rpi.edu (client-ip=128.113.2.229; helo=smtp9.server.rpi.edu; envelope-from=weeksd2@rpi.edu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=rpi.edu Received: from smtp9.server.rpi.edu (smtp9.server.rpi.edu [128.113.2.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4936SH0cMZzDrgD for ; Fri, 17 Apr 2020 03:59:42 +1000 (AEST) Received: from smtp-auth1.server.rpi.edu (smtp-auth1.server.rpi.edu [128.113.2.231]) by smtp9.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 03GHxc1F116640 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 13:59:39 -0400 Received: from smtp-auth1.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth1.server.rpi.edu (Postfix) with ESMTP id 50BD8580E2 for ; Thu, 16 Apr 2020 13:59:38 -0400 (EDT) Received: from dev.danweeks.net (cpe-74-70-107-6.nycap.res.rr.com [74.70.107.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: weeksd2) by smtp-auth1.server.rpi.edu (Postfix) with ESMTPSA id 314B05805A for ; Thu, 16 Apr 2020 13:59:38 -0400 (EDT) Date: Thu, 16 Apr 2020 13:59:36 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 07/11] New function to preprocess hardware address strings Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Virus-Scanned: ClamAV using ClamSMTP X-Bayes-Prob: 0.0001 (Score 0, tokens from: outgoing, @@RPTN) X-Spam-Score: 0.00 () [Hold at 10.10] X-CanIt-Incident-Id: 022rtXCfX X-CanIt-Geo: ip=74.70.107.6; country=US; region=New York; city=Troy; latitude=42.7273; longitude=-73.6696; http://maps.google.com/maps?q=42.7273,-73.6696&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.229 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" This function will take a long hardware address, and identify the beginning of the local, usable hardware address and, optionally, its length. Since Infiniband IP over IB hardware addresses begin with 12 bytes of addressing data that can change and is not representative of the local hardware, it is removed. Signed-off-by: Daniel M. Weeks --- lib/util/util.c | 22 ++++++++++++++++++++++ lib/util/util.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/lib/util/util.c b/lib/util/util.c index e672d19..c965cc4 100644 --- a/lib/util/util.c +++ b/lib/util/util.c @@ -18,6 +18,7 @@ #include #include +#include #include static const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', @@ -60,3 +61,24 @@ int hwaddr_cmp(uint8_t *hwaddr1, size_t hwaddr1_len, uint8_t *hwaddr2, size_t hw return memcmp(hwaddr1, hwaddr2, hwaddr1_len); } + +/* takes a pretty hardware address and returns the point to begin processing + * and a length or NULL if the length is unrecognized */ +const char *hwaddr_preprocess(const char *mac, size_t *length) +{ + if (!mac) + return NULL; + + if (strlen(mac) == 17) { /* a pretty MAC address */ + if (length) + *length = 6; + return mac; + } else if (strlen(mac) == 59) { /* a pretty IB address */ + if (length) + *length = 8; + return mac+36; + } else { + pb_debug("unsupported hwaddr format (length %ld)\n", strlen(mac)); + return NULL; + } +} diff --git a/lib/util/util.h b/lib/util/util.h index 416e1af..d9cc46b 100644 --- a/lib/util/util.h +++ b/lib/util/util.h @@ -54,5 +54,7 @@ void mac_str(uint8_t *mac, unsigned int maclen, char *buf, unsigned int buflen); int hwaddr_cmp(uint8_t *hwaddr1, size_t hwaddr1_len, uint8_t *hwaddr2, size_t hwaddr2_len); +const char *hwaddr_preprocess(const char *mac, size_t *length); + #endif /* UTIL_H */ From patchwork Thu Apr 16 17:59:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel M. Weeks" X-Patchwork-Id: 1271845 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4936dr0mYfz9sWY for ; Fri, 17 Apr 2020 04:08:00 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=rpi.edu Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4936dp1wblzDrhm for ; Fri, 17 Apr 2020 04:07:58 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rpi.edu (client-ip=128.113.2.230; helo=smtp10.server.rpi.edu; envelope-from=weeksd2@rpi.edu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=rpi.edu Received: from smtp10.server.rpi.edu (smtp10.server.rpi.edu [128.113.2.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4936SV4Kp4zDsG2 for ; Fri, 17 Apr 2020 03:59:54 +1000 (AEST) Received: from smtp-auth3.server.rpi.edu (route.canit.rpi.edu [128.113.2.233]) by smtp10.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 03GHxo9b096964 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 13:59:50 -0400 Received: from smtp-auth3.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth3.server.rpi.edu (Postfix) with ESMTP id 4E40558045 for ; Thu, 16 Apr 2020 13:59:50 -0400 (EDT) Received: from dev.danweeks.net (cpe-74-70-107-6.nycap.res.rr.com [74.70.107.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: weeksd2) by smtp-auth3.server.rpi.edu (Postfix) with ESMTPSA id 2E1F35800F for ; Thu, 16 Apr 2020 13:59:50 -0400 (EDT) Date: Thu, 16 Apr 2020 13:59:48 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 08/11] New function to convert pretty hwaddr to raw Message-ID: <9e7aba1f603262afc64e3d607c54e0220dc8e329.1587059235.git.weeksd2@rpi.edu> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Virus-Scanned: ClamAV using ClamSMTP X-Bayes-Prob: 0.0001 (Score 0, tokens from: outgoing, @@RPTN) X-Spam-Score: 0.00 () [Hold at 10.10] X-CanIt-Incident-Id: 032rtXOJU X-CanIt-Geo: ip=74.70.107.6; country=US; region=New York; city=Troy; latitude=42.7273; longitude=-73.6696; http://maps.google.com/maps?q=42.7273,-73.6696&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.230 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" This function extracts a method used in several places to convert a pretty hardware address back to raw bytes. It also includes support for an 8-byte hardware address. Signed-off-by: Daniel M. Weeks --- lib/util/util.c | 25 +++++++++++++++++++++++++ lib/util/util.h | 2 ++ 2 files changed, 27 insertions(+) diff --git a/lib/util/util.c b/lib/util/util.c index c965cc4..7f70084 100644 --- a/lib/util/util.c +++ b/lib/util/util.c @@ -15,6 +15,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include @@ -82,3 +83,27 @@ const char *hwaddr_preprocess(const char *mac, size_t *length) return NULL; } } + +int hwaddr_from_pretty_str(const char *hwaddr_str, size_t hwaddr_len, uint8_t *hwaddr, size_t hwaddr_size) +{ + if (hwaddr_size < hwaddr_len) + return -1; + + if (hwaddr_len == 6) { + sscanf(hwaddr_str, + "%hhX:%hhX:%hhX:%hhX:%hhX:%hhX", + hwaddr, hwaddr + 1, hwaddr + 2, + hwaddr + 3, hwaddr + 4, hwaddr + 5); + } else if (hwaddr_len == 8) { + sscanf(hwaddr_str, + "%hhX:%hhX:%hhX:%hhX:%hhX:%hhX:%hhX:%hhX", + hwaddr, hwaddr + 1, hwaddr + 2, + hwaddr + 3, hwaddr + 4, hwaddr + 5, + hwaddr + 6, hwaddr + 7); + } else { + pb_debug("unsupported hwaddr format\n"); + return -1; + } + + return 0; +} diff --git a/lib/util/util.h b/lib/util/util.h index d9cc46b..bbb6144 100644 --- a/lib/util/util.h +++ b/lib/util/util.h @@ -56,5 +56,7 @@ int hwaddr_cmp(uint8_t *hwaddr1, size_t hwaddr1_len, uint8_t *hwaddr2, size_t hw const char *hwaddr_preprocess(const char *mac, size_t *length); +int hwaddr_from_pretty_str(const char *hwaddr_str, size_t hwaddr_len, uint8_t *hwaddr, size_t hwaddr_size); + #endif /* UTIL_H */ From patchwork Thu Apr 16 18:00:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel M. Weeks" X-Patchwork-Id: 1271846 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4936f36G65z9sWb for ; Fri, 17 Apr 2020 04:08:11 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=rpi.edu Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4936f33QSHzDsGt for ; Fri, 17 Apr 2020 04:08:11 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rpi.edu (client-ip=128.113.2.229; helo=smtp9.server.rpi.edu; envelope-from=weeksd2@rpi.edu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=rpi.edu Received: from smtp9.server.rpi.edu (smtp9.server.rpi.edu [128.113.2.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4936T95LcSzDrgD for ; Fri, 17 Apr 2020 04:00:29 +1000 (AEST) Received: from smtp-auth3.server.rpi.edu (route.canit.rpi.edu [128.113.2.233]) by smtp9.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 03GI0QXP116792 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 14:00:26 -0400 Received: from smtp-auth3.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth3.server.rpi.edu (Postfix) with ESMTP id 4C5A158088 for ; Thu, 16 Apr 2020 14:00:26 -0400 (EDT) Received: from dev.danweeks.net (cpe-74-70-107-6.nycap.res.rr.com [74.70.107.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: weeksd2) by smtp-auth3.server.rpi.edu (Postfix) with ESMTPSA id 2DB9F58045 for ; Thu, 16 Apr 2020 14:00:26 -0400 (EDT) Date: Thu, 16 Apr 2020 14:00:24 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 09/11] Rename parse_mac_addr and parse GUIDs Message-ID: <87ebb71bf5e442cede33547e8d9aa7b2e0961dae.1587059235.git.weeksd2@rpi.edu> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Virus-Scanned: ClamAV using ClamSMTP X-Bayes-Prob: 0.0001 (Score 0, tokens from: outgoing, @@RPTN) X-Spam-Score: 0.00 () [Hold at 10.10] X-CanIt-Incident-Id: 022ru0qhb X-CanIt-Geo: ip=74.70.107.6; country=US; region=New York; city=Troy; latitude=42.7273; longitude=-73.6696; http://maps.google.com/maps?q=42.7273,-73.6696&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.229 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" The parse_mac_addr function is renamed to better indicate it has been simplified by way of two new common functions and now simply returns a Windows-style DHCP client ID. It also returns a placeholder "client ID" for 8-byte hardware addresses that will likely go unused in practice. Signed-off-by: Daniel M. Weeks --- discover/user-event.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/discover/user-event.c b/discover/user-event.c index 77d28c1..c1b1311 100644 --- a/discover/user-event.c +++ b/discover/user-event.c @@ -33,6 +33,7 @@ #include #include +#include #include "device-handler.h" #include "resource.h" #include "event.h" @@ -40,7 +41,7 @@ #include "sysinfo.h" -#define MAC_ADDR_SIZE 6 +#define MAX_ADDR_SIZE 8 #define IP_ADDR_SIZE 4 struct user_event { @@ -218,18 +219,23 @@ static const char *parse_host_addr(struct event *event) return NULL; } -static char *parse_mac_addr(struct discover_context *ctx, const char *mac) +static char *generate_clientid(struct discover_context *ctx, uint8_t *hwaddr, size_t hwaddr_len) { - unsigned int mac_addr_arr[MAC_ADDR_SIZE]; - char *mac_addr; - - sscanf(mac, "%X:%X:%X:%X:%X:%X", mac_addr_arr, mac_addr_arr + 1, - mac_addr_arr + 2, mac_addr_arr + 3, mac_addr_arr + 4, - mac_addr_arr + 5); - - mac_addr = talloc_asprintf(ctx, "01-%02x-%02x-%02x-%02x-%02x-%02x", - mac_addr_arr[0], mac_addr_arr[1], mac_addr_arr[2], - mac_addr_arr[3], mac_addr_arr[4], mac_addr_arr[5]); + char *mac_addr = NULL; + + if (hwaddr_len == 6) { + mac_addr = talloc_asprintf(ctx, "01-%02x-%02x-%02x-%02x-%02x-%02x", + hwaddr[0], hwaddr[1], hwaddr[2], + hwaddr[3], hwaddr[4], hwaddr[5]); + } else if (hwaddr_len == 8) { + /* this isn't actually a valid client ID for IB */ + mac_addr = talloc_asprintf(ctx, "%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x", + hwaddr[0], hwaddr[1], hwaddr[2], + hwaddr[3], hwaddr[4], hwaddr[5], + hwaddr[6], hwaddr[7]); + } else { + pb_debug("unsupported hwaddr format\n"); + } return mac_addr; } @@ -334,16 +340,19 @@ struct pb_url *user_event_parse_conf_url(struct discover_context *ctx, char **user_event_parse_conf_filenames( struct discover_context *ctx, struct event *event) { - char *mac_addr, *ip_hex; + char *mac_addr = NULL, *ip_hex; const char *mac, *ip; char **filenames; int index, len; + uint8_t hwaddr[MAX_ADDR_SIZE]; + size_t hwaddr_len; mac = event_get_param(event, "mac"); - if (mac) - mac_addr = parse_mac_addr(ctx, mac); - else - mac_addr = NULL; + if (mac) { + mac = hwaddr_preprocess(mac, &hwaddr_len); + if (hwaddr_from_pretty_str(mac, hwaddr_len, hwaddr, sizeof(hwaddr)) == 0) + mac_addr = generate_clientid(ctx, hwaddr, hwaddr_len); + } ip = event_get_param(event, "ip"); if (ip) { From patchwork Thu Apr 16 18:00:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel M. Weeks" X-Patchwork-Id: 1271847 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4936fG6nDLz9sWf for ; Fri, 17 Apr 2020 04:08:22 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=rpi.edu Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4936fG4cn7zDr8V for ; Fri, 17 Apr 2020 04:08:22 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rpi.edu (client-ip=128.113.2.230; helo=smtp10.server.rpi.edu; envelope-from=weeksd2@rpi.edu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=rpi.edu Received: from smtp10.server.rpi.edu (smtp10.server.rpi.edu [128.113.2.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4936Tb5FxFzDrdD for ; Fri, 17 Apr 2020 04:00:50 +1000 (AEST) Received: from smtp-auth3.server.rpi.edu (route.canit.rpi.edu [128.113.2.233]) by smtp10.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 03GI0iwA097130 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 14:00:44 -0400 Received: from smtp-auth3.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth3.server.rpi.edu (Postfix) with ESMTP id 2B113580D3 for ; Thu, 16 Apr 2020 14:00:44 -0400 (EDT) Received: from dev.danweeks.net (cpe-74-70-107-6.nycap.res.rr.com [74.70.107.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: weeksd2) by smtp-auth3.server.rpi.edu (Postfix) with ESMTPSA id 0CB78580D2 for ; Thu, 16 Apr 2020 14:00:44 -0400 (EDT) Date: Thu, 16 Apr 2020 14:00:42 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 10/11] Parse GUIDs in DHCP user events Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Virus-Scanned: ClamAV using ClamSMTP X-Bayes-Prob: 0.0001 (Score 0, tokens from: outgoing, @@RPTN) X-Spam-Score: 0.00 () [Hold at 10.10] X-CanIt-Incident-Id: 032ru0IL1 X-CanIt-Geo: ip=74.70.107.6; country=US; region=New York; city=Troy; latitude=42.7273; longitude=-73.6696; http://maps.google.com/maps?q=42.7273,-73.6696&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.230 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" Use new, common functions to preprocess and transform hardware addresses to strip any non-local address information. Signed-off-by: Daniel M. Weeks --- discover/device-handler.c | 2 ++ discover/user-event.c | 25 +++++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/discover/device-handler.c b/discover/device-handler.c index 4dfe537..da65125 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -27,6 +27,7 @@ #include #include +#include #include "device-handler.h" #include "discover-server.h" #include "devmapper.h" @@ -1491,6 +1492,7 @@ static void process_url_cb(struct load_url_result *result, void *data) } mac = event_get_param(event, "mac"); + mac = hwaddr_preprocess(mac, NULL); char *url = talloc_asprintf(event, "file://%s", result->local); event_set_param(event, "pxeconffile-local", url); diff --git a/discover/user-event.c b/discover/user-event.c index c1b1311..0263423 100644 --- a/discover/user-event.c +++ b/discover/user-event.c @@ -396,18 +396,20 @@ static int user_event_dhcp(struct user_event *uev, struct event *event) { struct device_handler *handler = uev->handler; struct discover_device *dev; + const char *mac; - uint8_t hwaddr[MAC_ADDR_SIZE]; + uint8_t hwaddr[MAX_ADDR_SIZE]; + size_t hwaddr_len; - sscanf(event_get_param(event, "mac"), - "%hhX:%hhX:%hhX:%hhX:%hhX:%hhX", - hwaddr, hwaddr + 1, hwaddr + 2, - hwaddr + 3, hwaddr + 4, hwaddr + 5); + mac = event_get_param(event, "mac"); + mac = hwaddr_preprocess(mac, &hwaddr_len); + if (hwaddr_from_pretty_str(mac, hwaddr_len, hwaddr, MAX_ADDR_SIZE) < 0) + return -1; - system_info_set_interface_address(sizeof(hwaddr), hwaddr, + system_info_set_interface_address(hwaddr_len, hwaddr, event_get_param(event, "ip")); - dev = discover_device_create(handler, event_get_param(event, "mac"), + dev = discover_device_create(handler, mac, event->device); device_handler_dhcp(handler, dev, event); @@ -420,10 +422,12 @@ static int user_event_add(struct user_event *uev, struct event *event) struct device_handler *handler = uev->handler; struct discover_context *ctx; struct discover_device *dev; + const char *mac; /* In case this is a network interface, try to refer to it by UUID */ - dev = discover_device_create(handler, event_get_param(event, "mac"), - event->device); + mac = event_get_param(event, "mac"); + mac = hwaddr_preprocess(mac, NULL); + dev = discover_device_create(handler, mac, event->device); dev->device->id = talloc_strdup(dev, event->device); ctx = device_handler_discover_context_create(handler, dev); @@ -441,9 +445,10 @@ static int user_event_remove(struct user_event *uev, struct event *event) struct device_handler *handler = uev->handler; struct discover_device *dev; const char *mac = event_get_param(event, "mac"); + mac = hwaddr_preprocess(mac, NULL); if (mac) - dev = device_lookup_by_uuid(handler, event_get_param(event, "mac")); + dev = device_lookup_by_uuid(handler, mac); else dev = device_lookup_by_id(handler, event->device); From patchwork Thu Apr 16 18:00:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel M. Weeks" X-Patchwork-Id: 1271848 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4936fY3Y3fz9sWc for ; Fri, 17 Apr 2020 04:08:37 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=rpi.edu Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4936fY2q6JzDrhc for ; Fri, 17 Apr 2020 04:08:37 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rpi.edu (client-ip=128.113.2.229; helo=smtp9.server.rpi.edu; envelope-from=weeksd2@rpi.edu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=rpi.edu Received: from smtp9.server.rpi.edu (smtp9.server.rpi.edu [128.113.2.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4936Tj5tfczDrgD for ; Fri, 17 Apr 2020 04:00:56 +1000 (AEST) Received: from smtp-auth3.server.rpi.edu (route.canit.rpi.edu [128.113.2.233]) by smtp9.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 03GI0rUk116883 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 14:00:53 -0400 Received: from smtp-auth3.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth3.server.rpi.edu (Postfix) with ESMTP id 59FFF580DF for ; Thu, 16 Apr 2020 14:00:53 -0400 (EDT) Received: from dev.danweeks.net (cpe-74-70-107-6.nycap.res.rr.com [74.70.107.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: weeksd2) by smtp-auth3.server.rpi.edu (Postfix) with ESMTPSA id 34EAB580DC for ; Thu, 16 Apr 2020 14:00:53 -0400 (EDT) Date: Thu, 16 Apr 2020 14:00:51 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 11/11] Ready interfaces with hwaddr longer than MAC Message-ID: <563dd5f2e23dbc029976b34fc13ac6f0ddd8751e.1587059235.git.weeksd2@rpi.edu> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Virus-Scanned: ClamAV using ClamSMTP X-Bayes-Prob: 0.0001 (Score 0, tokens from: outgoing, @@RPTN) X-Spam-Score: 0.00 () [Hold at 10.10] X-CanIt-Incident-Id: 022ru0RhR X-CanIt-Geo: ip=74.70.107.6; country=US; region=New York; city=Troy; latitude=42.7273; longitude=-73.6696; http://maps.google.com/maps?q=42.7273,-73.6696&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.229 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" With all other components prepared to parse, display, store and load hardware addresses longer than a MAC address (at least an Infiniband GUID), ready interfaces up to the maximum hardware address size supported. Signed-off-by: Daniel M. Weeks --- discover/network.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discover/network.c b/discover/network.c index 6887fc5..099ca98 100644 --- a/discover/network.c +++ b/discover/network.c @@ -673,7 +673,7 @@ void network_mark_interface_ready(struct device_handler *handler, return; } - if (hwsize != MAC_HWADDR_SIZE) + if (hwsize > MAX_HWADDR_SIZE) return; if (strncmp(ifname, "lo", strlen("lo")) == 0)