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
> what the local interface addresses are. I will improve README.IPV6 for
> the next release. It is somewhat decayed.
Here you are, it is horrible, but it is short and it works OK:
build-Linux-alpha/exim -d10 -bt jgg@foo
Exim version 3.12 debug level 10 uid=1083 gid=800
probably Berkeley DB version 1.8x (native mode)
[..]
lully.debian.org in local_domains? yes (matched lsearch;/etc/exim/locals)
Actual local interface address is 127.0.0.1
Actual local interface address is 216.160.206.172
Actual local interface address is ::1 (lo)
Actual local interface address is 3ffe:a00:e:1::2 (sit0)
Actual local interface address is ::127.0.0.1 (sit0)
Actual local interface address is ::216.160.206.172 (sit0)
Actual local interface address is fe80::250:4ff:fe87:6430 (eth0)
Thanks,
Jason
--- /tmp/exim-3.12/src/host.c Mon Aug 7 21:33:20 2000
+++ /tmp/exim-3.12.jgg/src/host.c Mon Aug 7 21:32:10 2000
@@ -461,6 +461,54 @@
return yield;
}
+#ifdef LINUX_IPV6
+/* This is so horrible, don't look. Slightly ripped from net-tools ifconfig */
+static ip_address_item *
+host_find_running_interfaces_linux6(void)
+{
+ ip_address_item *yield = NULL;
+ ip_address_item *last = NULL;
+ ip_address_item *next;
+ char addr6p[8][5];
+ int plen, scope, dad_status, if_idx;
+ char devname[20];
+ FILE *f;
+
+ yield = last = host_find_running_interfaces();
+
+ if ((f = fopen(LINUX_IPV6, "r")) == NULL)
+ return yield;
+
+ while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
+ addr6p[0], addr6p[1], addr6p[2], addr6p[3],
+ addr6p[4], addr6p[5], addr6p[6], addr6p[7],
+ &if_idx, &plen, &scope, &dad_status, devname) != EOF)
+ {
+ struct sockaddr_in6 Addr;
+
+ next = store_malloc(sizeof(ip_address_item));
+ next->next = NULL;
+ sprintf(next->address, "%s:%s:%s:%s:%s:%s:%s:%s",
+ addr6p[0], addr6p[1], addr6p[2], addr6p[3],
+ addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
+
+ /* Normalize the representation */
+ inet_pton(AF_INET6,next->address,&Addr.sin6_addr);
+ inet_ntop(AF_INET6,&Addr.sin6_addr,next->address,sizeof next->address);
+
+ if (yield == NULL) yield = last = next; else
+ {
+ last->next = next;
+ last = next;
+ }
+
+ DEBUG(9) debug_printf("Actual local interface address is %s (%s)\n",
+ last->address,devname);
+ }
+ fclose(f);
+ return yield;
+}
+#endif /* LINUX_IPV6 */
#else /* SYSCTL_IP_INTERFACES */
@@ -622,8 +670,12 @@
ip_address_item *last = NULL;
ip_address_item *next;
+#ifndef LINUX_IPV6
if (local_interfaces == NULL) return host_find_running_interfaces();
-
+#else
+if (local_interfaces == NULL) return host_find_running_interfaces_linux6();
+#endif
+
while ((s = string_nextinlist(&listptr, ':', buffer, sizeof(buffer))) != NULL)
{
if (!string_is_ip_address(s, NULL))
--- /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:17:38 2000
@@ -5,6 +5,7 @@
#define HAVE_SYS_VFS_H
#define NO_IP_VAR_H
#define GLIBC_IP_OPTIONS
+#define LINUX_IPV6 "/proc/net/if_inet6"
#define F_FREESP O_TRUNC
typedef struct flock flock_t;