From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 28A39C433F5 for ; Mon, 24 Jan 2022 13:09:36 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2986880FC6; Mon, 24 Jan 2022 14:09:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bQBbutgg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 41B3682EBB; Sat, 22 Jan 2022 16:16:51 +0100 (CET) Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 77B0A82045 for ; Sat, 22 Jan 2022 16:16:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=lylejfranklin@gmail.com Received: by mail-qt1-x834.google.com with SMTP id p3so8324822qtn.13 for ; Sat, 22 Jan 2022 07:16:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e8G6tuTjFhWnjRFFJ/cSiBY9ybF4SICsiSaaEymrbfA=; b=bQBbutggCTzJIS0UUbDt7+n8nBNvHAomKWKZGRG4eE8qvpHQDSakaDtBrr/NRH5zo+ Hvz331q2wuTufLj1m9wCxtD3JCFmsn0YkM6N23AbcmHfEf2xKu9MzMzslrpdO6XceRNW pnd0KeyeSIi+PdS+tKFyQRtzNQIbxPDQt6YZ5YgdfD9uCjdEKc9Ve2QrCEM6+/XogehR ZSg99xwPpLFjwpqKnL4zV7mEqLSxKIqPKeS+E3ZeN5n+9TMZ0c7Gcpv47VtFtzsBnYla wcDPqY1b2WfglMMgZsKFKvvZ9P2MCPsYWX7ZDxVD39YPPPtIf9atqduK5CdzoOeyXTVJ 7/Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e8G6tuTjFhWnjRFFJ/cSiBY9ybF4SICsiSaaEymrbfA=; b=ZyubkbxysytvQ/t7FgVqH/ybUGWIbdRuc840rERb517SvmVDXIAolwNF/XnROzrm+4 25rDYUBdde7rx2aFTgfnwD6777fQrrTTWNNHmPyVtdo/+VtGD6rPN4CNWZhdruiu77ZI Sqy2zu3j3PhTRPG0O6DATY1kfrW3Xwp1neBrruYKSESbm2AgXa57L3kqiN3IvyvujE1L XvMXZsovO9fEZFnG7he0LgEYipgPB2iWUWl8HHUiV1CVc8I/HlnvpAvj6iNtH9r/m29M L/yPdBW3mpMQwLt8ypWsqQbWsKAvf81DyFkDCz8eBJ7cl9TEhc/Cs8ueR2i1O0r+kNTU tZjw== X-Gm-Message-State: AOAM5320Q6bmyrwKIJeJDszpwmrvqDJDhTsSYnP93T80lWEE7IKCwMjS OGs1EREKPxXEsSnOyYKUhhw= X-Google-Smtp-Source: ABdhPJzrIVIXcKqwhCtEpmgHzHjJ33DFtYkfgu6sAyTmBbkWCtfBjEUcFv+6Mnvh2DB5yR+QY+GY2Q== X-Received: by 2002:ac8:4e4c:: with SMTP id e12mr6988584qtw.122.1642864607335; Sat, 22 Jan 2022 07:16:47 -0800 (PST) Received: from vega.localdomain (cpe-24-193-118-159.nyc.res.rr.com. [24.193.118.159]) by smtp.googlemail.com with ESMTPSA id v21sm4520801qtx.13.2022.01.22.07.16.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jan 2022 07:16:46 -0800 (PST) From: Lyle Franklin To: rfried.dev@gmail.com Cc: u-boot@lists.denx.de, joe.hershberger@ni.com, Lyle Franklin Subject: [PATCH v2] Allow colon in PXE bootfile URLs Date: Sat, 22 Jan 2022 10:16:36 -0500 Message-Id: <20220122151636.11887-1-lylejfranklin@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Mon, 24 Jan 2022 14:09:32 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean - U-boot's PXE flow supports prefixing your bootfile name with an IP address to fetch from a server other than the DHCP server, e.g. `hostIPaddr:bootfilename`: https://github.com/u-boot/u-boot/commit/a93907c43f847f076dd0e34ee3b69b5e8e6d0d29 - However, this breaks bootfile paths which contain a colon, e.g. `f0:ad:4e:10:1b:87/7/pxelinux.cfg/default` - This patch checks whether the `hostIPaddr` prefix is a valid IP address before overriding the serverIP otherwise the whole bootfile path is preserved Signed-off-by: Lyle Franklin --- net/net.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/net.c b/net/net.c index 072a82d8f9..57ed77795a 100644 --- a/net/net.c +++ b/net/net.c @@ -1538,14 +1538,18 @@ int is_serverip_in_cmd(void) int net_parse_bootfile(struct in_addr *ipaddr, char *filename, int max_len) { char *colon; + struct in_addr ip; if (net_boot_file_name[0] == '\0') return 0; colon = strchr(net_boot_file_name, ':'); if (colon) { - if (ipaddr) - *ipaddr = string_to_ip(net_boot_file_name); + ip = string_to_ip(net_boot_file_name); + if (ipaddr && ip.s_addr) + *ipaddr = ip; + } + if (ip.s_addr) { strncpy(filename, colon + 1, max_len); } else { strncpy(filename, net_boot_file_name, max_len); -- 2.31.1