From patchwork Thu Apr 16 18:02:01 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: 1271850 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 4936fy4l1bz9sWb for ; Fri, 17 Apr 2020 04:08:58 +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 4936fy2S3gzDrCm for ; Fri, 17 Apr 2020 04:08: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.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 4936W3371kzDqkS for ; Fri, 17 Apr 2020 04:02:06 +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 03GI22UJ117151 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 14:02:03 -0400 Received: from smtp-auth2.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth2.server.rpi.edu (Postfix) with ESMTP id 9189E1A0B3 for ; Thu, 16 Apr 2020 14:02:02 -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 6F53C1A096 for ; Thu, 16 Apr 2020 14:02:02 -0400 (EDT) Date: Thu, 16 Apr 2020 14:02:01 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 1/5] New function to find hardware address of interface 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: 022ru22jT 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" Return the hardware address of an interface based on its type. The address may be truncated if the supplied buffer is too short but the function will always return the actual length of the address. Signed-off-by: Daniel M. Weeks --- discover/network.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ discover/network.h | 2 ++ 2 files changed, 47 insertions(+) diff --git a/discover/network.c b/discover/network.c index 099ca98..ad7eced 100644 --- a/discover/network.c +++ b/discover/network.c @@ -5,7 +5,10 @@ #include #include #include +#include #include +#include +#include #include #include #include @@ -239,6 +242,48 @@ static void remove_interface(struct network *network, talloc_free(interface); } +int network_get_hwaddr(const char *ifname, uint8_t *dest, size_t dest_len) +{ + struct ifaddrs *ifaddr, *ifa; + struct sockaddr_ll *sll; + int chomp; + + int ret = -1; + size_t len; + + if (getifaddrs(&ifaddr) < 0) + return -1; + + for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) { + if (strcmp(ifname, ifa->ifa_name) == 0) { + sll = (struct sockaddr_ll *) ifa->ifa_addr; + + switch (sll->sll_hatype) { + case ARPHRD_ETHER: + chomp = 0; + break; + case ARPHRD_INFINIBAND: + chomp = 12; + break; + default: + chomp = -1; + break; + } + + if (chomp >= 0) { + len = sll->sll_halen - chomp; + memcpy(dest, sll->sll_addr+chomp, dest_len); + ret = len; + } + + break; + } + } + + freeifaddrs(ifaddr); + return ret; +} + void network_register_device(struct network *network, struct discover_device *dev) { diff --git a/discover/network.h b/discover/network.h index 0cea6f2..d802962 100644 --- a/discover/network.h +++ b/discover/network.h @@ -6,6 +6,8 @@ struct device_handler; struct discover_device; struct waitset; +int network_get_hwaddr(const char *ifname, uint8_t *dest, size_t dest_len); + struct network *network_init(struct device_handler *handler, struct waitset *waitset, bool dry_run); int network_shutdown(struct network *network); From patchwork Thu Apr 16 18:02:10 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: 1271851 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 4936gB6bv7z9sWb for ; Fri, 17 Apr 2020 04:09: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 4936g93qqnzDrhf for ; Fri, 17 Apr 2020 04:09:09 +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 4936WG2ZLLzDsM2 for ; Fri, 17 Apr 2020 04:02:17 +1000 (AEST) Received: from smtp-auth1.server.rpi.edu (route.canit.rpi.edu [128.113.2.231]) by smtp10.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 03GI2Crn097452 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 14:02:12 -0400 Received: from smtp-auth1.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth1.server.rpi.edu (Postfix) with ESMTP id 33A23580B6 for ; Thu, 16 Apr 2020 14:02:12 -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 14AC7580B5 for ; Thu, 16 Apr 2020 14:02:12 -0400 (EDT) Date: Thu, 16 Apr 2020 14:02:10 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 2/5] New function to append raw hardware addr to string 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: 032ru2cNg 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" It may be necessary to append a raw hardware address to another string. For example, the defacto standard for identifying hosts during DHCP over IB involves appending the IB adapter GUID to a particular prefix. Signed-off-by: Daniel M. Weeks --- discover/network.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/discover/network.c b/discover/network.c index ad7eced..bb76109 100644 --- a/discover/network.c +++ b/discover/network.c @@ -72,6 +72,13 @@ struct network { bool dry_run; }; +static void append_hwaddr_str(uint8_t *hwaddr, size_t hwaddr_len, char *dest) +{ + size_t i; + for (i = 0; i < hwaddr_len; i++) + sprintf(dest + (i * 2), "%02x", hwaddr[i]); +} + static char *mac_bytes_to_string(void *ctx, uint8_t *addr, int len) { const int l = strlen("xx:"); From patchwork Thu Apr 16 18:02:21 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: 1271852 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 4936gN05CVz9sWb for ; Fri, 17 Apr 2020 04:09:20 +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 4936gM6Kg9zDrhF for ; Fri, 17 Apr 2020 04:09: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.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 4936WR218ZzDqkS for ; Fri, 17 Apr 2020 04:02:26 +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 03GI2NK2117216 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 14:02:23 -0400 Received: from smtp-auth1.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth1.server.rpi.edu (Postfix) with ESMTP id 427DA58100 for ; Thu, 16 Apr 2020 14:02:23 -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 22726580FF for ; Thu, 16 Apr 2020 14:02:23 -0400 (EDT) Date: Thu, 16 Apr 2020 14:02:21 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 3/5] Add DHCP client identifier for IB 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: 022ru2nkp 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" When using DHCP to configure an interface, assume it's an Infiniband interface if its address length is >6 bytes, in which case add DHCP option 61 containing an industry-standard client identifier. Signed-off-by: Daniel M. Weeks --- discover/network.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/discover/network.c b/discover/network.c index bb76109..5f3a05c 100644 --- a/discover/network.c +++ b/discover/network.c @@ -375,7 +375,7 @@ static void configure_interface_dhcp(struct network *network, struct interface *interface) { const struct platform *platform; - char pidfile[256], id[10]; + char pidfile[256], id[10], id2[45] = "0x3d:ff000000000002000002c900"; struct process *process; int rc; const char *argv[] = { @@ -388,6 +388,7 @@ static void configure_interface_dhcp(struct network *network, "-p", pidfile, "-i", interface->name, "-x", id, /* [11,12] - dhcp client identifier */ + "-x", id2, NULL, }; @@ -403,6 +404,12 @@ static void configure_interface_dhcp(struct network *network, else argv[11] = NULL; + if (interface->hwaddr_len > 6) { + append_hwaddr_str(interface->hwaddr, interface->hwaddr_len, id2+strlen(id2)); + } else { + argv[15] = NULL; + } + process = process_create(interface); process->path = pb_system_apps.udhcpc; From patchwork Thu Apr 16 18:02:30 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: 1271853 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 4936gd1l0xz9sWb for ; Fri, 17 Apr 2020 04:09: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 4936gc1qN1zDrCP for ; Fri, 17 Apr 2020 04:09: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.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 4936Wf3wkCzDrgC for ; Fri, 17 Apr 2020 04:02:37 +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 03GI2WE0117237 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 14:02:33 -0400 Received: from smtp-auth3.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth3.server.rpi.edu (Postfix) with ESMTP id 83F05580E4 for ; Thu, 16 Apr 2020 14:02:32 -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 65049580CF for ; Thu, 16 Apr 2020 14:02:32 -0400 (EDT) Date: Thu, 16 Apr 2020 14:02:30 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 4/5] Do not require ID_NET_NAME_MAC from udev Message-ID: <68683873a4f78f0deb4a5601ce6390c2c954e04f.1587059223.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: 022ru2wkA 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" If ID_NET_NAME_MAC is not available for an interface, try to find the hardware address of the interface. If a compatible address is found, ready the interface. Signed-off-by: Daniel M. Weeks --- discover/udev.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/discover/udev.c b/discover/udev.c index 470bbc3..8a32815 100644 --- a/discover/udev.c +++ b/discover/udev.c @@ -242,9 +242,11 @@ static int udev_check_interface_ready(struct device_handler *handler, struct udev_device *dev) { const char *name, *name_path, *ifindex, *interface, *mac_name; - uint8_t *mac; + uint8_t *mac, *hwaddr; char byte[3]; unsigned int i, j; + int len; + int ret = -1; name = udev_device_get_sysname(dev); @@ -259,12 +261,36 @@ static int udev_check_interface_ready(struct device_handler *handler, mac_name = udev_device_get_property_value(dev, "ID_NET_NAME_MAC"); /* Physical interfaces should have all of these properties */ - if (!name_path || !ifindex || !interface || !mac_name) { + if (!ifindex || !interface) { pb_debug("%s: interface %s missing properties\n", __func__, name); return -1; } + if (!mac_name) { + pb_debug("%s: ready non-MAC interface %s\n", + __func__, name); + + /* only try to get up to 8 bytes (IB GUID length) */ + hwaddr = talloc_array(handler, uint8_t, MAX_HWADDR_SIZE); + if (!hwaddr) + return -1; + + len = network_get_hwaddr(name, hwaddr, MAX_HWADDR_SIZE); + if (len < 0) { + pb_log("Unable to get hwaddr for %s\n", name); + } else if (len > MAX_HWADDR_SIZE) { + pb_log("hwaddr for %s too long\n", name); + } else { + pb_debug("Got %d byte hwaddr for %s\n", len, name); + network_mark_interface_ready(handler, atoi(ifindex), + interface, hwaddr, len); + ret = 0; + } + talloc_free(hwaddr); + return ret; + } + /* ID_NET_NAME_MAC format is enxMACADDR */ if (strlen(mac_name) < 15) { pb_debug("%s: Unexpected MAC format: %s\n", From patchwork Thu Apr 16 18:02:40 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: 1271854 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 4936gv0nl5z9sWb for ; Fri, 17 Apr 2020 04:09:47 +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 4936gt6fczzDrg6 for ; Fri, 17 Apr 2020 04:09:46 +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 4936Wn3RVszDrCB for ; Fri, 17 Apr 2020 04:02:44 +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 03GI2fMC097548 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 14:02:42 -0400 Received: from smtp-auth3.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth3.server.rpi.edu (Postfix) with ESMTP id B8A71580F4 for ; Thu, 16 Apr 2020 14:02:41 -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 9980A580F3 for ; Thu, 16 Apr 2020 14:02:41 -0400 (EDT) Date: Thu, 16 Apr 2020 14:02:40 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 5/5] Always bring up network interfaces 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: 032ru2FNX 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 is necessary to process IB interfaces when a specific interface has been selected for DHCP, otherwise IB interfaces will not be listed in the info or config UIs. When IB interfaces are first discovered, they do not have a unique hardware address so they are not registered. Bringing them up even if they won't ultimately be configured gives them a second chance to be registered. Signed-off-by: Daniel M. Weeks --- discover/network.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/discover/network.c b/discover/network.c index 5f3a05c..b00190e 100644 --- a/discover/network.c +++ b/discover/network.c @@ -522,15 +522,6 @@ static void configure_interface(struct network *network, return; } - /* if we're in manual config mode, we need an interface configuration */ - if (network->manual_config && !config) { - interface->state = IFSTATE_IGNORED; - pb_log("network: skipping %s: manual config mode, " - "but no config for this interface\n", - interface->name); - return; - } - /* new interface? bring up to the point so we can detect a link */ if (interface->state == IFSTATE_NEW) { if (!up) { @@ -544,6 +535,15 @@ static void configure_interface(struct network *network, } } + /* if we're in manual config mode, we need an interface configuration */ + if (network->manual_config && !config) { + interface->state = IFSTATE_IGNORED; + pb_log("network: skipping %s: manual config mode, " + "but no config for this interface\n", + interface->name); + return; + } + /* no link? wait for a notification */ if (interface->state == IFSTATE_UP_WAITING_LINK && !link) return;