Debian Bug report logs - #433568
add vlan support

Package: netcfg; Maintainer for netcfg is Debian Install System Team <debian-boot@lists.debian.org>;

Reported by: Luca Filipozzi <lfilipoz@debian.org>

Date: Tue, 17 Jul 2007 23:57:01 UTC

Severity: wishlist

Tags: d-i, patch, pending

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package debian-installer. (full text, mbox, link).


Acknowledgement sent to Luca Filipozzi <lfilipoz@debian.org>:
New Bug report received and forwarded. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Luca Filipozzi <lfilipoz@debian.org>
To: submit@bugs.debian.org
Subject: add vlan support
Date: Tue, 17 Jul 2007 16:53:38 -0700
Package: debian-installer
Severity: wishlist

Please consider adding vlan support to debian-installer.  There are
cases (edge cases, admitedly) where machines and switches have been
configured to use vlan tagging.  A reinstall of these machines requires
a network reconfiguration.  vlan support in the installer would avoid
this reconfiguration.  Thanks for reading this far.

-- 
Luca Filipozzi
"Linux gives us the power we need to crush those that oppose us." - switchlinux
gpgkey 5A827A2D - A149 97BD 188C 7F29 779E  09C1 3573 32C4 5A82 7A2D



Bug reassigned from package `debian-installer' to `netcfg'. Request was from Joey Hess <joeyh@debian.org> to control@bugs.debian.org. (Wed, 18 Jul 2007 00:09:02 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (full text, mbox, link).


Acknowledgement sent to stappers@stappers.nl (Geert Stappers):
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (full text, mbox, link).


Message #12 received at 433568@bugs.debian.org (full text, mbox, reply):

From: stappers@stappers.nl (Geert Stappers)
To: Luca Filipozzi <lfilipoz@debian.org>, 433568@bugs.debian.org
Subject: Re: Bug#433568: add vlan support
Date: Wed, 18 Jul 2007 19:15:29 +0200
Op 17-07-2007 om 16:53 schreef Luca Filipozzi:
> Package: debian-installer

meanwhile reassigned to netcfg

> vlan support in the installer would avoid this reconfiguration.

Where to find more information about vlan support?
(Please provide pointer to vlan support in debian)


Cheers
Geert Stappers




Bug reassigned from package `netcfg' to `netcfg'. Request was from stappers@stappers.nl (Geert Stappers) to control@bugs.debian.org. (Wed, 18 Jul 2007 17:27:15 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (full text, mbox, link).


Acknowledgement sent to Jérémy Bobbio <lunar@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (full text, mbox, link).


Message #19 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Jérémy Bobbio <lunar@debian.org>
To: 433568@bugs.debian.org
Subject: Re: Bug#433568: add vlan support
Date: Wed, 18 Jul 2007 23:56:55 +0200
[Message part 1 (text/plain, inline)]
On Wed, Jul 18, 2007 at 07:15:29PM +0200, Geert Stappers wrote:
> Op 17-07-2007 om 16:53 schreef Luca Filipozzi:
> > Package: debian-installer
> 
> meanwhile reassigned to netcfg

It depends on which level we support vlans.  I see two options:
 * full support with the debconf questions and proper scripts,
 * only make the necessary udebs available and a good documentation on
   how to enable vlans through a shell.

In my opinion, people who would like to enable VLAN should be pretty
used to the command-line (network switches are usually configured that
way), so the later would be enough, IMHO.

> > vlan support in the installer would avoid this reconfiguration.
> 
> Where to find more information about vlan support?
> (Please provide pointer to vlan support in debian)

Please look into the vlan [1] package for the necessary command line
tools.  Kernel support is provided by the 8021q module, available in
standard Debian kernel.

[1] http://packages.debian.org/vlan

Once the vlan package is installed, I just need to write something like:

  iface eth0.42 inet dhcp

This will configure an interface named "eth0.42", using the physical
link connected on "eth0" and tagging packets with VLANID 42.

So in any case, we would need to recognize if such interface is used
during the installation process to install the "vlan" package in the
target.

Cheers,
-- 
Jérémy Bobbio                        .''`. 
lunar@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Fri, 24 Oct 2008 11:27:03 GMT) (full text, mbox, link).


Acknowledgement sent to Philipp Kolmann <kolmann@zid.tuwien.ac.at>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Fri, 24 Oct 2008 11:27:03 GMT) (full text, mbox, link).


Message #24 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Philipp Kolmann <kolmann@zid.tuwien.ac.at>
To: 433568@bugs.debian.org
Subject: Second that request
Date: Fri, 24 Oct 2008 13:25:59 +0200
Hi,

I would really love to see vlan support in DI.

I just had a box with vlans connected already and wanted to install 
debian with latest lenny installer but couldn't because of the lack of 
vlan support.

I'd prefer to have proper deb-conf vlan support, if possible. Shouldn't 
be too hard.

Probably you only need to say which interface and which vlan, add this 
interface and then start the network dlg.

Thanks
Philipp Kolmann




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Fri, 08 Jan 2010 19:03:06 GMT) (full text, mbox, link).


Acknowledgement sent to Robert LeBlanc <robert@leblancnet.us>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Fri, 08 Jan 2010 19:03:06 GMT) (full text, mbox, link).


Message #29 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Robert LeBlanc <robert@leblancnet.us>
To: 433568@bugs.debian.org
Subject: VLANs during install are important
Date: Fri, 8 Jan 2010 11:57:26 -0700
[Message part 1 (text/plain, inline)]
I too have been bitten by this. For as flexible as the Debian Installer is
and everything you can do, it's pretty disappointing that it can't do VLANs.
A lot of enterprises use VLANs, and it seems it would be important to have
VLAN support to install Debian. It's no fun to reconfigure the network just
to install/reinstall.

Thanks,

Robert LeBlanc
Life Sciences & Undergraduate Education Computer Support
Brigham Young University
[Message part 2 (text/html, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Sat, 09 Jan 2010 12:39:02 GMT) (full text, mbox, link).


Acknowledgement sent to Ferenc Wagner <wferi@niif.hu>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Sat, 09 Jan 2010 12:39:02 GMT) (full text, mbox, link).


Message #34 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Ferenc Wagner <wferi@niif.hu>
To: Robert LeBlanc <robert@leblancnet.us>
Cc: 433568@bugs.debian.org
Subject: Re: Bug#433568: VLANs during install are important
Date: Sat, 09 Jan 2010 13:37:50 +0100
Robert LeBlanc <robert@leblancnet.us> writes:

> I too have been bitten by this. For as flexible as the Debian Installer is
> and everything you can do, it's pretty disappointing that it can't do VLANs.
> A lot of enterprises use VLANs, and it seems it would be important to have
> VLAN support to install Debian. It's no fun to reconfigure the network just
> to install/reinstall.

I hacked VLAN support into the Sarge installer once upon a time.  It
wasn't a big deal, like adding the vconfig binary and extending netcfg
here and there a little bit.  The problem is that you can't just
download it like the other optional components, so it would waste memory
in the vast majority of installations.  Which wouldn't be a problem but
in the more memory constrained situations...  I can't judge this.

It would be less of a problem if d-i used the Busybox ip applet *and* if
that supported VLANs.  Until then, I'd work around this by adding the
vconfig binary to the installer medium or loading it as "additional
firmware".  :)
-- 
Regards,
Feri.




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Sat, 09 Jan 2010 13:06:02 GMT) (full text, mbox, link).


Acknowledgement sent to 433568@bugs.debian.org:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Sat, 09 Jan 2010 13:06:02 GMT) (full text, mbox, link).


Message #39 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Frans Pop <elendil@planet.nl>
To: 433568@bugs.debian.org
Cc: Robert LeBlanc <robert@leblancnet.us>
Subject: Re: Bug#433568: VLANs during install are important
Date: Sat, 9 Jan 2010 14:04:51 +0100
On Saturday 09 January 2010, Ferenc Wagner wrote:
> It would be less of a problem if d-i used the Busybox ip applet

It does (and nothing else).

> *and* if that supported VLANs.

That might be an issue. No idea.




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Thu, 25 Feb 2010 16:51:03 GMT) (full text, mbox, link).


Acknowledgement sent to Martin Zobel-Helas <zobel@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Thu, 25 Feb 2010 16:51:03 GMT) (full text, mbox, link).


Message #44 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Martin Zobel-Helas <zobel@debian.org>
To: 433568@bugs.debian.org
Subject: Re: Bug#433568: VLANs during install are important
Date: Thu, 25 Feb 2010 17:26:40 +0100
Hi, 

On Sat Jan 09, 2010 at 14:04:51 +0100, Frans Pop wrote:
> On Saturday 09 January 2010, Ferenc Wagner wrote:
> > It would be less of a problem if d-i used the Busybox ip applet
> 
> It does (and nothing else).
> 
> > *and* if that supported VLANs.
> 
> That might be an issue. No idea.

~ # ip link add link eth0 name vlan4 type vlan id 4
ip: invalid argument 'add' to 'ip'

It seems it doesn't support it.

I was bitten by that too yesterday, and would really appreciate if d-i
could support this. According to busybox's manpage it should support
vconfig if enabled, and d-i seems to miss the vlan kernel module for it. 

Cheers
Martin

-- 
 Martin Zobel-Helas <zobel@debian.org>  | Debian System Administrator
 Debian & GNU/Linux Developer           |           Debian Listmaster
 Public key http://zobel.ftbfs.de/5d64f870.asc   -   KeyID: 5D64 F870
 GPG Fingerprint:  5DB3 1301 375A A50F 07E7  302F 493E FB8E 5D64 F870




Added blocking bug(s) of 433568: 591756 Request was from Axel Beckert <abe@debian.org> to control@bugs.debian.org. (Thu, 05 Aug 2010 09:54:07 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Sun, 09 Sep 2012 14:00:03 GMT) (full text, mbox, link).


Acknowledgement sent to Aron Xu <happyaron.xu@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Sun, 09 Sep 2012 14:00:03 GMT) (full text, mbox, link).


Message #51 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Aron Xu <happyaron.xu@gmail.com>
To: 433568@bugs.debian.org
Subject: Re: Bug #433568 add vlan support
Date: Sun, 9 Sep 2012 21:56:25 +0800
I'm sending a reminder on this issue, it would be best if d-i can
support VLAN using expert mode of installation, configuring VLAN using
iproute2 during installation is much more annoying comparing to
configure it within d-i.

-- 
Regards,
Aron Xu



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Sun, 09 Sep 2012 15:57:03 GMT) (full text, mbox, link).


Acknowledgement sent to Gaudenz Steinlin <gaudenz@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Sun, 09 Sep 2012 15:57:03 GMT) (full text, mbox, link).


Message #56 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Gaudenz Steinlin <gaudenz@debian.org>
To: Aron Xu <happyaron.xu@gmail.com>, 433568@bugs.debian.org
Subject: Re: Bug#433568: Bug #433568 add vlan support
Date: Sun, 09 Sep 2012 17:47:47 +0200
Hi Aron

Aron Xu <happyaron.xu@gmail.com> writes:

> I'm sending a reminder on this issue, it would be best if d-i can
> support VLAN using expert mode of installation, configuring VLAN using
> iproute2 during installation is much more annoying comparing to
> configure it within d-i.

A reminder is nice and if you are luck might get things started, but
as you probably know, d-i is free software. Pachtes are most welcome.
Everyone is free to contribute and I don't know of any technically sound
contribution to d-i that has been turned down.

The code is at git.debian.org, the components you probably need to
modify are netcfg and busybox (to enable VLAN support).

Gaudenz

-- 
Ever tried. Ever failed. No matter.
Try again. Fail again. Fail better.
~ Samuel Beckett ~



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Sun, 09 Sep 2012 16:00:03 GMT) (full text, mbox, link).


Acknowledgement sent to Aron Xu <happyaron.xu@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Sun, 09 Sep 2012 16:00:03 GMT) (full text, mbox, link).


Message #61 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Aron Xu <happyaron.xu@gmail.com>
To: Gaudenz Steinlin <gaudenz@debian.org>
Cc: 433568@bugs.debian.org
Subject: Re: Bug#433568: Bug #433568 add vlan support
Date: Sun, 9 Sep 2012 23:56:26 +0800
Hi,

On Sun, Sep 9, 2012 at 11:47 PM, Gaudenz Steinlin <gaudenz@debian.org> wrote:
>
> Hi Aron
>
> Aron Xu <happyaron.xu@gmail.com> writes:
>
>> I'm sending a reminder on this issue, it would be best if d-i can
>> support VLAN using expert mode of installation, configuring VLAN using
>> iproute2 during installation is much more annoying comparing to
>> configure it within d-i.
>
> A reminder is nice and if you are luck might get things started, but
> as you probably know, d-i is free software. Pachtes are most welcome.
> Everyone is free to contribute and I don't know of any technically sound
> contribution to d-i that has been turned down.
>

Thanks, I know that, and I have been a Debian contributor for quite
some time, :-)

> The code is at git.debian.org, the components you probably need to
> modify are netcfg and busybox (to enable VLAN support).
>

IIRC busybox-udeb has enabled VLAN support, the only thing left is
netcfg. But to be honest I'm not familiar with those stuff...

-- 
Regards,
Aron Xu



Added blocking bug(s) of 433568: 689159 Request was from Aron Xu <happyaron.xu@gmail.com> to control@bugs.debian.org. (Sat, 29 Sep 2012 16:15:05 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Wed, 03 Oct 2012 13:06:03 GMT) (full text, mbox, link).


Acknowledgement sent to YunQiang Su <wzssyqa@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 03 Oct 2012 13:06:03 GMT) (full text, mbox, link).


Message #68 received at 433568@bugs.debian.org (full text, mbox, reply):

From: YunQiang Su <wzssyqa@gmail.com>
To: Josef Wolf <jw@raven.inka.de>, debian-boot@lists.debian.org, 433568@bugs.debian.org
Subject: Re: Bug#433568: VLANs during install are important
Date: Wed, 3 Oct 2012 21:03:02 +0800
[Message part 1 (text/plain, inline)]
I patched vlan to work with VLAN for linux and kfreebsd now.
While I have no idea whether we should load 8021q module manually.

I seems that 8021q module is not included in d-i (Linux).

Thanks for Aron Xu to write the templates.

-- 
YunQiang Su
[vlan.diff (application/octet-stream, attachment)]

Added tag(s) patch. Request was from Aron Xu <happyaron.xu@gmail.com> to control@bugs.debian.org. (Wed, 31 Oct 2012 21:09:05 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Fri, 28 Dec 2012 19:45:06 GMT) (full text, mbox, link).


Acknowledgement sent to Aron Xu <happyaron.xu@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Fri, 28 Dec 2012 19:45:06 GMT) (full text, mbox, link).


Message #75 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Aron Xu <happyaron.xu@gmail.com>
To: 433568@bugs.debian.org
Subject: Re: Bug#433568: add vlan support
Date: Sat, 29 Dec 2012 03:41:33 +0800
Hi,

The Linux kernel's vlan udeb is added in linux/3.2.35-1, so there is
no outside thing to block us from adding vlan support to netcfg, can
anyone review the patch?

-- 
Regards,
Aron Xu



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Fri, 28 Dec 2012 20:39:03 GMT) (full text, mbox, link).


Message #78 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Philipp Kern <pkern@debian.org>
To: Aron Xu <happyaron.xu@gmail.com>, 433568@bugs.debian.org
Subject: Re: Bug#433568: add vlan support
Date: Fri, 28 Dec 2012 21:37:50 +0100
[Message part 1 (text/plain, inline)]
On Sat, Dec 29, 2012 at 03:41:33AM +0800, Aron Xu wrote:
> The Linux kernel's vlan udeb is added in linux/3.2.35-1, so there is
> no outside thing to block us from adding vlan support to netcfg, can
> anyone review the patch?

It needs a rewrite, IMHO. I started reviewing / rewriting it, but I'm not
stopping others to work on it. (More debugging output, more sane memory
handling, coding style adjustments.)

I'm not sure I get to it before the next rc, though. At least, if it
works, it could probably also be backported to wheezy's d-i if it's too
late. It's pretty self-contained.

Kind regards
Philipp Kern
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Sat, 29 Dec 2012 07:39:06 GMT) (full text, mbox, link).


Acknowledgement sent to Christian PERRIER <bubulle@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Sat, 29 Dec 2012 07:39:06 GMT) (full text, mbox, link).


Message #83 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Christian PERRIER <bubulle@debian.org>
To: 433568@bugs.debian.org
Subject: Re: Bug#433568: add vlan support
Date: Sat, 29 Dec 2012 08:34:27 +0100
[Message part 1 (text/plain, inline)]
Quoting Philipp Kern (pkern@debian.org):
> On Sat, Dec 29, 2012 at 03:41:33AM +0800, Aron Xu wrote:
> > The Linux kernel's vlan udeb is added in linux/3.2.35-1, so there is
> > no outside thing to block us from adding vlan support to netcfg, can
> > anyone review the patch?
> 
> It needs a rewrite, IMHO. I started reviewing / rewriting it, but I'm not
> stopping others to work on it. (More debugging output, more sane memory
> handling, coding style adjustments.)
> 
> I'm not sure I get to it before the next rc, though. At least, if it
> works, it could probably also be backported to wheezy's d-i if it's too
> late. It's pretty self-contained.

Taking over KiBi's hat, I would say there is no chance this makes it
to wheezy. And taking mine, too, with several addition to localization
bits. The debconf templates need minor edits to compleltely fit with
the writing style we're using elsewhere...and they add 8
strings....and we have 56 complete translations (more than we *ever*
had).

In my opinion, this should go into a jessie branch, in netcfg.


[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Sat, 29 Dec 2012 13:18:06 GMT) (full text, mbox, link).


Message #86 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Philipp Kern <pkern@debian.org>
To: Christian PERRIER <bubulle@debian.org>, 433568@bugs.debian.org
Subject: Re: Bug#433568: add vlan support
Date: Sat, 29 Dec 2012 14:15:45 +0100
[Message part 1 (text/plain, inline)]
On Sat, Dec 29, 2012 at 08:34:27AM +0100, Christian PERRIER wrote:
> Taking over KiBi's hat, I would say there is no chance this makes it
> to wheezy. And taking mine, too, with several addition to localization
> bits. The debconf templates need minor edits to compleltely fit with
> the writing style we're using elsewhere...and they add 8
> strings....and we have 56 complete translations (more than we *ever*
> had).

I'd say that this is something that must be preseeded and if anything it
would show errors in English. So I'm not too concerned about that. But if
we agree that it is "useful" to show netcfg/use_vlan in jessie in expert
mode, we can do that too.

Kind regards
Philipp Kern
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Thu, 03 Jan 2013 21:45:04 GMT) (full text, mbox, link).


Acknowledgement sent to Aron Xu <happyaron.xu@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Thu, 03 Jan 2013 21:45:04 GMT) (full text, mbox, link).


Message #91 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Aron Xu <happyaron.xu@gmail.com>
To: Philipp Kern <pkern@debian.org>, Christian Perrier <bubulle@debian.org>
Cc: 433568@bugs.debian.org
Subject: Re: Bug#433568: add vlan support
Date: Fri, 4 Jan 2013 05:42:12 +0800
On Sat, Dec 29, 2012 at 4:37 AM, Philipp Kern <pkern@debian.org> wrote:
> On Sat, Dec 29, 2012 at 03:41:33AM +0800, Aron Xu wrote:
>> The Linux kernel's vlan udeb is added in linux/3.2.35-1, so there is
>> no outside thing to block us from adding vlan support to netcfg, can
>> anyone review the patch?
>
> It needs a rewrite, IMHO. I started reviewing / rewriting it, but I'm not
> stopping others to work on it. (More debugging output, more sane memory
> handling, coding style adjustments.)
>
> I'm not sure I get to it before the next rc, though. At least, if it
> works, it could probably also be backported to wheezy's d-i if it's too
> late. It's pretty self-contained.
>

Thank you for working on this, and sorry for my not able to provide more help.

I don't expect it to be included to Wheezy in current stage of freeze,
and a backport will work. I work part-time in an IDC and the needs of
some not-so-common usages (like vlan support in d-i) are obvious to
me. Replacing some of RHEL/CentOS installations with Debian helps
quite a log in daily operation, but this gives me some chances to find
problems and help on improving Debian in such environments.

It would be handy if the option is shown if vlan udeb is selected when
choosing additional functions during installation, but I doubt whether
this can apply for kBSD as they seem to have vlan support built-in to
the kernel. Also hurd does not support 8021q vlan yet, showing the
option does not make sense for it.


-- 
Regards,
Aron Xu



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Mon, 28 Jan 2013 01:51:03 GMT) (full text, mbox, link).


Acknowledgement sent to Cyril Brulebois <kibi@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Mon, 28 Jan 2013 01:51:03 GMT) (full text, mbox, link).


Message #96 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Cyril Brulebois <kibi@debian.org>
To: Philipp Kern <pkern@debian.org>, 433568@bugs.debian.org
Cc: Christian PERRIER <bubulle@debian.org>, Luca Filipozzi <lfilipoz@debian.org>
Subject: Re: Bug#433568: add vlan support
Date: Mon, 28 Jan 2013 02:48:56 +0100
[Message part 1 (text/plain, inline)]
Hello,

(putting back Luca in the loop just in case)

Philipp Kern <pkern@debian.org> (29/12/2012):
> On Sat, Dec 29, 2012 at 08:34:27AM +0100, Christian PERRIER wrote:
> > Taking over KiBi's hat, I would say there is no chance this makes
> > it to wheezy. And taking mine, too, with several addition to
> > localization bits. The debconf templates need minor edits to
> > compleltely fit with the writing style we're using elsewhere...and
> > they add 8 strings....and we have 56 complete translations (more
> > than we *ever* had).

I might have considered something “already-suitable” for inclusion
into rc2 or something, but since a rewrite is suggested by Philipp, it
looks like the backport solution looks the way to go (at least Aron is
OK with Philipp's proposal).

> I'd say that this is something that must be preseeded and if
> anything it would show errors in English. So I'm not too concerned
> about that. But if we agree that it is "useful" to show
> netcfg/use_vlan in jessie in expert mode, we can do that too.

ACK.

Mraw,
KiBi.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Wed, 27 Mar 2013 14:15:03 GMT) (full text, mbox, link).


Acknowledgement sent to YunQiang Su <wzssyqa@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 27 Mar 2013 14:15:03 GMT) (full text, mbox, link).


Message #101 received at 433568@bugs.debian.org (full text, mbox, reply):

From: YunQiang Su <wzssyqa@gmail.com>
To: Cyril Brulebois <kibi@debian.org>, 433568@bugs.debian.org
Cc: Philipp Kern <pkern@debian.org>, Christian PERRIER <bubulle@debian.org>, Luca Filipozzi <lfilipoz@debian.org>
Subject: Re: Bug#433568: add vlan support
Date: Wed, 27 Mar 2013 22:10:51 +0800
[Message part 1 (text/plain, inline)]
Thanks for Zhengpeng Hou, who points out that I leave a piece of code which is
not used anymore in this patch. This piece of code make a more malloc while not
free.

And I refresh this patch with the current git.
This is the new patch.

Any one has progress on rewriting it?
[vlan_new.diff (application/octet-stream, attachment)]

Added tag(s) d-i. Request was from YunQiang Su <wzssyqa@gmail.com> to control@bugs.debian.org. (Wed, 27 Mar 2013 15:45:10 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Wed, 29 Oct 2014 09:45:04 GMT) (full text, mbox, link).


Acknowledgement sent to Tim Stoop <tim@kumina.nl>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 29 Oct 2014 09:45:04 GMT) (full text, mbox, link).


Message #108 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Tim Stoop <tim@kumina.nl>
To: 433568@bugs.debian.org
Subject: Re: Bug#433568: add vlan support
Date: Wed, 29 Oct 2014 10:31:00 +0100
Hi,

We're really interested in this, where should we look for a status
update? I still do not see an option for it in the installer for Wheezy,
so I guess it's not done yet. Will it be present for Jessie? Anything we
can do to help?

-- 
Kind regards,
Met vriendelijke groet,
Tim Stoop
Kumina bv
www.kumina.nl
kvk nr 14095795

Interested in keeping up to date with Kumina?
Consider subscribing to our newsletter!
https://www.kumina.nl/newsletter



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Wed, 29 Oct 2014 10:09:10 GMT) (full text, mbox, link).


Acknowledgement sent to Cyril Brulebois <kibi@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 29 Oct 2014 10:09:10 GMT) (full text, mbox, link).


Message #113 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Cyril Brulebois <kibi@debian.org>
To: Tim Stoop <tim@kumina.nl>, 433568@bugs.debian.org
Cc: Philipp Kern <pkern@debian.org>
Subject: Re: Bug#433568: add vlan support
Date: Wed, 29 Oct 2014 11:06:45 +0100
[Message part 1 (text/plain, inline)]
Tim Stoop <tim@kumina.nl> (2014-10-29):
> Hi,
> 
> We're really interested in this, where should we look for a status
> update? I still do not see an option for it in the installer for Wheezy,
> so I guess it's not done yet. Will it be present for Jessie? Anything we
> can do to help?

Philipp, any news on your side?

Mraw,
KiBi.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Thu, 10 Mar 2016 17:15:04 GMT) (full text, mbox, link).


Acknowledgement sent to Dimitri John Ledkov <xnox@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Thu, 10 Mar 2016 17:15:04 GMT) (full text, mbox, link).


Message #118 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Dimitri John Ledkov <xnox@debian.org>
To: 433568@bugs.debian.org
Subject: Re: Bug#433568: add vlan support
Date: Thu, 10 Mar 2016 17:11:49 +0000
Hello,

On Wed, 27 Mar 2013 22:10:51 +0800 YunQiang Su <wzssyqa@gmail.com> wrote:
> Thanks for Zhengpeng Hou, who points out that I leave a piece of code which is
> not used anymore in this patch. This piece of code make a more malloc while not
> free.
>
> And I refresh this patch with the current git.
> This is the new patch.
>
> Any one has progress on rewriting it?


OMG, I just had to go through vlan pain, and *anything* would be
better than current situation, rewrite or not.

One thing I see missing is that apart from writing out correct
/etc/network/interface one also needs to install "vlan" package in the
target installation. Is this done somewhere?

Apart from that nit-pick, this is amazing, and I'm feeling like just
finally merging this.

Regards,

Dimitri.



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Sat, 12 Mar 2016 12:54:04 GMT) (full text, mbox, link).


Acknowledgement sent to Tom H <tomh0665@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Sat, 12 Mar 2016 12:54:04 GMT) (full text, mbox, link).


Message #123 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Tom H <tomh0665@gmail.com>
To: 433568@bugs.debian.org
Subject: add vlan support
Date: Sat, 12 Mar 2016 13:49:57 +0100
You don't need vlan; iproute2's ip can do it:

ip link add link eth0 name vlan9 type vlan id 9
or
ip link add link eth0 name eth0.9 type vlan id 9



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Wed, 30 Mar 2016 14:15:04 GMT) (full text, mbox, link).


Acknowledgement sent to Dimitri John Ledkov <xnox@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 30 Mar 2016 14:15:04 GMT) (full text, mbox, link).


Message #128 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Dimitri John Ledkov <xnox@debian.org>
To: 433568@bugs.debian.org
Subject: Re: add vlan support
Date: Wed, 30 Mar 2016 15:11:03 +0100
Hi,

On Sat, 12 Mar 2016 13:49:57 +0100 Tom H <tomh0665@gmail.com> wrote:
> You don't need vlan; iproute2's ip can do it:
>
> ip link add link eth0 name vlan9 type vlan id 9
> or
> ip link add link eth0 name eth0.9 type vlan id 9
>
>

I know that. vlan package is needed for the ifupdown hooks to parse
vlan stanza from /etc/network/interfaces and hence configure vlan id.
Or am I missing something?

Regards,

Dimitri.



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Wed, 30 Mar 2016 14:30:04 GMT) (full text, mbox, link).


Acknowledgement sent to "Lennart Sorensen" <lsorense@csclub.uwaterloo.ca>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 30 Mar 2016 14:30:04 GMT) (full text, mbox, link).


Message #133 received at 433568@bugs.debian.org (full text, mbox, reply):

From: "Lennart Sorensen" <lsorense@csclub.uwaterloo.ca>
To: Dimitri John Ledkov <xnox@debian.org>, 433568@bugs.debian.org
Subject: Re: Bug#433568: add vlan support
Date: Wed, 30 Mar 2016 10:26:52 -0400
On Wed, Mar 30, 2016 at 03:11:03PM +0100, Dimitri John Ledkov wrote:
> Hi,
> 
> On Sat, 12 Mar 2016 13:49:57 +0100 Tom H <tomh0665@gmail.com> wrote:
> > You don't need vlan; iproute2's ip can do it:
> >
> > ip link add link eth0 name vlan9 type vlan id 9
> > or
> > ip link add link eth0 name eth0.9 type vlan id 9
> >
> >
> 
> I know that. vlan package is needed for the ifupdown hooks to parse
> vlan stanza from /etc/network/interfaces and hence configure vlan id.
> Or am I missing something?

Currently the vlan package provides such hooks.  No reason one could
not add such hooks to the iproute2 package or even extend ifupdown to
handle it itself.  Using the vlan package is certainly not efficient
compared to using the ip command for the job.  This is also true for
bridge-utils as far as I know, where I think iproute2 can also completely
replace that.

-- 
Len Sorensen



Added tag(s) pending. Request was from Dimitri John Ledkov <xnox@ubuntu.com> to control@bugs.debian.org. (Wed, 30 Mar 2016 15:48:10 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Wed, 30 Mar 2016 16:21:03 GMT) (full text, mbox, link).


Acknowledgement sent to Dimitri John Ledkov <xnox@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 30 Mar 2016 16:21:03 GMT) (full text, mbox, link).


Message #140 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Dimitri John Ledkov <xnox@ubuntu.com>
To: 433568@bugs.debian.org
Cc: Dimitri John Ledkov <xnox@ubuntu.com>
Subject: [PATCH 1/3] Add vlan support.
Date: Wed, 30 Mar 2016 17:18:11 +0100
---
 Makefile                       |  2 +-
 debian/changelog               |  3 ++
 debian/netcfg-common.templates | 34 +++++++++++++++++++--
 netcfg.c                       |  5 ++++
 netcfg.h                       |  2 ++
 vlan.c                         | 67 ++++++++++++++++++++++++++++++++++++++++++
 write_interface.c              | 20 ++++++++++++-
 7 files changed, 129 insertions(+), 4 deletions(-)
 create mode 100644 vlan.c

diff --git a/Makefile b/Makefile
index a15d476..03343c9 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/changelog b/debian/changelog
index 0930928..2a5e4e6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,9 @@ netcfg (1.138) UNRELEASED; urgency=medium
   * static: trim user-specified values for IP and other addresses
   * Closes: #818611, LP: #1541955
 
+  [ YunQiang Su ]
+  * Add vlan support. Closes: #433568
+
   [ Dimitri John Ledkov ]
   * dhcp.c: check return result of two more fgets calls
   * nm-conf.c: check return result of fscanf
diff --git a/debian/netcfg-common.templates b/debian/netcfg-common.templates
index 2b77936..0dc3446 100644
--- a/debian/netcfg-common.templates
+++ b/debian/netcfg-common.templates
@@ -22,10 +22,41 @@ Type: string
 # :sl1:
 _Description: Domain name:
  The domain name is the part of your Internet address to the right of your
- host name.  It is often something that ends in .com, .net, .edu, or .org. 
+ host name.  It is often something that ends in .com, .net, .edu, or .org.
  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 configuring on 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 attached 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):
+ VLAN IDs are divided into a normal range and an extended range:
+ .
+ Normal range IDs are 1-1005. 1 is the default native VLAN,
+ and 1002-1005 are reserved for Token Ring and FDDI VLANs.
+ Extended range IDs are 1006-4094, which are designed for service
+ providers and have fewer options.
+
+Template: netcfg/vlan_cmderror
+Type: error
+# :sl6:
+_Description: Error setting VLAN
+ The command used to set VLAN during installation got an error,
+ please go back and try again.
+
 Template: netcfg/get_nameservers
 Type: string
 # :sl1:
@@ -371,4 +402,3 @@ _Choices: ${essid_list} Enter ESSID manually
 # :sl1:
 _Description: Wireless network:
  Select the wireless network to use during the installation process.
-
diff --git a/netcfg.c b/netcfg.c
index 195681b..df0bc04 100644
--- a/netcfg.c
+++ b/netcfg.c
@@ -222,6 +222,11 @@ int main(int argc, char *argv[])
                 else
                     state = GET_METHOD;
             }
+
+            if(netcfg_set_vlan(&interface, client) == GO_BACK){
+                state = BACKUP;
+            }
+
             break;
         case GET_HOSTNAME_ONLY:
             if(netcfg_get_hostname(client, "netcfg/get_hostname", hostname, 0))
diff --git a/netcfg.h b/netcfg.h
index 00a2cea..4dfbdee 100644
--- a/netcfg.h
+++ b/netcfg.h
@@ -270,4 +270,6 @@ extern void cleanup_dhcpv6_client(void);
 extern int start_dhcpv6_client(struct debconfclient *client, const struct netcfg_interface *interface);
 extern int netcfg_autoconfig(struct debconfclient *client, struct netcfg_interface *interface);
 
+extern int netcfg_set_vlan(struct netcfg_interface *interface, struct debconfclient *client);
+
 #endif /* _NETCFG_H_ */
diff --git a/vlan.c b/vlan.c
new file mode 100644
index 0000000..ec2a19b
--- /dev/null
+++ b/vlan.c
@@ -0,0 +1,67 @@
+#include <stdio.h>
+#include <cdebconf/debconfclient.h>
+#include <debian-installer.h>
+#include "netcfg.h"
+
+#define VLAN_SUCESSED 0
+#define VLAN_FAILED 1
+int netcfg_set_vlan(struct netcfg_interface *interface, struct debconfclient *client){
+    char *vlaniface = NULL, *vlanid = NULL, *vlancmd = NULL;
+    int vlaniface_len, vlancmd_len;
+
+/*kfreebsd or hurd has different cmd to set vlan*/
+#if defined(__linux__)
+    char vlancmd_template[] = "ip link add link %s name %s type vlan id %s";
+#elif defined(__FreeBSD_kernel__)
+    /*export 2 more to make it the same formt with Linux*/
+    char vlancmd_tmplate[] = "export NIC=%s; export VNIC=%s; export VLANID=%s;" 
+                             " ifconfig $VNIC create";
+#endif
+    int vlancmd_template_len = sizeof(vlancmd_template);
+
+    debconf_input(client, "medium", "netcfg/use_vlan");
+
+    if (debconf_go(client) == CMD_GOBACK)
+       return GO_BACK;
+    debconf_get(client, "netcfg/use_vlan");
+
+    if (!strcmp(client->value, "false")){
+       goto error;
+    }
+
+    debconf_input(client, "critical", "netcfg/vlan_id");
+    debconf_get(client, "netcfg/vlan_id");
+    vlanid = client -> value;
+
+    vlaniface_len = strlen(interface->name)+strlen(vlanid)+2;
+    vlaniface = malloc(vlaniface_len);
+    if(! vlaniface){
+       goto error;
+    }
+    snprintf(vlaniface, vlaniface_len, "%s.%s", interface->name, vlanid);
+    vlancmd_len = vlancmd_template_len + vlaniface_len*2 +1;
+    vlancmd = malloc(vlancmd_len);
+    if(! vlancmd){
+       goto error;
+    }
+    snprintf(vlancmd, vlancmd_len, vlancmd_template, interface->name, vlaniface, vlanid);
+    if(di_exec_shell_log(vlancmd)){
+       di_warning("^ Setting VLAN error: the command is \n%s", vlancmd);
+       debconf_capb(client); 
+       debconf_input(client, "critical", "netcfg/vlan_cmderror"); 
+       debconf_go(client); 
+       debconf_capb(client, "backup"); 
+       goto error;
+    }
+    if(interface->name){
+         free(interface->name);
+         interface->name = vlaniface;
+    }
+    free(vlancmd);
+    return VLAN_SUCESSED;
+
+error:
+    if(vlaniface) free(vlaniface);
+    if(vlancmd) free(vlancmd);
+    return VLAN_FAILED;
+}
diff --git a/write_interface.c b/write_interface.c
index 2ab1a34..be0d78b 100644
--- a/write_interface.c
+++ b/write_interface.c
@@ -44,6 +44,21 @@ static int nc_wi_loopback(const struct netcfg_interface *interface, FILE *fd)
 	return 1;
 }
 
+/* Write VLAN settings, such as: vlan_raw_device eth0
+*/
+static int nc_wi_vlan(const struct netcfg_interface *interface, FILE *fd)
+{
+    char *dup_name, *strip_name;
+    dup_name = strdup(interface->name);
+    strip_name = strsep(&dup_name, ".");
+    if(strip_name != NULL){
+        fprintf(fd, "\tvlan_raw_device %s\n", strip_name);
+	}
+    free(dup_name);
+	return 1;
+}
+
+
 static int nc_wi_wireless_options(const struct netcfg_interface *interface, FILE *fd)
 {
 	/*
@@ -271,7 +286,10 @@ int netcfg_write_interface(const struct netcfg_interface *interface)
 		di_debug("Writing static IPv6 stanza for %s", interface->name);
 		rv = nc_wi_static_ipv6(interface, fd);
 	}
-	
+	if (rv && strchr(interface->name, '.')){
+		di_debug("Writing VLAN: %s", interface->name);
+		rv = nc_wi_vlan(interface, fd);
+	}
 	if (rv && interface && is_wireless_iface(interface->name)) {
 		di_debug("Writing wireless options for %s", interface->name);
 		rv = nc_wi_wireless_options(interface, fd);
-- 
2.7.4




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Wed, 30 Mar 2016 16:21:07 GMT) (full text, mbox, link).


Acknowledgement sent to Dimitri John Ledkov <xnox@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 30 Mar 2016 16:21:07 GMT) (full text, mbox, link).


Message #145 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Dimitri John Ledkov <xnox@ubuntu.com>
To: 433568@bugs.debian.org
Cc: Dimitri John Ledkov <xnox@ubuntu.com>
Subject: [PATCH 2/3] Impove vlan support, by not relying on '.' to detect and write out vlan raw device stanza
Date: Wed, 30 Mar 2016 17:18:12 +0100
---
 debian/changelog  |  2 ++
 netcfg-common.c   |  1 +
 netcfg.h          |  3 +++
 vlan.c            | 16 ++++++++--------
 write_interface.c | 15 +++++++--------
 5 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 2a5e4e6..7b7aebe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,8 @@ netcfg (1.138) UNRELEASED; urgency=medium
   * nm-conf.c: check return result of fscanf
   * Makefile: link with -lm to resolve undefined log and other functions
   * All of above resolves FTBFS
+  * Impove vlan support, by not relying on '.' to detect and write out
+    vlan raw device stanza
 
  -- Dimitri John Ledkov <xnox@ubuntu.com>  Wed, 30 Mar 2016 12:13:56 +0100
 
diff --git a/netcfg-common.c b/netcfg-common.c
index c6d1d8d..8d69b5e 100644
--- a/netcfg-common.c
+++ b/netcfg-common.c
@@ -1564,6 +1564,7 @@ void netcfg_interface_init(struct netcfg_interface *iface)
     iface->v6_stateless_config = -1;
     iface->loopback = -1;
     iface->mode = MANAGED;
+    iface->vlan_raw_device = NULL;
 }
 
 /* Parse an IP address (v4 or v6), with optional CIDR netmask, into
diff --git a/netcfg.h b/netcfg.h
index 4dfbdee..65c97d7 100644
--- a/netcfg.h
+++ b/netcfg.h
@@ -151,6 +151,9 @@ struct netcfg_interface {
 	/* WPA */
 	wpa_t wpa_supplicant_status;
 	char *passphrase;
+
+	/* VLAN */
+	char *vlan_raw_device;
 };
 
 /* Somewhere we can store both in_addr and in6_addr; convenient for all those
diff --git a/vlan.c b/vlan.c
index ec2a19b..a96c9c6 100644
--- a/vlan.c
+++ b/vlan.c
@@ -14,8 +14,8 @@ int netcfg_set_vlan(struct netcfg_interface *interface, struct debconfclient *cl
     char vlancmd_template[] = "ip link add link %s name %s type vlan id %s";
 #elif defined(__FreeBSD_kernel__)
     /*export 2 more to make it the same formt with Linux*/
-    char vlancmd_tmplate[] = "export NIC=%s; export VNIC=%s; export VLANID=%s;" 
-                             " ifconfig $VNIC create";
+    char vlancmd_tmplate[] = "export NIC=%s; export VNIC=%s; export VLANID=%s;"
+			     " ifconfig $VNIC create";
 #endif
     int vlancmd_template_len = sizeof(vlancmd_template);
 
@@ -47,15 +47,15 @@ int netcfg_set_vlan(struct netcfg_interface *interface, struct debconfclient *cl
     snprintf(vlancmd, vlancmd_len, vlancmd_template, interface->name, vlaniface, vlanid);
     if(di_exec_shell_log(vlancmd)){
        di_warning("^ Setting VLAN error: the command is \n%s", vlancmd);
-       debconf_capb(client); 
-       debconf_input(client, "critical", "netcfg/vlan_cmderror"); 
-       debconf_go(client); 
-       debconf_capb(client, "backup"); 
+       debconf_capb(client);
+       debconf_input(client, "critical", "netcfg/vlan_cmderror");
+       debconf_go(client);
+       debconf_capb(client, "backup");
        goto error;
     }
     if(interface->name){
-         free(interface->name);
-         interface->name = vlaniface;
+       interface->vlan_raw_device = interface->name;
+       interface->name = vlaniface;
     }
     free(vlancmd);
     return VLAN_SUCESSED;
diff --git a/write_interface.c b/write_interface.c
index be0d78b..09f9848 100644
--- a/write_interface.c
+++ b/write_interface.c
@@ -48,14 +48,13 @@ static int nc_wi_loopback(const struct netcfg_interface *interface, FILE *fd)
 */
 static int nc_wi_vlan(const struct netcfg_interface *interface, FILE *fd)
 {
-    char *dup_name, *strip_name;
-    dup_name = strdup(interface->name);
-    strip_name = strsep(&dup_name, ".");
-    if(strip_name != NULL){
-        fprintf(fd, "\tvlan_raw_device %s\n", strip_name);
+	int rv;
+	rv = 1;
+	if (interface && interface->vlan_raw_device &&
+	    (fprintf(fd, "\tvlan_raw_device %s\n", interface->vlan_raw_device) < 0)) {
+		rv = 0;
 	}
-    free(dup_name);
-	return 1;
+	return rv;
 }
 
 
@@ -286,7 +285,7 @@ int netcfg_write_interface(const struct netcfg_interface *interface)
 		di_debug("Writing static IPv6 stanza for %s", interface->name);
 		rv = nc_wi_static_ipv6(interface, fd);
 	}
-	if (rv && strchr(interface->name, '.')){
+	if (rv && interface && interface->vlan_raw_device) {
 		di_debug("Writing VLAN: %s", interface->name);
 		rv = nc_wi_vlan(interface, fd);
 	}
-- 
2.7.4




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Wed, 30 Mar 2016 16:21:09 GMT) (full text, mbox, link).


Acknowledgement sent to Dimitri John Ledkov <xnox@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 30 Mar 2016 16:21:10 GMT) (full text, mbox, link).


Message #150 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Dimitri John Ledkov <xnox@ubuntu.com>
To: 433568@bugs.debian.org
Cc: Dimitri John Ledkov <xnox@ubuntu.com>
Subject: [PATCH 3/3] Queue installation of vlan package, at the end of vlan activation
Date: Wed, 30 Mar 2016 17:18:13 +0100
---
 debian/changelog | 1 +
 vlan.c           | 1 +
 2 files changed, 2 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 7b7aebe..941c16d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,7 @@ netcfg (1.138) UNRELEASED; urgency=medium
   * All of above resolves FTBFS
   * Impove vlan support, by not relying on '.' to detect and write out
     vlan raw device stanza
+  * Queue installation of vlan package, at the end of vlan activation
 
  -- Dimitri John Ledkov <xnox@ubuntu.com>  Wed, 30 Mar 2016 12:13:56 +0100
 
diff --git a/vlan.c b/vlan.c
index a96c9c6..15c68a1 100644
--- a/vlan.c
+++ b/vlan.c
@@ -56,6 +56,7 @@ int netcfg_set_vlan(struct netcfg_interface *interface, struct debconfclient *cl
     if(interface->name){
        interface->vlan_raw_device = interface->name;
        interface->name = vlaniface;
+       di_exec_shell_log("apt-install vlan");
     }
     free(vlancmd);
     return VLAN_SUCESSED;
-- 
2.7.4




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Wed, 30 Mar 2016 19:39:03 GMT) (full text, mbox, link).


Acknowledgement sent to Ben Hutchings <ben@decadent.org.uk>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Wed, 30 Mar 2016 19:39:03 GMT) (full text, mbox, link).


Message #155 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Ben Hutchings <ben@decadent.org.uk>
To: Dimitri John Ledkov <xnox@debian.org>
Cc: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>, 433568@bugs.debian.org
Subject: Re: Bug#433568: add vlan support
Date: Wed, 30 Mar 2016 20:35:38 +0100
[Message part 1 (text/plain, inline)]
On Wed, 2016-03-30 at 10:26 -0400, Lennart Sorensen wrote:
> On Wed, Mar 30, 2016 at 03:11:03PM +0100, Dimitri John Ledkov wrote:
> > 
> > Hi,
> > 
> > On Sat, 12 Mar 2016 13:49:57 +0100 Tom H <tomh0665@gmail.com> wrote:
> > > 
> > > You don't need vlan; iproute2's ip can do it:
> > > 
> > > ip link add link eth0 name vlan9 type vlan id 9
> > > or
> > > ip link add link eth0 name eth0.9 type vlan id 9
> > > 
> > > 
> > I know that. vlan package is needed for the ifupdown hooks to parse
> > vlan stanza from /etc/network/interfaces and hence configure vlan id.
> > Or am I missing something?
> Currently the vlan package provides such hooks.  No reason one could
> not add such hooks to the iproute2 package or even extend ifupdown to
> handle it itself.  Using the vlan package is certainly not efficient
> compared to using the ip command for the job.  This is also true for
> bridge-utils as far as I know, where I think iproute2 can also completely
> replace that.

I agree with this.  Debian-installer should not create a network
configuration that depends on tools that have been deprecated for over
a decade.

Ben.

-- 
Ben Hutchings
Tomorrow will be cancelled due to lack of interest.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Wed, 30 Mar 2016 23:21:03 GMT) (full text, mbox, link).


Message #158 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Philipp Kern <pkern@debian.org>
To: Dimitri John Ledkov <xnox@ubuntu.com>, 433568@bugs.debian.org
Subject: Re: Bug#433568: [PATCH 1/3] Add vlan support.
Date: Thu, 31 Mar 2016 01:19:27 +0200
[Message part 1 (text/plain, inline)]
If only I had had a test environment to test my rewrite against, oh
well.

On Wed, Mar 30, 2016 at 05:18:11PM +0100, Dimitri John Ledkov wrote:
> +Template: netcfg/use_vlan
> +Type: boolean
> +Default: false
> +# :sl6:
> +_Description: Are you configuring on 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 attached to a VLAN trunk port,
> + specifying a VLAN ID may be necessary to get a working connection.

s/configuring on/connected to/? It'd be good to also get the template
changes reviewed.

> +Template: netcfg/vlan_id
> +Type: string
> +# :sl6:
> +_Description: VLAN ID (1-4094):
> + VLAN IDs are divided into a normal range and an extended range:
> + .
> + Normal range IDs are 1-1005. 1 is the default native VLAN,
> + and 1002-1005 are reserved for Token Ring and FDDI VLANs.
> + Extended range IDs are 1006-4094, which are designed for service
> + providers and have fewer options.

This description is probably not very useful.

> +Template: netcfg/vlan_cmderror
> +Type: error
> +# :sl6:
> +_Description: Error setting VLAN
> + The command used to set VLAN during installation got an error,
> + please go back and try again.

s/got/returned/ I guess.

> diff --git a/netcfg.c b/netcfg.c
> index 195681b..df0bc04 100644
> --- a/netcfg.c
> +++ b/netcfg.c
> @@ -222,6 +222,11 @@ int main(int argc, char *argv[])
>                  else
>                      state = GET_METHOD;
>              }
> +
> +            if(netcfg_set_vlan(&interface, client) == GO_BACK){
> +                state = BACKUP;
> +            }
> +
>              break;
>          case GET_HOSTNAME_ONLY:
>              if(netcfg_get_hostname(client, "netcfg/get_hostname", hostname, 0))

Please adjust to the surrounding coding style (either no curly braces or
a space before it). I would also have preferred a GET_VLAN state in the
state machine.

> diff --git a/vlan.c b/vlan.c
> new file mode 100644
> index 0000000..ec2a19b
> --- /dev/null
> +++ b/vlan.c
> @@ -0,0 +1,67 @@
> +#include <stdio.h>
> +#include <cdebconf/debconfclient.h>
> +#include <debian-installer.h>
> +#include "netcfg.h"
> +
> +#define VLAN_SUCESSED 0

SUCESSED?

> +#define VLAN_FAILED 1
> +int netcfg_set_vlan(struct netcfg_interface *interface, struct debconfclient *client){
> +    char *vlaniface = NULL, *vlanid = NULL, *vlancmd = NULL;
> +    int vlaniface_len, vlancmd_len;
> +
> +/*kfreebsd or hurd has different cmd to set vlan*/

I would've prefered a get_vlan_command(const char* parentif, const char*
vlanif, int vlanid) here. The attached vlan.c (untested) has it.

> +#if defined(__linux__)
> +    char vlancmd_template[] = "ip link add link %s name %s type vlan id %s";
> +#elif defined(__FreeBSD_kernel__)
> +    /*export 2 more to make it the same formt with Linux*/
> +    char vlancmd_tmplate[] = "export NIC=%s; export VNIC=%s; export VLANID=%s;" 
> +                             " ifconfig $VNIC create";
> +#endif
> +    int vlancmd_template_len = sizeof(vlancmd_template);
> +
> +    debconf_input(client, "medium", "netcfg/use_vlan");
> +
> +    if (debconf_go(client) == CMD_GOBACK)
> +       return GO_BACK;
> +    debconf_get(client, "netcfg/use_vlan");
> +
> +    if (!strcmp(client->value, "false")){
> +       goto error;
> +    }
> +
> +    debconf_input(client, "critical", "netcfg/vlan_id");
> +    debconf_get(client, "netcfg/vlan_id");
> +    vlanid = client -> value;
> +
> +    vlaniface_len = strlen(interface->name)+strlen(vlanid)+2;
> +    vlaniface = malloc(vlaniface_len);
> +    if(! vlaniface){
> +       goto error;
> +    }
> +    snprintf(vlaniface, vlaniface_len, "%s.%s", interface->name, vlanid);
> +    vlancmd_len = vlancmd_template_len + vlaniface_len*2 +1;
> +    vlancmd = malloc(vlancmd_len);
> +    if(! vlancmd){
> +       goto error;
> +    }
> +    snprintf(vlancmd, vlancmd_len, vlancmd_template, interface->name, vlaniface, vlanid);
> +    if(di_exec_shell_log(vlancmd)){
> +       di_warning("^ Setting VLAN error: the command is \n%s", vlancmd);
> +       debconf_capb(client); 
> +       debconf_input(client, "critical", "netcfg/vlan_cmderror"); 
> +       debconf_go(client); 
> +       debconf_capb(client, "backup"); 
> +       goto error;
> +    }
> +    if(interface->name){
> +         free(interface->name);
> +         interface->name = vlaniface;
> +    }
> +    free(vlancmd);
> +    return VLAN_SUCESSED;
> +
> +error:
> +    if(vlaniface) free(vlaniface);
> +    if(vlancmd) free(vlancmd);
> +    return VLAN_FAILED;
> +}

Please convert this down into a consistent coding style. (Or maybe look
at the attached file. It has been a long time ago so maybe I didn't make
much sense of it either.)

> diff --git a/write_interface.c b/write_interface.c
> index 2ab1a34..be0d78b 100644
> --- a/write_interface.c
> +++ b/write_interface.c
> @@ -44,6 +44,21 @@ static int nc_wi_loopback(const struct netcfg_interface *interface, FILE *fd)
>  	return 1;
>  }
>  
> +/* Write VLAN settings, such as: vlan_raw_device eth0
> +*/
> +static int nc_wi_vlan(const struct netcfg_interface *interface, FILE *fd)
> +{
> +    char *dup_name, *strip_name;
> +    dup_name = strdup(interface->name);
> +    strip_name = strsep(&dup_name, ".");
> +    if(strip_name != NULL){
> +        fprintf(fd, "\tvlan_raw_device %s\n", strip_name);
> +	}
> +    free(dup_name);
> +	return 1;
> +}

As you already improved in the third patch the device should get its own
struct member.

>  static int nc_wi_wireless_options(const struct netcfg_interface *interface, FILE *fd)
>  {
>  	/*
> @@ -271,7 +286,10 @@ int netcfg_write_interface(const struct netcfg_interface *interface)
>  		di_debug("Writing static IPv6 stanza for %s", interface->name);
>  		rv = nc_wi_static_ipv6(interface, fd);
>  	}
> -	
> +	if (rv && strchr(interface->name, '.')){
> +		di_debug("Writing VLAN: %s", interface->name);
> +		rv = nc_wi_vlan(interface, fd);
> +	}
>  	if (rv && interface && is_wireless_iface(interface->name)) {
>  		di_debug("Writing wireless options for %s", interface->name);
>  		rv = nc_wi_wireless_options(interface, fd);

Kind regards
Philipp Kern
[vlan.c (text/x-csrc, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Tue, 05 Apr 2016 22:00:03 GMT) (full text, mbox, link).


Acknowledgement sent to Dimitri John Ledkov <xnox@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Tue, 05 Apr 2016 22:00:03 GMT) (full text, mbox, link).


Message #163 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Dimitri John Ledkov <xnox@ubuntu.com>
To: 433568@bugs.debian.org
Cc: pkern@debian.org, Dimitri John Ledkov <xnox@ubuntu.com>
Subject: [PATCH] Add vlan support, based on YunQiang Su patch and Phillip Kern's rewrite, with own additions. Closes: #433568
Date: Tue, 5 Apr 2016 22:57:07 +0100
---

 Squished all the patches, and hopefully did the multi-sided merge of
 Yun's, Pkern's, mine and extra debug stuff. This starts to look
 reasonable. Successfully tested this on s390x, and I'm glad I did it
 there, as I had to fix up the s390x specific code path too.

 I do believe it should be possible to interractively set
 vlan. Currently I am asking this question a "medium" priority, but I
 am open to changing to "low". E.g. I find it acceptable that a user
 needs to return to the main menu and change debconf priority.

 Or for example, should we show it in the static-config by default,
 and offer "configure vlan" as an option when automatic network
 detection fails? E.g. alongside the retry-dhcp,
 retry-dhcp-with-hostname, do-wifi, etc. options?

 Preseeding should be trivial - simply preseed netcfg/vlan_id=2654 and
 that's it.

 Updated template texts a bit. Given that the state-machine, templates
 and all of this patch is still under development, I have not sent
 these off to l10n-en for review.

 Any further comments about this update patch?

 Makefile                       |  2 +-
 debian/changelog               |  7 +++
 debian/netcfg-common.templates | 28 +++++++++++-
 dhcp.c                         |  2 +-
 netcfg-common.c                | 32 ++++++++++++--
 netcfg.c                       | 20 ++++++---
 netcfg.h                       | 11 +++++
 static.c                       | 12 +++---
 vlan.c                         | 97 ++++++++++++++++++++++++++++++++++++++++++
 wireless.c                     |  4 +-
 write_interface.c              | 19 ++++++++-
 11 files changed, 213 insertions(+), 21 deletions(-)
 create mode 100644 vlan.c

diff --git a/Makefile b/Makefile
index a15d476..03343c9 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/changelog b/debian/changelog
index f3dd40c..c2dae40 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+netcfg (1.139) UNRELEASED; urgency=medium
+
+  * Add vlan support, based on YunQiang Su patch and Phillip Kern's
+    rewrite, with own additions. Closes: #433568
+
+ -- Dimitri John Ledkov <xnox@ubuntu.com>  Mon, 04 Apr 2016 12:18:08 +0100
+
 netcfg (1.138) unstable; urgency=medium
 
   [ Hendrik Brueckner ]
diff --git a/debian/netcfg-common.templates b/debian/netcfg-common.templates
index 2b77936..bffded9 100644
--- a/debian/netcfg-common.templates
+++ b/debian/netcfg-common.templates
@@ -26,6 +26,33 @@ _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 go back and try again.
+
 Template: netcfg/get_nameservers
 Type: string
 # :sl1:
@@ -371,4 +398,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 fe06950..9476bac 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 c6d1d8d..ac2c6df 100644
--- a/netcfg-common.c
+++ b/netcfg-common.c
@@ -267,7 +267,7 @@ int is_raw_80211(const char *iface)
 
 #if defined(__s390__)
 // Layer 3 qeth on s390(x) cannot do arping to test gateway reachability.
-int is_layer3_qeth(const char *iface)
+int is_layer3_qeth(const struct netcfg_interface *interface)
 {
     const int bufsize = 1024;
     int retval = 0;
@@ -277,6 +277,12 @@ int is_layer3_qeth(const char *iface)
     ssize_t slen;
     char* driver;
     int fd;
+    char* iface;
+
+    if (interface->parentif)
+        iface = interface->parentif;
+    else
+        iface = interface->name;
 
     // This is sufficient for both /driver and /layer2.
     len = strlen(SYSCLASSNET) + strlen(iface) + strlen("/device/driver") + 1;
@@ -329,7 +335,7 @@ out:
     return retval;
 }
 #else
-int is_layer3_qeth(const char *iface __attribute__((unused)))
+int is_layer3_qeth(const struct netcfg_interface *interface  __attribute__((unused)))
 {
     return 0;
 }
@@ -1338,6 +1344,24 @@ void interface_down (const char *if_name)
     }
 }
 
+void netcfg_interface_up (const struct netcfg_interface *iface)
+{
+	if (iface->parentif)
+		interface_up (iface->parentif);
+
+	if (iface->name)
+		interface_up (iface->name);
+}
+
+void netcfg_interface_down (const struct netcfg_interface *iface)
+{
+	if (iface->name)
+		interface_down (iface->name);
+
+	if (iface->parentif)
+		interface_down (iface->parentif);
+}
+
 void parse_args (int argc, char ** argv)
 {
     if (argc == 2) {
@@ -1528,7 +1552,7 @@ int netcfg_detect_link(struct debconfclient *client, const struct netcfg_interfa
         if (ethtool_lite(if_name) == 1) /* ethtool-lite's CONNECTED */ {
             di_info("Found link on %s", if_name);
 
-            if (!empty_str(gateway) && !is_wireless_iface(if_name) && !is_layer3_qeth(if_name)) {
+            if (!empty_str(gateway) && !is_wireless_iface(if_name) && !is_layer3_qeth(interface)) {
                 for (count = 0; count < gw_tries; count++) {
                     if (di_exec_shell_log(arping) == 0)
                         break;
@@ -1564,6 +1588,8 @@ void netcfg_interface_init(struct netcfg_interface *iface)
     iface->v6_stateless_config = -1;
     iface->loopback = -1;
     iface->mode = MANAGED;
+    iface->parentif = NULL;
+    iface->vlanid = -1;
 }
 
 /* Parse an IP address (v4 or v6), with optional CIDR netmask, into
diff --git a/netcfg.c b/netcfg.c
index 195681b..c918641 100644
--- a/netcfg.c
+++ b/netcfg.c
@@ -67,6 +67,7 @@ int main(int argc, char *argv[])
            GET_METHOD,
            GET_DHCP,
            GET_STATIC,
+           GET_VLAN,
            WCONFIG,
            WCONFIG_ESSID,
            WCONFIG_SECURITY_TYPE,
@@ -216,13 +217,19 @@ int main(int argc, char *argv[])
                 state = BACKUP;
             else if (! interface.name || ! num_interfaces)
                 state = GET_HOSTNAME_ONLY;
-            else {
-                if (is_wireless_iface (interface.name))
-                    state = WCONFIG;
-                else
-                    state = GET_METHOD;
-            }
+            else if (is_wireless_iface (interface.name))
+                state = WCONFIG;
+            else
+                state = GET_VLAN;
+            break;
+
+	case GET_VLAN:
+            if (netcfg_set_vlan(client, &interface) == GO_BACK)
+                state = BACKUP;
+            else
+                state = GET_METHOD;
             break;
+
         case GET_HOSTNAME_ONLY:
             if(netcfg_get_hostname(client, "netcfg/get_hostname", hostname, 0))
                 state = BACKUP;
@@ -231,6 +238,7 @@ int main(int argc, char *argv[])
                 state = QUIT;
             }
             break;
+
         case GET_METHOD:
             if ((res = netcfg_get_method(client)) == GO_BACK)
                 state = (num_interfaces == 1) ? BACKUP : GET_INTERFACE;
diff --git a/netcfg.h b/netcfg.h
index 00a2cea..8b45776 100644
--- a/netcfg.h
+++ b/netcfg.h
@@ -151,6 +151,11 @@ struct netcfg_interface {
 	/* WPA */
 	wpa_t wpa_supplicant_status;
 	char *passphrase;
+
+	/* VLAN */
+	char *parentif;
+	int vlanid;
+
 };
 
 /* Somewhere we can store both in_addr and in6_addr; convenient for all those
@@ -221,6 +226,9 @@ extern void deconfigure_network(struct netcfg_interface *iface);
 extern void interface_up (const char *if_name);
 extern void interface_down (const char *if_name);
 
+extern void netcfg_interface_up (const struct netcfg_interface *iface);
+extern void netcfg_interface_down (const struct netcfg_interface *iface);
+
 extern void loop_setup(void);
 extern int get_hostname_from_dns(const struct netcfg_interface *interface, char *hostname, const size_t max_hostname_len);
 
@@ -270,4 +278,7 @@ extern void cleanup_dhcpv6_client(void);
 extern int start_dhcpv6_client(struct debconfclient *client, const struct netcfg_interface *interface);
 extern int netcfg_autoconfig(struct debconfclient *client, struct netcfg_interface *interface);
 
+/* vlan.c */
+extern int netcfg_set_vlan(struct debconfclient *client, struct netcfg_interface *interface);
+
 #endif /* _NETCFG_H_ */
diff --git a/static.c b/static.c
index ea12fba..ba03931 100644
--- a/static.c
+++ b/static.c
@@ -310,7 +310,7 @@ static int netcfg_activate_static_ipv4(struct debconfclient *client,
     deconfigure_network(NULL);
 
     loop_setup();
-    interface_up(interface->name);
+    netcfg_interface_up(interface);
 
     /* Flush all previous addresses, routes */
     snprintf(buf, sizeof(buf), "ifconfig %s inet 0 down", interface->name);
@@ -345,7 +345,7 @@ static int netcfg_activate_static_ipv4(struct debconfclient *client,
     deconfigure_network(NULL);
 
     loop_setup();
-    interface_up(interface->name);
+    netcfg_interface_up(interface);
 
     /* Flush all previous addresses, routes */
     snprintf(buf, sizeof(buf), "ip -f inet addr flush dev %s", interface->name);
@@ -426,7 +426,7 @@ static int netcfg_activate_static_ipv6(struct debconfclient *client,
     deconfigure_network(NULL);
     
     loop_setup();
-    interface_up(interface->name);
+    netcfg_interface_up(interface);
     
     /* Flush all previous addresses, routes */
     snprintf(buf, sizeof(buf), "ifconfig %s inet 0 down", interface->name);
@@ -449,7 +449,7 @@ static int netcfg_activate_static_ipv6(struct debconfclient *client,
     deconfigure_network(NULL);
 
     loop_setup();
-    interface_up(interface->name);
+    netcfg_interface_up(interface);
 
     /* Flush all previous addresses, routes */
     snprintf(buf, sizeof(buf), "ip -f inet6 addr flush dev %s", interface->name);
@@ -461,8 +461,8 @@ static int netcfg_activate_static_ipv6(struct debconfclient *client,
     /* Now down and up the interface, to get LL and SLAAC addresses back,
      * since flushing the addresses and routes gets rid of all that
      * sort of thing. */
-    interface_down(interface->name);
-    interface_up(interface->name);
+    netcfg_interface_down(interface);
+    netcfg_interface_up(interface);
 
     /* Add the new IP address and netmask */
     snprintf(buf, sizeof(buf), "ip addr add %s/%d dev %s",
diff --git a/vlan.c b/vlan.c
new file mode 100644
index 0000000..d3aa227
--- /dev/null
+++ b/vlan.c
@@ -0,0 +1,97 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <cdebconf/debconfclient.h>
+#include <debian-installer.h>
+#include "netcfg.h"
+
+static char* get_vlan_command(const char* parentif, const char* vlanif, int vlanid) {
+#if defined(__linux__)
+	const char* vlan_command = "ip link add link %s name %s type vlan id %d";
+	int len = strlen(vlan_command) + strlen(parentif) + strlen(vlanif) + 4 + 1;
+	char* buf = malloc(len);
+	snprintf(buf, len, vlan_command, parentif, vlanif, vlanid);
+	return buf;
+#elif defined(__FreeBSD_kernel__)
+	const char* vlan_command = "ifconfig %s vlan %d vlandev %s";
+	int len = strlen(vlan_command) + strlen(parentif) + strlen(vlanif) + 4 + 1;
+	char* buf = malloc(len);
+	snprintf(buf, len, vlan_command, vlanif, vlanid, parentif);
+	return buf;
+#endif
+}
+
+/* Create a new VLAN interface attached to the currently selected
+ * network interface.
+ */
+int netcfg_set_vlan (struct debconfclient *client, struct netcfg_interface *interface) {
+#if defined(__linux__) || defined(__FreeBSD_kernel__)
+	int vlanid;
+
+	debconf_get(client, "netcfg/vlan_id");
+	/* Empty string: no VLAN preseeded, ask if we should configure VLAN */
+	if (strlen(client->value) == 0) {
+		debconf_input (client, "medium", "netcfg/use_vlan");
+		if (debconf_go(client) == GO_BACK) {
+			return GO_BACK;
+		}
+
+		debconf_get(client, "netcfg/use_vlan");
+
+		if (!strcmp(client->value, "false")) {
+			return 0;
+		}
+
+		debconf_input(client, "critical", "netcfg/vlan_id");
+		if (debconf_go(client) == GO_BACK) {
+			return GO_BACK;
+		}
+		debconf_get(client, "netcfg/vlan_id");
+	}
+
+	for (;;) {
+		vlanid = strtol(client->value, NULL, 10);
+		/* Valid range: 1-4094 (0 and 4095 are reserved.)
+		 * 0 will be returned by strtol if the value cannot be parsed.
+		 */
+		if (vlanid < 1 || vlanid > 4094) {
+			di_error("VLAN ID \"%s\" is invalid.", client->value);
+			debconf_subst(client, "netcfg/vlan_id_invalid", "vlan_id", client->value);
+			debconf_input(client, "critical", "netcfg/invalid_vlan");
+			debconf_capb(client);
+			debconf_go(client);
+
+			debconf_capb(client, "backup");
+			debconf_input(client, "critical", "netcfg/vlan_id");
+			if (debconf_go(client) == GO_BACK) {
+				return GO_BACK;
+			}
+		} else {
+			break;
+		}
+	}
+
+	int vlaniflen = strlen(interface->name) + 1 + 4 + 1;
+	char* vlanif = malloc(vlaniflen);
+	snprintf(vlanif, vlaniflen, "%s.%d", interface->name, vlanid);
+
+	char *vlan_command = get_vlan_command(interface->name, vlanif, vlanid);
+	int rc = di_exec_shell_log(vlan_command);
+	if (rc != 0) {
+		di_error("\"%s\" failed to create VLAN interface; return code = %d", vlan_command, rc);
+		free(vlan_command);
+		debconf_input(client, "critical", "netcfg/vlan_failed");
+		debconf_go(client);
+		return GO_BACK;
+	}
+	free(vlan_command);
+
+	interface->parentif = interface->name;
+	interface->name = vlanif;
+	interface->vlanid = vlanid;
+	di_exec_shell_log("apt-install vlan");
+#else
+	/* This platform does not support VLANs. */
+#endif
+	return 0;
+}
diff --git a/wireless.c b/wireless.c
index 566b032..83b1d1d 100644
--- a/wireless.c
+++ b/wireless.c
@@ -121,7 +121,7 @@ int netcfg_wireless_show_essids(struct debconfclient *client, struct netcfg_inte
     int essid_list_len = 1;
 
     iw_get_basic_config (wfd, interface->name, &wconf);
-    interface_up(interface->name);
+    netcfg_interface_up(interface);
 
     if (iw_scan(wfd, interface->name, iw_get_kernel_we_version(),
                 &network_list) >= 0 ) {
@@ -205,7 +205,7 @@ int netcfg_wireless_show_essids(struct debconfclient *client, struct netcfg_inte
     }
 
     iw_set_basic_config(wfd, interface->name, &wconf);
-    interface_down(interface->name);
+    netcfg_interface_down(interface);
 
     di_info("Network chosen: %s. Proceeding to connect.", interface->essid);
 
diff --git a/write_interface.c b/write_interface.c
index 2ab1a34..e768002 100644
--- a/write_interface.c
+++ b/write_interface.c
@@ -44,6 +44,20 @@ static int nc_wi_loopback(const struct netcfg_interface *interface, FILE *fd)
 	return 1;
 }
 
+/* Write VLAN settings, such as: vlan_raw_device eth0
+*/
+static int nc_wi_vlan(const struct netcfg_interface *interface, FILE *fd)
+{
+	int rv;
+	rv = 1;
+	if (interface && interface->parentif &&
+	    (fprintf(fd, "\tvlan_raw_device %s\n", interface->parentif) < 0)) {
+		rv = 0;
+	}
+	return rv;
+}
+
+
 static int nc_wi_wireless_options(const struct netcfg_interface *interface, FILE *fd)
 {
 	/*
@@ -271,7 +285,10 @@ int netcfg_write_interface(const struct netcfg_interface *interface)
 		di_debug("Writing static IPv6 stanza for %s", interface->name);
 		rv = nc_wi_static_ipv6(interface, fd);
 	}
-	
+	if (rv && interface && interface->parentif) {
+		di_debug("Writing VLAN: %s", interface->name);
+		rv = nc_wi_vlan(interface, fd);
+	}
 	if (rv && interface && is_wireless_iface(interface->name)) {
 		di_debug("Writing wireless options for %s", interface->name);
 		rv = nc_wi_wireless_options(interface, fd);
-- 
2.7.4




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Sun, 10 Apr 2016 17:12:04 GMT) (full text, mbox, link).


Message #166 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Philipp Kern <pkern@debian.org>
To: Dimitri John Ledkov <xnox@ubuntu.com>, 433568@bugs.debian.org
Subject: Re: Bug#433568: [PATCH] Add vlan support, based on YunQiang Su patch and Phillip Kern's rewrite, with own additions. Closes: #433568
Date: Sun, 10 Apr 2016 19:09:48 +0200
Hi,

On Tue, Apr 05, 2016 at 10:57:07PM +0100, Dimitri John Ledkov wrote:
>  Squished all the patches, and hopefully did the multi-sided merge of
>  Yun's, Pkern's, mine and extra debug stuff. This starts to look
>  reasonable. Successfully tested this on s390x, and I'm glad I did it
>  there, as I had to fix up the s390x specific code path too.
> 
>  I do believe it should be possible to interractively set
>  vlan. Currently I am asking this question a "medium" priority, but I
>  am open to changing to "low". E.g. I find it acceptable that a user
>  needs to return to the main menu and change debconf priority.
>
>  Or for example, should we show it in the static-config by default,
>  and offer "configure vlan" as an option when automatic network
>  detection fails? E.g. alongside the retry-dhcp,
>  retry-dhcp-with-hostname, do-wifi, etc. options?

That doesn't sound totally crazy I guess.

>  Preseeding should be trivial - simply preseed netcfg/vlan_id=2654 and
>  that's it.
> 
>  Updated template texts a bit. Given that the state-machine, templates
>  and all of this patch is still under development, I have not sent
>  these off to l10n-en for review.

I'd still like this to be reviewed by them and Christian for sanity,
though. Sublevels, understandability, ... ;-)

>  Any further comments about this update patch?
> 
>  Makefile                       |  2 +-
>  debian/changelog               |  7 +++
>  debian/netcfg-common.templates | 28 +++++++++++-
>  dhcp.c                         |  2 +-
>  netcfg-common.c                | 32 ++++++++++++--
>  netcfg.c                       | 20 ++++++---
>  netcfg.h                       | 11 +++++
>  static.c                       | 12 +++---
>  vlan.c                         | 97 ++++++++++++++++++++++++++++++++++++++++++
>  wireless.c                     |  4 +-
>  write_interface.c              | 19 ++++++++-
>  11 files changed, 213 insertions(+), 21 deletions(-)
>  create mode 100644 vlan.c
> 
> diff --git a/Makefile b/Makefile
> index a15d476..03343c9 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/changelog b/debian/changelog
> index f3dd40c..c2dae40 100644
> --- a/debian/changelog
> +++ b/debian/changelog
> @@ -1,3 +1,10 @@
> +netcfg (1.139) UNRELEASED; urgency=medium
> +
> +  * Add vlan support, based on YunQiang Su patch and Phillip Kern's

Philipp  ;-)

> +    rewrite, with own additions. Closes: #433568
> +
> + -- Dimitri John Ledkov <xnox@ubuntu.com>  Mon, 04 Apr 2016 12:18:08 +0100
> +
>  netcfg (1.138) unstable; urgency=medium
>  
>    [ Hendrik Brueckner ]
> diff --git a/debian/netcfg-common.templates b/debian/netcfg-common.templates
> index 2b77936..bffded9 100644
> --- a/debian/netcfg-common.templates
> +++ b/debian/netcfg-common.templates
> @@ -26,6 +26,33 @@ _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 go back and try again.

I sort of fear that "go back and try again" would not be helpful. Check
the logs is probably more sensible. \-:

> +
>  Template: netcfg/get_nameservers
>  Type: string
>  # :sl1:
> @@ -371,4 +398,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 fe06950..9476bac 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 c6d1d8d..ac2c6df 100644
> --- a/netcfg-common.c
> +++ b/netcfg-common.c
> @@ -267,7 +267,7 @@ int is_raw_80211(const char *iface)
>  
>  #if defined(__s390__)
>  // Layer 3 qeth on s390(x) cannot do arping to test gateway reachability.
> -int is_layer3_qeth(const char *iface)
> +int is_layer3_qeth(const struct netcfg_interface *interface)
>  {
>      const int bufsize = 1024;
>      int retval = 0;
> @@ -277,6 +277,12 @@ int is_layer3_qeth(const char *iface)
>      ssize_t slen;
>      char* driver;
>      int fd;
> +    char* iface;
> +
> +    if (interface->parentif)
> +        iface = interface->parentif;
> +    else
> +        iface = interface->name;
>  
>      // This is sufficient for both /driver and /layer2.
>      len = strlen(SYSCLASSNET) + strlen(iface) + strlen("/device/driver") + 1;
> @@ -329,7 +335,7 @@ out:
>      return retval;
>  }
>  #else
> -int is_layer3_qeth(const char *iface __attribute__((unused)))
> +int is_layer3_qeth(const struct netcfg_interface *interface  __attribute__((unused)))
>  {
>      return 0;
>  }
> @@ -1338,6 +1344,24 @@ void interface_down (const char *if_name)
>      }
>  }
>  
> +void netcfg_interface_up (const struct netcfg_interface *iface)
> +{
> +	if (iface->parentif)
> +		interface_up (iface->parentif);
> +
> +	if (iface->name)
> +		interface_up (iface->name);
> +}
> +
> +void netcfg_interface_down (const struct netcfg_interface *iface)
> +{
> +	if (iface->name)
> +		interface_down (iface->name);
> +
> +	if (iface->parentif)
> +		interface_down (iface->parentif);
> +}
> +
>  void parse_args (int argc, char ** argv)
>  {
>      if (argc == 2) {
> @@ -1528,7 +1552,7 @@ int netcfg_detect_link(struct debconfclient *client, const struct netcfg_interfa
>          if (ethtool_lite(if_name) == 1) /* ethtool-lite's CONNECTED */ {
>              di_info("Found link on %s", if_name);
>  
> -            if (!empty_str(gateway) && !is_wireless_iface(if_name) && !is_layer3_qeth(if_name)) {
> +            if (!empty_str(gateway) && !is_wireless_iface(if_name) && !is_layer3_qeth(interface)) {
>                  for (count = 0; count < gw_tries; count++) {
>                      if (di_exec_shell_log(arping) == 0)
>                          break;
> @@ -1564,6 +1588,8 @@ void netcfg_interface_init(struct netcfg_interface *iface)
>      iface->v6_stateless_config = -1;
>      iface->loopback = -1;
>      iface->mode = MANAGED;
> +    iface->parentif = NULL;
> +    iface->vlanid = -1;
>  }
>  
>  /* Parse an IP address (v4 or v6), with optional CIDR netmask, into
> diff --git a/netcfg.c b/netcfg.c
> index 195681b..c918641 100644
> --- a/netcfg.c
> +++ b/netcfg.c
> @@ -67,6 +67,7 @@ int main(int argc, char *argv[])
>             GET_METHOD,
>             GET_DHCP,
>             GET_STATIC,
> +           GET_VLAN,
>             WCONFIG,
>             WCONFIG_ESSID,
>             WCONFIG_SECURITY_TYPE,
> @@ -216,13 +217,19 @@ int main(int argc, char *argv[])
>                  state = BACKUP;
>              else if (! interface.name || ! num_interfaces)
>                  state = GET_HOSTNAME_ONLY;
> -            else {
> -                if (is_wireless_iface (interface.name))
> -                    state = WCONFIG;
> -                else
> -                    state = GET_METHOD;
> -            }
> +            else if (is_wireless_iface (interface.name))
> +                state = WCONFIG;
> +            else
> +                state = GET_VLAN;
> +            break;
> +
> +	case GET_VLAN:
> +            if (netcfg_set_vlan(client, &interface) == GO_BACK)
> +                state = BACKUP;
> +            else
> +                state = GET_METHOD;
>              break;
> +
>          case GET_HOSTNAME_ONLY:
>              if(netcfg_get_hostname(client, "netcfg/get_hostname", hostname, 0))
>                  state = BACKUP;
> @@ -231,6 +238,7 @@ int main(int argc, char *argv[])
>                  state = QUIT;
>              }
>              break;
> +
>          case GET_METHOD:
>              if ((res = netcfg_get_method(client)) == GO_BACK)
>                  state = (num_interfaces == 1) ? BACKUP : GET_INTERFACE;
> diff --git a/netcfg.h b/netcfg.h
> index 00a2cea..8b45776 100644
> --- a/netcfg.h
> +++ b/netcfg.h
> @@ -151,6 +151,11 @@ struct netcfg_interface {
>  	/* WPA */
>  	wpa_t wpa_supplicant_status;
>  	char *passphrase;
> +
> +	/* VLAN */
> +	char *parentif;
> +	int vlanid;
> +
>  };
>  
>  /* Somewhere we can store both in_addr and in6_addr; convenient for all those
> @@ -221,6 +226,9 @@ extern void deconfigure_network(struct netcfg_interface *iface);
>  extern void interface_up (const char *if_name);
>  extern void interface_down (const char *if_name);
>  
> +extern void netcfg_interface_up (const struct netcfg_interface *iface);
> +extern void netcfg_interface_down (const struct netcfg_interface *iface);
> +
>  extern void loop_setup(void);
>  extern int get_hostname_from_dns(const struct netcfg_interface *interface, char *hostname, const size_t max_hostname_len);
>  
> @@ -270,4 +278,7 @@ extern void cleanup_dhcpv6_client(void);
>  extern int start_dhcpv6_client(struct debconfclient *client, const struct netcfg_interface *interface);
>  extern int netcfg_autoconfig(struct debconfclient *client, struct netcfg_interface *interface);
>  
> +/* vlan.c */
> +extern int netcfg_set_vlan(struct debconfclient *client, struct netcfg_interface *interface);
> +
>  #endif /* _NETCFG_H_ */
> diff --git a/static.c b/static.c
> index ea12fba..ba03931 100644
> --- a/static.c
> +++ b/static.c
> @@ -310,7 +310,7 @@ static int netcfg_activate_static_ipv4(struct debconfclient *client,
>      deconfigure_network(NULL);
>  
>      loop_setup();
> -    interface_up(interface->name);
> +    netcfg_interface_up(interface);
>  
>      /* Flush all previous addresses, routes */
>      snprintf(buf, sizeof(buf), "ifconfig %s inet 0 down", interface->name);
> @@ -345,7 +345,7 @@ static int netcfg_activate_static_ipv4(struct debconfclient *client,
>      deconfigure_network(NULL);
>  
>      loop_setup();
> -    interface_up(interface->name);
> +    netcfg_interface_up(interface);
>  
>      /* Flush all previous addresses, routes */
>      snprintf(buf, sizeof(buf), "ip -f inet addr flush dev %s", interface->name);
> @@ -426,7 +426,7 @@ static int netcfg_activate_static_ipv6(struct debconfclient *client,
>      deconfigure_network(NULL);
>      
>      loop_setup();
> -    interface_up(interface->name);
> +    netcfg_interface_up(interface);
>      
>      /* Flush all previous addresses, routes */
>      snprintf(buf, sizeof(buf), "ifconfig %s inet 0 down", interface->name);
> @@ -449,7 +449,7 @@ static int netcfg_activate_static_ipv6(struct debconfclient *client,
>      deconfigure_network(NULL);
>  
>      loop_setup();
> -    interface_up(interface->name);
> +    netcfg_interface_up(interface);
>  
>      /* Flush all previous addresses, routes */
>      snprintf(buf, sizeof(buf), "ip -f inet6 addr flush dev %s", interface->name);
> @@ -461,8 +461,8 @@ static int netcfg_activate_static_ipv6(struct debconfclient *client,
>      /* Now down and up the interface, to get LL and SLAAC addresses back,
>       * since flushing the addresses and routes gets rid of all that
>       * sort of thing. */
> -    interface_down(interface->name);
> -    interface_up(interface->name);
> +    netcfg_interface_down(interface);
> +    netcfg_interface_up(interface);
>  
>      /* Add the new IP address and netmask */
>      snprintf(buf, sizeof(buf), "ip addr add %s/%d dev %s",
> diff --git a/vlan.c b/vlan.c
> new file mode 100644
> index 0000000..d3aa227
> --- /dev/null
> +++ b/vlan.c
> @@ -0,0 +1,97 @@
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <cdebconf/debconfclient.h>
> +#include <debian-installer.h>
> +#include "netcfg.h"
> +
> +static char* get_vlan_command(const char* parentif, const char* vlanif, int vlanid) {
> +#if defined(__linux__)
> +	const char* vlan_command = "ip link add link %s name %s type vlan id %d";
> +	int len = strlen(vlan_command) + strlen(parentif) + strlen(vlanif) + 4 + 1;
> +	char* buf = malloc(len);
> +	snprintf(buf, len, vlan_command, parentif, vlanif, vlanid);
> +	return buf;
> +#elif defined(__FreeBSD_kernel__)
> +	const char* vlan_command = "ifconfig %s vlan %d vlandev %s";
> +	int len = strlen(vlan_command) + strlen(parentif) + strlen(vlanif) + 4 + 1;
> +	char* buf = malloc(len);
> +	snprintf(buf, len, vlan_command, vlanif, vlanid, parentif);
> +	return buf;
> +#endif
> +}
> +
> +/* Create a new VLAN interface attached to the currently selected
> + * network interface.
> + */
> +int netcfg_set_vlan (struct debconfclient *client, struct netcfg_interface *interface) {
> +#if defined(__linux__) || defined(__FreeBSD_kernel__)
> +	int vlanid;
> +
> +	debconf_get(client, "netcfg/vlan_id");
> +	/* Empty string: no VLAN preseeded, ask if we should configure VLAN */
> +	if (strlen(client->value) == 0) {
> +		debconf_input (client, "medium", "netcfg/use_vlan");
> +		if (debconf_go(client) == GO_BACK) {
> +			return GO_BACK;
> +		}
> +
> +		debconf_get(client, "netcfg/use_vlan");
> +
> +		if (!strcmp(client->value, "false")) {
> +			return 0;
> +		}
> +
> +		debconf_input(client, "critical", "netcfg/vlan_id");
> +		if (debconf_go(client) == GO_BACK) {
> +			return GO_BACK;
> +		}
> +		debconf_get(client, "netcfg/vlan_id");
> +	}
> +
> +	for (;;) {
> +		vlanid = strtol(client->value, NULL, 10);
> +		/* Valid range: 1-4094 (0 and 4095 are reserved.)
> +		 * 0 will be returned by strtol if the value cannot be parsed.
> +		 */
> +		if (vlanid < 1 || vlanid > 4094) {
> +			di_error("VLAN ID \"%s\" is invalid.", client->value);
> +			debconf_subst(client, "netcfg/vlan_id_invalid", "vlan_id", client->value);
> +			debconf_input(client, "critical", "netcfg/invalid_vlan");
> +			debconf_capb(client);
> +			debconf_go(client);
> +
> +			debconf_capb(client, "backup");
> +			debconf_input(client, "critical", "netcfg/vlan_id");
> +			if (debconf_go(client) == GO_BACK) {
> +				return GO_BACK;
> +			}
> +		} else {
> +			break;
> +		}
> +	}
> +
> +	int vlaniflen = strlen(interface->name) + 1 + 4 + 1;
> +	char* vlanif = malloc(vlaniflen);
> +	snprintf(vlanif, vlaniflen, "%s.%d", interface->name, vlanid);
> +
> +	char *vlan_command = get_vlan_command(interface->name, vlanif, vlanid);
> +	int rc = di_exec_shell_log(vlan_command);
> +	if (rc != 0) {
> +		di_error("\"%s\" failed to create VLAN interface; return code = %d", vlan_command, rc);
> +		free(vlan_command);
> +		debconf_input(client, "critical", "netcfg/vlan_failed");
> +		debconf_go(client);
> +		return GO_BACK;
> +	}
> +	free(vlan_command);
> +
> +	interface->parentif = interface->name;
> +	interface->name = vlanif;
> +	interface->vlanid = vlanid;
> +	di_exec_shell_log("apt-install vlan");
> +#else
> +	/* This platform does not support VLANs. */

I somewhat feel that it should fail if vlan_id has been set. But on the
other side it also shouldn't prompt for it. Maybe debconf_get it and
return an error so that the error screen is shown and log the concrete
ENOIMPL to syslog?

> +#endif
> +	return 0;
> +}
> diff --git a/wireless.c b/wireless.c
> index 566b032..83b1d1d 100644
> --- a/wireless.c
> +++ b/wireless.c
> @@ -121,7 +121,7 @@ int netcfg_wireless_show_essids(struct debconfclient *client, struct netcfg_inte
>      int essid_list_len = 1;
>  
>      iw_get_basic_config (wfd, interface->name, &wconf);
> -    interface_up(interface->name);
> +    netcfg_interface_up(interface);
>  
>      if (iw_scan(wfd, interface->name, iw_get_kernel_we_version(),
>                  &network_list) >= 0 ) {
> @@ -205,7 +205,7 @@ int netcfg_wireless_show_essids(struct debconfclient *client, struct netcfg_inte
>      }
>  
>      iw_set_basic_config(wfd, interface->name, &wconf);
> -    interface_down(interface->name);
> +    netcfg_interface_down(interface);
>  
>      di_info("Network chosen: %s. Proceeding to connect.", interface->essid);
>  
> diff --git a/write_interface.c b/write_interface.c
> index 2ab1a34..e768002 100644
> --- a/write_interface.c
> +++ b/write_interface.c
> @@ -44,6 +44,20 @@ static int nc_wi_loopback(const struct netcfg_interface *interface, FILE *fd)
>  	return 1;
>  }
>  
> +/* Write VLAN settings, such as: vlan_raw_device eth0
> +*/
> +static int nc_wi_vlan(const struct netcfg_interface *interface, FILE *fd)
> +{
> +	int rv;
> +	rv = 1;
> +	if (interface && interface->parentif &&
> +	    (fprintf(fd, "\tvlan_raw_device %s\n", interface->parentif) < 0)) {
> +		rv = 0;
> +	}
> +	return rv;
> +}

Would it make sense to have network-manager support as well?  It should
be fairly simple and along these lines:

[vlan]
parent=%parentif%
id=%vlanid%

> +
> +
>  static int nc_wi_wireless_options(const struct netcfg_interface *interface, FILE *fd)
>  {
>  	/*
> @@ -271,7 +285,10 @@ int netcfg_write_interface(const struct netcfg_interface *interface)
>  		di_debug("Writing static IPv6 stanza for %s", interface->name);
>  		rv = nc_wi_static_ipv6(interface, fd);
>  	}
> -	
> +	if (rv && interface && interface->parentif) {
> +		di_debug("Writing VLAN: %s", interface->name);
> +		rv = nc_wi_vlan(interface, fd);
> +	}
>  	if (rv && interface && is_wireless_iface(interface->name)) {
>  		di_debug("Writing wireless options for %s", interface->name);
>  		rv = nc_wi_wireless_options(interface, fd);
> -- 
> 2.7.4
> 

Otherwise this looks pretty good to me at this point. Much thanks for
doing the effort.

Kind regards
Philipp Kern



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Fri, 15 Apr 2016 02:21:04 GMT) (full text, mbox, link).


Acknowledgement sent to Dimitri John Ledkov <xnox@ubuntu.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Fri, 15 Apr 2016 02:21:04 GMT) (full text, mbox, link).


Message #171 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Dimitri John Ledkov <xnox@ubuntu.com>
To: 433568@bugs.debian.org
Cc: pkern@debian.org, Dimitri John Ledkov <xnox@ubuntu.com>
Subject: [PATCH] Add vlan support, based on YunQiang Su patch and Philipp Kern's rewrite, with own additions. Closes: #433568
Date: Fri, 15 Apr 2016 03:17:00 +0100
---

 Changes since last version:
 - Corrected Philipp's name
 - Adjusted vlan_failed text message
 - Adding a di_error if vlan_id is preseeded and not supported
 - Added NetworkManager vlan type
 - Sent templates for review

 Makefile                       |   2 +-
 debian/changelog               |   7 +++
 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              |  19 +++++++-
 13 files changed, 260 insertions(+), 24 deletions(-)
 create mode 100644 vlan.c

diff --git a/Makefile b/Makefile
index a15d476..03343c9 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/changelog b/debian/changelog
index f3dd40c..2ed40a2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+netcfg (1.139) UNRELEASED; urgency=medium
+
+  * Add vlan support, based on YunQiang Su patch and Philipp Kern's
+    rewrite, with own additions. Closes: #433568
+
+ -- Dimitri John Ledkov <xnox@ubuntu.com>  Mon, 04 Apr 2016 12:18:08 +0100
+
 netcfg (1.138) unstable; urgency=medium
 
   [ Hendrik Brueckner ]
diff --git a/debian/netcfg-common.templates b/debian/netcfg-common.templates
index 2b77936..ebbfbb3 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:
@@ -371,4 +399,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 fe06950..9476bac 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 c6d1d8d..ac2c6df 100644
--- a/netcfg-common.c
+++ b/netcfg-common.c
@@ -267,7 +267,7 @@ int is_raw_80211(const char *iface)
 
 #if defined(__s390__)
 // Layer 3 qeth on s390(x) cannot do arping to test gateway reachability.
-int is_layer3_qeth(const char *iface)
+int is_layer3_qeth(const struct netcfg_interface *interface)
 {
     const int bufsize = 1024;
     int retval = 0;
@@ -277,6 +277,12 @@ int is_layer3_qeth(const char *iface)
     ssize_t slen;
     char* driver;
     int fd;
+    char* iface;
+
+    if (interface->parentif)
+        iface = interface->parentif;
+    else
+        iface = interface->name;
 
     // This is sufficient for both /driver and /layer2.
     len = strlen(SYSCLASSNET) + strlen(iface) + strlen("/device/driver") + 1;
@@ -329,7 +335,7 @@ out:
     return retval;
 }
 #else
-int is_layer3_qeth(const char *iface __attribute__((unused)))
+int is_layer3_qeth(const struct netcfg_interface *interface  __attribute__((unused)))
 {
     return 0;
 }
@@ -1338,6 +1344,24 @@ void interface_down (const char *if_name)
     }
 }
 
+void netcfg_interface_up (const struct netcfg_interface *iface)
+{
+	if (iface->parentif)
+		interface_up (iface->parentif);
+
+	if (iface->name)
+		interface_up (iface->name);
+}
+
+void netcfg_interface_down (const struct netcfg_interface *iface)
+{
+	if (iface->name)
+		interface_down (iface->name);
+
+	if (iface->parentif)
+		interface_down (iface->parentif);
+}
+
 void parse_args (int argc, char ** argv)
 {
     if (argc == 2) {
@@ -1528,7 +1552,7 @@ int netcfg_detect_link(struct debconfclient *client, const struct netcfg_interfa
         if (ethtool_lite(if_name) == 1) /* ethtool-lite's CONNECTED */ {
             di_info("Found link on %s", if_name);
 
-            if (!empty_str(gateway) && !is_wireless_iface(if_name) && !is_layer3_qeth(if_name)) {
+            if (!empty_str(gateway) && !is_wireless_iface(if_name) && !is_layer3_qeth(interface)) {
                 for (count = 0; count < gw_tries; count++) {
                     if (di_exec_shell_log(arping) == 0)
                         break;
@@ -1564,6 +1588,8 @@ void netcfg_interface_init(struct netcfg_interface *iface)
     iface->v6_stateless_config = -1;
     iface->loopback = -1;
     iface->mode = MANAGED;
+    iface->parentif = NULL;
+    iface->vlanid = -1;
 }
 
 /* Parse an IP address (v4 or v6), with optional CIDR netmask, into
diff --git a/netcfg.c b/netcfg.c
index 195681b..c918641 100644
--- a/netcfg.c
+++ b/netcfg.c
@@ -67,6 +67,7 @@ int main(int argc, char *argv[])
            GET_METHOD,
            GET_DHCP,
            GET_STATIC,
+           GET_VLAN,
            WCONFIG,
            WCONFIG_ESSID,
            WCONFIG_SECURITY_TYPE,
@@ -216,13 +217,19 @@ int main(int argc, char *argv[])
                 state = BACKUP;
             else if (! interface.name || ! num_interfaces)
                 state = GET_HOSTNAME_ONLY;
-            else {
-                if (is_wireless_iface (interface.name))
-                    state = WCONFIG;
-                else
-                    state = GET_METHOD;
-            }
+            else if (is_wireless_iface (interface.name))
+                state = WCONFIG;
+            else
+                state = GET_VLAN;
+            break;
+
+	case GET_VLAN:
+            if (netcfg_set_vlan(client, &interface) == GO_BACK)
+                state = BACKUP;
+            else
+                state = GET_METHOD;
             break;
+
         case GET_HOSTNAME_ONLY:
             if(netcfg_get_hostname(client, "netcfg/get_hostname", hostname, 0))
                 state = BACKUP;
@@ -231,6 +238,7 @@ int main(int argc, char *argv[])
                 state = QUIT;
             }
             break;
+
         case GET_METHOD:
             if ((res = netcfg_get_method(client)) == GO_BACK)
                 state = (num_interfaces == 1) ? BACKUP : GET_INTERFACE;
diff --git a/netcfg.h b/netcfg.h
index 00a2cea..8b45776 100644
--- a/netcfg.h
+++ b/netcfg.h
@@ -151,6 +151,11 @@ struct netcfg_interface {
 	/* WPA */
 	wpa_t wpa_supplicant_status;
 	char *passphrase;
+
+	/* VLAN */
+	char *parentif;
+	int vlanid;
+
 };
 
 /* Somewhere we can store both in_addr and in6_addr; convenient for all those
@@ -221,6 +226,9 @@ extern void deconfigure_network(struct netcfg_interface *iface);
 extern void interface_up (const char *if_name);
 extern void interface_down (const char *if_name);
 
+extern void netcfg_interface_up (const struct netcfg_interface *iface);
+extern void netcfg_interface_down (const struct netcfg_interface *iface);
+
 extern void loop_setup(void);
 extern int get_hostname_from_dns(const struct netcfg_interface *interface, char *hostname, const size_t max_hostname_len);
 
@@ -270,4 +278,7 @@ extern void cleanup_dhcpv6_client(void);
 extern int start_dhcpv6_client(struct debconfclient *client, const struct netcfg_interface *interface);
 extern int netcfg_autoconfig(struct debconfclient *client, struct netcfg_interface *interface);
 
+/* vlan.c */
+extern int netcfg_set_vlan(struct debconfclient *client, struct netcfg_interface *interface);
+
 #endif /* _NETCFG_H_ */
diff --git a/nm-conf.c b/nm-conf.c
index aeab031..66d549b 100644
--- a/nm-conf.c
+++ b/nm-conf.c
@@ -32,11 +32,17 @@ static void get_uuid(char* target)
 
 static void nm_write_connection(FILE *config_file, nm_connection connection)
 {
+    static char *type = NM_DEFAULT_WIRED;
+    if (connection.type == WIFI) {
+	    type = NM_DEFAULT_WIRELESS;
+    }
+    if (connection.type == VLAN) {
+	    type = NM_DEFAULT_VLAN;
+    }
     fprintf(config_file, "\n%s\n", NM_SETTINGS_CONNECTION);
     fprintf(config_file, "id=%s\n", connection.id);
     fprintf(config_file, "uuid=%s\n", connection.uuid);
-    fprintf(config_file, "type=%s\n", (connection.type == WIFI) ?
-            NM_DEFAULT_WIRELESS : NM_DEFAULT_WIRED);
+    fprintf(config_file, "type=%s\n", type);
 }
 
 #ifdef WIRELESS
@@ -71,6 +77,15 @@ static void nm_write_wired_specific_options(FILE *config_file,
     }
 }
 
+static void nm_write_vlan_specific_options(FILE *config_file,
+        struct nm_config_info *nmconf)
+{
+    nm_vlan vlan = nmconf->vlan;
+    fprintf(config_file, "\n%s\n", NM_SETTINGS_VLAN);
+    fprintf(config_file, "parent=%s\n", vlan.parent);
+    fprintf(config_file, "parent=%i\n", vlan.id);
+}
+
 #ifdef WIRELESS
 static void nm_write_wireless_security(FILE *config_file, nm_wireless_security
         wireless_security)
@@ -176,6 +191,9 @@ static void nm_write_connection_type(struct nm_config_info nmconf)
     if (nmconf.connection.type == WIFI) {
         fprintf(f, "connection type: wireless\n");
     }
+    else if (nmconf.connection.type == VLAN) {
+        fprintf(f, "connection type: vlan\n");
+    }
     else {
         fprintf(f, "connection type: wired\n");
     }
@@ -229,6 +247,9 @@ void nm_write_configuration(struct nm_config_info nmconf)
     if (nmconf.connection.type == WIRED) {
         nm_write_wired_specific_options(config_file, &nmconf);
     }
+    else if (nmconf.connection.type == VLAN) {
+        nm_write_vlan_specific_options(config_file, &nmconf);
+    }
 #ifdef WIRELESS
     else {
         nm_write_wireless_specific_options(config_file, &nmconf);
@@ -420,6 +441,15 @@ static void nm_get_ipv6(struct netcfg_interface *niface, nm_ipvX *ipv6)
 
 }
 
+static void nm_get_vlan(struct netcfg_interface *niface, nm_connection *connection, nm_vlan *nmvlan)
+{
+    if (niface->vlanid > 0) {
+	    connection->type = VLAN;
+	    nmvlan->id = niface->vlanid;
+	    nmvlan->parent = niface->parentif;
+    }
+}
+
 /* Extract all configs for a wireless interface, from both global netcfg
  * values and other resources. */
 #ifdef WIRELESS
@@ -444,6 +474,7 @@ static void nm_get_wired_config(struct netcfg_interface *niface, struct nm_confi
     nm_get_wired_specific_options(niface, &(nmconf->wired));
     nm_get_ipv4(niface, &(nmconf->ipv4));
     nm_get_ipv6(niface, &(nmconf->ipv6));
+    nm_get_vlan(niface, &(nmconf->connection), &(nmconf->vlan));
 }
 
 /* Getting configurations for NM relies on netcfrg global variables. */
diff --git a/nm-conf.h b/nm-conf.h
index 6340222..9a6b695 100644
--- a/nm-conf.h
+++ b/nm-conf.h
@@ -20,6 +20,7 @@
 #define NM_DEFAULT_WIRED_NAME           "Wired connection 1"
 #define NM_DEFAULT_WIRELESS             "802-11-wireless"
 #define NM_DEFAULT_WIRELESS_SECURITY    "802-11-wireless-security"
+#define NM_DEFAULT_VLAN                 "vlan"
 #define NM_DEFAULT_PATH_FOR_MAC         "/sys/class/net/%s/address"
 #define NM_CONFIG_FILE_PATH             "/etc/NetworkManager/system-connections"
 #define NM_CONNECTION_FILE              "/tmp/connection_type"
@@ -30,6 +31,7 @@
 #define NM_SETTINGS_WIRELESS_SECURITY   "["NM_DEFAULT_WIRELESS_SECURITY"]"
 #define NM_SETTINGS_IPV4                "[ipv4]"
 #define NM_SETTINGS_IPV6                "[ipv6]"
+#define NM_SETTINGS_VLAN                "[vlan]"
 
 /* Minimalist structures for storing basic elements in order to write a Network
  * Manager format config file.
@@ -43,7 +45,7 @@ typedef struct nm_connection
 {
     char id[NM_MAX_LEN_ID];
     char uuid[NM_MAX_LEN_UUID];
-    enum {WIRED, WIFI} type;
+    enum {WIRED, WIFI, VLAN} type;
     int manual; /* 1 = true, 0 = false */
 } nm_connection;
 
@@ -86,6 +88,11 @@ typedef struct nm_ipvX
     unsigned int                    masklen;
 }   nm_ipvX;
 
+typedef struct nm_vlan
+{
+    char *                          parent;
+    int                             id;
+}   nm_vlan;
 
 typedef struct nm_config_info
 {
@@ -95,6 +102,7 @@ typedef struct nm_config_info
     nm_wireless_security    wireless_security;
     nm_ipvX                 ipv4;
     nm_ipvX                 ipv6;
+    nm_vlan                 vlan;
 }   nm_config_info;
 
 /* Public functions */
diff --git a/static.c b/static.c
index ea12fba..ba03931 100644
--- a/static.c
+++ b/static.c
@@ -310,7 +310,7 @@ static int netcfg_activate_static_ipv4(struct debconfclient *client,
     deconfigure_network(NULL);
 
     loop_setup();
-    interface_up(interface->name);
+    netcfg_interface_up(interface);
 
     /* Flush all previous addresses, routes */
     snprintf(buf, sizeof(buf), "ifconfig %s inet 0 down", interface->name);
@@ -345,7 +345,7 @@ static int netcfg_activate_static_ipv4(struct debconfclient *client,
     deconfigure_network(NULL);
 
     loop_setup();
-    interface_up(interface->name);
+    netcfg_interface_up(interface);
 
     /* Flush all previous addresses, routes */
     snprintf(buf, sizeof(buf), "ip -f inet addr flush dev %s", interface->name);
@@ -426,7 +426,7 @@ static int netcfg_activate_static_ipv6(struct debconfclient *client,
     deconfigure_network(NULL);
     
     loop_setup();
-    interface_up(interface->name);
+    netcfg_interface_up(interface);
     
     /* Flush all previous addresses, routes */
     snprintf(buf, sizeof(buf), "ifconfig %s inet 0 down", interface->name);
@@ -449,7 +449,7 @@ static int netcfg_activate_static_ipv6(struct debconfclient *client,
     deconfigure_network(NULL);
 
     loop_setup();
-    interface_up(interface->name);
+    netcfg_interface_up(interface);
 
     /* Flush all previous addresses, routes */
     snprintf(buf, sizeof(buf), "ip -f inet6 addr flush dev %s", interface->name);
@@ -461,8 +461,8 @@ static int netcfg_activate_static_ipv6(struct debconfclient *client,
     /* Now down and up the interface, to get LL and SLAAC addresses back,
      * since flushing the addresses and routes gets rid of all that
      * sort of thing. */
-    interface_down(interface->name);
-    interface_up(interface->name);
+    netcfg_interface_down(interface);
+    netcfg_interface_up(interface);
 
     /* Add the new IP address and netmask */
     snprintf(buf, sizeof(buf), "ip addr add %s/%d dev %s",
diff --git a/vlan.c b/vlan.c
new file mode 100644
index 0000000..bd474d4
--- /dev/null
+++ b/vlan.c
@@ -0,0 +1,101 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <cdebconf/debconfclient.h>
+#include <debian-installer.h>
+#include "netcfg.h"
+
+static char* get_vlan_command(const char* parentif, const char* vlanif, int vlanid) {
+#if defined(__linux__)
+	const char* vlan_command = "ip link add link %s name %s type vlan id %d";
+	int len = strlen(vlan_command) + strlen(parentif) + strlen(vlanif) + 4 + 1;
+	char* buf = malloc(len);
+	snprintf(buf, len, vlan_command, parentif, vlanif, vlanid);
+	return buf;
+#elif defined(__FreeBSD_kernel__)
+	const char* vlan_command = "ifconfig %s vlan %d vlandev %s";
+	int len = strlen(vlan_command) + strlen(parentif) + strlen(vlanif) + 4 + 1;
+	char* buf = malloc(len);
+	snprintf(buf, len, vlan_command, vlanif, vlanid, parentif);
+	return buf;
+#endif
+}
+
+/* Create a new VLAN interface attached to the currently selected
+ * network interface.
+ */
+int netcfg_set_vlan (struct debconfclient *client, struct netcfg_interface *interface) {
+#if defined(__linux__) || defined(__FreeBSD_kernel__)
+	int vlanid;
+
+	debconf_get(client, "netcfg/vlan_id");
+	/* Empty string: no VLAN preseeded, ask if we should configure VLAN */
+	if (strlen(client->value) == 0) {
+		debconf_input (client, "medium", "netcfg/use_vlan");
+		if (debconf_go(client) == GO_BACK) {
+			return GO_BACK;
+		}
+
+		debconf_get(client, "netcfg/use_vlan");
+
+		if (!strcmp(client->value, "false")) {
+			return 0;
+		}
+
+		debconf_input(client, "critical", "netcfg/vlan_id");
+		if (debconf_go(client) == GO_BACK) {
+			return GO_BACK;
+		}
+		debconf_get(client, "netcfg/vlan_id");
+	}
+
+	for (;;) {
+		vlanid = strtol(client->value, NULL, 10);
+		/* Valid range: 1-4094 (0 and 4095 are reserved.)
+		 * 0 will be returned by strtol if the value cannot be parsed.
+		 */
+		if (vlanid < 1 || vlanid > 4094) {
+			di_error("VLAN ID \"%s\" is invalid.", client->value);
+			debconf_subst(client, "netcfg/vlan_id_invalid", "vlan_id", client->value);
+			debconf_input(client, "critical", "netcfg/invalid_vlan");
+			debconf_capb(client);
+			debconf_go(client);
+
+			debconf_capb(client, "backup");
+			debconf_input(client, "critical", "netcfg/vlan_id");
+			if (debconf_go(client) == GO_BACK) {
+				return GO_BACK;
+			}
+		} else {
+			break;
+		}
+	}
+
+	int vlaniflen = strlen(interface->name) + 1 + 4 + 1;
+	char* vlanif = malloc(vlaniflen);
+	snprintf(vlanif, vlaniflen, "%s.%d", interface->name, vlanid);
+
+	char *vlan_command = get_vlan_command(interface->name, vlanif, vlanid);
+	int rc = di_exec_shell_log(vlan_command);
+	if (rc != 0) {
+		di_error("\"%s\" failed to create VLAN interface; return code = %d", vlan_command, rc);
+		free(vlan_command);
+		debconf_input(client, "critical", "netcfg/vlan_failed");
+		debconf_go(client);
+		return GO_BACK;
+	}
+	free(vlan_command);
+
+	interface->parentif = interface->name;
+	interface->name = vlanif;
+	interface->vlanid = vlanid;
+	di_exec_shell_log("apt-install vlan");
+#else
+	/* This platform does not support VLANs. */
+	debconf_get(client, "netcfg/vlan_id");
+	if (strlen(client->value) > 0) {
+		di_error("netcfg/vlan_id specified, yet VLAN is not supported on this platfrom");
+	}
+#endif
+	return 0;
+}
diff --git a/wireless.c b/wireless.c
index 566b032..83b1d1d 100644
--- a/wireless.c
+++ b/wireless.c
@@ -121,7 +121,7 @@ int netcfg_wireless_show_essids(struct debconfclient *client, struct netcfg_inte
     int essid_list_len = 1;
 
     iw_get_basic_config (wfd, interface->name, &wconf);
-    interface_up(interface->name);
+    netcfg_interface_up(interface);
 
     if (iw_scan(wfd, interface->name, iw_get_kernel_we_version(),
                 &network_list) >= 0 ) {
@@ -205,7 +205,7 @@ int netcfg_wireless_show_essids(struct debconfclient *client, struct netcfg_inte
     }
 
     iw_set_basic_config(wfd, interface->name, &wconf);
-    interface_down(interface->name);
+    netcfg_interface_down(interface);
 
     di_info("Network chosen: %s. Proceeding to connect.", interface->essid);
 
diff --git a/write_interface.c b/write_interface.c
index 2ab1a34..e768002 100644
--- a/write_interface.c
+++ b/write_interface.c
@@ -44,6 +44,20 @@ static int nc_wi_loopback(const struct netcfg_interface *interface, FILE *fd)
 	return 1;
 }
 
+/* Write VLAN settings, such as: vlan_raw_device eth0
+*/
+static int nc_wi_vlan(const struct netcfg_interface *interface, FILE *fd)
+{
+	int rv;
+	rv = 1;
+	if (interface && interface->parentif &&
+	    (fprintf(fd, "\tvlan_raw_device %s\n", interface->parentif) < 0)) {
+		rv = 0;
+	}
+	return rv;
+}
+
+
 static int nc_wi_wireless_options(const struct netcfg_interface *interface, FILE *fd)
 {
 	/*
@@ -271,7 +285,10 @@ int netcfg_write_interface(const struct netcfg_interface *interface)
 		di_debug("Writing static IPv6 stanza for %s", interface->name);
 		rv = nc_wi_static_ipv6(interface, fd);
 	}
-	
+	if (rv && interface && interface->parentif) {
+		di_debug("Writing VLAN: %s", interface->name);
+		rv = nc_wi_vlan(interface, fd);
+	}
 	if (rv && interface && is_wireless_iface(interface->name)) {
 		di_debug("Writing wireless options for %s", interface->name);
 		rv = nc_wi_wireless_options(interface, fd);
-- 
2.7.4




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Sat, 23 Apr 2016 12:03:03 GMT) (full text, mbox, link).


Message #174 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Philipp Kern <pkern@debian.org>
To: Dimitri John Ledkov <xnox@ubuntu.com>, 433568@bugs.debian.org
Subject: Re: Bug#433568: [PATCH] Add vlan support, based on YunQiang Su patch and Philipp Kern's rewrite, with own additions. Closes: #433568
Date: Sat, 23 Apr 2016 13:59:18 +0200
On Fri, Apr 15, 2016 at 03:17:00AM +0100, Dimitri John Ledkov wrote:
> ---
> 
>  Changes since last version:
>  - Corrected Philipp's name
>  - Adjusted vlan_failed text message
>  - Adding a di_error if vlan_id is preseeded and not supported
>  - Added NetworkManager vlan type
>  - Sent templates for review

From a patch point of view I'm mostly happy. But this should incorporate the
newly suggested templates as well. Plus there are a few nits below.

> +netcfg (1.139) UNRELEASED; urgency=medium
> +
> +  * Add vlan support, based on YunQiang Su patch and Philipp Kern's
> +    rewrite, with own additions. Closes: #433568

Please capitalize VLAN and put Closes into parantheses.

Suggested patch description:

    Add VLAN support.
    
    This is based on YunQiang Su patch and Philipp Kern's rewrite, with own
    additions.
    
    Closes: #433568

> +
> + -- Dimitri John Ledkov <xnox@ubuntu.com>  Mon, 04 Apr 2016 12:18:08 +0100
> +
>  netcfg (1.138) unstable; urgency=medium
>  
>    [ Hendrik Brueckner ]
> diff --git a/debian/netcfg-common.templates b/debian/netcfg-common.templates
> index 2b77936..ebbfbb3 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:
> @@ -371,4 +399,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 fe06950..9476bac 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 c6d1d8d..ac2c6df 100644
> --- a/netcfg-common.c
> +++ b/netcfg-common.c
> @@ -267,7 +267,7 @@ int is_raw_80211(const char *iface)
>  
>  #if defined(__s390__)
>  // Layer 3 qeth on s390(x) cannot do arping to test gateway reachability.
> -int is_layer3_qeth(const char *iface)
> +int is_layer3_qeth(const struct netcfg_interface *interface)
>  {
>      const int bufsize = 1024;
>      int retval = 0;
> @@ -277,6 +277,12 @@ int is_layer3_qeth(const char *iface)
>      ssize_t slen;
>      char* driver;
>      int fd;
> +    char* iface;
> +
> +    if (interface->parentif)
> +        iface = interface->parentif;
> +    else
> +        iface = interface->name;
>  
>      // This is sufficient for both /driver and /layer2.
>      len = strlen(SYSCLASSNET) + strlen(iface) + strlen("/device/driver") + 1;
> @@ -329,7 +335,7 @@ out:
>      return retval;
>  }
>  #else
> -int is_layer3_qeth(const char *iface __attribute__((unused)))
> +int is_layer3_qeth(const struct netcfg_interface *interface  __attribute__((unused)))
>  {
>      return 0;
>  }
> @@ -1338,6 +1344,24 @@ void interface_down (const char *if_name)
>      }
>  }
>  
> +void netcfg_interface_up (const struct netcfg_interface *iface)
> +{
> +	if (iface->parentif)
> +		interface_up (iface->parentif);
> +
> +	if (iface->name)
> +		interface_up (iface->name);
> +}
> +
> +void netcfg_interface_down (const struct netcfg_interface *iface)
> +{
> +	if (iface->name)
> +		interface_down (iface->name);
> +
> +	if (iface->parentif)
> +		interface_down (iface->parentif);
> +}
> +
>  void parse_args (int argc, char ** argv)
>  {
>      if (argc == 2) {
> @@ -1528,7 +1552,7 @@ int netcfg_detect_link(struct debconfclient *client, const struct netcfg_interfa
>          if (ethtool_lite(if_name) == 1) /* ethtool-lite's CONNECTED */ {
>              di_info("Found link on %s", if_name);
>  
> -            if (!empty_str(gateway) && !is_wireless_iface(if_name) && !is_layer3_qeth(if_name)) {
> +            if (!empty_str(gateway) && !is_wireless_iface(if_name) && !is_layer3_qeth(interface)) {
>                  for (count = 0; count < gw_tries; count++) {
>                      if (di_exec_shell_log(arping) == 0)
>                          break;
> @@ -1564,6 +1588,8 @@ void netcfg_interface_init(struct netcfg_interface *iface)
>      iface->v6_stateless_config = -1;
>      iface->loopback = -1;
>      iface->mode = MANAGED;
> +    iface->parentif = NULL;
> +    iface->vlanid = -1;
>  }
>  
>  /* Parse an IP address (v4 or v6), with optional CIDR netmask, into
> diff --git a/netcfg.c b/netcfg.c
> index 195681b..c918641 100644
> --- a/netcfg.c
> +++ b/netcfg.c
> @@ -67,6 +67,7 @@ int main(int argc, char *argv[])
>             GET_METHOD,
>             GET_DHCP,
>             GET_STATIC,
> +           GET_VLAN,
>             WCONFIG,
>             WCONFIG_ESSID,
>             WCONFIG_SECURITY_TYPE,
> @@ -216,13 +217,19 @@ int main(int argc, char *argv[])
>                  state = BACKUP;
>              else if (! interface.name || ! num_interfaces)
>                  state = GET_HOSTNAME_ONLY;
> -            else {
> -                if (is_wireless_iface (interface.name))
> -                    state = WCONFIG;
> -                else
> -                    state = GET_METHOD;
> -            }
> +            else if (is_wireless_iface (interface.name))
> +                state = WCONFIG;
> +            else
> +                state = GET_VLAN;
> +            break;
> +
> +	case GET_VLAN:
> +            if (netcfg_set_vlan(client, &interface) == GO_BACK)
> +                state = BACKUP;
> +            else
> +                state = GET_METHOD;
>              break;
> +
>          case GET_HOSTNAME_ONLY:
>              if(netcfg_get_hostname(client, "netcfg/get_hostname", hostname, 0))
>                  state = BACKUP;
> @@ -231,6 +238,7 @@ int main(int argc, char *argv[])
>                  state = QUIT;
>              }
>              break;
> +
>          case GET_METHOD:
>              if ((res = netcfg_get_method(client)) == GO_BACK)
>                  state = (num_interfaces == 1) ? BACKUP : GET_INTERFACE;
> diff --git a/netcfg.h b/netcfg.h
> index 00a2cea..8b45776 100644
> --- a/netcfg.h
> +++ b/netcfg.h
> @@ -151,6 +151,11 @@ struct netcfg_interface {
>  	/* WPA */
>  	wpa_t wpa_supplicant_status;
>  	char *passphrase;
> +
> +	/* VLAN */
> +	char *parentif;
> +	int vlanid;
> +
>  };
>  
>  /* Somewhere we can store both in_addr and in6_addr; convenient for all those
> @@ -221,6 +226,9 @@ extern void deconfigure_network(struct netcfg_interface *iface);
>  extern void interface_up (const char *if_name);
>  extern void interface_down (const char *if_name);
>  
> +extern void netcfg_interface_up (const struct netcfg_interface *iface);
> +extern void netcfg_interface_down (const struct netcfg_interface *iface);
> +
>  extern void loop_setup(void);
>  extern int get_hostname_from_dns(const struct netcfg_interface *interface, char *hostname, const size_t max_hostname_len);
>  
> @@ -270,4 +278,7 @@ extern void cleanup_dhcpv6_client(void);
>  extern int start_dhcpv6_client(struct debconfclient *client, const struct netcfg_interface *interface);
>  extern int netcfg_autoconfig(struct debconfclient *client, struct netcfg_interface *interface);
>  
> +/* vlan.c */
> +extern int netcfg_set_vlan(struct debconfclient *client, struct netcfg_interface *interface);
> +
>  #endif /* _NETCFG_H_ */
> diff --git a/nm-conf.c b/nm-conf.c
> index aeab031..66d549b 100644
> --- a/nm-conf.c
> +++ b/nm-conf.c
> @@ -32,11 +32,17 @@ static void get_uuid(char* target)
>  
>  static void nm_write_connection(FILE *config_file, nm_connection connection)
>  {
> +    static char *type = NM_DEFAULT_WIRED;
> +    if (connection.type == WIFI) {
> +	    type = NM_DEFAULT_WIRELESS;
> +    }
> +    if (connection.type == VLAN) {
> +	    type = NM_DEFAULT_VLAN;
> +    }
>      fprintf(config_file, "\n%s\n", NM_SETTINGS_CONNECTION);
>      fprintf(config_file, "id=%s\n", connection.id);
>      fprintf(config_file, "uuid=%s\n", connection.uuid);
> -    fprintf(config_file, "type=%s\n", (connection.type == WIFI) ?
> -            NM_DEFAULT_WIRELESS : NM_DEFAULT_WIRED);
> +    fprintf(config_file, "type=%s\n", type);
>  }
>  
>  #ifdef WIRELESS
> @@ -71,6 +77,15 @@ static void nm_write_wired_specific_options(FILE *config_file,
>      }
>  }
>  
> +static void nm_write_vlan_specific_options(FILE *config_file,
> +        struct nm_config_info *nmconf)
> +{
> +    nm_vlan vlan = nmconf->vlan;
> +    fprintf(config_file, "\n%s\n", NM_SETTINGS_VLAN);
> +    fprintf(config_file, "parent=%s\n", vlan.parent);
> +    fprintf(config_file, "parent=%i\n", vlan.id);

id=%d, no?

Would be nice to have this tested once, if it actually produces a configuration
that works. ;-)

> +}
> +
>  #ifdef WIRELESS
>  static void nm_write_wireless_security(FILE *config_file, nm_wireless_security
>          wireless_security)
> @@ -176,6 +191,9 @@ static void nm_write_connection_type(struct nm_config_info nmconf)
>      if (nmconf.connection.type == WIFI) {
>          fprintf(f, "connection type: wireless\n");
>      }
> +    else if (nmconf.connection.type == VLAN) {
> +        fprintf(f, "connection type: vlan\n");
> +    }
>      else {
>          fprintf(f, "connection type: wired\n");
>      }
> @@ -229,6 +247,9 @@ void nm_write_configuration(struct nm_config_info nmconf)
>      if (nmconf.connection.type == WIRED) {
>          nm_write_wired_specific_options(config_file, &nmconf);
>      }
> +    else if (nmconf.connection.type == VLAN) {
> +        nm_write_vlan_specific_options(config_file, &nmconf);
> +    }
>  #ifdef WIRELESS
>      else {
>          nm_write_wireless_specific_options(config_file, &nmconf);
> @@ -420,6 +441,15 @@ static void nm_get_ipv6(struct netcfg_interface *niface, nm_ipvX *ipv6)
>  
>  }
>  
> +static void nm_get_vlan(struct netcfg_interface *niface, nm_connection *connection, nm_vlan *nmvlan)
> +{
> +    if (niface->vlanid > 0) {
> +	    connection->type = VLAN;
> +	    nmvlan->id = niface->vlanid;
> +	    nmvlan->parent = niface->parentif;
> +    }
> +}
> +
>  /* Extract all configs for a wireless interface, from both global netcfg
>   * values and other resources. */
>  #ifdef WIRELESS
> @@ -444,6 +474,7 @@ static void nm_get_wired_config(struct netcfg_interface *niface, struct nm_confi
>      nm_get_wired_specific_options(niface, &(nmconf->wired));
>      nm_get_ipv4(niface, &(nmconf->ipv4));
>      nm_get_ipv6(niface, &(nmconf->ipv6));
> +    nm_get_vlan(niface, &(nmconf->connection), &(nmconf->vlan));
>  }
>  
>  /* Getting configurations for NM relies on netcfrg global variables. */

Would this also need to write out wired_specific_options for the
parentif? (The only one being the MAC address...) I'm not sure if it'd
need to be a separate file then. Probably? |:

Kind regards and thanks
Philipp Kern



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Mon, 27 Jun 2016 11:57:04 GMT) (full text, mbox, link).


Acknowledgement sent to Holger Levsen <holger@layer-acht.org>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Mon, 27 Jun 2016 11:57:04 GMT) (full text, mbox, link).


Message #179 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Holger Levsen <holger@layer-acht.org>
To: 433568@bugs.debian.org
Subject: support for detecting missing firmware for vlan support
Date: Mon, 27 Jun 2016 11:54:50 +0000
[Message part 1 (text/plain, inline)]
Hi,

I've installed Debian jessie in a setup yesterday, where I needed to use
vlan, so I was very happy when I saw that this bug has a patch.

However, the network card I used works nicely for configurations without
vlans without loading additional firmware, while it needs a non free
firmware to support vlans.

Looking through the patch for #433568 I could not see anything dealing
with such situations however :/ 


-- 
cheers,
	Holger
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Mon, 27 Jun 2016 12:06:14 GMT) (full text, mbox, link).


Acknowledgement sent to Ben Hutchings <ben@decadent.org.uk>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Mon, 27 Jun 2016 12:06:14 GMT) (full text, mbox, link).


Message #184 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Ben Hutchings <ben@decadent.org.uk>
To: Holger Levsen <holger@layer-acht.org>, 433568@bugs.debian.org
Subject: Re: Bug#433568: support for detecting missing firmware for vlan support
Date: Mon, 27 Jun 2016 14:05:53 +0200
[Message part 1 (text/plain, inline)]
On Mon, 2016-06-27 at 11:54 +0000, Holger Levsen wrote:
> Hi,
> 
> I've installed Debian jessie in a setup yesterday, where I needed to use
> vlan, so I was very happy when I saw that this bug has a patch.
> 
> However, the network card I used works nicely for configurations without
> vlans without loading additional firmware, while it needs a non free
> firmware to support vlans.
>
> Looking through the patch for #433568 I could not see anything dealing
> with such situations however :/ 
I've never heard of that situation before.  Which hardware is this? 
Where is the need for firmware documented?

Ben.

-- 

Ben Hutchings
Humour is the best antidote to reality.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Mon, 27 Jun 2016 14:15:05 GMT) (full text, mbox, link).


Acknowledgement sent to Holger Levsen <holger@layer-acht.org>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Mon, 27 Jun 2016 14:15:05 GMT) (full text, mbox, link).


Message #189 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Holger Levsen <holger@layer-acht.org>
To: 433568@bugs.debian.org
Subject: Re: Bug#433568: support for detecting missing firmware for vlan support
Date: Mon, 27 Jun 2016 14:13:33 +0000
[Message part 1 (text/plain, inline)]
On Mon, Jun 27, 2016 at 02:05:53PM +0200, Ben Hutchings wrote:
> I've never heard of that situation before. 

I think you have: PEBKAC :)

the server is located in a loud+dusty+dark room, has 4 ethernet devices
and it seems I mixed them up…

> Which hardware is this? 
> Where is the need for firmware documented?

eth2 needs the non-free firmware but eth3 is the one actually connected
to the switch…

63: None 02.0: 10701 Ethernet
  SysFS ID: /class/net/eth2
  SysFS Device Link: /devices/pci0000:00/0000:00:01.1/0000:02:00.0
  Hardware Class: network interface
  Model: "Ethernet network interface"
  Driver: "cxgb3"
  Driver Modules: "cxgb3"
  Device File: eth2
  Link detected: no

64: None 03.0: 10701 Ethernet
  SysFS ID: /class/net/eth3
  SysFS Device Link: /devices/pci0000:00/0000:00:1c.4/0000:04:00.0
  Hardware Class: network interface
  Model: "Ethernet network interface"
  Driver: "e1000e"
  Driver Modules: "e1000e"
  Device File: eth3

so, sorry for the noise.


-- 
cheers,
	Holger
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#433568; Package netcfg. (Thu, 02 Nov 2017 11:36:02 GMT) (full text, mbox, link).


Acknowledgement sent to Tim Stoop <tim@kumina.nl>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Thu, 02 Nov 2017 11:36:02 GMT) (full text, mbox, link).


Message #194 received at 433568@bugs.debian.org (full text, mbox, reply):

From: Tim Stoop <tim@kumina.nl>
To: 433568@bugs.debian.org
Subject: add vlan support
Date: Thu, 2 Nov 2017 12:24:06 +0100
Hi,

Has this patch already been accepted? Any more info on how to use it, in
that case?

-- 
Kind regards / Met vriendelijke groet,
Tim Stoop
Kumina bv
www.kumina.nl
kvk nr 14095795



Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Jan 6 19:50:37 2018; Machine Name: beach

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.