[ovs-dev] [PATCH v3 5/5] tests: Add tunnel-push-pop-ipv6 tests

Ben Pfaff blp at ovn.org
Tue Dec 1 20:32:09 UTC 2015


On Mon, Nov 30, 2015 at 04:53:06PM -0200, Thadeu Lima de Souza Cascardo wrote:
> Based on IPv4 tests, test tunnels over IPv6. In order to do that, add
> netdev-dummy/ip6addr command for dummy bridges, and get_in6 support for
> netdev-dummy as well.
> 
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at redhat.com>

A couple of minor comments:

>  static void
> +netdev_dummy_ip6addr(struct unixctl_conn *conn, int argc OVS_UNUSED,
> +                     const char *argv[], void *aux OVS_UNUSED)
> +{
> +    struct netdev *netdev = netdev_from_name(argv[1]);
> +
> +    if (netdev && is_dummy_class(netdev->netdev_class)) {
> +        char ip6_s[IPV6_SCAN_LEN + 1];
> +        struct in6_addr ip6;
> +
> +        if (ovs_scan(argv[2], IPV6_SCAN_FMT, ip6_s) &&
> +            inet_pton(AF_INET6, ip6_s, &ip6) == 1) {
> +            netdev_dummy_set_in6(netdev, &ip6);
> +            unixctl_command_reply(conn, "OK");
> +        } else {

This should be unixctl_command_reply_error():

> +            unixctl_command_reply(conn, "Invalid parameters");
> +        }
> +
> +        netdev_close(netdev);
> +    } else {
> +        unixctl_command_reply_error(conn, "Unknown Dummy Interface");
> +        netdev_close(netdev);
> +        return;
> +    }

Optionally the netdev_close() could be factored out of the two blocks
above (and the "return;" removed), since they both end with it.

Acked-by: Ben Pfaff <blp at ovn.org>



More information about the dev mailing list