Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Mar 2001 18:43:21 +0100
From:      Paul Richards <paul@freebsd-services.co.uk>
To:        freebsd-audit@freebsd.org
Subject:   if_name panic
Message-ID:  <3ABE2E39.C69E1160@freebsd-services.co.uk>

next in thread | raw e-mail | index | archive | help
If you unload an ethernet driver then you can get a panic from if_name.

This patch fixes it but I think it's a cludgy fix since I don't think
if_name should be called if the interface is gone and the checks should
be elsewhere. There's 44 calls to if_name and their all in the KAME code
as far as I can see so it might take a while to fix properly in
co-ordination with them but this causes a panic so it should probably be
considered a showstopper bug that should be bandaided like this before
4.3 goes out (with a more appropriate error message though :-)).


Index: net_osdep.c
===================================================================
RCS file: /home/ncvs/src/sys/net/net_osdep.c,v
retrieving revision 1.3
diff -u -r1.3 net_osdep.c
--- net_osdep.c	2000/07/04 16:35:04	1.3
+++ net_osdep.c	2001/03/25 17:35:32
@@ -54,6 +54,10 @@
 {
 	static char nam[IFNAMSIZ + 10];	/*enough?*/
 
-	snprintf(nam, sizeof(nam), "%s%d", ifp->if_name, ifp->if_unit);
+	if (! ifp || ! ifp->if_name || ! ifp->if_unit) {
+		snprintf(nam, sizeof(nam), "XXX No name, if gone?");
+	} else {
+		snprintf(nam, sizeof(nam), "%s%d", ifp->if_name, ifp->if_unit);
+	}
 	return nam;
 }

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




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