Changeset 1543

Show
Ignore:
Timestamp:
01/09/10 15:44:04 (7 months ago)
Author:
marek
Message:

batman-adv: don't lock while sending packets

As in other parts of batman-adv, we should not lock while sending a packet but
keep the locked time as short as possible. Additionally, we should check
whether the interface is active, otherwise batman_if->net_dev might not be
available ...

Signed-off-by: Simon Wunderlich <siwu@…>
Acked-by: Marek Lindner <lindner_marek@…>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/batman-adv-kernelland/device.c

    r1526 r1543  
    2626#include "types.h" 
    2727#include "hash.h" 
     28#include "hard-interface.h" 
    2829 
    2930#include "compat.h" 
     
    209210        struct orig_node *orig_node; 
    210211        struct batman_if *batman_if; 
     212        uint8_t dstaddr[ETH_ALEN]; 
    211213        unsigned long flags; 
    212214 
     
    254256 
    255257        batman_if = orig_node->batman_if; 
     258        memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); 
     259 
     260        spin_unlock_irqrestore(&orig_hash_lock, flags); 
    256261 
    257262        if (!batman_if) 
    258                 goto unlock; 
     263                goto dst_unreach; 
     264 
     265        if (batman_if->if_active != IF_ACTIVE) 
     266                goto dst_unreach; 
    259267 
    260268        memcpy(icmp_packet.orig, 
     
    264272        send_raw_packet((unsigned char *)&icmp_packet, 
    265273                        sizeof(struct icmp_packet), 
    266                         batman_if, orig_node->router->addr); 
    267  
    268         spin_unlock_irqrestore(&orig_hash_lock, flags); 
     274                        batman_if, dstaddr); 
     275 
    269276        goto out; 
    270277