[systemd-devel] [PATCH] networkd: introduce vti6 tunnel

Lennart Poettering lennart at poettering.net
Tue Apr 21 09:24:46 PDT 2015


On Tue, 21.04.15 15:16, Susant Sahani (susant at redhat.com) wrote:

>  
> +static int netdev_vti6_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
> +        Tunnel *t = VTI6(netdev);
> +        int r;
> +
> +        assert(netdev);
> +        assert(link);
> +        assert(m);
> +        assert(t);
> +        assert(t->family == AF_INET6);
> +
> +        r = sd_rtnl_message_append_u32(m, IFLA_VTI_LINK, link->ifindex);
> +        if (r < 0) {
> +                log_netdev_error(netdev,
> +                                 "Could not append IFLA_IPTUN_LINK attribute: %s",
> +                                 strerror(-r));
> +                return r;
> +        }

I have now added log_netdev_error_errno(), which takes the error
number as parameter, and opens it up for %m. Hence please rewrite the
7 lines above as these 2:

    if (r < 0)
            return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");

> +        r = sd_rtnl_message_append_in6_addr(m, IFLA_VTI_LOCAL, &t->local.in6);
> +        if (r < 0) {
> +                log_netdev_error(netdev,
> +                                 "Could not append IFLA_IPTUN_LOCAL attribute: %s",
> +                                 strerror(-r));
> +                return r;
> +        }

Similar here.

> +        r = sd_rtnl_message_append_in6_addr(m, IFLA_VTI_REMOTE, &t->remote.in6);
> +        if (r < 0) {
> +                log_netdev_error(netdev,
> +                                 "Could not append IFLA_IPTUN_REMOTE attribute: %s",
> +                                 strerror(-r));
> +                return r;
> +        }

Similar here.

>  
>  static void vti_init(NetDev *n) {
> -        Tunnel *t = VTI(n);
> +        Tunnel *t;
>  
>          assert(n);
> +
> +        if (n->kind == NETDEV_KIND_VTI)
> +                t =  VTI(n);

Spurious space.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list