conf/144726: network.subr functions accumulate output before r197139

Garrett Cooper gcooper at FreeBSD.org
Sun Mar 14 05:20:04 UTC 2010


>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 at bayonetta /scratch/src/head/usr.bin/hexdump]$ . /etc/rc.subr ; . /etc/network.subr ; . /etc/defaults/rc.conf ; list_net_interfaces
lo0 em0 fwe0
[gcooper at 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 at 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:


More information about the freebsd-bugs mailing list