netlink: implement nla_put_in_addr and nla_put_in6_addr
[cascardo/linux.git] / net / ipv6 / ip6_tunnel.c
index 41f84f7..80543d1 100644 (file)
@@ -131,7 +131,7 @@ struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t)
        struct dst_entry *dst = t->dst_cache;
 
        if (dst && dst->obsolete &&
-           dst->ops->check(dst, t->dst_cookie) == NULL) {
+           !dst->ops->check(dst, t->dst_cookie)) {
                t->dst_cache = NULL;
                dst_release(dst);
                return NULL;
@@ -325,7 +325,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p)
 
        dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN,
                           ip6_tnl_dev_setup);
-       if (dev == NULL)
+       if (!dev)
                goto failed;
 
        dev_net_set(dev, net);
@@ -496,7 +496,7 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
 
        rcu_read_lock();
        t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->daddr, &ipv6h->saddr);
-       if (t == NULL)
+       if (!t)
                goto out;
 
        tproto = ACCESS_ONCE(t->parms.proto);
@@ -807,7 +807,7 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
 
        rcu_read_lock();
        t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr, &ipv6h->daddr);
-       if (t != NULL) {
+       if (t) {
                struct pcpu_sw_netstats *tstats;
 
                tproto = ACCESS_ONCE(t->parms.proto);
@@ -1274,7 +1274,7 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
                                                 &p->raddr, &p->laddr,
                                                 p->link, strict);
 
-               if (rt == NULL)
+               if (!rt)
                        return;
 
                if (rt->dst.dev) {
@@ -1739,10 +1739,8 @@ static int ip6_tnl_fill_info(struct sk_buff *skb, const struct net_device *dev)
        struct __ip6_tnl_parm *parm = &tunnel->parms;
 
        if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) ||
-           nla_put(skb, IFLA_IPTUN_LOCAL, sizeof(struct in6_addr),
-                   &parm->laddr) ||
-           nla_put(skb, IFLA_IPTUN_REMOTE, sizeof(struct in6_addr),
-                   &parm->raddr) ||
+           nla_put_in6_addr(skb, IFLA_IPTUN_LOCAL, &parm->laddr) ||
+           nla_put_in6_addr(skb, IFLA_IPTUN_REMOTE, &parm->raddr) ||
            nla_put_u8(skb, IFLA_IPTUN_TTL, parm->hop_limit) ||
            nla_put_u8(skb, IFLA_IPTUN_ENCAP_LIMIT, parm->encap_limit) ||
            nla_put_be32(skb, IFLA_IPTUN_FLOWINFO, parm->flowinfo) ||
@@ -1815,7 +1813,7 @@ static void __net_exit ip6_tnl_destroy_tunnels(struct net *net)
 
        for (h = 0; h < HASH_SIZE; h++) {
                t = rtnl_dereference(ip6n->tnls_r_l[h]);
-               while (t != NULL) {
+               while (t) {
                        /* If dev is in the same netns, it has already
                         * been added to the list by the previous loop.
                         */