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

Thadeu Lima de Souza Cascardo cascardo at redhat.com
Thu Oct 27 14:20:48 UTC 2016


On Thu, Oct 27, 2016 at 02:08:13PM +0000, 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 <ariel.waizel at hpe.com<mailto:ariel.waizel at hpe.com>>
> 
> 
> 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 0000000..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
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list