Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Mar 1999 19:04:52 -0500 (EST)
From:      Bill Paul <wpaul@skynet.ctr.columbia.edu>
To:        current@freebsd.org
Subject:   2nd request for review for vlan changes
Message-ID:  <199903080004.TAA11513@skynet.ctr.columbia.edu>

next in thread | raw e-mail | index | archive | help
This is a second request for review for my proposed if_vlan updates.
Since I tweaked a couple of different things, I placed a tarball with
the sources at http://www.freebsd.org/~wpaul/VLAN/vlan.tar.gz (or,
for those of you with freebsd.org accounts,
~wpaul/public_html/VLAN/vlan.tag.gz). This contains updated sources
if_vlan.c, if_vlan_var.h and ifconfig.

The changes are as follows:

- If the IFF_LINK0 flag is set on a vlan pseudo-interface, it does not
  peform any header mangling to create the 802.1Q encapsulation, instead
  allowing the underlying parent driver to do it. (Again, this is mainly
  for the Tigon driver that I'm working on, which can do its own vlan
  tag insertion and extraction in firmware.) (I know I used LINK1 before;
  that's because I forgot that the flag values were zero-based and that
  LINK0 was really the first one. :)

  Note: vlan_start() will set rcvif on the outbound mbuf so that the
  parent driver can find the vlan interface where it originated and
  find the vlan tag. In order to avoid having the driver possibly
  follow an uninitialized rcvif pointer, vlan_start() will also set
  the M_PROTO1 flag in the mbuf to signal to the parent driver that
  the rcvif is valid.

- Implemented vlan_input_tag(), for use with interfaces that know how
  to do vlan tag extraction and de-capsulation on their own. Works like
  vlan_input(), except it accepts a third argument, t, which is the
  extracted vlan tag; given the tag, it tracks down the appropriate vlan
  interface and sends it the frame.

- Added support for multicast. The vlan pseudo interface adds entries
  to the parent's multicast filter using if_addmulti() and keeps a
  private list of those groups which it has added. If an update is done,
  the private list is removed with if_delmulti(), and the parent is
  programmed again (which again updates the private list). This is a
  little messy in principle, but the code is fairly simple.

- Implemented vlan_unconfig(), the opposite of vlan_config(). When
  setting up a vlan/parent association with SIOCSETVLAN, the parent's
  ethernet address and other info are copied to the vlan pseudo interface.
  This should be removed when the association is broken.

- Changed vlan_input()/vlan_input_tag() and vlan_start() to update
  ifp->if_ipackets and ifp->if_opackets respecively.

- If the output queue of the parent interface is full in vlan_start(),
  increment ifp->if_oerrors, free the mbuf, and continue, instead of
  just falling through and trying to queue the mbuf even though we know
  the output queue is full.

- Modified ifconfig(8) to allow setting the vlan tag and parent interface
  of a vlan interface, and to display the interface settings. Three new
  commands have been added: vlan, vlandev and -vlandev. To set up a vlan
  interface, you can do this:

	# ifconfig vlan0 vlan 12345 vlandev foo0

  To break the association, you can do this:

	# ifconfig vlan0 -vlandev foo0

  You have to set vlan and vlandev at the same time, since that's how the
  SIOCSETVLAN ioctl works. Also updated the ifconfig.8 man page.

- Fixed a bug in ifconfig. The setifflags() function does a SIOCGIFFLAGS
  on the ifreq structure that gets passed to it, however this clobbers
  part of it (namely sa_family) because everything after ifr_name is
  just one big union. This causes later portions of ifconfig that check
  the sa_family value to get confused. In my case, the effect was that
  when I did 'ifconfig vlan0 link0,' ifconfig printed out a line of
  appletalk status information because sa_family had gotten mangled to
  16 (AF_APPLETALK).

I still need to write a vlan(4) man page.

-Bill

-- 
=============================================================================
-Bill Paul            (212) 854-6020 | System Manager, Master of Unix-Fu
Work:         wpaul@ctr.columbia.edu | Center for Telecommunications Research
Home:  wpaul@skynet.ctr.columbia.edu | Columbia University, New York City
=============================================================================
 "It is not I who am crazy; it is I who am mad!" - Ren Hoek, "Space Madness"
=============================================================================


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903080004.TAA11513>