summaryrefslogtreecommitdiffstats
path: root/sbin/routed
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2009-04-05 15:06:02 +0000
committerphk <phk@FreeBSD.org>2009-04-05 15:06:02 +0000
commitbf0cde780f6b8e0ccb209add2d686963706d9e78 (patch)
tree77cd6cfe11ecfe1d0839dd74515da4906b510c43 /sbin/routed
parentab2775f3db00244b047f362ba89ba36865f7a02a (diff)
downloadFreeBSD-src-bf0cde780f6b8e0ccb209add2d686963706d9e78.zip
FreeBSD-src-bf0cde780f6b8e0ccb209add2d686963706d9e78.tar.gz
Convert list of remote interfaces to LIST_* macros
Diffstat (limited to 'sbin/routed')
-rw-r--r--sbin/routed/defs.h4
-rw-r--r--sbin/routed/if.c18
-rw-r--r--sbin/routed/input.c2
3 files changed, 8 insertions, 16 deletions
diff --git a/sbin/routed/defs.h b/sbin/routed/defs.h
index 9c44bbd..3d5ea7f 100644
--- a/sbin/routed/defs.h
+++ b/sbin/routed/defs.h
@@ -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 on loopback */
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 */
diff --git a/sbin/routed/if.c b/sbin/routed/if.c
index 0f6f83a..69ca3cb 100644
--- a/sbin/routed/if.c
+++ b/sbin/routed/if.c
@@ -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
diff --git a/sbin/routed/input.c b/sbin/routed/input.c
index f655346..51da12b 100644
--- a/sbin/routed/input.c
+++ b/sbin/routed/input.c
@@ -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;
}
OpenPOWER on IntegriCloud