[<prev] [next>] [day] [month] [year] [list]
Message-ID: <90008df8-c3b5-8f17-9007-589a36c0be42@secunet.com>
Date: Thu, 10 Sep 2020 15:54:46 +0200
From: Christian Langrock <christian.langrock@...unet.com>
To: "David S. Miller" <davem@...emloft.net>,
<linux-kernel@...r.kernel.org>,
"Klassert, Steffen" <Steffen.Klassert@...unet.com>
Subject: [PATCH] drivers: net: Fix *_ipsec_offload_ok(): Use ip_hdr family
Xfrm_dev_offload_ok() is called with the unencrypted SKB. So in case of
interfamily ipsec traffic (IPv4-in-IPv6 and IPv6 in IPv4) the check
assumes the wrong family of the skb (IP family of the state).
With this patch the ip header of the SKB is used to determine the
family.
Signed-off-by: Christian Langrock <christian.langrock@...unet.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 2 +-
drivers/net/ethernet/intel/ixgbevf/ipsec.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
index eca73526ac86..3601dd293463 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
@@ -813,7 +813,7 @@ static void ixgbe_ipsec_del_sa(struct xfrm_state *xs)
**/
static bool ixgbe_ipsec_offload_ok(struct sk_buff *skb, struct
xfrm_state *xs)
{
- if (xs->props.family == AF_INET) {
+ if (ip_hdr(skb)->version == 4) {
/* Offload with IPv4 options is not supported yet */
if (ip_hdr(skb)->ihl != 5)
return false;
diff --git a/drivers/net/ethernet/intel/ixgbevf/ipsec.c
b/drivers/net/ethernet/intel/ixgbevf/ipsec.c
index 5170dd9d8705..b1d72d5d1744 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ipsec.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ipsec.c
@@ -418,7 +418,7 @@ static void ixgbevf_ipsec_del_sa(struct xfrm_state *xs)
**/
static bool ixgbevf_ipsec_offload_ok(struct sk_buff *skb, struct
xfrm_state *xs)
{
- if (xs->props.family == AF_INET) {
+ if (ip_hdr(skb)->version == 4) {
/* Offload with IPv4 options is not supported yet */
if (ip_hdr(skb)->ihl != 5)
return false;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
index d39989cddd90..e3a9b313b01f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
@@ -460,7 +460,7 @@ void mlx5e_ipsec_cleanup(struct mlx5e_priv *priv)
static bool mlx5e_ipsec_offload_ok(struct sk_buff *skb, struct
xfrm_state *x)
{
- if (x->props.family == AF_INET) {
+ if (ip_hdr(skb)->version == 4) {
/* Offload with IPv4 options is not supported yet */
if (ip_hdr(skb)->ihl > 5)
return false;
--
2.21.0
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists