aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/ipv6.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-08-06 04:42:04 -0400
committerDavid S. Miller <davem@davemloft.net>2012-08-15 02:12:17 -0400
commit4db67e808640e3934d82ce61ee8e2e89fd877ba8 (patch)
treeff02e330187c41970c75f6d8a6275e1cc25165f0 /net/sctp/ipv6.c
parent4110cc255ddec59c79fba4d71cdd948d0a382140 (diff)
sctp: Make the address lists per network namespace
- Move the address lists into struct net - Add per network namespace initialization and cleanup - Pass around struct net so it is everywhere I need it. - Rename all of the global variable references into references to the variables moved into struct net Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Vlad Yasevich <vyasevich@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/ipv6.c')
-rw-r--r--net/sctp/ipv6.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 2165a7ed25f1..bbf15341eb2b 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -99,6 +99,7 @@ static int sctp_inet6addr_event(struct notifier_block *this, unsigned long ev,
99 struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)ptr; 99 struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)ptr;
100 struct sctp_sockaddr_entry *addr = NULL; 100 struct sctp_sockaddr_entry *addr = NULL;
101 struct sctp_sockaddr_entry *temp; 101 struct sctp_sockaddr_entry *temp;
102 struct net *net = dev_net(ifa->idev->dev);
102 int found = 0; 103 int found = 0;
103 104
104 switch (ev) { 105 switch (ev) {
@@ -110,27 +111,27 @@ static int sctp_inet6addr_event(struct notifier_block *this, unsigned long ev,
110 addr->a.v6.sin6_addr = ifa->addr; 111 addr->a.v6.sin6_addr = ifa->addr;
111 addr->a.v6.sin6_scope_id = ifa->idev->dev->ifindex; 112 addr->a.v6.sin6_scope_id = ifa->idev->dev->ifindex;
112 addr->valid = 1; 113 addr->valid = 1;
113 spin_lock_bh(&sctp_local_addr_lock); 114 spin_lock_bh(&net->sctp.local_addr_lock);
114 list_add_tail_rcu(&addr->list, &sctp_local_addr_list); 115 list_add_tail_rcu(&addr->list, &net->sctp.local_addr_list);
115 sctp_addr_wq_mgmt(addr, SCTP_ADDR_NEW); 116 sctp_addr_wq_mgmt(net, addr, SCTP_ADDR_NEW);
116 spin_unlock_bh(&sctp_local_addr_lock); 117 spin_unlock_bh(&net->sctp.local_addr_lock);
117 } 118 }
118 break; 119 break;
119 case NETDEV_DOWN: 120 case NETDEV_DOWN:
120 spin_lock_bh(&sctp_local_addr_lock); 121 spin_lock_bh(&net->sctp.local_addr_lock);
121 list_for_each_entry_safe(addr, temp, 122 list_for_each_entry_safe(addr, temp,
122 &sctp_local_addr_list, list) { 123 &net->sctp.local_addr_list, list) {
123 if (addr->a.sa.sa_family == AF_INET6 && 124 if (addr->a.sa.sa_family == AF_INET6 &&
124 ipv6_addr_equal(&addr->a.v6.sin6_addr, 125 ipv6_addr_equal(&addr->a.v6.sin6_addr,
125 &ifa->addr)) { 126 &ifa->addr)) {
126 sctp_addr_wq_mgmt(addr, SCTP_ADDR_DEL); 127 sctp_addr_wq_mgmt(net, addr, SCTP_ADDR_DEL);
127 found = 1; 128 found = 1;
128 addr->valid = 0; 129 addr->valid = 0;
129 list_del_rcu(&addr->list); 130 list_del_rcu(&addr->list);
130 break; 131 break;
131 } 132 }
132 } 133 }
133 spin_unlock_bh(&sctp_local_addr_lock); 134 spin_unlock_bh(&net->sctp.local_addr_lock);
134 if (found) 135 if (found)
135 kfree_rcu(addr, rcu); 136 kfree_rcu(addr, rcu);
136 break; 137 break;