From b4a57bf88b54a2b6ab3852188e77cd93b70b5165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 14 Apr 2009 21:24:43 +0000 Subject: [PATCH] * Now makes sure the timer is properly shutdown when deleting the arp_entry. * This fixes a crashing bug that could be triggered when switching IP addresses often. * Also added a TODO about another possible crashing problem I won't look into today anymore. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30165 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/network/datalink_protocols/arp/arp.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/network/datalink_protocols/arp/arp.cpp b/src/add-ons/kernel/network/datalink_protocols/arp/arp.cpp index a2e652a064..0afc0148b8 100644 --- a/src/add-ons/kernel/network/datalink_protocols/arp/arp.cpp +++ b/src/add-ons/kernel/network/datalink_protocols/arp/arp.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2006-2008, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2009, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -242,6 +242,10 @@ arp_entry::Add(in_addr_t protocolAddress, sockaddr_dl *hardwareAddress, arp_entry::~arp_entry() { + // make sure there is no active timer left for us + sStackModule->cancel_timer(&timer); + sStackModule->wait_for_timer(&timer); + ClearQueue(); } @@ -562,6 +566,8 @@ arp_timer(struct net_timer *timer, void *data) // the entry has aged so much that we're going to remove it TRACE((" remove ARP entry %p!\n", entry)); + // TODO: we need to make sure we aren't deleting this entry from + // somewhere else right now! mutex_lock(&sCacheLock); hash_remove(sCache, entry); mutex_unlock(&sCacheLock);