- add QoS support, patch from Philip Prindeville <philipp@fedoraproject.org>

upstream reserved option ID 0xe7 for testing of this new feature (#576643)
This commit is contained in:
Jaroslav Škarvada 2011-01-10 15:40:19 +01:00
parent a60fab56a8
commit f823fb2a17
3 changed files with 156 additions and 1 deletions

145
sendmail-8.14.4-qos.patch Normal file
View File

@ -0,0 +1,145 @@
--- sendmail-8.14.3/cf/m4/proto.m4.orig 2008-01-24 16:42:01.000000000 -0700
+++ sendmail-8.14.3/cf/m4/proto.m4 2010-04-01 11:24:43.000000000 -0600
@@ -251,6 +251,9 @@ _OPTION(SevenBitInput, `confSEVEN_BIT_IN
# 8-bit data handling
_OPTION(EightBitMode, `confEIGHT_BIT_HANDLING', `pass8')
+# DSCP marking of traffic (IP_TOS)
+_OPTION(InetQoS, `confINET_QOS', `none')
+
# wait for alias file rebuild (default units: minutes)
_OPTION(AliasWait, `confALIAS_WAIT', `5m')
--- sendmail-8.14.3/cf/cf/submit.mc.orig 2006-04-04 23:54:41.000000000 -0600
+++ sendmail-8.14.3/cf/cf/submit.mc 2010-03-19 12:08:25.000000000 -0600
@@ -22,6 +22,8 @@
define(`_USE_DECNET_SYNTAX_', `1')dnl support DECnet
define(`confTIME_ZONE', `USE_TZ')dnl
define(`confDONT_INIT_GROUPS', `True')dnl
+dnl # If you're operating in a DSCP/RFC-4594 environment with QoS
+dnl define(`confINET_QOS', `AF11')dnl
define(`confPID_FILE', `/var/run/sm-client.pid')dnl
dnl define(`confDIRECT_SUBMISSION_MODIFIERS',`C')dnl
FEATURE(`use_ct_file')dnl
--- sendmail-8.14.3/sendmail/sendmail.h.orig 2008-02-15 16:19:58.000000000 -0700
+++ sendmail-8.14.3/sendmail/sendmail.h 2009-11-28 14:11:51.000000000 -0700
@@ -2373,7 +2373,9 @@ EXTERN struct termescape TermEscape; /*
EXTERN SOCKADDR ConnectOnlyTo; /* override connection address (for testing) */
EXTERN SOCKADDR RealHostAddr; /* address of host we are talking to */
extern const SM_EXC_TYPE_T EtypeQuickAbort; /* type of a QuickAbort exception */
-
+#if defined(SOL_IP) && defined(IP_TOS)
+EXTERN int InetQoS; /* QoS mapping */
+#endif
EXTERN int ConnectionRateWindowSize;
--- sendmail-8.14.3/sendmail/daemon.c.orig 2008-02-13 17:20:26.000000000 -0700
+++ sendmail-8.14.3/sendmail/daemon.c 2009-11-28 14:16:37.000000000 -0700
@@ -104,6 +104,8 @@
static time_t NextDiskSpaceCheck = 0;
+int InetQoS = 0; /* none by default */
+
/*
** GETREQUESTS -- open mail IPC port and get requests.
**
@@ -1131,6 +1131,12 @@ opendaemonsocket(d, firsttime)
(void) setsockopt(d->d_socket, SOL_SOCKET,
SO_KEEPALIVE, (char *)&on, sizeof(on));
+#if defined(SOL_IP) && defined(IP_TOS)
+ if (d->d_addr.sa.sa_family == AF_INET && InetQoS != 0x00)
+ (void) setsockopt(d->d_socket, SOL_IP,
+ IP_TOS, (char *)&InetQoS, sizeof(InetQoS));
+#endif
+
#ifdef SO_RCVBUF
if (d->d_tcprcvbufsize > 0)
{
--- sendmail-8.14.3/sendmail/readcf.c.orig 2008-02-14 10:25:14.000000000 -0700
+++ sendmail-8.14.3/sendmail/readcf.c 2009-12-10 00:12:23.000000000 -0700
@@ -2271,6 +2271,10 @@
# define O_RCPTTHROTDELAY 0xe6
{ "BadRcptThrottleDelay", O_RCPTTHROTDELAY, OI_SAFE },
#endif /* _FFR_RCPTTHROTDELAY */
+#if defined(SOL_IP) && defined(IP_TOS)
+# define O_INETQOS 0xe7
+ { "InetQoS", O_INETQOS, OI_NONE },
+#endif
{ NULL, '\0', OI_NONE }
};
@@ -2351,6 +2355,37 @@
};
#endif /* STARTTLS && _FFR_TLS_1 */
+#ifdef O_INETQOS
+static struct qosmap
+{
+ char *name; /* name of the setting */
+ int value; /* corresponding setsockopt() value */
+} QoSMap[] = {
+ { "CS0", 0x00 },
+ { "CS1", 0x20 },
+ { "AF11", 0x28 },
+ { "AF12", 0x30 },
+ { "AF13", 0x38 },
+ { "CS2", 0x40 },
+ { "AF21", 0x48 },
+ { "AF22", 0x50 },
+ { "AF23", 0x58 },
+ { "CS3", 0x60 },
+ { "AF31", 0x68 },
+ { "AF32", 0x70 },
+ { "AF33", 0x78 },
+ { "CS4", 0x80 },
+ { "AF41", 0x88 },
+ { "AF42", 0x90 },
+ { "AF43", 0x98 },
+ { "CS5", 0xa0 },
+ { "CS6", 0xc0 },
+ { "CS7", 0xe0 },
+ { "none", 0x00 },
+ { NULL, 0 }
+};
+#endif
+
# define CANONIFY(val)
@@ -3985,6 +4020,33 @@
break;
#endif /* _FFR_BADRCPT_SHUTDOWN */
+#ifdef O_INETQOS
+ case O_INETQOS:
+ {
+ struct qosmap *qmp;
+ InetQoS = -1;
+
+ for (qmp = QoSMap; qmp->name != NULL; ++qmp) {
+ if (!strcmp(val, qmp->name)) {
+ InetQoS = qmp->value;
+ break;
+ }
+ }
+
+ /*
+ ** we could allow writing it as a hex value, but
+ ** we don't at this time.
+ **/
+ if (qmp->name == NULL) {
+ (void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
+ "Warning: Option: %s unknown parameter '%s'\n",
+ OPTNAME, val);
+ break;
+ }
+ break;
+ }
+#endif
+
default:
if (tTd(37, 1))
{

View File

@ -72,6 +72,8 @@ dnl define(`confTO_QUEUERETURN', `5d')dnl
dnl define(`confQUEUE_LA', `12')dnl
dnl define(`confREFUSE_LA', `18')dnl
define(`confTO_IDENT', `0')dnl
dnl # If you're operating in a DSCP/RFC-4594 environment with QoS
dnl define(`confINET_QOS', `AF11')dnl
dnl FEATURE(delay_checks)dnl
FEATURE(`no_default_msa', `dnl')dnl
FEATURE(`smrsh', `/usr/sbin/smrsh')dnl

View File

@ -14,7 +14,7 @@
Summary: A widely used Mail Transport Agent (MTA)
Name: sendmail
Version: 8.14.4
Release: 17%{?dist}
Release: 18%{?dist}
License: Sendmail
Group: System Environment/Daemons
URL: http://www.sendmail.org/
@ -83,6 +83,9 @@ Patch22: sendmail-8.14.4-libdb5.patch
Patch23: sendmail-8.14.4-sasl2-in-etc.patch
# fix m4 ldap routing macro, #650366
Patch24: sendmail-8.14.4-m4-ldap-routing.patch
# add QoS support, patch from Philip Prindeville <philipp@fedoraproject.org>
# upstream reserved option ID 0xe7 for testing of this new feature, #576643
Patch25: sendmail-8.14.4-qos.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: tcp_wrappers-devel
BuildRequires: libdb-devel
@ -192,6 +195,7 @@ cp devtools/M4/UNIX/{,shared}library.m4
%patch22 -p1 -b .libdb5
%patch23 -p1 -b .sasl2-in-etc
%patch24 -p1 -b .m4-ldap-routing
%patch25 -p1 -b .qos
for f in RELEASE_NOTES contrib/etrn.0; do
iconv -f iso8859-1 -t utf8 -o ${f}{_,} &&
@ -644,6 +648,10 @@ exit 0
%changelog
* Mon Jan 10 2011 Jaroslav Škarvada <jskarvad@redhat.com> - 8.14.4-18
- add QoS support, patch from Philip Prindeville <philipp@fedoraproject.org>
upstream reserved option ID 0xe7 for testing of this new feature (#576643)
* Fri Nov 26 2010 Jaroslav Škarvada <jskarvad@redhat.com> - 8.14.4-17
- change LSB init header to provide $mail-transport-agent (#627413)