On Thu, Feb 22, 2024 at 09:16:24AM +0100, Lucas Bonnet wrote:
>
> Hello dear Debian maintainers,
>
> I can confirm that the 2020 patch from Carsten Schoenert still applies
> to d-i/netcfg releases 1.187 and 1.188, and result in a debian installer
> that knows about VLANs and can be fully automated with a preseed config
> like the following:
>
> d-i netcfg/enableboolean true
> d-i netcfg/use_vlan boolean true
> d-i netcfg/vlan_id string 1001
> d-i netcfg/choose_interface select ens3f0np0
>
>
> We would be interested in helping push the patch upstream so that other
> users can enjoy this without having to build and make their own initrd,
> how can we help?
>
>
> Regards,
> --
> Lucas Bonnet
> Bearstech - http://bearstech.com
>
Sorry, I have to disagree with you here -- the patch certainly does not apply
cleanly anymore. Even after fixing it up, I faced installation issues as it
attempts to add the VLAN subinterface twice, and fails the second time due to
it already existing.
The VLAN code does not use ioctls/netlink and instead shells out to ip link/
ifconfig for Linux and FreeBSD respectively. I took a quick look at what it
would take to shift this code over to ioctls, but it seems there are inherent
differences in the ioctl interface between the two OS-es that would make it
non-trivial to support both at that level. I would be curious to hear the
maintainers feedback as to whether or not this is acceptable.
I'm attaching a patch that applies cleanly against 1.188 and was tested
against a patched bookworm initrd with success.
Cheers,
Tyler
>From d7127bafc4520d3675061ec7225966ce204d9495 Mon Sep 17 00:00:00 2001
From: "Tyler J. Stachecki"
Date: Mon, 27 May 2024 13:01:44 -0400
Subject: [PATCH] Add VLAN support to d-i/netcfg
---
Makefile | 2 +-
debian/netcfg-common.templates | 28
dhcp.c | 2 +-
netcfg-common.c| 32 -
netcfg.c | 17 +++--
netcfg.h | 10 +++
nm-conf.c | 33 ++
nm-conf.h | 10 ++-
static.c | 12 ++--
vlan.c | 114 +
wireless.c | 4 +-
write_interface.c | 18 ++
12 files changed, 262 insertions(+), 20 deletions(-)
create mode 100644 vlan.c
diff --git a/Makefile b/Makefile
index a15d476f..03343c94 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ TARGETS ?= netcfg-static netcfg
LDOPTS = -ldebconfclient -ldebian-installer
CFLAGS = -W -Wall -Werror -DNDEBUG -DNETCFG_VERSION="\"$(NETCFG_VERSION)\"" -I.
-COMMON_OBJS = netcfg-common.o wireless.o write_interface.o ipv6.o
+COMMON_OBJS = netcfg-common.o wireless.o write_interface.o ipv6.o vlan.o
NETCFG_O = netcfg.o dhcp.o static.o ethtool-lite.o wpa.o wpa_ctrl.o rdnssd.o autoconfig.o
NETCFG_STATIC_O = netcfg-static.o static.o ethtool-lite.o
diff --git a/debian/netcfg-common.templates b/debian/netcfg-common.templates
index 7cba22ec..4f848df5 100644
--- a/debian/netcfg-common.templates
+++ b/debian/netcfg-common.templates
@@ -26,6 +26,34 @@ _Description: Domain name:
If you are setting up a home network, you can make something up, but make
sure you use the same domain name on all your computers.
+Template: netcfg/use_vlan
+Type: boolean
+Default: false
+# :sl6:
+_Description: Are you connected to an IEEE 802.1Q VLAN trunk port?
+ Virtual LAN (VLAN) is a concept of partitioning a physical network to create
+ distinct broadcast domains. Packets can be marked for different IDs by
+ tagging, so that a single interconnect (trunk) may be used to transport
+ data for various VLANs.
+ .
+ If your network interface is directly connected to a VLAN trunk port,
+ specifying a VLAN ID may be necessary to get a working connection.
+
+Template: netcfg/vlan_id
+Type: string
+# :sl6:
+_Description: VLAN ID (1-4094):
+ If your network interface is directly connected to a VLAN trunk port,
+ specifying a VLAN ID may be necessary to get a working connection.
+
+Template: netcfg/vlan_failed
+Type: error
+# :sl6:
+_Description: Error setting up VLAN
+ The command used to set up VLAN during the installation returned an
+ error, please check installer logs, or go back and try another
+ configuration.
+
Template: netcfg/get_nameservers
Type: string
# :sl1:
diff --git a/dhcp.c b/dhcp.c
index 0ef37736..bb0369e4 100644
--- a/dhcp.c
+++ b/dhcp.c
@@ -459,7 +459,7 @@ int netcfg_activate_dhcp (struct debconfclient *client, struct netcfg_interface
kill_dhcp_client();
loop_setup();
-interface_up(interface->name);
+netcfg_interface_up(interface);
for (;;) {
di_debug("State is now %i", state);
diff --git a/netcfg-common.c b/netcfg-common.c
index 11334531..5ca9560e 100644
--- a/netcfg-common.c
+++ b/netcfg-common.c
@@ -277,7 +277,7 @@ int is_raw_80211(const char *ifa