Subject: kern/11924: ioctl(sock,SIOCDIFADDR, xxx) fails silently
To: None <gnats-bugs@gnats.netbsd.org>
From: None <donlee_ppc@icompute.com>
List: netbsd-bugs
Date: 01/09/2001 20:50:13
>Number:         11924
>Category:       kern
>Synopsis:       The ioctl "ioctl(sockfd, SIOCDIFADDR, (caddr_t) &ifr)"
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 09 20:50:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Donald Lee
>Release:        NetBSD 1.5 MacPPC release
>Organization:
	icompute.com
>Environment:
	Power Center 132 w/ Sonnet 300 Mhz/512K upgrade card.
System: NetBSD charm 1.5


>Description:
	This is closely related to pr 11916.
	An ioctl() that manipulates interfaces/routes on ppp
	devices fails silently.  This happens to me when running
	pppd, and makes it really tough to detect the problem and
	fix it in the code.
	I have a workaround in my 1.3 and 1.4 systems, but this
	problem leaves me unable to use my workaround for 11916.
	In the code in usr.sbin/pppd/pppd/sys-bsd.c, in routine
	sifaddr(), the ppp interface address is set up.  At the code
	near the end of this routine:

    if (ioctl(sockfd, SIOCAIFADDR, (caddr_t) &ifra) < 0) {
        if (errno != EEXIST) {
            error("Couldn't set interface address: %m");
            return 0;
        }
        warn("Couldn't set interface address: Address %I already exists", o);
        return(0);
    }

This code would spit out the message "Couldn't set interface...." in
1.3.x and 1.4.x systems when an arp entry already exists for the
address in question.  In 1.5, this ioctl fails, but returns zero, so
I can't tell in the code if the call has failed.
>How-To-Repeat:
	Follow procedure in 11916 and check this message, which *never*
	appears in the log under NetBSD 1.5.
>Fix:
	none
>Release-Note:
>Audit-Trail:
>Unformatted: