@@ -425,6 +425,10 @@ static int hard_if_event(struct notifier_block *this,
break;
case NETDEV_UP:
hardif_activate_interface(batman_if);
+ if ((atomic_read(&module_state) == MODULE_INACTIVE) &&
+ (hardif_get_active_if_num() > 0)) {
+ activate_module();
+ }
break;
/* NETDEV_CHANGEADDR - mac address change - what are we doing here ? */
default:
@@ -173,7 +173,7 @@ end:
/* shuts down the whole module.*/
void shutdown_module(void)
{
- atomic_set(&module_state, MODULE_INACTIVE);
+ atomic_set(&module_state, MODULE_DEACTIVATING);
purge_outstanding_packets();
flush_workqueue(bat_event_workqueue);
@@ -199,6 +199,7 @@ void shutdown_module(void)
hardif_remove_interfaces();
synchronize_rcu();
+ atomic_set(&module_state, MODULE_INACTIVE);
}
void inc_module_count(void)
@@ -63,7 +63,7 @@
#define MODULE_INACTIVE 0
#define MODULE_ACTIVE 1
-/* #define MODULE_WAITING 2 -- not needed anymore */
+#define MODULE_DEACTIVATING 2
/*
@@ -399,7 +399,7 @@ void send_outstanding_bcast_packet(struct work_struct *work)
/* if we still have some more bcasts to send and we are not shutting
* down */
if ((forw_packet->num_packets < 3) &&
- (atomic_read(&module_state) != MODULE_INACTIVE))
+ (atomic_read(&module_state) != MODULE_DEACTIVATING))
_add_bcast_packet_to_list(forw_packet, ((5 * HZ) / 1000));
else
forw_packet_free(forw_packet);
@@ -424,7 +424,7 @@ void send_outstanding_bat_packet(struct work_struct *work)
* shutting down
*/
if ((forw_packet->own) &&
- (atomic_read(&module_state) != MODULE_INACTIVE))
+ (atomic_read(&module_state) != MODULE_DEACTIVATING))
schedule_own_packet(forw_packet->if_incoming);
forw_packet_free(forw_packet);