gpt4 book ai didi

c - 我在 IP header 中找不到 DSCP 字段,只有已弃用的 TOS 字段

转载 作者:太空宇宙 更新时间:2023-11-04 03:39:24 33 4
gpt4 key购买 nike

我将尝试通过我的 Raspberry Pi 接入点保证一些 QoS。

开始之前,我先动手:我阅读了有关 tcp、udp 和 ip header 的内容。在IP header description我看到了 DSCP 字段,最初定义为 Type of Service 字段。

DSCP 字段会为我提供有关 Qos 的有趣信息,所以我寻找它......但我找不到它:我仍然有已弃用的 tos字段。

来 self 的/usr/include/netinet/ip.h:

struct ip {
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int ip_hl:4; /* header length */
unsigned int ip_v:4; /* version */
#endif
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned int ip_v:4; /* version */
unsigned int ip_hl:4; /* header length */
#endif
u_int8_t ip_tos; /* type of service */
u_short ip_len; /* total length */
u_short ip_id; /* identification */
u_short ip_off; /* fragment offset field */
#define IP_RF 0x8000 /* reserved fragment flag */
#define IP_DF 0x4000 /* dont fragment flag */
#define IP_MF 0x2000 /* more fragments flag */
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
u_int8_t ip_ttl; /* time to live */
u_int8_t ip_p; /* protocol */
u_short ip_sum; /* checksum */
struct in_addr ip_src, ip_dst; /* source and dest address */
};

关于我的系统的信息:

uname -r -> 3.13.0-49-generic
lsb_release -a -> Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty

最佳答案

DSCP 字段取代了 ToS 字段:这些只是 IP header 中同一字段的两个名称。如果发件人将 DSCP 值放入该字段,则可以使用 ToS 字段访问它。

但是请注意,路由器是否以及如何实际解析 DSCP/ToS 字段在很大程度上取决于实现。大多数运营商 (ISP) 将在进入其网络时简单地清除该字段。大多数家用路由器会忽略该字段,尽管 OpenWRT 会将其解释为 ToS。

简而言之——在没有很好地了解您的本地网络环境的情况下使用 DSCP/ToS 字段只是 cargo 崇拜。

关于c - 我在 IP header 中找不到 DSCP 字段,只有已弃用的 TOS 字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29879130/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com