lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140915145023.4834.93706.stgit@dragon>
Date:	Mon, 15 Sep 2014 16:50:47 +0200
From:	Jesper Dangaard Brouer <brouer@...hat.com>
To:	Jesper Dangaard Brouer <brouer@...hat.com>, netdev@...r.kernel.org
Cc:	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <eric.dumazet@...il.com>,
	Stephen Hemminger <shemminger@...tta.com>
Subject: [net-next PATCH] net: Correct TOS priority mapping for DSCP EF

The DSCP value for Expedited Forwarding (EF) got mapped to
internal priority TC_PRIO_INTERACTIVE_BULK, which ends up in
medium/best-effort priority band(1) of pfifo_fast

This patch change TOS mapping, causing the DSCP EF to get mapped
to TC_PRIO_INTERACTIVE, which end up in high priority band(0)
of pfifo_fast.

While performing this policy change, document the TOS to priority
lookup table ip_tos2prio[16].  Thus, making it easier to
understand this table for reviewers.

The DSCP AFxx mappings are also suboptimal, but we choose not to
change those mapping, only document the mapping in the code.

Signed-off-by: Jesper Dangaard Brouer <brouer@...hat.com>
---

 net/ipv4/route.c |   43 +++++++++++++++++++++++++++----------------
 1 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 234a43e..800b6f4 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -168,23 +168,34 @@ static struct dst_ops ipv4_dst_ops = {
 
 #define ECN_OR_COST(class)	TC_PRIO_##class
 
+/* lookup: tos bitmasked 0x1E and shifted right (tos>>1) in rt_tos2priority() */
 const __u8 ip_tos2prio[16] = {
-	TC_PRIO_BESTEFFORT,
-	ECN_OR_COST(BESTEFFORT),
-	TC_PRIO_BESTEFFORT,
-	ECN_OR_COST(BESTEFFORT),
-	TC_PRIO_BULK,
-	ECN_OR_COST(BULK),
-	TC_PRIO_BULK,
-	ECN_OR_COST(BULK),
-	TC_PRIO_INTERACTIVE,
-	ECN_OR_COST(INTERACTIVE),
-	TC_PRIO_INTERACTIVE,
-	ECN_OR_COST(INTERACTIVE),
-	TC_PRIO_INTERACTIVE_BULK,
-	ECN_OR_COST(INTERACTIVE_BULK),
-	TC_PRIO_INTERACTIVE_BULK,
-	ECN_OR_COST(INTERACTIVE_BULK)
+	/* Desc format: two least-significant bits should have been
+	 * for ECN (see "-" split). The hex values represent the TOS
+	 * byte in IP-header (masked with 0x1E)
+	 */
+	TC_PRIO_BESTEFFORT,           /* [0] 000-00 = 0x00 default            */
+	ECN_OR_COST(BESTEFFORT),      /* [1] 000-10 = 0x02 TOS-"mincost"      */
+	TC_PRIO_BESTEFFORT,           /* [2] 001-00 = 0x04 TOS-"reliability"  */
+	ECN_OR_COST(BESTEFFORT),      /* [3] 001-10 = 0x06                    */
+	TC_PRIO_BULK,                 /* [4] 010-00 = 0x08 TOS-"throughput"
+				       * (incidentally maps) DSCP(AF11+21+31+41)
+				       */
+	ECN_OR_COST(BULK),            /* [5] 010-10 = 0x0A                    */
+	TC_PRIO_BULK,                 /* [6] 011-00 = 0x0C                    */
+	ECN_OR_COST(BULK),            /* [7] 011-10 = 0x0E                    */
+	TC_PRIO_INTERACTIVE,          /* [8] 100-00 = 0x10 TOS-"lowdelay"
+				       * (incidentally maps) DSCP(AF12+22+32+42)
+				       */
+	ECN_OR_COST(INTERACTIVE),     /* [9] 100-10 = 0x12                    */
+	TC_PRIO_INTERACTIVE,          /*[10] 101-00 = 0x14                    */
+	ECN_OR_COST(INTERACTIVE),     /*[11] 101-10 = 0x16                    */
+	TC_PRIO_INTERACTIVE_BULK,     /*[12] 110-00 = 0x18
+				       * (incidentally maps) DSCP(AF13+23+33+43)
+				       */
+	ECN_OR_COST(INTERACTIVE_BULK),/*[13] 110-10 = 0x1A                    */
+	TC_PRIO_INTERACTIVE,          /*[14] 111-00 = 0x1C maps DSCP(EF)      */
+	ECN_OR_COST(INTERACTIVE_BULK) /*[15] 111-10 = 0x1E                    */
 };
 EXPORT_SYMBOL(ip_tos2prio);
 

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ