Re: [EXIM] Strange multiple local interface?

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Philip Hazel
Date:  
À: Daniel Ryde
CC: Exim Users
Sujet: Re: [EXIM] Strange multiple local interface?
On Thu, 5 Feb 1998, Daniel Ryde wrote:

> On Thu, 5 Feb 1998, Philip Hazel wrote:
>
> > Exim calls the SIOCGIFCONF ioctl to find the local interfaces. This
> > seems to be one of those things that varies between Unices. There is
> > some contorted code in there to try to get this right. Perhaps Linux is
> > being different (again)... The code is in the function
> > host_find_running_interfaces() in the host.c module.
>
> Umm, you define:
>
> struct ifreq ifreq, *ifr;
>
> And then later you start using the pointer ifr uninitialized?
>
>     mac_max(ifr->ifr_addr.sa_len, sizeof(ifr->ifr_addr)) +

>
> Am I wrong?


Yes, I'm afraid you are. The lines in question are:

for (cp = buf; cp < buf + ifc.ifc_len; cp +=
    #ifdef HAVE_SA_LEN
    mac_max(ifr->ifr_addr.sa_len, sizeof(ifr->ifr_addr)) +
      sizeof(ifr->ifr_name))
    #else
    sizeof(*ifr))
    #endif
  {
  ifr = (struct ifreq *)cp;


The use of ifr in the "for" statement come in the third part, which gets
obeyed at the end of each time round the loop. Notice that the first
statement in the loop sets ifr, so it will be set when that expression
is evaluated.

-- 
Philip Hazel                   University Computing Service,
ph10@???             New Museums Site, Cambridge CB2 3QG,
P.Hazel@???          England.  Phone: +44 1223 334714



--
*** Exim information can be found at http://www.exim.org/ ***