static struct ip6_tnl **tnls[2] = { tnls_wc, tnls_r_l };
/* lock for the tunnel lists */
-static rwlock_t ip6ip6_lock = RW_LOCK_UNLOCKED;
+static DEFINE_RWLOCK(ip6ip6_lock);
static inline struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t)
{
struct ip6_tnl *t;
for (t = tnls_r_l[h0 ^ h1]; t; t = t->next) {
- if (!ipv6_addr_cmp(local, &t->parms.laddr) &&
- !ipv6_addr_cmp(remote, &t->parms.raddr) &&
+ if (ipv6_addr_equal(local, &t->parms.laddr) &&
+ ipv6_addr_equal(remote, &t->parms.raddr) &&
(t->dev->flags & IFF_UP))
return t;
}
{
struct ip6_tnl **tp = ip6ip6_bucket(&t->parms);
- write_lock_bh(&ip6ip6_lock);
t->next = *tp;
- write_unlock_bh(&ip6ip6_lock);
+ write_lock_bh(&ip6ip6_lock);
*tp = t;
+ write_unlock_bh(&ip6ip6_lock);
}
/**
return -EINVAL;
for (t = *ip6ip6_bucket(p); t; t = t->next) {
- if (!ipv6_addr_cmp(local, &t->parms.laddr) &&
- !ipv6_addr_cmp(remote, &t->parms.raddr)) {
+ if (ipv6_addr_equal(local, &t->parms.laddr) &&
+ ipv6_addr_equal(remote, &t->parms.raddr)) {
*pt = t;
return (create ? -EEXIST : 0);
}
static inline int
ip6ip6_tnl_addr_conflict(struct ip6_tnl *t, struct ipv6hdr *hdr)
{
- return !ipv6_addr_cmp(&t->parms.raddr, &hdr->saddr);
+ return ipv6_addr_equal(&t->parms.raddr, &hdr->saddr);
}
/**