Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Oct 1999 11:03:42 -0700 (PDT)
From:      Archie Cobbs <archie@whistle.com>
To:        tarkhil@over.ru (Alex Povolotsky)
Cc:        freebsd-stable@FreeBSD.ORG, freebsd-net@FreeBSD.ORG
Subject:   Re: SIOCGIFCONF (or qmail?) problem?
Message-ID:  <199910221803.LAA67886@bubba.whistle.com>
In-Reply-To: <19991021193216.D86089@over.ru> from Alex Povolotsky at "Oct 21, 1999 07:32:16 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Alex Povolotsky writes:
> I've just found, that bringing up ppp0 on a computer with one more network
> interface causes qmail-1.03 to crash.
> 
> Investigating further, I've found that one of qmail's internal variables
> gets overwriten when calling ioctl SIOCGIFCONF with pointer to ifconf
> structure as argument (ipme.c, line 57 in qmail).
> 
> I still have not found if qmail gives wrong address to ioctl or if ioctl use
> more memory than requested. The fail seems to occur after iterating through
> ds0 interface.
> 
> By the way, what is ds0, how it should be configured, and where is it
> described? What does it do?
> 
> Does anyone else runs FreeBSD 3.3-RELEASE with qmail and dial-in access? 

This may or may not be the problem, but there is a common bug in
programs that use SIOCGIFCONF. The proper way to compute the byte
increment to the next entry is:

     ifp = (struct ifreq *) ((char *) &ifp->ifr_addr
      + MAX(ifp->ifr_addr.sa_len, sizeof(ifp->ifr_addr))))

The WRONG way to do it is:

     ifp = (struct ifreq *)
      ((char *) &ifp->ifr_addr + ifp->ifr_addr.sa_len))

This bug usually only gets triggered when there are discard,
tunnel, etc. interfaces which have no link information.

You might plow through the qmail sources and check.

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com


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




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