Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2 net 0/4] ipv4: Fix accidental RTO_ONLINK flags passed to ip_route_output_key_hash()
@ 2022-01-10 13:43 Guillaume Nault
  2022-01-10 13:43 ` [PATCH v2 net 1/4] xfrm: Don't accidentally set RTO_ONLINK in decode_session4() Guillaume Nault
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Guillaume Nault @ 2022-01-10 13:43 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski
  Cc: netdev, Steffen Klassert, Herbert Xu, Hideaki YOSHIFUJI,
	David Ahern, wenxu, Varun Prakash, Saeed Mahameed,
	Leon Romanovsky, Vlad Buslov, Or Gerlitz

The IPv4 stack generally uses the last bit of ->flowi4_tos as a flag
indicating link scope for route lookups (RTO_ONLINK). Therefore, we
have to be careful when copying a TOS value to ->flowi4_tos. In
particular, the ->tos field of IPv4 packets may have this bit set
because of ECN. Also tunnel keys generally accept any user value for
the tos.

This series fixes several places where ->flowi4_tos was set from
non-sanitised values and the flowi4 structure was later used by
ip_route_output_key_hash().

Note that the IPv4 stack usually clears the RTO_ONLINK bit using
RT_TOS(). However this macro is based on an obsolete interpretation of
the old IPv4 TOS field (RFC 1349) and clears the three high order bits
too. Since we don't need to clear these bits and since it doesn't make
sense to clear only one of the ECN bits, this patch series uses
INET_ECN_MASK instead.

All patches were compile tested only.

v2: Rebase on top of net.

Guillaume Nault (4):
  xfrm: Don't accidentally set RTO_ONLINK in decode_session4()
  gre: Don't accidentally set RTO_ONLINK in gre_fill_metadata_dst()
  libcxgb: Don't accidentally set RTO_ONLINK in cxgb_find_route()
  mlx5: Don't accidentally set RTO_ONLINK before
    mlx5e_route_lookup_ipv4_get()

 drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c   | 3 ++-
 drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 5 +++--
 net/ipv4/ip_gre.c                                   | 5 +++--
 net/xfrm/xfrm_policy.c                              | 3 ++-
 4 files changed, 10 insertions(+), 6 deletions(-)

-- 
2.21.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-12  4:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10 13:43 [PATCH v2 net 0/4] ipv4: Fix accidental RTO_ONLINK flags passed to ip_route_output_key_hash() Guillaume Nault
2022-01-10 13:43 ` [PATCH v2 net 1/4] xfrm: Don't accidentally set RTO_ONLINK in decode_session4() Guillaume Nault
2022-01-10 13:43 ` [PATCH v2 net 2/4] gre: Don't accidentally set RTO_ONLINK in gre_fill_metadata_dst() Guillaume Nault
2022-01-10 13:43 ` [PATCH v2 net 3/4] libcxgb: Don't accidentally set RTO_ONLINK in cxgb_find_route() Guillaume Nault
2022-01-10 13:43 ` [PATCH v2 net 4/4] mlx5: Don't accidentally set RTO_ONLINK before mlx5e_route_lookup_ipv4_get() Guillaume Nault
2022-01-12  4:50 ` [PATCH v2 net 0/4] ipv4: Fix accidental RTO_ONLINK flags passed to ip_route_output_key_hash() patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).