DSCP: document; hex print; -bI:dscp
authorPhil Pennock <pdp@exim.org>
Sat, 2 Jun 2012 13:10:44 +0000 (09:10 -0400)
committerPhil Pennock <pdp@exim.org>
Sat, 2 Jun 2012 13:10:44 +0000 (09:10 -0400)
doc/doc-docbook/spec.xfpt
doc/doc-txt/ChangeLog
doc/doc-txt/NewStuff
doc/doc-txt/OptionLists.txt
src/src/exim.c
src/src/functions.h
src/src/ip.c
src/src/smtp_out.c

index 64aac1ae56dcb7d961cbd0ed9a49f0fd95486eae..15a8f35501c6086c50b8be45308134ef5e2533ae 100644 (file)
@@ -2938,6 +2938,7 @@ if this is required. If the &%bi_command%& option is not set, calling Exim with
 &%-bi%& is a no-op.
 
 .new
+. // Keep :help first, then the rest in alphabetical order
 .vitem &%-bI:help%&
 .oindex "&%-bI:help%&"
 .cindex "querying exim information"
@@ -2947,6 +2948,12 @@ consumption.  This one is not.  The &%-bI:help%& option asks Exim for a
 synopsis of supported options beginning &`-bI:`&.  Use of any of these
 options shall cause Exim to exit after producing the requested output.
 
+.vitem &%-bI:dscp%&
+.oindex "&%-bI:dscp%&"
+.cindex "DSCP" "values"
+This option causes Exim to emit an alphabetically sorted list of all
+recognised DSCP names.
+
 .vitem &%-bI:sieve%&
 .oindex "&%-bI:sieve%&"
 .cindex "Sieve filter" "capabilities"
@@ -22094,6 +22101,22 @@ See the &%search_parents%& option in chapter &<<CHAPdnslookup>>& for more
 details.
 
 
+.new
+.option dscp smtp string unset
+.cindex "DCSP"
+.cindex "DiffServ"
+This option causes the DSCP value associated with a socket to be set to one
+of a number of fixed strings.  The &%-bI:dscp%& option may be used to ask
+Exim which values it knows of.  Common values include &`throughput`&,
+&`mincost`&, and on newer systems &`ef`&, &`af41`&, ...
+
+The outbound packets from Exim will be marked with this value in the header
+(for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
+that these packets will have any effect, not be stripped by networking
+equipment, or do much of anything without cooperation with your Network
+Engineer and those of all network operators between the source and destination.
+.wen
+
 
 .option fallback_hosts smtp "string list" unset
 .cindex "fallback" "hosts specified on transport"
index 34f94059257cecfca46bb2d7ae7762137406c069..1e8063bf3d7556ac4ee41015044c0fca656cd705 100644 (file)
@@ -16,6 +16,8 @@ PP/04 First step towards DNSSEC, provide $sender_host_dnssec for
       $sender_host_name and config options to manage this, and basic check
       routines.
 
+PP/05 DSCP support for outbound connections.
+
 
 Exim version 4.80
 -----------------
index 093feee72625e2d2f683cffe4b914104db52a1b6..2aaf56232c6c92788a59e632364fa1ea7b37fad0 100644 (file)
@@ -39,6 +39,11 @@ Version 4.81
 
     Current status: work-in-progress; $sender_host_dnssec variable added.
 
+ 5. DSCP support for outbound connections: on a transport using the smtp driver,
+    set "dscp = ef", for instance, to cause the connections to have the relevant
+    DSCP (IPv4 TOS or IPv6 TCLASS) value in the header.  Supported values depend
+    upon system libraries.  "exim -bI:dscp" to list the ones Exim knows of.
+
 
 Version 4.80
 ------------
index 20d8dbdc5a4e375a4c5b845a17a67bb57961cc8c..1c7881e767307f09637b6a9fb3b2f3197196e6b9 100644 (file)
@@ -187,6 +187,7 @@ driver                               string          unset         authenticator
                                                      unset         routers           4.00
                                                      unset         transports
 drop_cr                              boolean         false         main              4.00 became a no-op in 4.21
+dscp                                 string          unset         smtp              4.81
 dsn_from                             string*         +             main              4.67
 envelope_to_add                      boolean         false         transports
 envelope_to_remove                   boolean         true          main
index 9f6f3d8c3a301114e182dfe74e73393c0f9c3291..d20f938e6d478fb72b12e6c00c3f4c98a1a1e90e 100644 (file)
@@ -57,7 +57,7 @@ store_free(block);
 *************************************************/
 
 enum commandline_info { CMDINFO_NONE=0,
-  CMDINFO_HELP, CMDINFO_SIEVE };
+  CMDINFO_HELP, CMDINFO_SIEVE, CMDINFO_DSCP };
 
 
 
@@ -1044,6 +1044,7 @@ switch(request)
 "If the string is not recognised, you'll get this help (on stderr).\n"
 "\n"
 "  exim -bI:help    this information\n"
+"  exim -bI:dscp    dscp value keywords known\n"
 "  exim -bI:sieve   list of supported sieve extensions, one per line.\n"
 );
     return;
@@ -1051,7 +1052,9 @@ switch(request)
     for (pp = exim_sieve_extension_list; *pp; ++pp)
       fprintf(stream, "%s\n", *pp);
     return;
-
+  case CMDINFO_DSCP:
+    dscp_list_to_stream(stream);
+    return;
   }
 }
 
@@ -1987,6 +1990,11 @@ for (i = 1; i < argc; i++)
           info_flag = CMDINFO_SIEVE;
           info_stdout = TRUE;
           }
+        else if (strcmpic(p, CUS"dscp") == 0)
+          {
+          info_flag = CMDINFO_DSCP;
+          info_stdout = TRUE;
+          }
         else if (strcmpic(p, CUS"help") == 0)
           {
           info_stdout = TRUE;
index dd9549b182693d3e6cd8859b03da75f687abf92c..7fea6ff5ccf6eae65b2e62223a9872d0a75780dc 100644 (file)
@@ -109,6 +109,7 @@ extern int     dns_lookup(dns_answer *, uschar *, int, uschar **);
 extern int     dns_special_lookup(dns_answer *, uschar *, int, uschar **);
 extern dns_record *dns_next_rr(dns_answer *, dns_scan *, int);
 extern uschar *dns_text_type(int);
+extern void    dscp_list_to_stream(FILE *);
 extern BOOL    dscp_lookup(const uschar *, int, int *, int *, int *);
 
 extern void    enq_end(uschar *);
index 66a750dfdadd460fdf5299c723c14ac1f37bb20f..be4511dfa514d21caf7eb7e0b97b1b353b70e50e 100644 (file)
@@ -372,29 +372,29 @@ struct dscp_name_tableentry {
 /* Keep both of these tables sorted! */
 static struct dscp_name_tableentry dscp_table[] = {
 #ifdef IPTOS_DSCP_AF11
-    { "af11", IPTOS_DSCP_AF11 },
-    { "af12", IPTOS_DSCP_AF12 },
-    { "af13", IPTOS_DSCP_AF13 },
-    { "af21", IPTOS_DSCP_AF21 },
-    { "af22", IPTOS_DSCP_AF22 },
-    { "af23", IPTOS_DSCP_AF23 },
-    { "af31", IPTOS_DSCP_AF31 },
-    { "af32", IPTOS_DSCP_AF32 },
-    { "af33", IPTOS_DSCP_AF33 },
-    { "af41", IPTOS_DSCP_AF41 },
-    { "af42", IPTOS_DSCP_AF42 },
-    { "af43", IPTOS_DSCP_AF43 },
-    { "ef", IPTOS_DSCP_EF },
+    { CUS"af11", IPTOS_DSCP_AF11 },
+    { CUS"af12", IPTOS_DSCP_AF12 },
+    { CUS"af13", IPTOS_DSCP_AF13 },
+    { CUS"af21", IPTOS_DSCP_AF21 },
+    { CUS"af22", IPTOS_DSCP_AF22 },
+    { CUS"af23", IPTOS_DSCP_AF23 },
+    { CUS"af31", IPTOS_DSCP_AF31 },
+    { CUS"af32", IPTOS_DSCP_AF32 },
+    { CUS"af33", IPTOS_DSCP_AF33 },
+    { CUS"af41", IPTOS_DSCP_AF41 },
+    { CUS"af42", IPTOS_DSCP_AF42 },
+    { CUS"af43", IPTOS_DSCP_AF43 },
+    { CUS"ef", IPTOS_DSCP_EF },
 #endif
 #ifdef IPTOS_LOWCOST
-    { "lowcost", IPTOS_LOWCOST },
+    { CUS"lowcost", IPTOS_LOWCOST },
 #endif
-    { "lowdelay", IPTOS_LOWDELAY },
+    { CUS"lowdelay", IPTOS_LOWDELAY },
 #ifdef IPTOS_MINCOST
-    { "mincost", IPTOS_MINCOST },
+    { CUS"mincost", IPTOS_MINCOST },
 #endif
-    { "reliability", IPTOS_RELIABILITY },
-    { "throughput", IPTOS_THROUGHPUT }
+    { CUS"reliability", IPTOS_RELIABILITY },
+    { CUS"throughput", IPTOS_THROUGHPUT }
 };
 static int dscp_table_size =
   sizeof(dscp_table) / sizeof(struct dscp_name_tableentry);
@@ -468,5 +468,13 @@ while (last > first)
 return FALSE;
 }
 
+void
+dscp_list_to_stream(FILE *stream)
+{
+int i;
+for (i=0; i < dscp_table_size; ++i)
+  fprintf(stream, "%s\n", dscp_table[i].name);
+}
+
 
 /* End of ip.c */
index 7b58b4a7483103f49cbaf2332f4ad5a9e0d38871..42a889aa66ed0fd89133eaa4ee6017d7e8286df1 100644 (file)
@@ -212,7 +212,7 @@ bomb out, just log it and continue in default traffic class. */
 if (dscp && dscp_lookup(dscp, host_af, &dscp_level, &dscp_option, &dscp_value))
   {
   HDEBUG(D_transport|D_acl|D_v)
-    debug_printf("DSCP \"%s\"=%d ", dscp, dscp_value);
+    debug_printf("DSCP \"%s\"=%x ", dscp, dscp_value);
   if (setsockopt(sock, dscp_level, dscp_option, &dscp_value, sizeof(dscp_value)) < 0)
     HDEBUG(D_transport|D_acl|D_v)
       debug_printf("failed to set DSCP: %s ", strerror(errno));