--- zzzz-none-000/linux-2.6.28.10/include/net/addrconf.h 2009-05-02 18:54:43.000000000 +0000 +++ fusiv-7390-686/linux-2.6.28.10/include/net/addrconf.h 2012-02-14 14:37:49.000000000 +0000 @@ -178,6 +178,78 @@ return rcu_dereference(dev->ip6_ptr); } +#ifdef CONFIG_DEV_REFCNT_DEBUG + +#include "linux/kallsyms.h" + +static inline void in6_show_here(char *func, struct net_device *dev, + int refcnt, char *fn, int ln, + unsigned long ip) +{ + printk(KERN_DEBUG "%s: in6 %d dev %d %s() %s:%d", + dev->name, refcnt, atomic_read(&dev->refcnt), + func, fn, ln); + print_ip_sym(ip); +} + +#define in6_dev_get(dev) ____in6_dev_get(dev, __FILE__, __LINE__) + +static inline struct inet6_dev * +____in6_dev_get(struct net_device *dev, char *fn, int ln) +{ + struct inet6_dev *idev = NULL; + rcu_read_lock(); + idev = __in6_dev_get(dev); + if (idev) { + atomic_inc(&idev->refcnt); + in6_show_here("in6_dev_get", idev->dev, atomic_read(&idev->refcnt), + fn, ln, + (unsigned long)__builtin_return_address(0)); + } + rcu_read_unlock(); + return idev; +} + +extern void in6_dev_finish_destroy(struct inet6_dev *idev); + +#define in6_dev_put(idev) ____in6_dev_put(idev, __FILE__, __LINE__) + +static inline void +____in6_dev_put(struct inet6_dev *idev, char *fn, int ln) +{ + int tmp = atomic_dec_and_test(&idev->refcnt); + + in6_show_here("in6_dev_put", idev->dev, atomic_read(&idev->refcnt), + fn, ln, + (unsigned long)__builtin_return_address(0)); + if (tmp) + in6_dev_finish_destroy(idev); +} + +#define __in6_dev_put(idev) ______in6_dev_put(idev, __FILE__, __LINE__) + +static inline void +______in6_dev_put(struct inet6_dev *idev, char *fn, int ln) +{ + atomic_dec(&(idev)->refcnt); + in6_show_here("__in6_dev_put", idev->dev, atomic_read(&idev->refcnt), + fn, ln, + (unsigned long)__builtin_return_address(0)); +} + +#define in6_dev_hold(idev) ____in6_dev_hold(idev, __FILE__, __LINE__) + +static inline void +____in6_dev_hold(struct inet6_dev *idev, char *fn, int ln) +{ + atomic_inc(&(idev)->refcnt); + in6_show_here("__in6_dev_put", idev->dev, atomic_read(&idev->refcnt), + fn, ln, + (unsigned long)__builtin_return_address(0)); +} + +#else + static inline struct inet6_dev * in6_dev_get(struct net_device *dev) { @@ -201,6 +273,7 @@ #define __in6_dev_put(idev) atomic_dec(&(idev)->refcnt) #define in6_dev_hold(idev) atomic_inc(&(idev)->refcnt) +#endif extern void inet6_ifa_finish_destroy(struct inet6_ifaddr *ifp); @@ -241,6 +314,14 @@ (addr->s6_addr32[3] ^ htonl(0x00000001))) == 0); } +static inline int ipv6_addr_is_solicit_multi(const struct in6_addr *addr) +{ + return (((addr->s6_addr32[0] ^ htonl(0xff020000)) | + addr->s6_addr32[1] | + (addr->s6_addr32[2] ^ htonl(0x00000001)) | + ((addr->s6_addr32[3] & 0xff000000) ^ htonl(0xff000000))) == 0); +} + static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) { return (((addr->s6_addr32[0] ^ htonl(0xff020000)) | @@ -248,6 +329,39 @@ (addr->s6_addr32[3] ^ htonl(0x00000002))) == 0); } +static inline int ipv6_addr_is_ll_all_mldv2routers(const struct in6_addr *addr) +{ + return (((addr->s6_addr32[0] ^ htonl(0xff020000)) | + addr->s6_addr32[1] | addr->s6_addr32[2] | + (addr->s6_addr32[3] ^ htonl(0x00000016))) == 0); +} + +static inline int ipv6_addr_is_ll_mdns_nodes(const struct in6_addr *addr) +{ + return(((addr->s6_addr32[0] ^ htonl(0xff020000)) | + addr->s6_addr32[1] | + addr->s6_addr32[2] | + (addr->s6_addr32[3] ^ htonl(0x000000fb))) == 0); +} + + +static inline int ipv6_addr_is_ll_ssdp_nodes(const struct in6_addr *addr) +{ + return (((addr->s6_addr32[0] ^ htonl(0xff020000)) | + addr->s6_addr32[1] | + addr->s6_addr32[2] | + (addr->s6_addr32[3] ^ htonl(0x0000000c))) == 0); +} + +static inline int ipv6_addr_is_resev(const struct in6_addr *addr) +{ + return ((((addr->s6_addr32[0]& 0xfff0ffff ) ^ htonl(0xff000000)) | + addr->s6_addr32[1] | addr->s6_addr32[2] | + ((addr->s6_addr32[3]& 0xfffeff00) ^ htonl(0x00000000))) == 0); +} + + + extern int __ipv6_isatap_ifid(u8 *eui, __be32 addr); static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)