Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP address when a gateway ip is introduced

2016-10-31 Thread Waizel, Ariel
Don't mind, go ahead


 הודעה מקורית 
מאת: Thadeu Lima de Souza Cascardo 
נשלח: Monday, October 31, 2016 11:36 PM
אל: Ben Pfaff 
נושא: Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP address when 
a gateway ip is introduced
עותק: "Waizel, Ariel" ,[email protected]


Ariel, do you mind if I submit it myself with your authorship and sign-off as
soon as I test it and can give my sign-off?

Cascardo.

On Mon, Oct 31, 2016 at 01:55:16PM -0700, Ben Pfaff wrote:
> I can't get any of the versions of this patch to apply.  Maybe you
> should just send it as a Github pull request.
>
> On Thu, Oct 27, 2016 at 03:21:49PM +, Waizel, Ariel wrote:
> > OK I tried again - I think the tabs are OK, but not sure about the extra 
> > new lines... if there's a problem I'll try one of the email clients.
> >
> > Thnx :)
> >
> > -Original Message-
> > From: Thadeu Lima de Souza Cascardo [mailto:[email protected]]
> > Sent: Thursday, October 27, 2016 5:21 PM
> > To: Waizel, Ariel 
> > Cc: [email protected]
> > Subject: Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP 
> > address when a gateway ip is introduced
> >
> > On Thu, Oct 27, 2016 at 02:08:13PM +, Waizel, Ariel wrote:
> > >
> > >
> > > When adding a VXLAN tunnel that connects to a VTEP residing in a
> > >
> > > different IP network, the tunnel source ip needs to be selected by
> > >
> > > best fit (longest matching netmask), based on the destination VTEP
> > >
> > > ip, and the specific route's gateway ip.
> > >
> > > A bug in ovs-router.c made the source ip to be decided only based on
> > >
> > > the destination ip: Thus, if all source ips available to OVS and the
> > >
> > > destination ip are in different ip networks - no source ip is
> > >
> > > selected, and an error is returned.
> > >
> > > This error accorded when  using OVS-DPDK and configuring a VXLAN
> > >
> > > tunnel, where source ip and destination ip are in different
> > >
> > > networks, and a gateway ip was in place for the specific route.
> > >
> >
> > Besides these extra new lines, it seems your MUA turns tabs into spaces. 
> > Can you try to fix that?
> >
> > Sorry to bother you with that, but I can't apply your patch with git am as 
> > it is. Maybe the following documentation can help?
> >
> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/email-clients.txt
> >
> > Thanks.
> > Cascardo.
> >
> > >
> > >
> > > The fix tries to match a source ip based on the gateway ip, if no
> > >
> > > matching source ip was found based on the destination ip - This way,
> > >
> > > the gateway becomes the first hop only if the tunnel crosses between ip 
> > > networks.
> > >
> > > Signed-off-by: Ariel Waizel
> > > mailto:[email protected]>>
> > >
> > >
> > > diff --git a/lib/ovs-router.c b/lib/ovs-router.c index
> > > e27514a..18d0f8e 100644
> > > --- a/lib/ovs-router.c
> > > +++ b/lib/ovs-router.c
> > > @@ -198,6 +198,9 @@ ovs_router_insert__(uint8_t priority, const struct 
> > > in6_addr *ip6_dst,
> > >  p->plen = plen;
> > >  p->priority = priority;
> > >  err = get_src_addr(ip6_dst, output_bridge, &p->src_addr);
> > > +if (err && ipv6_addr_is_set(gw)) {
> > > +err = get_src_addr(gw, output_bridge, &p->src_addr);
> > > +}
> > >  if (err) {
> > >  free(p);
> > >  return err;
> > > diff --git a/tests/automake.mk b/tests/automake.mk index
> > > c170ae7..0383933 100644
> > > --- a/tests/automake.mk
> > > +++ b/tests/automake.mk
> > > @@ -93,7 +93,8 @@ TESTSUITE_AT = \
> > > tests/ovn-nbctl.at \
> > >tests/ovn-sbctl.at \
> > > tests/ovn-controller.at \
> > > -   tests/ovn-controller-vtep.at
> > > +   tests/ovn-controller-vtep.at \
> > > +   tests/ovs-route.at
> > >  SYSTEM_KMOD_TESTSUITE_AT = \
> > > tests/system-common-macros.at \ diff --git
> > > a/tests/ovs-route.at b/tests/ovs-route.at new file mode 100644 index
> > > 000..ac11847
> > > --- /dev/null
> > > +++ b/tests/ovs-route.at
> > > @@ -0,0 +1,10 @@
> > > +AT_BANNER([appctl route/add w

Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP address when a gateway ip is introduced

2016-10-31 Thread Thadeu Lima de Souza Cascardo
Ariel, do you mind if I submit it myself with your authorship and sign-off as
soon as I test it and can give my sign-off?

Cascardo.

On Mon, Oct 31, 2016 at 01:55:16PM -0700, Ben Pfaff wrote:
> I can't get any of the versions of this patch to apply.  Maybe you
> should just send it as a Github pull request.
> 
> On Thu, Oct 27, 2016 at 03:21:49PM +, Waizel, Ariel wrote:
> > OK I tried again - I think the tabs are OK, but not sure about the extra 
> > new lines... if there's a problem I'll try one of the email clients.
> > 
> > Thnx :)
> > 
> > -Original Message-
> > From: Thadeu Lima de Souza Cascardo [mailto:[email protected]] 
> > Sent: Thursday, October 27, 2016 5:21 PM
> > To: Waizel, Ariel 
> > Cc: [email protected]
> > Subject: Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP 
> > address when a gateway ip is introduced
> > 
> > On Thu, Oct 27, 2016 at 02:08:13PM +, Waizel, Ariel wrote:
> > > 
> > > 
> > > When adding a VXLAN tunnel that connects to a VTEP residing in a
> > > 
> > > different IP network, the tunnel source ip needs to be selected by
> > > 
> > > best fit (longest matching netmask), based on the destination VTEP
> > > 
> > > ip, and the specific route's gateway ip.
> > > 
> > > A bug in ovs-router.c made the source ip to be decided only based on
> > > 
> > > the destination ip: Thus, if all source ips available to OVS and the
> > > 
> > > destination ip are in different ip networks - no source ip is
> > > 
> > > selected, and an error is returned.
> > > 
> > > This error accorded when  using OVS-DPDK and configuring a VXLAN
> > > 
> > > tunnel, where source ip and destination ip are in different
> > > 
> > > networks, and a gateway ip was in place for the specific route.
> > > 
> > 
> > Besides these extra new lines, it seems your MUA turns tabs into spaces. 
> > Can you try to fix that?
> > 
> > Sorry to bother you with that, but I can't apply your patch with git am as 
> > it is. Maybe the following documentation can help?
> > 
> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/email-clients.txt
> > 
> > Thanks.
> > Cascardo.
> > 
> > > 
> > > 
> > > The fix tries to match a source ip based on the gateway ip, if no
> > > 
> > > matching source ip was found based on the destination ip - This way,
> > > 
> > > the gateway becomes the first hop only if the tunnel crosses between ip 
> > > networks.
> > > 
> > > Signed-off-by: Ariel Waizel 
> > > mailto:[email protected]>>
> > > 
> > > 
> > > diff --git a/lib/ovs-router.c b/lib/ovs-router.c index 
> > > e27514a..18d0f8e 100644
> > > --- a/lib/ovs-router.c
> > > +++ b/lib/ovs-router.c
> > > @@ -198,6 +198,9 @@ ovs_router_insert__(uint8_t priority, const struct 
> > > in6_addr *ip6_dst,
> > >  p->plen = plen;
> > >  p->priority = priority;
> > >  err = get_src_addr(ip6_dst, output_bridge, &p->src_addr);
> > > +if (err && ipv6_addr_is_set(gw)) {
> > > +err = get_src_addr(gw, output_bridge, &p->src_addr);
> > > +}
> > >  if (err) {
> > >  free(p);
> > >  return err;
> > > diff --git a/tests/automake.mk b/tests/automake.mk index 
> > > c170ae7..0383933 100644
> > > --- a/tests/automake.mk
> > > +++ b/tests/automake.mk
> > > @@ -93,7 +93,8 @@ TESTSUITE_AT = \
> > > tests/ovn-nbctl.at \
> > >tests/ovn-sbctl.at \
> > > tests/ovn-controller.at \
> > > -   tests/ovn-controller-vtep.at
> > > +   tests/ovn-controller-vtep.at \
> > > +   tests/ovs-route.at
> > >  SYSTEM_KMOD_TESTSUITE_AT = \
> > > tests/system-common-macros.at \ diff --git 
> > > a/tests/ovs-route.at b/tests/ovs-route.at new file mode 100644 index 
> > > 000..ac11847
> > > --- /dev/null
> > > +++ b/tests/ovs-route.at
> > > @@ -0,0 +1,10 @@
> > > +AT_BANNER([appctl route/add with gateway]) AT_SETUP([appctl - 
> > > +route/add with gateway]) AT_XFAIL_IF([test "$IS_WIN32" = "yes"]) 
> > > +OVS_VSWITCHD_START([add-port br0 p2 -- set Interface p2 type=gre \
> > > +options:local_ip=2.2.2.2 options:remote_ip=1

Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP address when a gateway ip is introduced

2016-10-31 Thread Ben Pfaff
I can't get any of the versions of this patch to apply.  Maybe you
should just send it as a Github pull request.

On Thu, Oct 27, 2016 at 03:21:49PM +, Waizel, Ariel wrote:
> OK I tried again - I think the tabs are OK, but not sure about the extra new 
> lines... if there's a problem I'll try one of the email clients.
> 
> Thnx :)
> 
> -Original Message-
> From: Thadeu Lima de Souza Cascardo [mailto:[email protected]] 
> Sent: Thursday, October 27, 2016 5:21 PM
> To: Waizel, Ariel 
> Cc: [email protected]
> Subject: Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP address 
> when a gateway ip is introduced
> 
> On Thu, Oct 27, 2016 at 02:08:13PM +, Waizel, Ariel wrote:
> > 
> > 
> > When adding a VXLAN tunnel that connects to a VTEP residing in a
> > 
> > different IP network, the tunnel source ip needs to be selected by
> > 
> > best fit (longest matching netmask), based on the destination VTEP
> > 
> > ip, and the specific route's gateway ip.
> > 
> > A bug in ovs-router.c made the source ip to be decided only based on
> > 
> > the destination ip: Thus, if all source ips available to OVS and the
> > 
> > destination ip are in different ip networks - no source ip is
> > 
> > selected, and an error is returned.
> > 
> > This error accorded when  using OVS-DPDK and configuring a VXLAN
> > 
> > tunnel, where source ip and destination ip are in different
> > 
> > networks, and a gateway ip was in place for the specific route.
> > 
> 
> Besides these extra new lines, it seems your MUA turns tabs into spaces. Can 
> you try to fix that?
> 
> Sorry to bother you with that, but I can't apply your patch with git am as it 
> is. Maybe the following documentation can help?
> 
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/email-clients.txt
> 
> Thanks.
> Cascardo.
> 
> > 
> > 
> > The fix tries to match a source ip based on the gateway ip, if no
> > 
> > matching source ip was found based on the destination ip - This way,
> > 
> > the gateway becomes the first hop only if the tunnel crosses between ip 
> > networks.
> > 
> > Signed-off-by: Ariel Waizel 
> > mailto:[email protected]>>
> > 
> > 
> > diff --git a/lib/ovs-router.c b/lib/ovs-router.c index 
> > e27514a..18d0f8e 100644
> > --- a/lib/ovs-router.c
> > +++ b/lib/ovs-router.c
> > @@ -198,6 +198,9 @@ ovs_router_insert__(uint8_t priority, const struct 
> > in6_addr *ip6_dst,
> >  p->plen = plen;
> >  p->priority = priority;
> >  err = get_src_addr(ip6_dst, output_bridge, &p->src_addr);
> > +if (err && ipv6_addr_is_set(gw)) {
> > +err = get_src_addr(gw, output_bridge, &p->src_addr);
> > +}
> >  if (err) {
> >  free(p);
> >  return err;
> > diff --git a/tests/automake.mk b/tests/automake.mk index 
> > c170ae7..0383933 100644
> > --- a/tests/automake.mk
> > +++ b/tests/automake.mk
> > @@ -93,7 +93,8 @@ TESTSUITE_AT = \
> > tests/ovn-nbctl.at \
> >tests/ovn-sbctl.at \
> > tests/ovn-controller.at \
> > -   tests/ovn-controller-vtep.at
> > +   tests/ovn-controller-vtep.at \
> > +   tests/ovs-route.at
> >  SYSTEM_KMOD_TESTSUITE_AT = \
> > tests/system-common-macros.at \ diff --git 
> > a/tests/ovs-route.at b/tests/ovs-route.at new file mode 100644 index 
> > 000..ac11847
> > --- /dev/null
> > +++ b/tests/ovs-route.at
> > @@ -0,0 +1,10 @@
> > +AT_BANNER([appctl route/add with gateway]) AT_SETUP([appctl - 
> > +route/add with gateway]) AT_XFAIL_IF([test "$IS_WIN32" = "yes"]) 
> > +OVS_VSWITCHD_START([add-port br0 p2 -- set Interface p2 type=gre \
> > +options:local_ip=2.2.2.2 options:remote_ip=1.1.1.1 \
> > +-- add-port br0 p1  -- set interface p1 
> > +type=dummy]) ovs-appctl netdev-dummy/ip4addr br0 2.2.2.2/24 
> > +AT_CHECK([ovs-appctl ovs/route/add 1.1.1.0/24 br0 2.2.2.10], [0], [OK
> > +])
> > +AT_CLEANUP
> > diff --git a/tests/testsuite.at b/tests/testsuite.at index 
> > 2123bee..a2c707d 100644
> > --- a/tests/testsuite.at
> > +++ b/tests/testsuite.at
> > @@ -75,3 +75,4 @@ m4_include([tests/ovn-nbctl.at])
> > m4_include([tests/ovn-sbctl.at])
> > m4_include([tests/ovn-controller.at])
> > m4_include([tests/ovn-controller-vtep.at])
> > +m4_include([tests/ovs-route.at])
> > ___
> > dev mailing list
> > [email protected]
> > http://openvswitch.org/mailman/listinfo/dev
> ___
> dev mailing list
> [email protected]
> http://openvswitch.org/mailman/listinfo/dev
___
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP address when a gateway ip is introduced

2016-10-27 Thread Waizel, Ariel
OK I tried again - I think the tabs are OK, but not sure about the extra new 
lines... if there's a problem I'll try one of the email clients.

Thnx :)

-Original Message-
From: Thadeu Lima de Souza Cascardo [mailto:[email protected]] 
Sent: Thursday, October 27, 2016 5:21 PM
To: Waizel, Ariel 
Cc: [email protected]
Subject: Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP address 
when a gateway ip is introduced

On Thu, Oct 27, 2016 at 02:08:13PM +, Waizel, Ariel wrote:
> 
> 
> When adding a VXLAN tunnel that connects to a VTEP residing in a
> 
> different IP network, the tunnel source ip needs to be selected by
> 
> best fit (longest matching netmask), based on the destination VTEP
> 
> ip, and the specific route's gateway ip.
> 
> A bug in ovs-router.c made the source ip to be decided only based on
> 
> the destination ip: Thus, if all source ips available to OVS and the
> 
> destination ip are in different ip networks - no source ip is
> 
> selected, and an error is returned.
> 
> This error accorded when  using OVS-DPDK and configuring a VXLAN
> 
> tunnel, where source ip and destination ip are in different
> 
> networks, and a gateway ip was in place for the specific route.
> 

Besides these extra new lines, it seems your MUA turns tabs into spaces. Can 
you try to fix that?

Sorry to bother you with that, but I can't apply your patch with git am as it 
is. Maybe the following documentation can help?

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/email-clients.txt

Thanks.
Cascardo.

> 
> 
> The fix tries to match a source ip based on the gateway ip, if no
> 
> matching source ip was found based on the destination ip - This way,
> 
> the gateway becomes the first hop only if the tunnel crosses between ip 
> networks.
> 
> Signed-off-by: Ariel Waizel 
> mailto:[email protected]>>
> 
> 
> diff --git a/lib/ovs-router.c b/lib/ovs-router.c index 
> e27514a..18d0f8e 100644
> --- a/lib/ovs-router.c
> +++ b/lib/ovs-router.c
> @@ -198,6 +198,9 @@ ovs_router_insert__(uint8_t priority, const struct 
> in6_addr *ip6_dst,
>  p->plen = plen;
>  p->priority = priority;
>  err = get_src_addr(ip6_dst, output_bridge, &p->src_addr);
> +if (err && ipv6_addr_is_set(gw)) {
> +err = get_src_addr(gw, output_bridge, &p->src_addr);
> +}
>  if (err) {
>  free(p);
>  return err;
> diff --git a/tests/automake.mk b/tests/automake.mk index 
> c170ae7..0383933 100644
> --- a/tests/automake.mk
> +++ b/tests/automake.mk
> @@ -93,7 +93,8 @@ TESTSUITE_AT = \
> tests/ovn-nbctl.at \
>tests/ovn-sbctl.at \
> tests/ovn-controller.at \
> -   tests/ovn-controller-vtep.at
> +   tests/ovn-controller-vtep.at \
> +   tests/ovs-route.at
>  SYSTEM_KMOD_TESTSUITE_AT = \
> tests/system-common-macros.at \ diff --git 
> a/tests/ovs-route.at b/tests/ovs-route.at new file mode 100644 index 
> 000..ac11847
> --- /dev/null
> +++ b/tests/ovs-route.at
> @@ -0,0 +1,10 @@
> +AT_BANNER([appctl route/add with gateway]) AT_SETUP([appctl - 
> +route/add with gateway]) AT_XFAIL_IF([test "$IS_WIN32" = "yes"]) 
> +OVS_VSWITCHD_START([add-port br0 p2 -- set Interface p2 type=gre \
> +options:local_ip=2.2.2.2 options:remote_ip=1.1.1.1 \
> +-- add-port br0 p1  -- set interface p1 
> +type=dummy]) ovs-appctl netdev-dummy/ip4addr br0 2.2.2.2/24 
> +AT_CHECK([ovs-appctl ovs/route/add 1.1.1.0/24 br0 2.2.2.10], [0], [OK
> +])
> +AT_CLEANUP
> diff --git a/tests/testsuite.at b/tests/testsuite.at index 
> 2123bee..a2c707d 100644
> --- a/tests/testsuite.at
> +++ b/tests/testsuite.at
> @@ -75,3 +75,4 @@ m4_include([tests/ovn-nbctl.at])
> m4_include([tests/ovn-sbctl.at])
> m4_include([tests/ovn-controller.at])
> m4_include([tests/ovn-controller-vtep.at])
> +m4_include([tests/ovs-route.at])
> ___
> dev mailing list
> [email protected]
> http://openvswitch.org/mailman/listinfo/dev
___
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP address when a gateway ip is introduced

2016-10-27 Thread Thadeu Lima de Souza Cascardo
On Thu, Oct 27, 2016 at 02:08:13PM +, Waizel, Ariel wrote:
> 
> 
> When adding a VXLAN tunnel that connects to a VTEP residing in a
> 
> different IP network, the tunnel source ip needs to be selected by
> 
> best fit (longest matching netmask), based on the destination VTEP
> 
> ip, and the specific route's gateway ip.
> 
> A bug in ovs-router.c made the source ip to be decided only based on
> 
> the destination ip: Thus, if all source ips available to OVS and the
> 
> destination ip are in different ip networks - no source ip is
> 
> selected, and an error is returned.
> 
> This error accorded when  using OVS-DPDK and configuring a VXLAN
> 
> tunnel, where source ip and destination ip are in different
> 
> networks, and a gateway ip was in place for the specific route.
> 

Besides these extra new lines, it seems your MUA turns tabs into spaces. Can you
try to fix that?

Sorry to bother you with that, but I can't apply your patch with git am as it
is. Maybe the following documentation can help?

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/email-clients.txt

Thanks.
Cascardo.

> 
> 
> The fix tries to match a source ip based on the gateway ip, if no
> 
> matching source ip was found based on the destination ip - This way,
> 
> the gateway becomes the first hop only if the tunnel crosses between ip 
> networks.
> 
> Signed-off-by: Ariel Waizel 
> mailto:[email protected]>>
> 
> 
> diff --git a/lib/ovs-router.c b/lib/ovs-router.c
> index e27514a..18d0f8e 100644
> --- a/lib/ovs-router.c
> +++ b/lib/ovs-router.c
> @@ -198,6 +198,9 @@ ovs_router_insert__(uint8_t priority, const struct 
> in6_addr *ip6_dst,
>  p->plen = plen;
>  p->priority = priority;
>  err = get_src_addr(ip6_dst, output_bridge, &p->src_addr);
> +if (err && ipv6_addr_is_set(gw)) {
> +err = get_src_addr(gw, output_bridge, &p->src_addr);
> +}
>  if (err) {
>  free(p);
>  return err;
> diff --git a/tests/automake.mk b/tests/automake.mk
> index c170ae7..0383933 100644
> --- a/tests/automake.mk
> +++ b/tests/automake.mk
> @@ -93,7 +93,8 @@ TESTSUITE_AT = \
> tests/ovn-nbctl.at \
>tests/ovn-sbctl.at \
> tests/ovn-controller.at \
> -   tests/ovn-controller-vtep.at
> +   tests/ovn-controller-vtep.at \
> +   tests/ovs-route.at
>  SYSTEM_KMOD_TESTSUITE_AT = \
> tests/system-common-macros.at \
> diff --git a/tests/ovs-route.at b/tests/ovs-route.at
> new file mode 100644
> index 000..ac11847
> --- /dev/null
> +++ b/tests/ovs-route.at
> @@ -0,0 +1,10 @@
> +AT_BANNER([appctl route/add with gateway])
> +AT_SETUP([appctl - route/add with gateway])
> +AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
> +OVS_VSWITCHD_START([add-port br0 p2 -- set Interface p2 type=gre \
> +options:local_ip=2.2.2.2 options:remote_ip=1.1.1.1 \
> +-- add-port br0 p1  -- set interface p1 type=dummy])
> +ovs-appctl netdev-dummy/ip4addr br0 2.2.2.2/24
> +AT_CHECK([ovs-appctl ovs/route/add 1.1.1.0/24 br0 2.2.2.10], [0], [OK
> +])
> +AT_CLEANUP
> diff --git a/tests/testsuite.at b/tests/testsuite.at
> index 2123bee..a2c707d 100644
> --- a/tests/testsuite.at
> +++ b/tests/testsuite.at
> @@ -75,3 +75,4 @@ m4_include([tests/ovn-nbctl.at])
> m4_include([tests/ovn-sbctl.at])
> m4_include([tests/ovn-controller.at])
> m4_include([tests/ovn-controller-vtep.at])
> +m4_include([tests/ovs-route.at])
> ___
> dev mailing list
> [email protected]
> http://openvswitch.org/mailman/listinfo/dev
___
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP address when a gateway ip is introduced

2016-10-27 Thread Thadeu Lima de Souza Cascardo
On Thu, Oct 27, 2016 at 01:33:35PM +, Waizel, Ariel wrote:
> No problem:
> > When adding a VXLAN tunnel that connects to a VTEP residing in a different 
> > IP network, the tunnel source ip needs to be selected by best fit 
> > (longest matching netmask), based on the destination VTEP ip, 
> > and the specific route's gateway ip.
> > 
> > A bug in ovs-router.c made the source ip to be decided only based on 
> > the destination ip: Thus, if all source ips available to OVS and the 
> > destination ip are in different ip networks - 
> > no source ip is selected, and an error is returned.
> > 
> > This error accorded when  using OVS-DPDK and configuring a VXLAN tunnel,
> > where source ip and destination ip are in different networks, 
> > and a gateway ip was in place for the specific route.
> > 
> > The fix tries to match a source ip based on the gateway ip, if no matching
> > source ip was found based on the destination ip - This way, the gateway 
> > becomes the first hop only if the tunnel crosses between ip networks.
> > 
> > Signed-off-by: Ariel Waizel 

Hi, Ariel.

Not sure this is something that can be easily applied. Can you send a new
message, properly formatted, excluding any of my replies, that is rebased on top
of master?

Thanks a lot.
Cascardo.

> 
> diff --git a/lib/ovs-router.c b/lib/ovs-router.c
> index e27514a..18d0f8e 100644
> --- a/lib/ovs-router.c
> +++ b/lib/ovs-router.c
> @@ -198,6 +198,9 @@ ovs_router_insert__(uint8_t priority, const struct 
> in6_addr *ip6_dst,
>  p->plen = plen;
>  p->priority = priority;
>  err = get_src_addr(ip6_dst, output_bridge, &p->src_addr);
> +if (err && ipv6_addr_is_set(gw)) {
> +err = get_src_addr(gw, output_bridge, &p->src_addr);
> +}
>  if (err) {
>  free(p);
>  return err;
> diff --git a/tests/automake.mk b/tests/automake.mk
> index c170ae7..0383933 100644
> --- a/tests/automake.mk
> +++ b/tests/automake.mk
> @@ -93,7 +93,8 @@ TESTSUITE_AT = \
> tests/ovn-nbctl.at \
> tests/ovn-sbctl.at \
> tests/ovn-controller.at \
> -   tests/ovn-controller-vtep.at
> +   tests/ovn-controller-vtep.at \
> +   tests/ovs-route.at
>  
>  SYSTEM_KMOD_TESTSUITE_AT = \
> tests/system-common-macros.at \
> diff --git a/tests/ovs-route.at b/tests/ovs-route.at
> new file mode 100644
> index 000..ac11847
> --- /dev/null
> +++ b/tests/ovs-route.at
> @@ -0,0 +1,10 @@
> +AT_BANNER([appctl route/add with gateway])
> +AT_SETUP([appctl - route/add with gateway])
> +AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
> +OVS_VSWITCHD_START([add-port br0 p2 -- set Interface p2 type=gre \
> +options:local_ip=2.2.2.2 options:remote_ip=1.1.1.1 \
> +-- add-port br0 p1  -- set interface p1 type=dummy])
> +ovs-appctl netdev-dummy/ip4addr br0 2.2.2.2/24
> +AT_CHECK([ovs-appctl ovs/route/add 1.1.1.0/24 br0 2.2.2.10], [0], [OK
> +])
> +AT_CLEANUP
> diff --git a/tests/testsuite.at b/tests/testsuite.at
> index 2123bee..a2c707d 100644
> --- a/tests/testsuite.at
> +++ b/tests/testsuite.at
> @@ -75,3 +75,4 @@ m4_include([tests/ovn-nbctl.at])
>  m4_include([tests/ovn-sbctl.at])
>  m4_include([tests/ovn-controller.at])
>  m4_include([tests/ovn-controller-vtep.at])
> +m4_include([tests/ovs-route.at])
> 
> 
> -Original Message-
> From: Thadeu Lima de Souza Cascardo [mailto:[email protected]] 
> Sent: Tuesday, October 4, 2016 7:48 PM
> To: Waizel, Ariel 
> Cc: [email protected]; Dotan, Alon 
> Subject: Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP address 
> when a gateway ip is introduced
> 
> On Tue, Sep 13, 2016 at 07:08:52AM +, Waizel, Ariel wrote:
> > When adding a VXLAN tunnel that connects to a VTEP residing in a different 
> > IP network, the tunnel source ip needs to be selected by best fit (longest 
> > matching netmask), based on the destination VTEP ip, and the specific 
> > route's gateway ip.
> > 
> > A bug in ovs-router.c made the source ip to be decided only based on the 
> > destination ip: Thus, if all source ips available to OVS and the 
> > destination ip are in different ip networks - no source ip is selected, and 
> > an error is returned.
> > 
> > This error accorded when  using OVS-DPDK and configuring a VXLAN tunnel 
> > where source ip and destination ip are in different networks, and a gateway 
> > ip was in place for the specific route.
> > 
> > The fix tries to match a source ip based on the gateway ip, if no matching 
> > source ip was found based on the

Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP address when a gateway ip is introduced

2016-10-27 Thread Waizel, Ariel
No problem:
> When adding a VXLAN tunnel that connects to a VTEP residing in a different 
> IP network, the tunnel source ip needs to be selected by best fit 
> (longest matching netmask), based on the destination VTEP ip, 
> and the specific route's gateway ip.
> 
> A bug in ovs-router.c made the source ip to be decided only based on 
> the destination ip: Thus, if all source ips available to OVS and the 
> destination ip are in different ip networks - 
> no source ip is selected, and an error is returned.
> 
> This error accorded when  using OVS-DPDK and configuring a VXLAN tunnel,
> where source ip and destination ip are in different networks, 
> and a gateway ip was in place for the specific route.
> 
> The fix tries to match a source ip based on the gateway ip, if no matching
> source ip was found based on the destination ip - This way, the gateway 
> becomes the first hop only if the tunnel crosses between ip networks.
> 
> Signed-off-by: Ariel Waizel 

diff --git a/lib/ovs-router.c b/lib/ovs-router.c
index e27514a..18d0f8e 100644
--- a/lib/ovs-router.c
+++ b/lib/ovs-router.c
@@ -198,6 +198,9 @@ ovs_router_insert__(uint8_t priority, const struct in6_addr 
*ip6_dst,
 p->plen = plen;
 p->priority = priority;
 err = get_src_addr(ip6_dst, output_bridge, &p->src_addr);
+if (err && ipv6_addr_is_set(gw)) {
+err = get_src_addr(gw, output_bridge, &p->src_addr);
+}
 if (err) {
 free(p);
 return err;
diff --git a/tests/automake.mk b/tests/automake.mk
index c170ae7..0383933 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -93,7 +93,8 @@ TESTSUITE_AT = \
tests/ovn-nbctl.at \
tests/ovn-sbctl.at \
tests/ovn-controller.at \
-   tests/ovn-controller-vtep.at
+   tests/ovn-controller-vtep.at \
+   tests/ovs-route.at
 
 SYSTEM_KMOD_TESTSUITE_AT = \
tests/system-common-macros.at \
diff --git a/tests/ovs-route.at b/tests/ovs-route.at
new file mode 100644
index 000..ac11847
--- /dev/null
+++ b/tests/ovs-route.at
@@ -0,0 +1,10 @@
+AT_BANNER([appctl route/add with gateway])
+AT_SETUP([appctl - route/add with gateway])
+AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
+OVS_VSWITCHD_START([add-port br0 p2 -- set Interface p2 type=gre \
+options:local_ip=2.2.2.2 options:remote_ip=1.1.1.1 \
+-- add-port br0 p1  -- set interface p1 type=dummy])
+ovs-appctl netdev-dummy/ip4addr br0 2.2.2.2/24
+AT_CHECK([ovs-appctl ovs/route/add 1.1.1.0/24 br0 2.2.2.10], [0], [OK
+])
+AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 2123bee..a2c707d 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -75,3 +75,4 @@ m4_include([tests/ovn-nbctl.at])
 m4_include([tests/ovn-sbctl.at])
 m4_include([tests/ovn-controller.at])
 m4_include([tests/ovn-controller-vtep.at])
+m4_include([tests/ovs-route.at])


-Original Message-
From: Thadeu Lima de Souza Cascardo [mailto:[email protected]] 
Sent: Tuesday, October 4, 2016 7:48 PM
To: Waizel, Ariel 
Cc: [email protected]; Dotan, Alon 
Subject: Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP address 
when a gateway ip is introduced

On Tue, Sep 13, 2016 at 07:08:52AM +, Waizel, Ariel wrote:
> When adding a VXLAN tunnel that connects to a VTEP residing in a different IP 
> network, the tunnel source ip needs to be selected by best fit (longest 
> matching netmask), based on the destination VTEP ip, and the specific route's 
> gateway ip.
> 
> A bug in ovs-router.c made the source ip to be decided only based on the 
> destination ip: Thus, if all source ips available to OVS and the destination 
> ip are in different ip networks - no source ip is selected, and an error is 
> returned.
> 
> This error accorded when  using OVS-DPDK and configuring a VXLAN tunnel where 
> source ip and destination ip are in different networks, and a gateway ip was 
> in place for the specific route.
> 
> The fix tries to match a source ip based on the gateway ip, if no matching 
> source ip was found based on the destination ip - This way, the gateway 
> becomes the first hop only if the tunnel crosses between ip networks.
> 
> Signed-off-by: Ariel Waizel 
> 
> diff --git a/lib/ovs-router.c b/lib/ovs-router.c index 
> e27514a..18d0f8e 100644
> --- a/lib/ovs-router.c
> +++ b/lib/ovs-router.c
> @@ -198,6 +198,9 @@ ovs_router_insert__(uint8_t priority, const struct 
> in6_addr *ip6_dst,
>  p->plen = plen;
>  p->priority = priority;
>  err = get_src_addr(ip6_dst, output_bridge, &p->src_addr);
> +if (err && ipv6_addr_is_set(gw)) {
> +err = get_src_addr(gw, output_bridge, &p->src_addr);
> +}
>  if (err) {
>  free(p);
>  ret

Re: [ovs-dev] [PATCH] ovs-router: Fix selection of source IP address when a gateway ip is introduced

2016-10-04 Thread Thadeu Lima de Souza Cascardo
On Tue, Sep 13, 2016 at 07:08:52AM +, Waizel, Ariel wrote:
> When adding a VXLAN tunnel that connects to a VTEP residing in a different IP 
> network, the tunnel source ip needs to be selected by best fit (longest 
> matching netmask), based on the destination VTEP ip, and the specific route's 
> gateway ip.
> 
> A bug in ovs-router.c made the source ip to be decided only based on the 
> destination ip: Thus, if all source ips available to OVS and the destination 
> ip are in different ip networks - no source ip is selected, and an error is 
> returned.
> 
> This error accorded when  using OVS-DPDK and configuring a VXLAN tunnel where 
> source ip and destination ip are in different networks, and a gateway ip was 
> in place for the specific route.
> 
> The fix tries to match a source ip based on the gateway ip, if no matching 
> source ip was found based on the destination ip - This way, the gateway 
> becomes the first hop only if the tunnel crosses between ip networks.
> 
> Signed-off-by: Ariel Waizel 
> 
> diff --git a/lib/ovs-router.c b/lib/ovs-router.c
> index e27514a..18d0f8e 100644
> --- a/lib/ovs-router.c
> +++ b/lib/ovs-router.c
> @@ -198,6 +198,9 @@ ovs_router_insert__(uint8_t priority, const struct 
> in6_addr *ip6_dst,
>  p->plen = plen;
>  p->priority = priority;
>  err = get_src_addr(ip6_dst, output_bridge, &p->src_addr);
> +if (err && ipv6_addr_is_set(gw)) {
> +err = get_src_addr(gw, output_bridge, &p->src_addr);
> +}
>  if (err) {
>  free(p);
>  return err;

Hi, Ariel.

Thanks for that. Can you resend wrapping the log text to 72 columns and add a
test? At least one test verifying that adding such routes with ovs/route/add
work as expected.

Acked-by: Thadeu Lima de Souza Cascardo 

Cascardo.
___
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev