The following commit has been merged in the master branch: commit 15c3c06c1ce2d55af8e519764ac9af7f492b9d58 Author: marek marek@45894c77-fb22-0410-b583-ff6e7d5dbf6c Date: Sun Oct 25 00:13:47 2009 +0000
[batman-adv] Start to send originator messages when interface gets active
The module gets in a inactive state when all interfaces are down. This stops the sending of new packets. When a interface gets activated again it must reactivate the module and then start the sending of new originator messages.
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de Signed-off-by: Marek Lindner lindner_marek@yahoo.de
git-svn-id: http://downloads.open-mesh.net/svn/batman/trunk/batman-adv-kernelland@1455 45894c77-fb22-0410-b583-ff6e7d5dbf6c
diff --git a/hard-interface.c b/hard-interface.c index f04d2db..960e86c 100644 --- a/hard-interface.c +++ b/hard-interface.c @@ -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: diff --git a/main.c b/main.c index 8fbefc2..4e70c95 100644 --- a/main.c +++ b/main.c @@ -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) diff --git a/main.h b/main.h index 21d3919..9493f96 100644 --- a/main.h +++ b/main.h @@ -63,7 +63,7 @@
#define MODULE_INACTIVE 0 #define MODULE_ACTIVE 1 -/* #define MODULE_WAITING 2 -- not needed anymore */ +#define MODULE_DEACTIVATING 2
/* diff --git a/send.c b/send.c index 73fe371..01396b4 100644 --- a/send.c +++ b/send.c @@ -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);