diff options
author | Esben Norby <norby@cvs.openbsd.org> | 2005-05-26 19:54:50 +0000 |
---|---|---|
committer | Esben Norby <norby@cvs.openbsd.org> | 2005-05-26 19:54:50 +0000 |
commit | 755230bde72fda8331ed54058957946ac2fe0f4c (patch) | |
tree | ac59b6364f31b70c49a66bc7933f4def9a6d3931 | |
parent | f8009f6e463e355844b35ddf145d2428e98c4fbd (diff) |
Simplify and cleanup passive interface handling.
ok claudio@
-rw-r--r-- | usr.sbin/ospfd/database.c | 5 | ||||
-rw-r--r-- | usr.sbin/ospfd/hello.c | 5 | ||||
-rw-r--r-- | usr.sbin/ospfd/interface.c | 16 | ||||
-rw-r--r-- | usr.sbin/ospfd/lsack.c | 5 | ||||
-rw-r--r-- | usr.sbin/ospfd/lsreq.c | 5 | ||||
-rw-r--r-- | usr.sbin/ospfd/lsupdate.c | 8 | ||||
-rw-r--r-- | usr.sbin/ospfd/ospfe.c | 22 | ||||
-rw-r--r-- | usr.sbin/ospfd/packet.c | 8 |
8 files changed, 23 insertions, 51 deletions
diff --git a/usr.sbin/ospfd/database.c b/usr.sbin/ospfd/database.c index bd35c134238..68b14ab969e 100644 --- a/usr.sbin/ospfd/database.c +++ b/usr.sbin/ospfd/database.c @@ -1,4 +1,4 @@ -/* $OpenBSD: database.c,v 1.10 2005/05/26 19:10:56 norby Exp $ */ +/* $OpenBSD: database.c,v 1.11 2005/05/26 19:54:49 norby Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -46,9 +46,6 @@ send_db_description(struct nbr *nbr) struct buf *buf; int ret = 0; - if (nbr->iface->passive) - return (0); - if ((buf = buf_open(nbr->iface->mtu - sizeof(struct ip))) == NULL) fatal("send_db_description"); diff --git a/usr.sbin/ospfd/hello.c b/usr.sbin/ospfd/hello.c index dcca30b6140..005143c3479 100644 --- a/usr.sbin/ospfd/hello.c +++ b/usr.sbin/ospfd/hello.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hello.c,v 1.5 2005/04/05 13:01:21 claudio Exp $ */ +/* $OpenBSD: hello.c,v 1.6 2005/05/26 19:54:49 norby Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -44,9 +44,6 @@ send_hello(struct iface *iface) struct buf *buf; int ret; - if (iface->passive) - return (0); - /* XXX READ_BUF_SIZE */ if ((buf = buf_dynamic(PKG_DEF_SIZE, READ_BUF_SIZE)) == NULL) fatal("send_hello"); diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c index d371aefd9df..b1040640e0c 100644 --- a/usr.sbin/ospfd/interface.c +++ b/usr.sbin/ospfd/interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interface.c,v 1.22 2005/05/26 18:46:16 norby Exp $ */ +/* $OpenBSD: interface.c,v 1.23 2005/05/26 19:54:49 norby Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -286,11 +286,9 @@ if_hello_timer(int fd, short event, void *arg) send_hello(iface); /* reschedule hello_timer */ - if (!iface->passive) { - timerclear(&tv); - tv.tv_sec = iface->hello_interval; - evtimer_add(&iface->hello_timer, &tv); - } + timerclear(&tv); + tv.tv_sec = iface->hello_interval; + evtimer_add(&iface->hello_timer, &tv); } int @@ -338,12 +336,6 @@ if_act_start(struct iface *iface) { struct in_addr addr; - if (iface->passive) { - log_debug("if_act_start: cannot start passive interface %s", - iface->name); - return (-1); - } - if (!((iface->flags & IFF_UP) && (iface->linkstate != LINK_STATE_DOWN))) { log_debug("if_act_start: interface %s link down", diff --git a/usr.sbin/ospfd/lsack.c b/usr.sbin/ospfd/lsack.c index b4a752ed343..128fdbd0421 100644 --- a/usr.sbin/ospfd/lsack.c +++ b/usr.sbin/ospfd/lsack.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lsack.c,v 1.9 2005/05/25 22:05:58 norby Exp $ */ +/* $OpenBSD: lsack.c,v 1.10 2005/05/26 19:54:49 norby Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -44,9 +44,6 @@ send_ls_ack(struct iface *iface, struct in_addr addr, void *data, int len) log_debug("send_ls_ack: interface %s addr %s", iface->name, inet_ntoa(addr)); - if (iface->passive) - return (0); - /* XXX READ_BUF_SIZE */ if ((buf = buf_dynamic(PKG_DEF_SIZE, READ_BUF_SIZE)) == NULL) fatal("send_ls_ack"); diff --git a/usr.sbin/ospfd/lsreq.c b/usr.sbin/ospfd/lsreq.c index ec497541979..6ecf0b3e30e 100644 --- a/usr.sbin/ospfd/lsreq.c +++ b/usr.sbin/ospfd/lsreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lsreq.c,v 1.8 2005/04/12 09:47:30 claudio Exp $ */ +/* $OpenBSD: lsreq.c,v 1.9 2005/05/26 19:54:49 norby Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -39,9 +39,6 @@ send_ls_req(struct nbr *nbr) struct buf *buf; int ret; - if (nbr->iface->passive) - return (0); - if ((buf = buf_open(nbr->iface->mtu - sizeof(struct ip))) == NULL) fatal("send_ls_req"); diff --git a/usr.sbin/ospfd/lsupdate.c b/usr.sbin/ospfd/lsupdate.c index cc3691258dd..b5feac12568 100644 --- a/usr.sbin/ospfd/lsupdate.c +++ b/usr.sbin/ospfd/lsupdate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lsupdate.c,v 1.9 2005/04/05 13:01:22 claudio Exp $ */ +/* $OpenBSD: lsupdate.c,v 1.10 2005/05/26 19:54:49 norby Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -45,9 +45,6 @@ lsa_flood(struct iface *iface, struct nbr *originator, struct lsa_hdr *lsa_hdr, int queued = 0, dont_ack = 0; int r; - if (iface->passive) - return (0); - LIST_FOREACH(nbr, &iface->nbr_list, entry) { if (nbr == iface->self) continue; @@ -155,9 +152,6 @@ send_ls_update(struct iface *iface, struct in_addr addr, void *data, int len) log_debug("send_ls_update: interface %s addr %s", iface->name, inet_ntoa(addr)); - if (iface->passive) - return (0); - /* XXX READ_BUF_SIZE */ if ((buf = buf_dynamic(PKG_DEF_SIZE, READ_BUF_SIZE)) == NULL) fatal("send_ls_update"); diff --git a/usr.sbin/ospfd/ospfe.c b/usr.sbin/ospfd/ospfe.c index 0ab896ad378..3279b8c021b 100644 --- a/usr.sbin/ospfd/ospfe.c +++ b/usr.sbin/ospfd/ospfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfe.c,v 1.22 2005/05/26 18:46:16 norby Exp $ */ +/* $OpenBSD: ospfe.c,v 1.23 2005/05/26 19:54:49 norby Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -168,10 +168,12 @@ ospfe(struct ospfd_conf *xconf, int pipe_parent2ospfe[2], int pipe_ospfe2rde[2], /* start interfaces */ LIST_FOREACH(area, &oeconf->area_list, entry) { LIST_FOREACH(iface, &area->iface_list, entry) { - if_init(xconf, iface); - if (if_fsm(iface, IF_EVT_UP)) { - log_debug("error starting interface %s", - iface->name); + if (!iface->passive) { + if_init(xconf, iface); + if (if_fsm(iface, IF_EVT_UP)) { + log_debug("error starting interface %s", + iface->name); + } } } } @@ -192,12 +194,14 @@ ospfe_shutdown(void) /* stop all interfaces and remove all areas */ LIST_FOREACH(area, &oeconf->area_list, entry) { LIST_FOREACH(iface, &area->iface_list, entry) { - if (if_fsm(iface, IF_EVT_DOWN)) { - log_debug("error stopping interface %s", - iface->name); + if (!iface->passive) { + if (if_fsm(iface, IF_EVT_DOWN)) { + log_debug("error stopping interface %s", + iface->name); + } } + area_del(area); } - area_del(area); } /* clean up */ diff --git a/usr.sbin/ospfd/packet.c b/usr.sbin/ospfd/packet.c index 0c197473914..2f0ba92a85f 100644 --- a/usr.sbin/ospfd/packet.c +++ b/usr.sbin/ospfd/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.8 2005/04/14 20:02:10 cloder Exp $ */ +/* $OpenBSD: packet.c,v 1.9 2005/05/26 19:54:49 norby Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -60,12 +60,6 @@ gen_ospf_hdr(struct buf *buf, struct iface *iface, u_int8_t type) int send_packet(struct iface *iface, char *pkt, int len, struct sockaddr_in *dst) { - if (iface->passive) { - log_warnx("send_packet: cannot send packet on passive " - "interface %s", iface->name); - return (-1); - } - /* set outgoing interface for multicast traffic */ if (IN_MULTICAST(ntohl(dst->sin_addr.s_addr))) if (if_set_mcast(iface) == -1) { |