em_ioctl and SIOCGIFADDR

Fredrik Lindberg fli at FreeBSD.org
Sat May 12 16:57:53 UTC 2007


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
-------------- next part --------------
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


More information about the freebsd-net mailing list