From owner-svn-src-head@FreeBSD.ORG Sun Apr 5 15:06:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C5F1106564A; Sun, 5 Apr 2009 15:06:02 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A85F8FC12; Sun, 5 Apr 2009 15:06:02 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n35F62gU021185; Sun, 5 Apr 2009 15:06:02 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n35F62bM021182; Sun, 5 Apr 2009 15:06:02 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200904051506.n35F62bM021182@svn.freebsd.org> From: Poul-Henning Kamp Date: Sun, 5 Apr 2009 15:06:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190713 - head/sbin/routed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Apr 2009 15:06:02 -0000 Author: phk Date: Sun Apr 5 15:06:02 2009 New Revision: 190713 URL: http://svn.freebsd.org/changeset/base/190713 Log: Convert list of remote interfaces to LIST_* macros Modified: head/sbin/routed/defs.h head/sbin/routed/if.c head/sbin/routed/input.c Modified: head/sbin/routed/defs.h ============================================================================== --- head/sbin/routed/defs.h Sun Apr 5 14:15:05 2009 (r190712) +++ head/sbin/routed/defs.h Sun Apr 5 15:06:02 2009 (r190713) @@ -264,9 +264,9 @@ struct rt_entry { */ struct interface { LIST_ENTRY(interface) int_list; + LIST_ENTRY(interface) remote_list; struct interface *int_ahash, **int_ahash_prev; struct interface *int_bhash, **int_bhash_prev; - struct interface *int_rlink, **int_rlink_prev; struct interface *int_nhash, **int_nhash_prev; char int_name[IF_NAME_LEN+1]; u_short int_index; @@ -486,7 +486,7 @@ extern naddr loopaddr; /* our address o extern int tot_interfaces; /* # of remote and local interfaces */ extern int rip_interfaces; /* # of interfaces doing RIP */ extern struct ifhead ifnet; /* all interfaces */ -extern struct interface *remote_if; /* remote interfaces */ +extern struct ifhead remote_if; /* remote interfaces */ extern int have_ripv1_out; /* have a RIPv1 interface */ extern int have_ripv1_in; extern int need_flash; /* flash update needed */ Modified: head/sbin/routed/if.c ============================================================================== --- head/sbin/routed/if.c Sun Apr 5 14:15:05 2009 (r190712) +++ head/sbin/routed/if.c Sun Apr 5 15:06:02 2009 (r190713) @@ -42,6 +42,7 @@ __RCSID("$Revision: 2.27 $"); #endif struct ifhead ifnet = LIST_HEAD_INITIALIZER(ifnet); /* all interfaces */ +struct ifhead remote_if = LIST_HEAD_INITIALIZER(ifnet); /* remote interfaces */ /* hash table for all interfaces, big enough to tolerate ridiculous * numbers of IP aliases. Crazy numbers of aliases such as 7000 @@ -56,7 +57,6 @@ struct interface *ahash_tbl[AHASH_LEN]; #define BHASH(a) &bhash_tbl[(a)%BHASH_LEN] struct interface *bhash_tbl[BHASH_LEN]; -struct interface *remote_if; /* remote interfaces */ /* hash for physical interface names. * Assume there are never more 100 or 200 real interfaces, and that @@ -117,13 +117,8 @@ if_link(struct interface *ifp) *hifp = ifp; } - if (ifp->int_state & IS_REMOTE) { - ifp->int_rlink_prev = &remote_if; - ifp->int_rlink = remote_if; - if (remote_if != 0) - remote_if->int_rlink_prev = &ifp->int_rlink; - remote_if = ifp; - } + if (ifp->int_state & IS_REMOTE) + LIST_INSERT_HEAD(&remote_if, ifp, remote_list); hifp = nhash(ifp->int_name); if (ifp->int_state & IS_ALIAS) { @@ -467,11 +462,8 @@ ifdel(struct interface *ifp) if (ifp->int_bhash != 0) ifp->int_bhash->int_bhash_prev = ifp->int_bhash_prev; } - if (ifp->int_state & IS_REMOTE) { - *ifp->int_rlink_prev = ifp->int_rlink; - if (ifp->int_rlink != 0) - ifp->int_rlink->int_rlink_prev = ifp->int_rlink_prev; - } + if (ifp->int_state & IS_REMOTE) + LIST_REMOVE(ifp, remote_list); if (!(ifp->int_state & IS_ALIAS)) { /* delete aliases when the main interface dies Modified: head/sbin/routed/input.c ============================================================================== --- head/sbin/routed/input.c Sun Apr 5 14:15:05 2009 (r190712) +++ head/sbin/routed/input.c Sun Apr 5 15:06:02 2009 (r190713) @@ -96,7 +96,7 @@ read_rip(int sock, cc+sizeof(inbuf.ifname)); /* check the remote interfaces first */ - for (aifp = remote_if; aifp; aifp = aifp->int_rlink) { + LIST_FOREACH(aifp, &remote_if, remote_list) { if (aifp->int_addr == from.sin_addr.s_addr) break; }