From owner-freebsd-bugs@FreeBSD.ORG Sun Jan 16 19:00:21 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 065501065673 for ; Sun, 16 Jan 2011 19:00:21 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E55328FC18 for ; Sun, 16 Jan 2011 19:00:18 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p0GJ0IfU075578 for ; Sun, 16 Jan 2011 19:00:18 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p0GJ0I4u075551; Sun, 16 Jan 2011 19:00:18 GMT (envelope-from gnats) Resent-Date: Sun, 16 Jan 2011 19:00:18 GMT Resent-Message-Id: <201101161900.p0GJ0I4u075551@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Roman Bogorodskiy Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84B00106567A for ; Sun, 16 Jan 2011 18:51:05 +0000 (UTC) (envelope-from novel@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 592518FC0C; Sun, 16 Jan 2011 18:51:05 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p0GIp5Yi073365; Sun, 16 Jan 2011 18:51:05 GMT (envelope-from novel@freefall.freebsd.org) Received: (from novel@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p0GIp5Dv073358; Sun, 16 Jan 2011 18:51:05 GMT (envelope-from novel) Message-Id: <201101161851.p0GIp5Dv073358@freefall.freebsd.org> Date: Sun, 16 Jan 2011 18:51:05 GMT From: Roman Bogorodskiy To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: vysster@gmail.com Subject: conf/154062: [ patch ] change to way of auto-generatation of vlan devices based on the chosen parent device X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Roman Bogorodskiy List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Jan 2011 19:00:21 -0000 >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 , 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: