Date: Mon, 06 Dec 1999 16:31:39 +0000 From: Mike Bristow <michaelb@demon.net> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/15318: ifconfig dumps core Message-ID: <E11v135-000E2H-00@singsing.eng.demon.net>
next in thread | raw e-mail | index | archive | help
>Number: 15318
>Category: bin
>Synopsis: ifconfig dumps core
>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: Mon Dec 6 11:20:00 PST 1999
>Closed-Date:
>Last-Modified:
>Originator: Mike Bristow
>Release: FreeBSD 3.3-STABLE-19991129 i386; FreeBSD 4.0-CURRENT-19991118 i386 ; FreeBSD-3.3-RELEASE i386
>Organization:
Thus PLC
>Environment:
FreeBSD 3.3-RELEASE; FreeBSD-3.3-STABLE; FreeBSD-
>Description:
ifconfig will dump core when run with certain arguments; this is when
the struct afswtch contains a NULL function pointer which gets called.
>How-To-Repeat:
/sbin/ifconfig foo0 ether 66:c0:4f:60:49:e1
(with some value of foo that exists on the system)
>Fix:
The following patch will fix the core dump by making ifconfig notice a
NULL function pointer and exit. It applies to FreeBSD-STABLE; I
haven't checked FreeBSD-CURRENT (other than confirming that the
behaviour is identical).
--- /usr/src/sbin/ifconfig/ifconfig.c.orig Thu Sep 2 16:30:32 1999
+++ /usr/src/sbin/ifconfig/ifconfig.c Mon Dec 6 16:06:32 1999
@@ -565,6 +565,9 @@
setaddr++;
if (doalias == 0)
clearaddr = 1;
+ if (afp->af_getaddr == NULL) {
+ errx(1,"setifaddr: no af_getaddr function for %s interfaces", afp->af_name);
+ }
(*afp->af_getaddr)(addr, (doalias >= 0 ? ADDR : RIDADDR));
}
@@ -575,6 +578,9 @@
int s;
const struct afswtch *afp;
{
+ if (afp->af_getaddr == NULL) {
+ errx(1,"setifnetmask: no af_getaddr function for %s interfaces", afp->af_name);
+ }
(*afp->af_getaddr)(addr, MASK);
}
@@ -585,6 +591,9 @@
int s;
const struct afswtch *afp;
{
+ if (afp->af_getaddr == NULL) {
+ errx(1,"setbroadaddr: no af_getaddr function for %s interfaces", afp->af_name);
+ }
(*afp->af_getaddr)(addr, DSTADDR);
}
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E11v135-000E2H-00>
