Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 214604
b: refs/heads/master
c: 48daa3b
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Sep 22, 2010
1 parent d8357e8 commit 5c22c50
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 756e64a0b106f1a2ca96889c39ea0d48131105c0
refs/heads/master: 48daa3bb84d547828871534caa51427a3fe90748
63 changes: 43 additions & 20 deletions trunk/include/net/addrconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,32 @@ extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
extern int register_inet6addr_notifier(struct notifier_block *nb);
extern int unregister_inet6addr_notifier(struct notifier_block *nb);

static inline struct inet6_dev *
__in6_dev_get(struct net_device *dev)
/**
* __in6_dev_get - get inet6_dev pointer from netdevice
* @dev: network device
*
* Caller must hold rcu_read_lock or RTNL, because this function
* does not take a reference on the inet6_dev.
*/
static inline struct inet6_dev *__in6_dev_get(const struct net_device *dev)
{
return rcu_dereference_check(dev->ip6_ptr,
rcu_read_lock_held() ||
lockdep_rtnl_is_held());
return rcu_dereference_rtnl(dev->ip6_ptr);
}

static inline struct inet6_dev *
in6_dev_get(struct net_device *dev)
/**
* in6_dev_get - get inet6_dev pointer from netdevice
* @dev: network device
*
* This version can be used in any context, and takes a reference
* on the inet6_dev. Callers must use in6_dev_put() later to
* release this reference.
*/
static inline struct inet6_dev *in6_dev_get(const struct net_device *dev)
{
struct inet6_dev *idev = NULL;
struct inet6_dev *idev;

rcu_read_lock();
idev = __in6_dev_get(dev);
idev = rcu_dereference(dev->ip6_ptr);
if (idev)
atomic_inc(&idev->refcnt);
rcu_read_unlock();
Expand All @@ -196,16 +208,21 @@ in6_dev_get(struct net_device *dev)

extern void in6_dev_finish_destroy(struct inet6_dev *idev);

static inline void
in6_dev_put(struct inet6_dev *idev)
static inline void in6_dev_put(struct inet6_dev *idev)
{
if (atomic_dec_and_test(&idev->refcnt))
in6_dev_finish_destroy(idev);
}

#define __in6_dev_put(idev) atomic_dec(&(idev)->refcnt)
#define in6_dev_hold(idev) atomic_inc(&(idev)->refcnt)
static inline void __in6_dev_put(struct inet6_dev *idev)
{
atomic_dec(&idev->refcnt);
}

static inline void in6_dev_hold(struct inet6_dev *idev)
{
atomic_inc(&idev->refcnt);
}

extern void inet6_ifa_finish_destroy(struct inet6_ifaddr *ifp);

Expand All @@ -215,9 +232,15 @@ static inline void in6_ifa_put(struct inet6_ifaddr *ifp)
inet6_ifa_finish_destroy(ifp);
}

#define __in6_ifa_put(ifp) atomic_dec(&(ifp)->refcnt)
#define in6_ifa_hold(ifp) atomic_inc(&(ifp)->refcnt)
static inline void __in6_ifa_put(struct inet6_ifaddr *ifp)
{
atomic_dec(&ifp->refcnt);
}

static inline void in6_ifa_hold(struct inet6_ifaddr *ifp)
{
atomic_inc(&ifp->refcnt);
}


/*
Expand All @@ -240,23 +263,23 @@ static inline int ipv6_addr_is_multicast(const struct in6_addr *addr)

static inline int ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr)
{
return (((addr->s6_addr32[0] ^ htonl(0xff020000)) |
return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
addr->s6_addr32[1] | addr->s6_addr32[2] |
(addr->s6_addr32[3] ^ htonl(0x00000001))) == 0);
(addr->s6_addr32[3] ^ htonl(0x00000001))) == 0;
}

static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr)
{
return (((addr->s6_addr32[0] ^ htonl(0xff020000)) |
return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
addr->s6_addr32[1] | addr->s6_addr32[2] |
(addr->s6_addr32[3] ^ htonl(0x00000002))) == 0);
(addr->s6_addr32[3] ^ htonl(0x00000002))) == 0;
}

extern int __ipv6_isatap_ifid(u8 *eui, __be32 addr);

static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
{
return ((addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE));
return (addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE);
}

#ifdef CONFIG_PROC_FS
Expand Down

0 comments on commit 5c22c50

Please sign in to comment.