Bug#433568: VLAN support within D-I

2026-08-06 Thread Colin Watson

On Thu, Jul 30, 2026 at 12:57:19PM +0100, Colin Watson wrote:

On Thu, Jul 30, 2026 at 01:41:41PM +0200, Cyril Brulebois wrote:

Colin Watson  (2026-07-30):

Once this reaches daily builds
(https://www.debian.org/devel/debian-installer/), I'd very much appreciate
testing by others in live environments that use VLANs to confirm that I
didn't break anything.  I don't use them routinely myself; I set up a test
environment so that I could connect a test laptop to a trunk port, but
there's always the possibility that I made mistakes in both the patch and my
test environment that cancelled each other out.


I think the “test laptop” bit increases the chance my hunch in #1143094
might be correct: you wouldn't have gotten a short name like ens3 there,
but something long-ish like enx00e04c680be4 or enx2e7cf2e89a52, hiding
the alignment/padding issue?


enp0s25 in my case, but yes, since it seems that the kernel uses %6s 
here, that's long enough to hide the issue.  Will fix, thanks!


This is fixed (hw-detect 1.177, 
https://salsa.debian.org/installer-team/hw-detect/-/commit/f655fc230ce9668a5999c20ca3efa468a232d05b).


There's also a draft documentation patch up for review in 
https://salsa.debian.org/installer-team/installation-guide/-/merge_requests/46.


--
Colin Watson (he/him)  [[email protected]]



Bug#433568: VLAN support within D-I

2026-07-30 Thread Colin Watson

On Thu, Jul 30, 2026 at 01:41:41PM +0200, Cyril Brulebois wrote:

Colin Watson  (2026-07-30):

After a fair bit of local testing, I've applied this patch to netcfg master,
with several additional changes of my own, and uploaded them as part of
netcfg 1.204.  For transparency I've kept my own changes as separate git
commits, and you can see them all here along with my rebased version of
Tyler's patch: […]


Thanks for picking up that topic. I'm sorry it's never managed to get near
the top of my todo list in so many years…


I think I remember somebody (maybe Martin?) asking me about this at 
DebConf 14 in Portland ...



Once this reaches daily builds
(https://www.debian.org/devel/debian-installer/), I'd very much appreciate
testing by others in live environments that use VLANs to confirm that I
didn't break anything.  I don't use them routinely myself; I set up a test
environment so that I could connect a test laptop to a trunk port, but
there's always the possibility that I made mistakes in both the patch and my
test environment that cancelled each other out.


I think the “test laptop” bit increases the chance my hunch in #1143094
might be correct: you wouldn't have gotten a short name like ens3 there,
but something long-ish like enx00e04c680be4 or enx2e7cf2e89a52, hiding
the alignment/padding issue?


enp0s25 in my case, but yes, since it seems that the kernel uses %6s 
here, that's long enough to hide the issue.  Will fix, thanks!


--
Colin Watson (he/him)  [[email protected]]



Bug#433568: VLAN support within D-I

2026-07-30 Thread Cyril Brulebois
Hi Colin,

Colin Watson  (2026-07-30):
> After a fair bit of local testing, I've applied this patch to netcfg master,
> with several additional changes of my own, and uploaded them as part of
> netcfg 1.204.  For transparency I've kept my own changes as separate git
> commits, and you can see them all here along with my rebased version of
> Tyler's patch: […]

Thanks for picking up that topic. I'm sorry it's never managed to get near
the top of my todo list in so many years…

> Once this reaches daily builds
> (https://www.debian.org/devel/debian-installer/), I'd very much appreciate
> testing by others in live environments that use VLANs to confirm that I
> didn't break anything.  I don't use them routinely myself; I set up a test
> environment so that I could connect a test laptop to a trunk port, but
> there's always the possibility that I made mistakes in both the patch and my
> test environment that cancelled each other out.

I think the “test laptop” bit increases the chance my hunch in #1143094
might be correct: you wouldn't have gotten a short name like ens3 there,
but something long-ish like enx00e04c680be4 or enx2e7cf2e89a52, hiding
the alignment/padding issue?


Cheers,
-- 
Cyril Brulebois ([email protected])
D-I release manager -- Release team member -- Freelance Consultant


signature.asc
Description: PGP signature


Bug#433568: VLAN support within D-I

2026-07-30 Thread Colin Watson

On Mon, May 27, 2024 at 02:06:26PM -0400, Tyler Stachecki wrote:

I'm attaching a patch that applies cleanly against 1.188 and was tested
against a patched bookworm initrd with success.


After a fair bit of local testing, I've applied this patch to netcfg 
master, with several additional changes of my own, and uploaded them as 
part of netcfg 1.204.  For transparency I've kept my own changes as 
separate git commits, and you can see them all here along with my 
rebased version of Tyler's patch:


  
https://salsa.debian.org/installer-team/netcfg/-/compare/5eeeda8570c62ef8acefac5ab5b22af76a4c1416...1a3ab35c22f360fcc887863dce4fc19053142386?from_project_id=23458

Note in particular that I modernized the approach used for ifupdown, and 
that I added Netplan support (since that had been added to netcfg since 
the last iteration of the VLAN patch in this bug, so it seemed best to 
enable it for parity, although the only way I could find to test it in 
practice was to manually run "apt-install netplan.io").  The other 
changes were just minor nits and glitches.


Once this reaches daily builds 
(https://www.debian.org/devel/debian-installer/), I'd very much 
appreciate testing by others in live environments that use VLANs to 
confirm that I didn't break anything.  I don't use them routinely 
myself; I set up a test environment so that I could connect a test 
laptop to a trunk port, but there's always the possibility that I made 
mistakes in both the patch and my test environment that cancelled each 
other out.


I also made a minor change to hw-detect to avoid confusion if you go 
back to the "Detect network hardware" step:


  
https://salsa.debian.org/installer-team/hw-detect/-/commit/619ba547da555a9a87290c8ce9315c3db5376cf0

One piece that remains is documentation.  I'll work on this once this 
has percolated through to daily builds, and ideally once it's had a bit 
of testing by others.


Thanks,

--
Colin Watson (he/him)  [[email protected]]



Bug#433568: VLAN support within D-I

2024-05-27 Thread Tyler Stachecki
On Mon, May 27, 2024 at 2:02 PM Tyler Stachecki
 wrote:
>
> 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

Hi,

Sorry -- turns out this was a little rash on my part: the patch from
2020 applies to 1.188 with fuzz but not 1.889 (which is what I had
checked out). Anywho - the patch I attached previously applies cleanly
to 1.189 and I am similarly happy to act on any feedback from the
maintainer to carry this one across the line.

Cheers,
Tyler



Bug#433568: VLAN support within D-I

2024-05-27 Thread Tyler Stachecki
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 

Bug#433568: VLAN support within D-I

2024-02-22 Thread Lucas Bonnet


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



Bug#433568: VLAN support within D-I

2020-04-14 Thread Carsten Schoenert
Hi there,

it's long ago this issue was opened and some working code was added by
patches. :-)

On Mon, Jun 27, 2016 at 02:13:33PM +, Holger Levsen wrote:
> the server is located in a loud+dusty+dark room, has 4 ethernet devices
> and it seems I mixed them up…

On my day job we now hit exactly this situation for some months now. Our
network infrastructure got renewed and mostly all physical ports now
have VLANs tagged only.

I remembered this report and extracted the patches and information
around, put it all together on top of the Git tree for the installer and
build various variants based on the master tree for the d-i but also for
the tree of buster. We were able to configure the network setup within
the d-i to recognize the VLAN ID and proceeded successfully further with
the installation of servers.

Technically it is working, as pointed out within this report some issues
regarding debconf are still needed to work on.

I attach the current WIP of my patch work here. I reworked the source a
little bit to follow the existing coding style for the new files and
routines. But there is nothing technically changed in the new source
files.

I'd appreciate if we could get one step closer to include VLAN support
for the D-I as possible release goal for bulleseye. If possible I work
on further needed adjustments.

Thanks and Regards
Carsten
>From e3a3735d2b8006a9bc91a38a3b2de337fd1fa716 Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov 
Date: Fri, 10 Jan 2020 22:31:43 +0100
Subject: [PATCH] Add vlan support

Based on YunQiang Su patch and Philipp Kern's rewrite, with own
additions.

Closes: #433568
---
 Makefile   |   2 +-
 debian/netcfg-common.templates |  29 +-
 dhcp.c |   2 +-
 netcfg-common.c|  32 ++-
 netcfg.c   |  20 +--
 netcfg.h   |  11 
 nm-conf.c  |  35 +++-
 nm-conf.h  |  10 +++-
 static.c   |  12 ++--
 vlan.c | 101 +
 wireless.c |   4 +-
 write_interface.c  |  18 +-
 12 files changed, 252 insertions(+), 24 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..4df1d1c7 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:
@@ -375,4 +403,3 @@ _Choices: ${essid_list} Enter ESSID manually
 # :sl1:
 _Description: Wireless network:
  Select the wireless network to use during the installation process.
-
diff --git a/dhcp.c b/dhcp.c
index fe069501..9476bac6 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 c6d1d8d5..cfa96b02 100644
--- a/netcfg-common.c
+++ b/netcfg-common.c
@@ -267,7 +267,7 @@ int is_raw_80211(const char