Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Mar 2010 05:12:06 GMT
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   conf/144726: network.subr functions accumulate output before r197139
Message-ID:  <201003140512.o2E5C6no036752@www.freebsd.org>
Resent-Message-ID: <201003140520.o2E5K3IL022390@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         144726
>Category:       conf
>Synopsis:       network.subr functions accumulate output before r197139
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 14 05:20:03 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        RELENG_8
>Organization:
Cisco Systems, Inc.
>Environment:
FreeBSD foo.localdomain 8.0-STABLE FreeBSD 8.0-STABLE #1 r204854M: Fri Mar 12 22:21:06 PST 2010     root@:/usr/obj/scratch/ip-thinclient-test/releng_8/sys/GENERIC  amd64
>Description:
On a system prior to r197319, any given time that list_net_interfaces is run more than once, the list grows as the variables in list_net_interfaces after that commit is a local and not a global variable.

Example (RELENG_8):

# . /etc/rc.subr ; . /etc/network.subr ; . /etc/defaults/rc.conf ; list_net_interfaces
lo0 lo0 lo0 lo0 plip0 bge0 bge1plip0 bge0 bge1plip0 bge0 bge1
# uname -a
FreeBSD foo.localdomain 8.0-STABLE FreeBSD 8.0-STABLE #1 r204854M: Fri Mar 12 22:21:06 PST 2010     root@:/usr/obj/scratch/ip-thinclient-test/releng_8/sys/GENERIC  amd64

Example (9-CURRENT):

[gcooper@bayonetta /scratch/src/head/usr.bin/hexdump]$ . /etc/rc.subr ; . /etc/network.subr ; . /etc/defaults/rc.conf ; list_net_interfaces
lo0 em0 fwe0
[gcooper@bayonetta /scratch/src/head/usr.bin/hexdump]$ uname -a
FreeBSD bayonetta.localdomain 9.0-CURRENT FreeBSD 9.0-CURRENT #2: Thu Mar  4 13:16:39 PST 2010     gcooper@bayonetta.localdomain:/usr/obj/usr/src/sys/BAYONETTA  amd64

It would be nice if this variable scoping was properly backported so others could use the functions more than once without unsetting the variables beforehand (it saves me from duplicating network interface detection in a script I'm using).
>How-To-Repeat:
1. Use a system based off of sources prior to r197319.
2. Execute: . /etc/rc.subr ; . /etc/network.subr ; . /etc/defaults/rc.conf ; list_net_interfaces
>Fix:
MFC the code in r197139 (it was supposed to be MFCed after 3 days according to the commit email: http://svn.freebsd.org/changeset/base/197139 ).

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



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