mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
RT_TOS() from include/uapi/linux/in_route.h is defined using
IPTOS_TOS_MASK from include/uapi/linux/ip.h. This is problematic for
files such as include/net/ip_fib.h that want to use RT_TOS() as without
including both header files kernel compilation fails:
In file included from ./include/net/ip_fib.h:25,
from ./include/net/route.h:27,
from ./include/net/lwtunnel.h:9,
from net/core/dst.c:24:
./include/net/ip_fib.h: In function ‘fib_dscp_masked_match’:
./include/uapi/linux/in_route.h:31:32: error: ‘IPTOS_TOS_MASK’ undeclared (first use in this function)
31 | #define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK)
| ^~~~~~~~~~~~~~
./include/net/ip_fib.h:440:45: note: in expansion of macro ‘RT_TOS’
440 | return dscp == inet_dsfield_to_dscp(RT_TOS(fl4->flowi4_tos));
Therefore, cited commit changed linux/in_route.h to include linux/ip.h.
However, as reported by David, this breaks iproute2 compilation due
overlapping definitions between linux/ip.h and
/usr/include/netinet/ip.h:
In file included from ../include/uapi/linux/in_route.h:5,
from iproute.c:19:
../include/uapi/linux/ip.h:25:9: warning: "IPTOS_TOS" redefined
25 | #define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK)
| ^~~~~~~~~
In file included from iproute.c:17:
/usr/include/netinet/ip.h:222:9: note: this is the location of the previous definition
222 | #define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK)
Fix by changing include/net/ip_fib.h to include linux/ip.h. Note that
usage of RT_TOS() should not spread further in the kernel due to recent
work in this area.
Fixes: 1fa3314c14 ("ipv4: Centralize TOS matching")
Reported-by: David Ahern <dsahern@kernel.org>
Closes: https://lore.kernel.org/netdev/2f5146ff-507d-4cab-a195-b28c0c9e654e@kernel.org/
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Link: https://patch.msgid.link/20240903133554.2807343-1-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
34 lines
936 B
C
34 lines
936 B
C
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
#ifndef _LINUX_IN_ROUTE_H
|
|
#define _LINUX_IN_ROUTE_H
|
|
|
|
/* IPv4 routing cache flags */
|
|
|
|
#define RTCF_DEAD RTNH_F_DEAD
|
|
#define RTCF_ONLINK RTNH_F_ONLINK
|
|
|
|
/* Obsolete flag. About to be deleted */
|
|
#define RTCF_NOPMTUDISC RTM_F_NOPMTUDISC
|
|
|
|
#define RTCF_NOTIFY 0x00010000
|
|
#define RTCF_DIRECTDST 0x00020000 /* unused */
|
|
#define RTCF_REDIRECTED 0x00040000
|
|
#define RTCF_TPROXY 0x00080000 /* unused */
|
|
|
|
#define RTCF_FAST 0x00200000 /* unused */
|
|
#define RTCF_MASQ 0x00400000 /* unused */
|
|
#define RTCF_SNAT 0x00800000 /* unused */
|
|
#define RTCF_DOREDIRECT 0x01000000
|
|
#define RTCF_DIRECTSRC 0x04000000
|
|
#define RTCF_DNAT 0x08000000
|
|
#define RTCF_BROADCAST 0x10000000
|
|
#define RTCF_MULTICAST 0x20000000
|
|
#define RTCF_REJECT 0x40000000 /* unused */
|
|
#define RTCF_LOCAL 0x80000000
|
|
|
|
#define RTCF_NAT (RTCF_DNAT|RTCF_SNAT)
|
|
|
|
#define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK)
|
|
|
|
#endif /* _LINUX_IN_ROUTE_H */
|