diff mbox series

[RESEND:,net] drivers: net: ixgbe: Fix *_ipsec_offload_ok():, Use ip_hdr family

Message ID 5bbccb85-9d71-1f99-e668-27893c4e9945@secunet.com
State Changes Requested
Delegated to: David Miller
Headers show
Series [RESEND:,net] drivers: net: ixgbe: Fix *_ipsec_offload_ok():, Use ip_hdr family | expand

Checks

Context Check Description
jkicinski/apply fail Patch does not apply to net
jkicinski/tree_selection success Clearly marked for net

Commit Message

Christian Langrock Oct. 26, 2020, 4:03 p.m. UTC
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.

Fixes IP family handling for offloading inter family packets.

Signed-off-by: Christian Langrock <christian.langrock@secunet.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 2 +-
 drivers/net/ethernet/intel/ixgbevf/ipsec.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

                        return false;

Comments

Jakub Kicinski Oct. 26, 2020, 10:17 p.m. UTC | #1
On Mon, 26 Oct 2020 17:03:16 +0100 Christian Langrock wrote:
> 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.
> 
> Fixes IP family handling for offloading inter family packets.
> 
> Signed-off-by: Christian Langrock <christian.langrock@secunet.com>

All your 3 submissions got mangled by the email client.

You'll need to resend, perhaps try git send-email?
diff mbox series

Patch

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)