b8f0f74
diff -up netkit-rwho-0.17/rwhod/rwhod.c.neighbours netkit-rwho-0.17/rwhod/rwhod.c
b8f0f74
--- netkit-rwho-0.17/rwhod/rwhod.c.neighbours	2011-06-01 18:26:01.913226552 +0200
b8f0f74
+++ netkit-rwho-0.17/rwhod/rwhod.c	2011-06-01 18:28:44.434226510 +0200
b8f0f74
@@ -383,6 +383,8 @@ broadcaster()
b8f0f74
 	getboottime(&mywd);
b8f0f74
 
b8f0f74
 	while (1) {
b8f0f74
+		if (!configure(sk))
b8f0f74
+			exit(1);
b8f0f74
 		sendpacket(&mywd);
b8f0f74
 		(void) sleep(AL_INTERVAL);
b8f0f74
 	}
b8f0f74
@@ -603,6 +605,20 @@ configure(int s)
b8f0f74
 	struct sockaddr_in *sn;
b8f0f74
 	register struct neighbor *np;
b8f0f74
 
b8f0f74
+	/* forget previous neighbors; interfaces may have changed */
b8f0f74
+	for (np = neighbors; np != NULL; ) {
b8f0f74
+		register struct neighbor *pp;
b8f0f74
+ 
b8f0f74
+		if(np->n_name)
b8f0f74
+			free(np->n_name);
b8f0f74
+		if(np->n_addr)
b8f0f74
+			free(np->n_addr);
b8f0f74
+		pp = np;
b8f0f74
+		np = np->n_next;
b8f0f74
+		free((char *)pp);
b8f0f74
+	}
b8f0f74
+	neighbors = 0;
b8f0f74
+
b8f0f74
 	ifc.ifc_len = sizeof (buf);
b8f0f74
 	ifc.ifc_buf = (char *)buf;
b8f0f74
 	if (ioctl(s, SIOCGIFCONF, &ifc) < 0) {