Subject: optional DaemonPortOptions (DaemonPortOptions Modifiers=O)
To: None <sendmail-bugs@sendmail.ORG>
From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
List: tech-net
Date: 05/08/2000 10:52:03
(this is not really a bug report, but a suggested patch)
While we (netbsd) tried to ship IPv6/v4 ready userland programs with
our distribution, we found a problem with sendmail.cf.
- We would like to ship single sendmail.cf, that support IPv4/v6 dual
stack kernel as well as IPv4-only kernel
- It is not possible since, if we have the following DaemonPortOptions
with sendmail.cf, sendmail will choke on IPv4-only kernel.
>O DaemonPortOptions=Family=inet,address=0.0.0.0
>O DaemonPortOptions=Family=inet6,address=::
May 8 10:22:35 lychee sendmail[7571]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon Daemon1: can't create server SMTP socket: No such file or directory
May 8 10:22:35 lychee sendmail[7571]: daemon Daemon1: problem creating SMTP socket
What we need is an optional DaemonPortOptions, which will cease if
the address family is not available. If 2nd socket can be made
optional we can ship single sendmail.cf to support IPv4/v6 kernel as
well as IPv4-only kernel.
To achieve this, a new modifier "O" (means "optional") is added by
the following patch. With "O" modifier, inet6 DaemonPortOptions can be
made optional and sendmail will work fine on IPv4-only kernel.
>O DaemonPortOptions=Family=inet,address=0.0.0.0
>O DaemonPortOptions=Family=inet6,address=::,Modifiers=O
May 8 10:22:59 lychee sendmail[7595]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon Daemon1: can't create server SMTP socket: No such file or directory
May 8 10:22:59 lychee sendmail[7595]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon Daemon1: optional socket disabled
issues:
- D_DISABLE is not really necessary if it is okay to set
d_refuse_connections_until to ~0. I added D_DISABLE since I don't
want a surprise in year 2038, or time_t expansion from 32bit.
Please review the patch, and I hope this to become part of future
sendmail distributions.
itojun
---
Only in .: obj.NetBSD.1.4.2.i386
diff -ur /tmp/sendmail-8.10.1/sendmail/daemon.c ./sendmail/daemon.c
--- /tmp/sendmail-8.10.1/sendmail/daemon.c Sun Mar 12 05:52:46 2000
+++ ./sendmail/daemon.c Mon May 8 10:24:41 2000
@@ -227,6 +227,8 @@
{
if (curtime() < Daemons[idx].d_refuse_connections_until)
continue;
+ if (bitnset(D_DISABLE, Daemons[idx].d_flags))
+ continue;
if (refuseconnections(Daemons[idx].d_name, e, idx))
{
if (Daemons[idx].d_socket >= 0)
@@ -771,6 +773,12 @@
{
save_errno = errno;
syserr("opendaemonsocket: daemon %s: can't create server SMTP socket", d->d_name);
+ if (bitnset(D_OPTIONAL, d->d_flags) && save_errno == EAFNOSUPPORT)
+ {
+ syserr("opendaemonsocket: daemon %s: optional socket disabled", d->d_name);
+ setbitn(D_DISABLE, d->d_flags);
+ return -1;
+ }
severe:
if (LogLevel > 0)
sm_syslog(LOG_ALERT, NOQID,
diff -ur /tmp/sendmail-8.10.1/sendmail/sendmail.h ./sendmail/sendmail.h
--- /tmp/sendmail-8.10.1/sendmail/sendmail.h Tue Mar 21 17:42:54 2000
+++ ./sendmail/sendmail.h Mon May 8 10:17:29 2000
@@ -1387,6 +1387,8 @@
#define D_NOCANON 'C' /* no canonification (cf) */
#define D_NOETRN 'E' /* no ETRN (MSA) */
#define D_ETRNONLY ((char)0x01) /* allow only ETRN (disk low) */
+#define D_OPTIONAL 'O' /* optional socket */
+#define D_DISABLE ((char)0x02) /* optional socket disabled */
/* Flags for submitmode */
#define SUBMIT_UNKNOWN 0x0000 /* unknown agent type */