Re: [Exim] Re: Bug#64531: Exim does not recognize IPv6 local…

Top Page
Delete this message
Reply to this message
Author: Jason Gunthorpe
Date:  
To: Philip Hazel
CC: Mark Baker, Jason Gunthorpe, exim-users
Old-Topics: Re: [Exim] Re: Bug#64531: Exim does not recognize IPv6 local IP's
Subject: Re: [Exim] Re: Bug#64531: Exim does not recognize IPv6 local IP's
On Mon, 12 Jun 2000, Philip Hazel wrote:

> This can't be done (yet) for IPv6 as I understand it. That is why the
> Exim notes for IPv6 suggest that you set local_interfaces to tell Exim


Linux currently won't return IPv6 for SIOCGIFCONF presumably because glibc
still has 'struct sockaddr' not 'struct sockaddr_storage' so it cannot
hold the larger addresess.

You'll have to use netlink or /proc/net/if_inet6 - I might make a patch
for that.

However, here is a patch that you can apply to fix interface discovery and
multiple IPs. Using the new-style aliasing in Linux you can have multiple
IPs per interface. Exim does a SIOCFIGADDR which breaks that, this patch
simply makes that configurable and disables it for Linux..

Example of situation:

white{jgg}/tmp#ip addr
1: lo: <LOOPBACK,UP> mtu 3924 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 100
    link/ether 00:50:da:79:a4:2a brd ff:ff:ff:ff:ff:ff
    inet 172.16.1.1/24 scope global eth0
    inet 216.221.195.75/29 scope global eth0


Old exim:

white{jgg}/tmp#exim -d10 -bt jgg@foorbar
Exim version 3.12 debug level 10 uid=103 gid=100
probably Berkeley DB version 1.8x (native mode)
white.priv.deltatee.com in local_domains? no (end of list)
Actual local interface address is 127.0.0.1
Actual local interface address is 172.16.1.1
Actual local interface address is 172.16.1.1

Fixed exim:

white{jgg}/tmp/exim-3.12.jgg#build-Linux-i386/exim -d10 -bt jgg@foorbar
Exim version 3.12 debug level 10 uid=103 gid=100
probably Berkeley DB version 1.8x (native mode)
white.priv.deltatee.com in local_domains? no (end of list)
Actual local interface address is 127.0.0.1
Actual local interface address is 172.16.1.1
Actual local interface address is 216.221.195.75

Jason
--- /tmp/exim-3.12/src/host.c    Mon Aug 7 21:07:12 2000
+++ /tmp/exim-3.12.jgg/src/host.c    Mon Aug  7 21:21:05 2000
@@ -433,11 +433,16 @@
   if ((ifreq.ifr_flags & IFF_UP) == 0) continue;
 
   /* Get the IP address of the interface */
-
+#ifndef SIOCGIFCONF_GIVES_ADDR
   if (ioctl(vs, SIOCGIFADDR, (char *)&ifreq) < 0)
     log_write(0, LOG_PANIC_DIE, "Unable to get interface address: %d %s",
       errno, strerror(errno));
-
+#else
+  /* On OS's where SIOCGIFCONF gives the address we do not want to 
+     use SIOCGIFADDR, it may be bad in the case of ip aliasing */
+  ifreq = *ifr;
+#endif
+     
   /* Create a data block for the address, fill in the data, and put it on the
   chain. This data has to survive for ever, so use malloc. */
 
--- /tmp/exim-3.12/OS/os.h-Linux    Wed Dec  8 02:57:03 1999
+++ /tmp/exim-3.12.jgg/OS/os.h-Linux    Mon Aug  7 21:19:42 2000
@@ -5,6 +5,7 @@
 #define HAVE_SYS_VFS_H
 #define NO_IP_VAR_H
 #define GLIBC_IP_OPTIONS
+#define SIOCGIFCONF_GIVES_ADDR
 
 #define F_FREESP     O_TRUNC
 typedef struct flock flock_t;