From nobody Thu Sep 11 17:06:45 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cN3r61yplz66vJC; Thu, 11 Sep 2025 17:06:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cN3r52cW6z3Tkj; Thu, 11 Sep 2025 17:06:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757610405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jyA1Np6n2PVSTXly9x15zpekzeDOdFjbGs+tBHJnJbM=; b=xjZIg0vzw5aenOPLnky/IiYYpfrJeC1yNos6SEuvktM3r8tPENFld733FVxpmzrCmbyNCc Y3T/49m8mtxajKIJP6QqF9MpPwFnrR66LLTM1qYVv7Nadunau+w2JHGMKqRbrlPknaCRjA DwXG1qBOWbQ8ZOCQLalhxW1Pn8RRkDUEu01zx+/K8o0bJGKTngNh5dwEP76ljGL/Le3srd 0C9BadbefHs9WDefzDoODfCVBgf+B8qAZW/MIIqTA5ee5SGE93fS/VgsVF+8fw88FBt71C uXw7tjmFa7ESfg5ZZEZYqgYFNTIDef3/AIfLLfXuJUj5+DmPpTjCgiClPiCa0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757610405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jyA1Np6n2PVSTXly9x15zpekzeDOdFjbGs+tBHJnJbM=; b=wrtYD1w9hYwjfRHXrtGFKfi0tztl5hh3PE4X+N4zDDhYUNlqZ1A7VqojXdv/XT5FjoylZf P/ipwo9f9Y1zhhKC/TKin2sGQrTW6wf03/Ptz9RQrOTUwSG7Vky40QVNpQBNaeiCKdtOkn Aoa4NLyuUl2n3FqEvn6DogiArIC1RpMktRthgEiud8+DI50xRuVjYMqNmlfLQoxSPQY6Rx kP2oOwBmdgJp8+z5syKb0z2FK9He7tiNn5XIE1aUrtR5HN0V9Z7d0ktrNeUZsNM59JuPHx B/z1qc9uPAi7XjIb6OCjyvSIq1Eb4Upj4M7suKfjukkahBGX1Ch4XUwY9/7YCA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757610405; a=rsa-sha256; cv=none; b=b1EuMY8/Orhh8wz4saqH9kGWZfETab7C3xAVpZCKzXn4Uok3YhirUQLLezDbqGA9938Zao hbWBAFBqeXfgiSEjSAEyFK3TDndJOBel9DUmeBvSsjJPhAbUSioZXEVZw8WykI8L6+5BW8 fovKh120GTXGBJdDeDwP2OpZMPWvT/oMKSAlDOCBqayezyzag93ke0hcO9KQgFxv6m9F+I Vw5yjEsmVQK1Q/gCgpjV4ziOtgV7uk6eUoX7YKN9F00iiDRgislqMsUXBSyOf/r+jNy57X TsSOA7XYCuZWuaqzPL9eAfEWPcbmgbatNgnL5eeS8IuYRDZZbmkxeSbam9rdag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cN3r51tRWz1gs; Thu, 11 Sep 2025 17:06:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58BH6j6w097464; Thu, 11 Sep 2025 17:06:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58BH6jJH097461; Thu, 11 Sep 2025 17:06:45 GMT (envelope-from git) Date: Thu, 11 Sep 2025 17:06:45 GMT Message-Id: <202509111706.58BH6jJH097461@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jes=C3=BAs?= Daniel Colmenares Oviedo Subject: git: 95230b248f64 - main - nuageinit: Allow the use of network parameters from network-config List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dtxdf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95230b248f6412c2d1c416c1e9795c3192cdf750 Auto-Submitted: auto-generated The branch main has been updated by dtxdf: URL: https://cgit.FreeBSD.org/src/commit/?id=95230b248f6412c2d1c416c1e9795c3192cdf750 commit 95230b248f6412c2d1c416c1e9795c3192cdf750 Author: Jesús Daniel Colmenares Oviedo AuthorDate: 2025-09-11 16:52:30 +0000 Commit: Jesús Daniel Colmenares Oviedo CommitDate: 2025-09-11 17:06:03 +0000 nuageinit: Allow the use of network parameters from network-config To better comply with the cloud-init specification, we need to support the configuration of network-related parameters from the network-config file, which is common in most deployments. Reviewed by: bapt@ Approved by: bapt@ Differential Revision: https://reviews.freebsd.org/D52419 --- libexec/nuageinit/nuageinit | 31 ++++++++++++++++++++++++++++++- libexec/nuageinit/nuageinit.7 | 7 +++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/libexec/nuageinit/nuageinit b/libexec/nuageinit/nuageinit index 70b27cb33d87..52bfc4d9f69f 100755 --- a/libexec/nuageinit/nuageinit +++ b/libexec/nuageinit/nuageinit @@ -582,6 +582,26 @@ local function config2_network(p) routing:close() end +local function parse_network_config() + local nc_file = ni_path .. "/network-config" + local nc_file_attr = lfs.attributes(nc_file) + if nc_file_attr == nil then + return + end + local f, err = io.open(nc_file) + if err then + nuage.err("error parsing nocloud network-config: " .. err) + end + local obj = yaml.load(f:read("*a")) + f:close() + if not obj then + nuage.err("error parsing nocloud network-config") + end + local netobj = {} + netobj["network"] = obj + return netobj +end + if citype == "config-2" then local parser = ucl.parser() local res, err = parser:parse_file(ni_path .. "/meta_data.json") @@ -678,7 +698,16 @@ if line == "#cloud-config" then end for i = 1, #calls_table do - calls_table[i](obj) + if citype == "nocloud" and calls_table[i] == network_config then + netobj = parse_network_config() + if netobj == nil then + network_config(obj) + else + network_config(netobj) + end + else + calls_table[i](obj) + end end elseif line:sub(1, 2) == "#!" then -- delay for execution at rc.local time -- diff --git a/libexec/nuageinit/nuageinit.7 b/libexec/nuageinit/nuageinit.7 index bfa028fe3fa3..84990c93e545 100644 --- a/libexec/nuageinit/nuageinit.7 +++ b/libexec/nuageinit/nuageinit.7 @@ -182,6 +182,13 @@ configuration in .Pa /etc/ssh/sshd_config .It Ic network Network configuration parameters. +.Pp +Specifying the following parameters from a file named +.Pa network-config +takes precedence over their specification from the +.Ic network +parameter of +.Pa user-data Ns . .Bl -tag -width "ethernets" .It Ic ethernets Mapping representing a generic configuration for existing network interfaces.