From: Terry Wilson Date: Mon, 16 May 2011 18:00:21 +0000 (+0000) Subject: Unlink a peer from peers_by_ip when expiring a registration X-Git-Tag: 1.6.2.19-rc1~3^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e59b9085d7940d8b3507da3ccbe6cfaf292a018f;p=thirdparty%2Fasterisk.git Unlink a peer from peers_by_ip when expiring a registration Review: https://reviewboard.asterisk.org/r/1218/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@319202 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 14b4940cb8..a153f15e18 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -12605,6 +12605,11 @@ static int expire_register(const void *data) if (peer->selfdestruct || ast_test_flag(&peer->flags[1], SIP_PAGE2_RTAUTOCLEAR)) { unlink_peer_from_tables(peer); + } else if (peer->addr.sin_addr.s_addr) { + /* If we aren't self-destructing a temp_peer, we still need to unlink the peer + * from the peers_by_ip table, otherwise we end up with multiple copies hanging + * around each time a registration expires and the peer re-registers. */ + ao2_t_unlink(peers_by_ip, peer, "ao2_unlink of peer from peers_by_ip table"); } /* Only clear the addr after we check for destruction. The addr must remain