conf/154062: [ patch ] change to way of auto-generatation of vlan devices based on the chosen parent device

Roman Bogorodskiy novel at FreeBSD.org
Sun Jan 16 19:00:21 UTC 2011


>Number:         154062
>Category:       conf
>Synopsis:       [ patch ] change to way of auto-generatation of vlan devices based on the chosen parent device
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 16 19:00:18 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Roman Bogorodskiy
>Release:        FreeBSD 8.1-STABLE i386
>Organization:
>Environment:

>Description:
	The attached patch modifies the way vlan devices are generated based
	on the chosen parent device (rc.conf:vlans_IFNAME). In case when a name
        of the generated device is implicitly connected to an interface number it's
	split with a dot from a virtual network number. This symbol is not allowed
	in an interface name when referring it from netgraph subsystem and therefore
	it's visible as 'unnamed'.

	The attached patch allows to change a different separator when generating vlan
	device names. It also loads netgraph(4) so interface creation didn't depend on
	current system configuration.

	Consistency of interface names in negraph and ifconfig is required by mpd
        (/usr/ports/net/mpd5). The patch also adds default value to /etc/defauls/rc.conf
        to allow things to be backward-compatible.

	Patch is created and tested on 8.1-RELEASE-p2. The patch is authored by
	Vladimir Stepanov <vysster at gmail.com>, my role is only to help with
	translation and sending of this PR. Please keep both him and me in CC.

>How-To-Repeat:
>Fix:


--- ng_char4vlan.diff begins here ---
*** etc/network.subr.orig	Tue Dec 28 07:48:40 2010
--- etc/network.subr	Wed Dec 29 21:42:21 2010
***************
*** 564,576 ****
  
  	if [ -n "${child_vlans}" ]; then
  		load_kld if_vlan
  	fi
  
  	for child in ${child_vlans}; do
  		if expr $child : '[1-9][0-9]*$' >/dev/null 2>&1; then
! 			child="${ifn}.${child}"
! 			create_args=`get_if_var $child create_args_IF`
! 			ifconfig $child create ${create_args} && cfg=0
  		else
  			create_args="vlandev $ifn `get_if_var $child create_args_IF`"
  			if expr $child : 'vlan[0-9][0-9]*$' >/dev/null 2>&1; then
--- 564,587 ----
  
  	if [ -n "${child_vlans}" ]; then
  		load_kld if_vlan
+ 		if [ "${ng_char4vlan}" != "." && "${ng_char4vlan}" != ":" ]; then
+ 			load_kld netgraph
+ 		fi
  	fi
  
  	for child in ${child_vlans}; do
  		if expr $child : '[1-9][0-9]*$' >/dev/null 2>&1; then
! 			if [ "${ng_char4vlan}" = "." ]; then
! 				child="${ifn}.${child}"
! 				create_args=`get_if_var $child create_args_IF`
! 				ifconfig $child create ${create_args} && cfg=0
! 			else
! 				create_args="vlandev $ifn vlan $child `get_if_var ${ifn}_${child} create_args_IF`"
! 				child="${ifn}${ng_char4vlan}${child}"
! 				i=`ifconfig vlan create ${create_args}`
! 				ngctl name "${i}:" $child
! 				ifconfig $i name $child && cfg=0
! 			fi
  		else
  			create_args="vlandev $ifn `get_if_var $child create_args_IF`"
  			if expr $child : 'vlan[0-9][0-9]*$' >/dev/null 2>&1; then
*** etc/defaults/rc.conf.orig	Wed Dec 29 19:47:01 2010
--- etc/defaults/rc.conf	Wed Dec 29 19:48:41 2010
***************
*** 211,216 ****
--- 211,217 ----
  #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry.
  #ifconfig_ed0_ipx="ipx 0x00010010"	# Sample IPX address family entry.
  #ifconfig_fxp0_name="net0"	# Change interface name from fxp0 to net0.
+ ng_char4vlan="."		# Must be changed for work with netgraph system.
  #vlans_fxp0="101 vlan0"		# vlan(4) interfaces for fxp0 device
  #create_arg_vlan0="vlan 102"	# vlan tag for vlan0 device
  #wlans_ath0="wlan0"		# wlan(4) interfaces for ath0 device
--- ng_char4vlan.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list