This is the mail archive of the
libc-alpha@sourceware.org
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 at redfish-solutions dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Fri, 27 Nov 2009 16:30:57 -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. 4.2.2.2.
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
Requirements.
4.2.2.1 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).
4.2.2.2 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
routing traffic.
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.
========
2009-11-27 Philip Prindeville <philipp@redfish-solutions.com>
* sysdeps/include/generic/netinet/ip.h: Add CSn definitions
for ip_tos (per RFC 2474).
Fixes: http://sourceware.org/bugzilla/show_bug.cgi?id=11027
---
diff --git a/sysdeps/generic/netinet/ip.h b/sysdeps/generic/netinet/ip.h
index 38bd755..7b927b9 100644
--- a/sysdeps/generic/netinet/ip.h
+++ b/sysdeps/generic/netinet/ip.h
@@ -189,7 +189,26 @@ struct ip_timestamp
#define IPTOS_DSCP_EF 0xb8
/*
- * Definitions for IP type of service (ip_tos)
+ * In RFC 2474, Section 4.2.2.1, the Class Selector Codepoints subsume
+ * the old ToS Precedence values.
+ */
+
+#define IPTOS_CLASS_MASK IPTOS_PREC_MASK
+#define IPTOS_CLASS(class) IPTOS_PREC(class)
+#define IPTOS_CLASS_CS0 IPTOS_PREC_ROUTINE
+#define IPTOS_CLASS_CS1 IPTOS_PREC_PRIORITY
+#define IPTOS_CLASS_CS2 IPTOS_PREC_IMMEDIATE
+#define IPTOS_CLASS_CS3 IPTOS_PREC_FLASH
+#define IPTOS_CLASS_CS4 IPTOS_PREC_FLASHOVERRIDE
+#define IPTOS_CLASS_CS5 IPTOS_PREC_CRITIC_ECP
+#define IPTOS_CLASS_CS6 IPTOS_PREC_INTERNETCONTROL
+#define IPTOS_CLASS_CS7 IPTOS_PREC_NETCONTROL
+
+#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,7 +219,7 @@ 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)
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>