Skip to content

Commit

Permalink
Merge branch 'net-2.6.26-misc-20080412b' of git://git.linux-ipv6.org/…
Browse files Browse the repository at this point in the history
…gitroot/yoshfuji/linux-2.6-dev
  • Loading branch information
David S. Miller committed Apr 13, 2008
2 parents 03e1ad7 + 05f175c commit 6fb9114
Show file tree
Hide file tree
Showing 20 changed files with 264 additions and 238 deletions.
8 changes: 8 additions & 0 deletions include/linux/in6.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ extern const struct in6_addr in6addr_any;
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
extern const struct in6_addr in6addr_loopback;
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
#ifdef __KERNEL__
extern const struct in6_addr in6addr_linklocal_allnodes;
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
{ { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
extern const struct in6_addr in6addr_linklocal_allrouters;
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
{ { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } }
#endif

struct sockaddr_in6 {
unsigned short int sin6_family; /* AF_INET6 */
Expand Down
87 changes: 22 additions & 65 deletions include/net/addrconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ extern int ipv6_chk_prefix(struct in6_addr *addr,
struct net_device *dev);

extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net,
struct in6_addr *addr,
const struct in6_addr *addr,
struct net_device *dev,
int strict);

extern int ipv6_dev_get_saddr(struct net_device *dev,
struct in6_addr *daddr,
const struct in6_addr *daddr,
unsigned int srcprefs,
struct in6_addr *saddr);
extern int ipv6_get_lladdr(struct net_device *dev,
Expand All @@ -105,25 +105,27 @@ extern u32 ipv6_addr_label(const struct in6_addr *addr,
/*
* multicast prototypes (mcast.c)
*/
extern int ipv6_sock_mc_join(struct sock *sk, int ifindex,
struct in6_addr *addr);
extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex,
struct in6_addr *addr);
extern int ipv6_sock_mc_join(struct sock *sk, int ifindex,
const struct in6_addr *addr);
extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex,
const struct in6_addr *addr);
extern void ipv6_sock_mc_close(struct sock *sk);
extern int inet6_mc_check(struct sock *sk, struct in6_addr *mc_addr,
struct in6_addr *src_addr);
extern int inet6_mc_check(struct sock *sk,
const struct in6_addr *mc_addr,
const struct in6_addr *src_addr);

extern int ipv6_dev_mc_inc(struct net_device *dev, struct in6_addr *addr);
extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, struct in6_addr *addr);
extern int ipv6_dev_mc_dec(struct net_device *dev, struct in6_addr *addr);
extern int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr);
extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr);
extern int ipv6_dev_mc_dec(struct net_device *dev, const struct in6_addr *addr);
extern void ipv6_mc_up(struct inet6_dev *idev);
extern void ipv6_mc_down(struct inet6_dev *idev);
extern void ipv6_mc_init_dev(struct inet6_dev *idev);
extern void ipv6_mc_destroy_dev(struct inet6_dev *idev);
extern void addrconf_dad_failure(struct inet6_ifaddr *ifp);

extern int ipv6_chk_mcast_addr(struct net_device *dev, struct in6_addr *group,
struct in6_addr *src_addr);
extern int ipv6_chk_mcast_addr(struct net_device *dev,
const struct in6_addr *group,
const struct in6_addr *src_addr);
extern int ipv6_is_mld(struct sk_buff *skb, int nexthdr);

extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len);
Expand Down Expand Up @@ -189,25 +191,6 @@ static inline void in6_ifa_put(struct inet6_ifaddr *ifp)
#define in6_ifa_hold(ifp) atomic_inc(&(ifp)->refcnt)


/*
* Hash function taken from net_alias.c
*/

static __inline__ u8 ipv6_addr_hash(const struct in6_addr *addr)
{
__u32 word;

/*
* We perform the hash function over the last 64 bits of the address
* This will include the IEEE address token on links that support it.
*/

word = (__force u32)(addr->s6_addr32[2] ^ addr->s6_addr32[3]);
word ^= (word >> 16);
word ^= (word >> 8);

return ((word ^ (word >> 4)) & 0x0f);
}

/*
* compute link-local solicited-node multicast address
Expand All @@ -222,52 +205,26 @@ static inline void addrconf_addr_solict_mult(const struct in6_addr *addr,
htonl(0xFF000000) | addr->s6_addr32[3]);
}


static inline void ipv6_addr_all_nodes(struct in6_addr *addr)
{
ipv6_addr_set(addr, htonl(0xFF020000), 0, 0, htonl(0x1));
}

static inline void ipv6_addr_all_routers(struct in6_addr *addr)
{
ipv6_addr_set(addr, htonl(0xFF020000), 0, 0, htonl(0x2));
}

static inline int ipv6_addr_is_multicast(const struct in6_addr *addr)
{
return (addr->s6_addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000);
}

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

static inline int ipv6_isatap_eui64(u8 *eui, __be32 addr)
{
eui[0] = (ipv4_is_zeronet(addr) || ipv4_is_private_10(addr) ||
ipv4_is_loopback(addr) || ipv4_is_linklocal_169(addr) ||
ipv4_is_private_172(addr) || ipv4_is_test_192(addr) ||
ipv4_is_anycast_6to4(addr) || ipv4_is_private_192(addr) ||
ipv4_is_test_198(addr) || ipv4_is_multicast(addr) ||
ipv4_is_lbcast(addr)) ? 0x00 : 0x02;
eui[1] = 0;
eui[2] = 0x5E;
eui[3] = 0xFE;
memcpy (eui+4, &addr, 4);
return 0;
}
extern int __ipv6_isatap_ifid(u8 *eui, __be32 addr);

static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
{
Expand Down
6 changes: 3 additions & 3 deletions include/net/ip6_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ extern int ip6_ins_rt(struct rt6_info *);
extern int ip6_del_rt(struct rt6_info *);

extern struct rt6_info *rt6_lookup(struct net *net,
struct in6_addr *daddr,
struct in6_addr *saddr,
const struct in6_addr *daddr,
const struct in6_addr *saddr,
int oif, int flags);

extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
struct neighbour *neigh,
struct in6_addr *addr);
const struct in6_addr *addr);
extern int icmp6_dst_gc(int *more);

extern void fib6_force_start_gc(struct net *net);
Expand Down
26 changes: 12 additions & 14 deletions include/net/ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,10 @@ static inline int
ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m,
const struct in6_addr *a2)
{
unsigned int i;

for (i = 0; i < 4; i++)
if ((a1->s6_addr32[i] ^ a2->s6_addr32[i]) & m->s6_addr32[i])
return 1;
return 0;
return (!!(((a1->s6_addr32[0] ^ a2->s6_addr32[0]) & m->s6_addr32[0]) |
((a1->s6_addr32[1] ^ a2->s6_addr32[1]) & m->s6_addr32[1]) |
((a1->s6_addr32[2] ^ a2->s6_addr32[2]) & m->s6_addr32[2]) |
((a1->s6_addr32[3] ^ a2->s6_addr32[3]) & m->s6_addr32[3])));
}

static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2)
Expand Down Expand Up @@ -320,10 +318,10 @@ static inline void ipv6_addr_set(struct in6_addr *addr,
static inline int ipv6_addr_equal(const struct in6_addr *a1,
const struct in6_addr *a2)
{
return (a1->s6_addr32[0] == a2->s6_addr32[0] &&
a1->s6_addr32[1] == a2->s6_addr32[1] &&
a1->s6_addr32[2] == a2->s6_addr32[2] &&
a1->s6_addr32[3] == a2->s6_addr32[3]);
return (((a1->s6_addr32[0] ^ a2->s6_addr32[0]) |
(a1->s6_addr32[1] ^ a2->s6_addr32[1]) |
(a1->s6_addr32[2] ^ a2->s6_addr32[2]) |
(a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0);
}

static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2,
Expand Down Expand Up @@ -371,8 +369,8 @@ static inline int ipv6_addr_any(const struct in6_addr *a)

static inline int ipv6_addr_v4mapped(const struct in6_addr *a)
{
return ((a->s6_addr32[0] | a->s6_addr32[1]) == 0 &&
a->s6_addr32[2] == htonl(0x0000ffff));
return ((a->s6_addr32[0] | a->s6_addr32[1] |
(a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0);
}

/*
Expand Down Expand Up @@ -453,8 +451,8 @@ extern int ip6_xmit(struct sock *sk,
extern int ip6_nd_hdr(struct sock *sk,
struct sk_buff *skb,
struct net_device *dev,
struct in6_addr *saddr,
struct in6_addr *daddr,
const struct in6_addr *saddr,
const struct in6_addr *daddr,
int proto, int len);

extern int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr);
Expand Down
3 changes: 0 additions & 3 deletions include/net/mip6.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
#include <linux/skbuff.h>
#include <net/sock.h>

#define MIP6_OPT_PAD_1 0
#define MIP6_OPT_PAD_N 1

/*
* Mobility Header
*/
Expand Down
14 changes: 7 additions & 7 deletions include/net/ndisc.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@ extern int ndisc_rcv(struct sk_buff *skb);

extern void ndisc_send_ns(struct net_device *dev,
struct neighbour *neigh,
struct in6_addr *solicit,
struct in6_addr *daddr,
struct in6_addr *saddr);
const struct in6_addr *solicit,
const struct in6_addr *daddr,
const struct in6_addr *saddr);

extern void ndisc_send_rs(struct net_device *dev,
struct in6_addr *saddr,
struct in6_addr *daddr);
const struct in6_addr *saddr,
const struct in6_addr *daddr);

extern void ndisc_send_redirect(struct sk_buff *skb,
struct neighbour *neigh,
struct in6_addr *target);
const struct in6_addr *target);

extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir);

Expand Down Expand Up @@ -134,7 +134,7 @@ extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
extern void inet6_ifinfo_notify(int event,
struct inet6_dev *idev);

static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, struct in6_addr *addr)
static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, const struct in6_addr *addr)
{

if (dev)
Expand Down
Loading

0 comments on commit 6fb9114

Please sign in to comment.