dscp revision 67adc03ef81fb610f8df093b17f55275ee816754
0N/A
2362N/A Differentiate Services Code Point Support
0N/A
0N/A$Id: dscp,v 1.1.2.1 2012/02/24 05:20:36 marka Exp $
0N/A
0N/ADifferentiate Services Code Point (DSCP) is implemented in IPv4 using the
2362N/ATOS octet and in IPv6 using the TCLASS octet.
0N/A
2362N/ARFC 3542 defines the api to manipulate the TCLASS octet as part of
0N/Athe advanced socket API. TCLASS is settable on both a socket and
0N/Apacket basis (setsockopt/sendmsg) and the sent value can be retrieved
0N/Ausing recvmsg over UDP. Retrieval is undefined for TCP.
0N/A
0N/AThe Advanced socket API was not incorporated into the POSIX socket
0N/AAPI for IPv6 and may not be completely implemented in any OS.
0N/A
0N/AFor TOS setsockopt() supports setting of the field on a persocket
0N/Abasis. TOS may also be set on a per packet basis on some OS using
0N/Asendmsg. If it is not supported the sendmsg call reports a error.
0N/ASupport can only be determined by attempted to send a packet with
2362N/Athe option set. Retrieval of the sent TOS value is retrievable on
2362N/ALinux. This can be determined at compile time.
2362N/A
0N/ADSCP values need to be compatible with TOS values as it is a re-use
0N/Aof the field.
0N/A
0N/ALIBISC:
0N/A
0N/AWe will need to be able to probe for the level of DSCP support. We
0N/Aneed to know if we can set it at the socket level, packet level and
0N/Aif we can retrieve the DSCP value sent. This needs to be done
0N/Aindependently for IPv4 and IPv6.
0N/A
0N/A#define ISC_NET_DSCPRECVV4 0x01 /* Can receive sent DSCP value IPv4 */
0N/A#define ISC_NET_DSCPRECVV6 0x02 /* Can receive sent DSCP value IPv6 */
0N/A#define ISC_NET_DSCPSETV4 0x04 /* Can set DSCP on socket IPv4 */
0N/A#define ISC_NET_DSCPSETV6 0x08 /* Can set DSCP on socket IPv6 */
0N/A#define ISC_NET_DSCPPKTV4 0x10 /* Can set DSCP on per packet IPv4 */
0N/A#define ISC_NET_DSCPPKTV6 0x20 /* Can set DSCP on per packet IPv6 */
0N/A#define ISC_NET_DSCPALL 0x3f /* All valid flags */
0N/A
0N/Aunsigned int
0N/Aisc_net_probedscp(void);
0N/A/*%<
0N/A * Probe the level of DSCP support.
0N/A */
0N/A
0N/AWe also need to be able to set DSCP values on a per socket basis, per packet
0N/Abasis and to retrieve dscp values from received packet.
0N/A
0N/ASetting dscp on a per socket basis shall be done using isc_socket_dscp.
0N/A
0N/Avoid
0N/Aisc_socket_dscp(isc_socket_t *sock, unsigned int dscp);
0N/A/*%<
0N/A * Requires:
0N/A *\li 'sock' is a valid socket.
0N/A */
0N/A/*@}*/
0N/A
0N/Aisc_socketevent shall be extended to support the sending of and retrieval
0N/Aof DSCP values. If ISC_SOCKEVENTATTR_DSCP is set then isc_socket_sendto2
0N/Ashall set the DSCP value. isc_socket_recv shall set ISC_SOCKEVENTATTR_DSCP
0N/Aand the dscp element if the OS returns the value via recvmsg.
0N/A
0N/A#define ISC_SOCKEVENTATTR_DSCP 0x00040000U /* public */
0N/A
0N/Astruct isc_socketevent {
0N/A ISC_EVENT_COMMON(isc_socketevent_t);
0N/A isc_result_t result; /*%< OK, EOF, whatever else */
0N/A unsigned int minimum; /*%< minimum i/o for event */
0N/A unsigned int n; /*%< bytes read or written */
0N/A unsigned int offset; /*%< offset into buffer list */
0N/A isc_region_t region; /*%< for single-buffer i/o */
0N/A isc_bufferlist_t bufferlist; /*%< list of buffers */
0N/A isc_sockaddr_t address; /*%< source address */
0N/A isc_time_t timestamp; /*%< timestamp of packet recv */
0N/A struct in6_pktinfo pktinfo; /*%< ipv6 pktinfo */
0N/A isc_uint32_t attributes; /*%< see below */
0N/A isc_eventdestructor_t destroy; /*%< original destructor */
0N/A unsigned int dscp; /*%< UDP dscp value */
0N/A};
0N/A
0N/AA convience function will be provided to allocate and intialize the structure.
0N/A
0N/Aisc_socketevent_t *
0N/Aisc_socket_socketevent(isc_socket_t *sock0, isc_eventtype_t eventtype,
0N/A isc_taskaction_t action, const void *arg)
0N/A
0N/ANAMED/LIBDNS:
0N/A
0N/ANamed needs to be able to set the DSCP value of sent traffic. We should
0N/Abe able to set DSCP for all TCP connections.
For UDP we should have a default DSCP value for when we can't set this on
a per packet basis with the ability to override for specific destinations.
options/view/server;
tcp-dscp <value>;
udp-dscp <value>;
http://bogpeople.com/networking/dscp.shtml list a set of TOS compatible
values (below).
DSCP Name DS Field Value IP Precedence
Binary Decimal
CS0 000 000 0 0
CS1 001 000 8 1
AF11 001 010 10 1
AF12 001 100 12 1
AF13 001 110 14 1
CS2 010 000 16 2
AF21 010 010 18 2
AF22 010 100 20 2
AF23 010 110 22 2
CS3 011 000 24 3
AF31 011 010 26 3
AF32 011 100 28 3
AF33 011 110 30 3
CS4 100 000 32 4
AF41 100 010 34 4
AF42 100 100 36 4
AF43 100 110 38 4
CS5 101 000 40 5
EF 101 110 46 5
CS6 110 000 48 6
CS7 111 000 56 7
CS Class Selector (RFC 2474)
AFxy Assured Forwarding (x=class, y=drop precedence) (RFC2597)
EF Expedited Forwarding (RFC 3246)
value should be one of these or a numeric 0..63. The default value is 0.