summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@nvidia.com>2024-08-29 09:54:51 +0300
committerDavid S. Miller <davem@davemloft.net>2024-08-31 17:44:51 +0100
commitff95cb5e521b60d046e6571ada697a0977b189c3 (patch)
treeca5e5015e1eeb4dc307753e426100f804835e25f /include/net
parent4805646c42e51d2fbf142864d281473ad453ad5d (diff)
downloadlinux-ff95cb5e521b60d046e6571ada697a0977b189c3.tar.gz
linux-ff95cb5e521b60d046e6571ada697a0977b189c3.tar.bz2
linux-ff95cb5e521b60d046e6571ada697a0977b189c3.zip
ipv4: Unmask upper DSCP bits in ip_sock_rt_tos()
The function is used to read the DS field that was stored in IPv4 sockets via the IP_TOS socket option so that it could be used to initialize the flowi4_tos field before resolving an output route. Unmask the upper DSCP bits so that in the future the output route lookup could be performed according to the full DSCP value. Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Guillaume Nault <gnault@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/route.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/net/route.h b/include/net/route.h
index 93833cfe9c96..b896f086ec8e 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -27,6 +27,7 @@
#include <net/ip_fib.h>
#include <net/arp.h>
#include <net/ndisc.h>
+#include <net/inet_dscp.h>
#include <linux/in_route.h>
#include <linux/rtnetlink.h>
#include <linux/rcupdate.h>
@@ -45,7 +46,7 @@ static inline __u8 ip_sock_rt_scope(const struct sock *sk)
static inline __u8 ip_sock_rt_tos(const struct sock *sk)
{
- return RT_TOS(READ_ONCE(inet_sk(sk)->tos));
+ return READ_ONCE(inet_sk(sk)->tos) & INET_DSCP_MASK;
}
struct ip_tunnel_info;