diff mbox series

[ovs-dev,03/11] datapath: add seqadj extension when NAT is used.

Message ID 1571074671-31834-4-git-send-email-yihung.wei@gmail.com
State Superseded
Headers show
Series Backport upstream conntrack related patches | expand

Commit Message

Yi-Hung Wei Oct. 14, 2019, 5:37 p.m. UTC
From: Flavio Leitner <fbl@sysclose.org>

upstream patch:

commit fa7e428c6b7ed3281610511a2b2ec716d9894be8
Author: Flavio Leitner <fbl@sysclose.org>
Date:   Mon Mar 25 15:58:31 2019 -0300

    openvswitch: add seqadj extension when NAT is used.

    When the conntrack is initialized, there is no helper attached
    yet so the nat info initialization (nf_nat_setup_info) skips
    adding the seqadj ext.

    A helper is attached later when the conntrack is not confirmed
    but is going to be committed. In this case, if NAT is needed then
    adds the seqadj ext as well.

    Fixes: 16ec3d4fbb96 ("openvswitch: Fix cached ct with helper.")
    Signed-off-by: Flavio Leitner <fbl@sysclose.org>
    Acked-by: Pravin B Shelar <pshelar@ovn.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
---
 datapath/conntrack.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Yifeng Sun Oct. 14, 2019, 11:35 p.m. UTC | #1
LGTM, thanks.

Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>

On Mon, Oct 14, 2019 at 10:51 AM Yi-Hung Wei <yihung.wei@gmail.com> wrote:
>
> From: Flavio Leitner <fbl@sysclose.org>
>
> upstream patch:
>
> commit fa7e428c6b7ed3281610511a2b2ec716d9894be8
> Author: Flavio Leitner <fbl@sysclose.org>
> Date:   Mon Mar 25 15:58:31 2019 -0300
>
>     openvswitch: add seqadj extension when NAT is used.
>
>     When the conntrack is initialized, there is no helper attached
>     yet so the nat info initialization (nf_nat_setup_info) skips
>     adding the seqadj ext.
>
>     A helper is attached later when the conntrack is not confirmed
>     but is going to be committed. In this case, if NAT is needed then
>     adds the seqadj ext as well.
>
>     Fixes: 16ec3d4fbb96 ("openvswitch: Fix cached ct with helper.")
>     Signed-off-by: Flavio Leitner <fbl@sysclose.org>
>     Acked-by: Pravin B Shelar <pshelar@ovn.org>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
>
> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
> ---
>  datapath/conntrack.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/datapath/conntrack.c b/datapath/conntrack.c
> index 291d4f4723d9..1b345a03e704 100644
> --- a/datapath/conntrack.c
> +++ b/datapath/conntrack.c
> @@ -1063,6 +1063,12 @@ static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key,
>                                                             GFP_ATOMIC);
>                         if (err)
>                                 return err;
> +
> +                       /* helper installed, add seqadj if NAT is required */
> +                       if (info->nat && !nfct_seqadj(ct)) {
> +                               if (!nfct_seqadj_ext_add(ct))
> +                                       return -EINVAL;
> +                       }
>                 }
>
>                 /* Call the helper only if:
> --
> 2.7.4
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Flavio Leitner Oct. 14, 2019, 11:40 p.m. UTC | #2
On Mon, 14 Oct 2019 10:37:43 -0700
Yi-Hung Wei <yihung.wei@gmail.com> wrote:

> From: Flavio Leitner <fbl@sysclose.org>
> 
> upstream patch:
> 
> commit fa7e428c6b7ed3281610511a2b2ec716d9894be8
> Author: Flavio Leitner <fbl@sysclose.org>
> Date:   Mon Mar 25 15:58:31 2019 -0300
> 
>     openvswitch: add seqadj extension when NAT is used.
> 
>     When the conntrack is initialized, there is no helper attached
>     yet so the nat info initialization (nf_nat_setup_info) skips
>     adding the seqadj ext.
> 
>     A helper is attached later when the conntrack is not confirmed
>     but is going to be committed. In this case, if NAT is needed then
>     adds the seqadj ext as well.
> 
>     Fixes: 16ec3d4fbb96 ("openvswitch: Fix cached ct with helper.")
>     Signed-off-by: Flavio Leitner <fbl@sysclose.org>
>     Acked-by: Pravin B Shelar <pshelar@ovn.org>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>


LGTM
fbl


> ---
>  datapath/conntrack.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/datapath/conntrack.c b/datapath/conntrack.c
> index 291d4f4723d9..1b345a03e704 100644
> --- a/datapath/conntrack.c
> +++ b/datapath/conntrack.c
> @@ -1063,6 +1063,12 @@ static int __ovs_ct_lookup(struct net *net,
> struct sw_flow_key *key, GFP_ATOMIC);
>  			if (err)
>  				return err;
> +
> +			/* helper installed, add seqadj if NAT is
> required */
> +			if (info->nat && !nfct_seqadj(ct)) {
> +				if (!nfct_seqadj_ext_add(ct))
> +					return -EINVAL;
> +			}
>  		}
>  
>  		/* Call the helper only if:
diff mbox series

Patch

diff --git a/datapath/conntrack.c b/datapath/conntrack.c
index 291d4f4723d9..1b345a03e704 100644
--- a/datapath/conntrack.c
+++ b/datapath/conntrack.c
@@ -1063,6 +1063,12 @@  static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key,
 							    GFP_ATOMIC);
 			if (err)
 				return err;
+
+			/* helper installed, add seqadj if NAT is required */
+			if (info->nat && !nfct_seqadj(ct)) {
+				if (!nfct_seqadj_ext_add(ct))
+					return -EINVAL;
+			}
 		}
 
 		/* Call the helper only if: