batman-adv: free neighbors when an interface is deactivated

Message ID 1295173672-16895-1-git-send-email-lindner_marek@yahoo.de (mailing list archive)
State Accepted, archived
Headers

Commit Message

Marek Lindner Jan. 16, 2011, 10:27 a.m. UTC
  hardif_disable_interface() calls purge_orig_ref() to immediately free
all neighbors associated with the interface that is going down.
purge_orig_neighbors() checked if the interface status is IF_INACTIVE
which is set to IF_NOT_IN_USE shortly before calling purge_orig_ref().

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---

Note: The previous patch created a new problem when cleaning up pending
OGMs, therefore this different approach.

 batman-adv/originator.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
  

Comments

Marek Lindner Jan. 19, 2011, 7:13 p.m. UTC | #1
On Sunday 16 January 2011 11:27:52 Marek Lindner wrote:
> hardif_disable_interface() calls purge_orig_ref() to immediately free
> all neighbors associated with the interface that is going down.
> purge_orig_neighbors() checked if the interface status is IF_INACTIVE
> which is set to IF_NOT_IN_USE shortly before calling purge_orig_ref().

Applied in revision 1903.

Regards,
Marek
  

Patch

diff --git a/batman-adv/originator.c b/batman-adv/originator.c
index c043bf8..1840f3a 100644
--- a/batman-adv/originator.c
+++ b/batman-adv/originator.c
@@ -224,10 +224,15 @@  static bool purge_orig_neighbors(struct bat_priv *bat_priv,
 		if ((time_after(jiffies,
 			neigh_node->last_valid + PURGE_TIMEOUT * HZ)) ||
 		    (neigh_node->if_incoming->if_status == IF_INACTIVE) ||
+		    (neigh_node->if_incoming->if_status == IF_NOT_IN_USE) ||
 		    (neigh_node->if_incoming->if_status == IF_TO_BE_REMOVED)) {
 
-			if (neigh_node->if_incoming->if_status ==
-							IF_TO_BE_REMOVED)
+			if ((neigh_node->if_incoming->if_status ==
+								IF_INACTIVE) ||
+			    (neigh_node->if_incoming->if_status ==
+							IF_NOT_IN_USE) ||
+			    (neigh_node->if_incoming->if_status ==
+							IF_TO_BE_REMOVED))
 				bat_dbg(DBG_BATMAN, bat_priv,
 					"neighbor purge: originator %pM, "
 					"neighbor: %pM, iface: %s\n",