support ipv4 ToS and ipv6 TrafficClass

Signed-off-by: 梁超众 <liangchaozhong@xiaomi.com>
This commit is contained in:
梁超众
2022-12-21 12:40:42 +08:00
committed by archer
parent 5e0af0ecfd
commit 5012195bde
26 changed files with 256 additions and 47 deletions
+2
View File
@@ -129,6 +129,8 @@
* the incoming packet */
#define IPV6_RECVPKTINFO (__SO_PROTOCOL + 9) /* It functions just same as
* IPV6_PKTINFO for now */
#define IPV6_TCLASS (__SO_PROTOCOL + 10) /* Access the Traffic Class
* field */
/* Values used with SIOCSIFMCFILTER and SIOCGIFMCFILTER ioctl's */
+20
View File
@@ -77,6 +77,26 @@
#define IP_PROTO_UDP 17
#define IP_PROTO_ICMP6 58
/* Values for the TOS field */
#define IPTOS_TOS_MASK 0x1e
#define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK)
#define IPTOS_LOWDELAY 0x10
#define IPTOS_THROUGHPUT 0x08
#define IPTOS_RELIABILITY 0x04
#define IPTOS_MINCOST 0x02
#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
/* Flag bits in 16-bit flags + fragment offset IPv4 header field */
#define IP_FLAG_RESERVED 0x8000
+5
View File
@@ -222,6 +222,11 @@ struct socket_conn_s
uint8_t s_flags; /* See _SF_* definitions */
/* Definitions of IPv4 TOS and IPv6 Traffic Class */
uint8_t s_tos; /* IPv4 Type of Service */
#define s_tclass s_tos /* IPv6 traffic class defination */
/* Connection-specific content may follow */
};