Module Name: src
Committed By: kefren
Date: Sat Jan 22 19:35:01 UTC 2011
Modified Files:
src/usr.sbin/ldpd: socketops.c
Log Message:
use SLIST_FOREACH_SAFE when deleting a peer in loop
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/ldpd/socketops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/ldpd/socketops.c
diff -u src/usr.sbin/ldpd/socketops.c:1.3 src/usr.sbin/ldpd/socketops.c:1.4
--- src/usr.sbin/ldpd/socketops.c:1.3 Thu Dec 30 11:29:21 2010
+++ src/usr.sbin/ldpd/socketops.c Sat Jan 22 19:35:00 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: socketops.c,v 1.3 2010/12/30 11:29:21 kefren Exp $ */
+/* $NetBSD: socketops.c,v 1.4 2011/01/22 19:35:00 kefren Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -457,7 +457,7 @@
void
send_hello_alarm(int unused)
{
- struct ldp_peer *p;
+ struct ldp_peer *p, *ptmp;
struct hello_info *hi, *hinext;
time_t t = time(NULL);
int olderrno = errno;
@@ -471,15 +471,14 @@
p->timeout--;
/* Check for timeout */
-check_peer:
- SLIST_FOREACH(p, &ldp_peer_head, peers)
+ SLIST_FOREACH_SAFE(p, &ldp_peer_head, peers, ptmp)
if (p->timeout < 1)
switch (p->state) {
case LDP_PEER_HOLDDOWN:
debugp("LDP holddown expired for peer %s\n",
inet_ntoa(p->ldp_id));
ldp_peer_delete(p);
- goto check_peer;
+ break;
case LDP_PEER_ESTABLISHED:
case LDP_PEER_CONNECTED:
send_notification(p, 0,