From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id CBCB897844 for ; Tue, 5 Mar 2024 13:54:41 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B43097DD9 for ; Tue, 5 Mar 2024 13:54:41 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 5 Mar 2024 13:54:40 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 688EE487A9 for ; Tue, 5 Mar 2024 13:54:40 +0100 (CET) From: Christian Ebner To: pve-devel@lists.proxmox.com Date: Tue, 5 Mar 2024 13:54:30 +0100 Message-Id: <20240305125431.273796-3-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305125431.273796-1-c.ebner@proxmox.com> References: <20240305125431.273796-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.041 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [nodeconfig.pm, nodes.pm] Subject: [pve-devel] [PATCH manager 2/3] fix #5255: node: wol: configurable broadcast address X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2024 12:54:41 -0000 Allows to configure a custom broadcast address to use when sending a wake on lan packet to wake a remote node. Default behaviour remains to fallback to 255.255.255.255. Signed-off-by: Christian Ebner --- PVE/API2/Nodes.pm | 3 ++- PVE/NodeConfig.pm | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm index 620dac1c..e73fc28f 100644 --- a/PVE/API2/Nodes.pm +++ b/PVE/API2/Nodes.pm @@ -697,11 +697,12 @@ __PACKAGE__->register_method({ my $local_config = PVE::NodeConfig::load_config($local_node); my $bind_iface = $local_config->{'wakeonlan-bind-interface'}; + my $broadcast_addr = $local_config->{'wakeonlan-broadcast-address'} // '255.255.255.255'; $mac_addr =~ s/://g; my $packet = chr(0xff) x 6 . pack('H*', $mac_addr) x 16; - my $addr = gethostbyname('255.255.255.255'); + my $addr = gethostbyname($broadcast_addr); my $port = getservbyname('discard', 'udp'); my $to = Socket::pack_sockaddr_in($port, $addr); diff --git a/PVE/NodeConfig.pm b/PVE/NodeConfig.pm index 5450ab2f..e3feaaa6 100644 --- a/PVE/NodeConfig.pm +++ b/PVE/NodeConfig.pm @@ -97,6 +97,12 @@ my $confdesc = { format => 'pve-iface', optional => 1, }, + 'wakeonlan-broadcast-address' => { + type => 'string', + description => 'IPv4 broadcast address to use when sending wake on LAN packet', + format => 'ipv4', + optional => 1, + }, 'startall-onboot-delay' => { description => 'Initial delay in seconds, before starting all the Virtual Guests with on-boot enabled.', type => 'integer', -- 2.39.2