Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jan 2006 15:43:45 GMT
From:      Spencer Minear <minear@securecomputing.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/91399: The setifmediacallback function is not returning the saved media data before making the ioctl call
Message-ID:  <200601061543.k06Fhj7j065445@www.freebsd.org>
Resent-Message-ID: <200601061550.k06Fo6K0002590@freefall.freebsd.org>

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

>Number:         91399
>Category:       misc
>Synopsis:       The setifmediacallback function is not returning the saved media data before making the ioctl call
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 06 15:50:06 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Spencer Minear
>Release:        FreeBSD 6.0 RELEASE
>Organization:
Secure Computing Corp.
>Environment:
FreeBSD freebe1.scur.com 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Thu Nov  3 09:36:13 UTC 2005     root@x64.samsco.home:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
              The 1.19 version of ifconfig/ifmedia.c added the use of setifmediacallback so that media setting gets done only once at the end of the sequence of changes.

The change carefully made sure the that new media value was saved in the ifmr structure which is held in the callback structure.

However the new sefifmediacallback structure fails to return media information saved in the ifmr structure to the ifr structure before the ioctl call is made.  This depending on the order of paramters on the ifconfig command this can result in making a SIOCSIFMEDIA call with parameters from a previous operation.

>How-To-Repeat:
              Use a command like:

ifconfig <IF> inet <addr> netmask <mask> media <mediasetting> mtu 1500

In this case the mtu ioctl gets done before the media ioctl.  In this case the medial ioctl call contains the 1500 left over from the mtu ioctl call and returns an ENXIO error.
>Fix:
I think the fix is simple.  Add

		ifr.ifr_media = ifmr->ifm_current;
following line 242.

The code should look like:

	if (!did_it) {
		ifr.ifr_media = ifmr->ifm_current;
		if (ioctl(s, SIOCSIFMEDIA, (caddr_t)&ifr) < 0)
>Release-Note:
>Audit-Trail:
>Unformatted:



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