This is the mail archive of the
mailing list for the glibc project.
[PATCH 2.10-357-ga0902db 1/1] Add CSn definitions to netinet/ip.h
- From: "Philip A. Prindeville" <philipp_subx at redfish-solutions dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Sun, 10 Jan 2010 21:56:36 -0800
- Subject: [PATCH 2.10-357-ga0902db 1/1] Add CSn definitions to netinet/ip.h
The fix in bugid 10789 could be interpreted to mean that DSCP markings (IPTOS_DSCP_AF21 .. IPTOS_DSCP_EF)
are used exclusively for marking in the Internet today.
That would be an incorrect reading.
The old IPTOS_PREC_xxx values are still in use, but have been renamed as CS0 ... CS7.
This patch clarifies that.
Quoting the additional RFC 2474:
2. Terminology Used in This Document
Behavior Aggregate: a collection of packets with the same codepoint
crossing a link in a particular direction. The terms "aggregate" and
"behavior aggregate" are used interchangeably in this document.
Classifier: an entity which selects packets based on the content of
packet headers according to defined rules.
Class Selector Codepoint: any of the eight codepoints in the range '
xxx000' (where 'x' may equal '0' or '1'). Class Selector Codepoints
are discussed in Sec. 4.2.2.
Class Selector Compliant PHB: a per-hop behavior satisfying the Class
Selector PHB Requirements specified in Sec. 126.96.36.199.
Codepoint: a specific value of the DSCP portion of the DS field.
Recommended codepoints SHOULD map to specific, standardized PHBs.
Multiple codepoints MAY map to the same PHB.
4.2.2 Subsuming IP Precedence into Class Selector Codepoints
A specification of the packet forwarding treatments selected by the
IP Precedence field today would have to be quite general; probably
not specific enough to build predictable services from in the
differentiated services framework. To preserve partial backwards
compatibility with known current uses of the IP Precedence field
without sacrificing future flexibility, we have taken the approach of
describing minimum requirements on a set of PHBs that are compatible
with most of the deployed forwarding treatments selected by the IP
Precedence field. In addition, we give a set of codepoints that MUST
map to PHBs meeting these minimum requirements. The PHBs mapped to
by these codepoints MAY have a more detailed list of specifications
in addition to the required ones stated here. Other codepoints MAY
map to these same PHBs. We refer to this set of codepoints as the
Class Selector Codepoints, and the minimum requirements for PHBs that
these codepoints may map to are called the Class Selector PHB
188.8.131.52 The Class Selector Codepoints
A specification of the packet forwarding treatments selected by the
The DS field values of 'xxx000|xx', or DSCP = 'xxx000' and CU
subfield unspecified, are reserved as a set of Class Selector
Codepoints. PHBs which are mapped to by these codepoints MUST
satisfy the Class Selector PHB requirements in addition to preserving
the Default PHB requirement on codepoint '000000' (Sec. 4.1).
184.108.40.206 The Class Selector PHB Requirements
We refer to a Class Selector Codepoint with a larger numerical value
than another Class Selector Codepoint as having a higher relative
order while a Class Selector Codepoint with a smaller numerical value
than another Class Selector Codepoint is said to have a lower
relative order. The set of PHBs mapped to by the eight Class
Selector Codepoints MUST yield at least two independently forwarded
classes of traffic, and PHBs selected by a Class Selector Codepoint
SHOULD give packets a probability of timely forwarding that is not
lower than that given to packets marked with a Class Selector
codepoint of lower relative order, under reasonable operating
conditions and traffic loads. A discarded packet is considered to be
an extreme case of untimely forwarding. In addition, PHBs selected
by codepoints '11x000' MUST give packets a preferential forwarding
treatment by comparison to the PHB selected by codepoint '000000' to
preserve the common usage of IP Precedence values '110' and '111' for
Further, PHBs selected by distinct Class Selector Codepoints SHOULD
be independently forwarded; that is, packets marked with different
Class Selector Codepoints MAY be re-ordered. A network node MAY
enforce limits on the amount of the node's resources that can be
utilized by each of these PHBs.
PHB groups whose specification satisfy these requirements are
referred to as Class Selector Compliant PHBs.
The Class Selector PHB Requirements on codepoint '000000' are
compatible with those listed for the Default PHB in Sec. 4.1.
So this patch pretty much just 'lifts' the bitfield definitions from this
RFC and incorporates them into the header in the same way that was previously
done for RFC-791 and TOS/Precedence to reflect the re-designation of
IPTOS_PREC_xxx that RFC 2474 incurred.
This reworking addresses the review comments:
2009-12-09 Philip Prindeville <email@example.com>
* sysdeps/include/generic/netinet/ip.h: Add CSn definitions
for ip_tos (per RFC 2474).
sysdeps/generic/netinet/ip.h | 43 ++++++++++++++++++++++++++++++-----------
1 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/sysdeps/generic/netinet/ip.h b/sysdeps/generic/netinet/ip.h
index 38bd755..a837b98 100644
@@ -189,7 +189,26 @@ struct ip_timestamp
#define IPTOS_DSCP_EF 0xb8
- * Definitions for IP type of service (ip_tos)
+ * In RFC 2474, Section 220.127.116.11, the Class Selector Codepoints subsume
+ * the old ToS Precedence values.
+#define IPTOS_CLASS_MASK 0xe0
+#define IPTOS_CLASS(class) ((tos) & IPTOS_CLASS_MASK)
+#define IPTOS_CLASS_CS0 0x00
+#define IPTOS_CLASS_CS1 0x20
+#define IPTOS_CLASS_CS2 0x40
+#define IPTOS_CLASS_CS3 0x60
+#define IPTOS_CLASS_CS4 0x80
+#define IPTOS_CLASS_CS5 0xa0
+#define IPTOS_CLASS_CS6 0xc0
+#define IPTOS_CLASS_CS7 0xe0
+#define IPTOS_CLASS_DEFAULT IPTOS_CLASS_CS0
+ * Definitions for IP type of service (ip_tos) [deprecated; use DSCP
+ * and CS definitions above instead.]
#define IPTOS_TOS_MASK 0x1E
#define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK)
@@ -200,18 +219,18 @@ struct ip_timestamp
#define IPTOS_MINCOST IPTOS_LOWCOST
- * Definitions for IP precedence (also in ip_tos) (hopefully unused)
+ * Definitions for IP precedence (also in ip_tos) [also deprecated.]
-#define IPTOS_PREC_MASK 0xe0
-#define IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK)
-#define IPTOS_PREC_NETCONTROL 0xe0
-#define IPTOS_PREC_INTERNETCONTROL 0xc0
-#define IPTOS_PREC_CRITIC_ECP 0xa0
-#define IPTOS_PREC_FLASHOVERRIDE 0x80
-#define IPTOS_PREC_FLASH 0x60
-#define IPTOS_PREC_IMMEDIATE 0x40
-#define IPTOS_PREC_PRIORITY 0x20
-#define IPTOS_PREC_ROUTINE 0x00
+#define IPTOS_PREC_MASK IPTOS_CLASS_MASK
+#define IPTOS_PREC(tos) IPTOS_CLASS(tos)
+#define IPTOS_PREC_NETCONTROL IPTOS_CLASS_CS7
+#define IPTOS_PREC_INTERNETCONTROL IPTOS_CLASS_CS6
+#define IPTOS_PREC_CRITIC_ECP IPTOS_CLASS_CS5
+#define IPTOS_PREC_FLASHOVERRIDE IPTOS_CLASS_CS4
+#define IPTOS_PREC_FLASH IPTOS_CLASS_CS3
+#define IPTOS_PREC_IMMEDIATE IPTOS_CLASS_CS2
+#define IPTOS_PREC_PRIORITY IPTOS_CLASS_CS1
+#define IPTOS_PREC_ROUTINE IPTOS_CLASS_CS0
* Definitions for options.
Signed-off-by: Philip Prindeville <firstname.lastname@example.org>