diff options
author | Marek Lindner <lindner_marek@yahoo.de> | 2011-01-19 15:01:44 -0500 |
---|---|---|
committer | Marek Lindner <lindner_marek@yahoo.de> | 2011-03-05 06:52:04 -0500 |
commit | d0072609baebaffb522083d367f4f195187f60f8 (patch) | |
tree | 44e014264e2a2815d63f09c6ba9283d2866cbf48 /net/batman-adv/icmp_socket.c | |
parent | 1605d0d60b66b9461cfcff86f8cfc80964f23430 (diff) |
batman-adv: remove orig_hash spinlock
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/icmp_socket.c')
-rw-r--r-- | net/batman-adv/icmp_socket.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index a0a35b1af167..34ce56c358e5 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c | |||
@@ -158,9 +158,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, | |||
158 | 158 | ||
159 | struct orig_node *orig_node = NULL; | 159 | struct orig_node *orig_node = NULL; |
160 | struct neigh_node *neigh_node = NULL; | 160 | struct neigh_node *neigh_node = NULL; |
161 | struct batman_if *batman_if; | ||
162 | size_t packet_len = sizeof(struct icmp_packet); | 161 | size_t packet_len = sizeof(struct icmp_packet); |
163 | uint8_t dstaddr[ETH_ALEN]; | ||
164 | 162 | ||
165 | if (len < sizeof(struct icmp_packet)) { | 163 | if (len < sizeof(struct icmp_packet)) { |
166 | bat_dbg(DBG_BATMAN, bat_priv, | 164 | bat_dbg(DBG_BATMAN, bat_priv, |
@@ -220,7 +218,6 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, | |||
220 | if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE) | 218 | if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE) |
221 | goto dst_unreach; | 219 | goto dst_unreach; |
222 | 220 | ||
223 | spin_lock_bh(&bat_priv->orig_hash_lock); | ||
224 | rcu_read_lock(); | 221 | rcu_read_lock(); |
225 | orig_node = orig_hash_find(bat_priv, icmp_packet->dst); | 222 | orig_node = orig_hash_find(bat_priv, icmp_packet->dst); |
226 | 223 | ||
@@ -239,14 +236,10 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, | |||
239 | 236 | ||
240 | rcu_read_unlock(); | 237 | rcu_read_unlock(); |
241 | 238 | ||
242 | batman_if = orig_node->router->if_incoming; | 239 | if (!neigh_node->if_incoming) |
243 | memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); | ||
244 | spin_unlock_bh(&bat_priv->orig_hash_lock); | ||
245 | |||
246 | if (!batman_if) | ||
247 | goto dst_unreach; | 240 | goto dst_unreach; |
248 | 241 | ||
249 | if (batman_if->if_status != IF_ACTIVE) | 242 | if (neigh_node->if_incoming->if_status != IF_ACTIVE) |
250 | goto dst_unreach; | 243 | goto dst_unreach; |
251 | 244 | ||
252 | memcpy(icmp_packet->orig, | 245 | memcpy(icmp_packet->orig, |
@@ -254,14 +247,13 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, | |||
254 | 247 | ||
255 | if (packet_len == sizeof(struct icmp_packet_rr)) | 248 | if (packet_len == sizeof(struct icmp_packet_rr)) |
256 | memcpy(icmp_packet->rr, | 249 | memcpy(icmp_packet->rr, |
257 | batman_if->net_dev->dev_addr, ETH_ALEN); | 250 | neigh_node->if_incoming->net_dev->dev_addr, ETH_ALEN); |
258 | 251 | ||
259 | send_skb_packet(skb, batman_if, dstaddr); | 252 | send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr); |
260 | goto out; | 253 | goto out; |
261 | 254 | ||
262 | unlock: | 255 | unlock: |
263 | rcu_read_unlock(); | 256 | rcu_read_unlock(); |
264 | spin_unlock_bh(&bat_priv->orig_hash_lock); | ||
265 | dst_unreach: | 257 | dst_unreach: |
266 | icmp_packet->msg_type = DESTINATION_UNREACHABLE; | 258 | icmp_packet->msg_type = DESTINATION_UNREACHABLE; |
267 | bat_socket_add_packet(socket_client, icmp_packet, packet_len); | 259 | bat_socket_add_packet(socket_client, icmp_packet, packet_len); |