Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90636
b: refs/heads/master
c: f3ee401
h: refs/heads/master
v: v3
  • Loading branch information
YOSHIFUJI Hideaki committed Apr 12, 2008
1 parent b92bd93 commit cb98bdb
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 49 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: 9acd9f3ae92d0dc0ca7504fb48c1040e8bbc39fe
refs/heads/master: f3ee4010e84452aa133e5163e6cfabc52b194e94
8 changes: 8 additions & 0 deletions trunk/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
11 changes: 0 additions & 11 deletions trunk/include/net/addrconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,6 @@ 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);
Expand Down
25 changes: 7 additions & 18 deletions trunk/net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
const struct in6_addr in6addr_linklocal_allnodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT;

/* Check if a valid qdisc is available */
static inline int addrconf_qdisc_ok(struct net_device *dev)
Expand Down Expand Up @@ -321,7 +323,6 @@ EXPORT_SYMBOL(in6_dev_finish_destroy);
static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
{
struct inet6_dev *ndev;
struct in6_addr maddr;

ASSERT_RTNL();

Expand Down Expand Up @@ -406,8 +407,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
rcu_assign_pointer(dev->ip6_ptr, ndev);

/* Join all-node multicast group */
ipv6_addr_all_nodes(&maddr);
ipv6_dev_mc_inc(dev, &maddr);
ipv6_dev_mc_inc(dev, &in6addr_linklocal_allnodes);

return ndev;
}
Expand All @@ -433,18 +433,15 @@ static void dev_forward_change(struct inet6_dev *idev)
{
struct net_device *dev;
struct inet6_ifaddr *ifa;
struct in6_addr addr;

if (!idev)
return;
dev = idev->dev;
if (dev && (dev->flags & IFF_MULTICAST)) {
ipv6_addr_all_routers(&addr);

if (idev->cnf.forwarding)
ipv6_dev_mc_inc(dev, &addr);
ipv6_dev_mc_inc(dev, &in6addr_linklocal_allrouters);
else
ipv6_dev_mc_dec(dev, &addr);
ipv6_dev_mc_dec(dev, &in6addr_linklocal_allrouters);
}
for (ifa=idev->addr_list; ifa; ifa=ifa->if_next) {
if (ifa->flags&IFA_F_TENTATIVE)
Expand Down Expand Up @@ -2654,18 +2651,14 @@ static void addrconf_rs_timer(unsigned long data)

spin_lock(&ifp->lock);
if (ifp->probes++ < ifp->idev->cnf.rtr_solicits) {
struct in6_addr all_routers;

/* The wait after the last probe can be shorter */
addrconf_mod_timer(ifp, AC_RS,
(ifp->probes == ifp->idev->cnf.rtr_solicits) ?
ifp->idev->cnf.rtr_solicit_delay :
ifp->idev->cnf.rtr_solicit_interval);
spin_unlock(&ifp->lock);

ipv6_addr_all_routers(&all_routers);

ndisc_send_rs(ifp->idev->dev, &ifp->addr, &all_routers);
ndisc_send_rs(ifp->idev->dev, &ifp->addr, &in6addr_linklocal_allrouters);
} else {
spin_unlock(&ifp->lock);
/*
Expand Down Expand Up @@ -2806,16 +2799,12 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
ifp->idev->cnf.rtr_solicits > 0 &&
(dev->flags&IFF_LOOPBACK) == 0 &&
(ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) {
struct in6_addr all_routers;

ipv6_addr_all_routers(&all_routers);

/*
* If a host as already performed a random delay
* [...] as part of DAD [...] there is no need
* to delay again before sending the first RS
*/
ndisc_send_rs(ifp->idev->dev, &ifp->addr, &all_routers);
ndisc_send_rs(ifp->idev->dev, &ifp->addr, &in6addr_linklocal_allrouters);

spin_lock_bh(&ifp->lock);
ifp->probes = 1;
Expand Down
23 changes: 8 additions & 15 deletions trunk/net/ipv6/mcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1766,10 +1766,9 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
struct inet6_dev *idev;
struct sk_buff *skb;
struct icmp6hdr *hdr;
struct in6_addr *snd_addr;
const struct in6_addr *snd_addr;
struct in6_addr *addrp;
struct in6_addr addr_buf;
struct in6_addr all_routers;
int err, len, payload_len, full_len;
u8 ra[8] = { IPPROTO_ICMPV6, 0,
IPV6_TLV_ROUTERALERT, 2, 0, 0,
Expand All @@ -1780,11 +1779,10 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
IP6_INC_STATS(__in6_dev_get(dev),
IPSTATS_MIB_OUTREQUESTS);
rcu_read_unlock();
snd_addr = addr;
if (type == ICMPV6_MGM_REDUCTION) {
snd_addr = &all_routers;
ipv6_addr_all_routers(&all_routers);
}
if (type == ICMPV6_MGM_REDUCTION)
snd_addr = &in6addr_linklocal_allrouters;
else
snd_addr = addr;

len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr);
payload_len = len + sizeof(ra);
Expand Down Expand Up @@ -2309,24 +2307,19 @@ void ipv6_mc_init_dev(struct inet6_dev *idev)
void ipv6_mc_destroy_dev(struct inet6_dev *idev)
{
struct ifmcaddr6 *i;
struct in6_addr maddr;

/* Deactivate timers */
ipv6_mc_down(idev);

/* Delete all-nodes address. */
ipv6_addr_all_nodes(&maddr);

/* We cannot call ipv6_dev_mc_dec() directly, our caller in
* addrconf.c has NULL'd out dev->ip6_ptr so in6_dev_get() will
* fail.
*/
__ipv6_dev_mc_dec(idev, &maddr);
__ipv6_dev_mc_dec(idev, &in6addr_linklocal_allnodes);

if (idev->cnf.forwarding) {
ipv6_addr_all_routers(&maddr);
__ipv6_dev_mc_dec(idev, &maddr);
}
if (idev->cnf.forwarding)
__ipv6_dev_mc_dec(idev, &in6addr_linklocal_allrouters);

write_lock_bh(&idev->lock);
while ((i = idev->mc_list) != NULL) {
Expand Down
5 changes: 1 addition & 4 deletions trunk/net/ipv6/ndisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
is_router = !!idev->cnf.forwarding;

if (dad) {
struct in6_addr maddr;

ipv6_addr_all_nodes(&maddr);
ndisc_send_na(dev, NULL, &maddr, &msg->target,
ndisc_send_na(dev, NULL, &in6addr_linklocal_allnodes, &msg->target,
is_router, 0, (ifp != NULL), 1);
goto out;
}
Expand Down

0 comments on commit cb98bdb

Please sign in to comment.