From owner-freebsd-bugs@FreeBSD.ORG Fri Jan 6 15:50:17 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 013E416A41F for ; Fri, 6 Jan 2006 15:50:17 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3B8DC43D5F for ; Fri, 6 Jan 2006 15:50:07 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k06Fo69j002591 for ; Fri, 6 Jan 2006 15:50:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k06Fo6K0002590; Fri, 6 Jan 2006 15:50:06 GMT (envelope-from gnats) Resent-Date: Fri, 6 Jan 2006 15:50:06 GMT Resent-Message-Id: <200601061550.k06Fo6K0002590@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, Spencer Minear Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CBEE816A420 for ; Fri, 6 Jan 2006 15:43:45 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 90A8043D45 for ; Fri, 6 Jan 2006 15:43:45 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k06FhjMp065446 for ; Fri, 6 Jan 2006 15:43:45 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id k06Fhj7j065445; Fri, 6 Jan 2006 15:43:45 GMT (envelope-from nobody) Message-Id: <200601061543.k06Fhj7j065445@www.freebsd.org> Date: Fri, 6 Jan 2006 15:43:45 GMT From: Spencer Minear To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: misc/91399: The setifmediacallback function is not returning the saved media data before making the ioctl call X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2006 15:50:17 -0000 >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 inet netmask media 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: