From owner-freebsd-net@FreeBSD.ORG Sat May 12 16:57:53 2007 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BEDF916A400 for ; Sat, 12 May 2007 16:57:53 +0000 (UTC) (envelope-from fli@FreeBSD.org) Received: from mx1.h3q.net (mx1.h3q.net [212.37.5.30]) by mx1.freebsd.org (Postfix) with ESMTP id 83F4B13C447 for ; Sat, 12 May 2007 16:57:53 +0000 (UTC) (envelope-from fli@FreeBSD.org) Received: from [192.168.1.100] (81-232-22-115-no50.tbcn.telia.com [81.232.22.115]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: fli@shapeshifter.se) by mx1.h3q.net (Postfix) with ESMTP id 273BB78C5F; Sat, 12 May 2007 18:30:02 +0200 (CEST) Message-ID: <4645EB89.6030208@FreeBSD.org> Date: Sat, 12 May 2007 18:30:01 +0200 From: Fredrik Lindberg User-Agent: Thunderbird 2.0.0.0 (X11/20070420) MIME-Version: 1.0 To: freebsd-net@freebsd.org Content-Type: multipart/mixed; boundary="------------020804090506080608050002" Cc: jfvogel@gmail.com Subject: em_ioctl and SIOCGIFADDR X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 May 2007 16:57:53 -0000 This is a multi-part message in MIME format. --------------020804090506080608050002 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi I'm getting panics when doing a SIOCGIFADDR ioctl to a em device, verified with todays current. FreeBSD 7.0-CURRENT #16: Sat May 12 15:44:05 CEST 2007 The interface only had a auto configured ipv6 address and no ipv4 address at all. Both SIOCGIFADDR and SIOCSIFADDR take a struct ifreq as an argument, so one should dereference a struct ifreq in em_ioctl and not a struct ifaddr. At least this takes care of the panic. Fredrik Lindberg --------------020804090506080608050002 Content-Type: text/plain; name="if_em.c-20070512" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="if_em.c-20070512" Index: if_em.c =================================================================== RCS file: /home/ncvs/src/sys/dev/em/if_em.c,v retrieving revision 1.175 diff -u -u -r1.175 if_em.c --- if_em.c 11 May 2007 21:36:08 -0000 1.175 +++ if_em.c 12 May 2007 16:19:14 -0000 @@ -974,7 +974,7 @@ switch (command) { case SIOCSIFADDR: case SIOCGIFADDR: - if (ifa->ifa_addr->sa_family == AF_INET) { + if (ifr->ifr_addr.sa_family == AF_INET) { /* * XXX * Since resetting hardware takes a very long time --------------020804090506080608050002--