diff options
Diffstat (limited to 'usr.sbin/ospfd')
-rw-r--r-- | usr.sbin/ospfd/control.c | 4 | ||||
-rw-r--r-- | usr.sbin/ospfd/database.c | 4 | ||||
-rw-r--r-- | usr.sbin/ospfd/interface.c | 4 | ||||
-rw-r--r-- | usr.sbin/ospfd/lsack.c | 4 | ||||
-rw-r--r-- | usr.sbin/ospfd/lsreq.c | 4 | ||||
-rw-r--r-- | usr.sbin/ospfd/lsupdate.c | 8 | ||||
-rw-r--r-- | usr.sbin/ospfd/neighbor.c | 8 | ||||
-rw-r--r-- | usr.sbin/ospfd/ospf.h | 3 | ||||
-rw-r--r-- | usr.sbin/ospfd/ospfd.h | 13 | ||||
-rw-r--r-- | usr.sbin/ospfd/ospfe.h | 11 | ||||
-rw-r--r-- | usr.sbin/ospfd/parse.y | 6 | ||||
-rw-r--r-- | usr.sbin/ospfd/rde.h | 8 | ||||
-rw-r--r-- | usr.sbin/ospfd/rde_spf.c | 36 |
13 files changed, 54 insertions, 59 deletions
diff --git a/usr.sbin/ospfd/control.c b/usr.sbin/ospfd/control.c index ce9a9e9d6ee..a217b9600af 100644 --- a/usr.sbin/ospfd/control.c +++ b/usr.sbin/ospfd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.8 2005/03/15 22:03:56 claudio Exp $ */ +/* $OpenBSD: control.c,v 1.9 2005/03/22 22:13:48 norby Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -229,7 +229,7 @@ control_dispatch_imsg(int fd, short event, void *bula) case IMSG_CTL_KROUTE: case IMSG_CTL_KROUTE_ADDR: c->ibuf.pid = imsg.hdr.pid; - ospfe_imsg_compose_parent(imsg.hdr.type, + ospfe_imsg_compose_parent(imsg.hdr.type, imsg.hdr.pid, imsg.data, imsg.hdr.len - IMSG_HEADER_SIZE); break; diff --git a/usr.sbin/ospfd/database.c b/usr.sbin/ospfd/database.c index 9f4d6ccf003..daa300a741a 100644 --- a/usr.sbin/ospfd/database.c +++ b/usr.sbin/ospfd/database.c @@ -1,4 +1,4 @@ -/* $OpenBSD: database.c,v 1.5 2005/02/10 14:05:48 claudio Exp $ */ +/* $OpenBSD: database.c,v 1.6 2005/03/22 22:13:48 norby Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -245,7 +245,7 @@ recv_db_description(struct nbr *nbr, char *buf, u_int16_t len) /* slave */ log_debug("recv_db_description: slave, " "neighbor ID %s", inet_ntoa(nbr->id)); - nbr->master = false; + nbr->master = 0; nbr->dd_seq_num = ntohl(dd_hdr.dd_seq_num); /* event negotiation done */ diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c index 76677fb477e..138c8306d65 100644 --- a/usr.sbin/ospfd/interface.c +++ b/usr.sbin/ospfd/interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interface.c,v 1.11 2005/03/11 12:26:50 henning Exp $ */ +/* $OpenBSD: interface.c,v 1.12 2005/03/22 22:13:48 norby Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -161,7 +161,7 @@ if_new(struct kif *kif) err(1, "if_new: calloc"); iface->state = IF_STA_DOWN; - iface->passive = true; + iface->passive = 1; LIST_INIT(&iface->nbr_list); TAILQ_INIT(&iface->ls_ack_list); diff --git a/usr.sbin/ospfd/lsack.c b/usr.sbin/ospfd/lsack.c index 381aefd86b0..bfd0c9a1f7e 100644 --- a/usr.sbin/ospfd/lsack.c +++ b/usr.sbin/ospfd/lsack.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lsack.c,v 1.6 2005/03/17 21:17:12 claudio Exp $ */ +/* $OpenBSD: lsack.c,v 1.7 2005/03/22 22:13:48 norby Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -210,7 +210,7 @@ ls_ack_list_clr(struct iface *iface) iface->ls_ack_cnt = 0; } -bool +int ls_ack_list_empty(struct iface *iface) { return (TAILQ_EMPTY(&iface->ls_ack_list)); diff --git a/usr.sbin/ospfd/lsreq.c b/usr.sbin/ospfd/lsreq.c index 1764cb011b9..f7c0fc2b691 100644 --- a/usr.sbin/ospfd/lsreq.c +++ b/usr.sbin/ospfd/lsreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lsreq.c,v 1.4 2005/02/10 14:05:48 claudio Exp $ */ +/* $OpenBSD: lsreq.c,v 1.5 2005/03/22 22:13:48 norby Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -188,7 +188,7 @@ ls_req_list_clr(struct nbr *nbr) nbr->ls_req = NULL; } -bool +int ls_req_list_empty(struct nbr *nbr) { return (TAILQ_EMPTY(&nbr->ls_req_list)); diff --git a/usr.sbin/ospfd/lsupdate.c b/usr.sbin/ospfd/lsupdate.c index 230dae663f6..a3760edb7c2 100644 --- a/usr.sbin/ospfd/lsupdate.c +++ b/usr.sbin/ospfd/lsupdate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lsupdate.c,v 1.6 2005/03/17 21:17:12 claudio Exp $ */ +/* $OpenBSD: lsupdate.c,v 1.7 2005/03/22 22:13:48 norby Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -338,7 +338,7 @@ ls_retrans_list_clr(struct nbr *nbr) ls_retrans_list_free(nbr, le); } -bool +int ls_retrans_list_empty(struct nbr *nbr) { return (TAILQ_EMPTY(&nbr->ls_retrans_list)); @@ -351,7 +351,7 @@ ls_retrans_timer(int fd, short event, void *bula) struct in_addr addr; struct nbr *nbr = bula; struct lsa_entry *le; - + if (nbr->iface->self == nbr) { if (!(nbr->iface->state & IF_STA_DROTHER)) { /* @@ -373,7 +373,7 @@ ls_retrans_timer(int fd, short event, void *bula) } else memcpy(&addr, &nbr->addr, sizeof(addr)); - + if ((le = TAILQ_FIRST(&nbr->ls_retrans_list)) != NULL) { send_ls_update(nbr->iface, addr, le->le_ref->data, le->le_ref->len); diff --git a/usr.sbin/ospfd/neighbor.c b/usr.sbin/ospfd/neighbor.c index 3bf3e5b6613..2d62444e21f 100644 --- a/usr.sbin/ospfd/neighbor.c +++ b/usr.sbin/ospfd/neighbor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: neighbor.c,v 1.12 2005/03/17 21:17:12 claudio Exp $ */ +/* $OpenBSD: neighbor.c,v 1.13 2005/03/22 22:13:48 norby Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -255,7 +255,7 @@ nbr_new(u_int32_t nbr_id, struct iface *iface, int self) fatal("nbr_new"); nbr->state = NBR_STA_DOWN; - nbr->master = true; + nbr->master = 1; nbr->dd_seq_num = arc4random(); /* RFC: some unique value */ nbr->id.s_addr = nbr_id; @@ -496,7 +496,7 @@ nbr_act_eval(struct nbr *nbr) } nbr->state = NBR_STA_XSTRT; - nbr->master = true; + nbr->master = 1; nbr->dd_seq_num++; /* as per RFC */ nbr->dd_pending = 0; /* initial db negotiation */ @@ -569,7 +569,7 @@ nbr_act_restart_dd(struct nbr *nbr) } nbr->state = NBR_STA_XSTRT; - nbr->master = true; + nbr->master = 1; nbr->dd_seq_num += arc4random() & 0xffff; nbr->dd_pending = 0; diff --git a/usr.sbin/ospfd/ospf.h b/usr.sbin/ospfd/ospf.h index 40570137ef6..7dd2b582ff8 100644 --- a/usr.sbin/ospfd/ospf.h +++ b/usr.sbin/ospfd/ospf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospf.h,v 1.8 2005/02/27 08:21:15 norby Exp $ */ +/* $OpenBSD: ospf.h,v 1.9 2005/03/22 22:13:48 norby Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -22,7 +22,6 @@ #define _OSPF_H_ #include <netinet/in.h> -#include <stdbool.h> /* misc */ #define OSPF_VERSION 2 diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h index e8d6ee337c8..d1fbc1d0fb2 100644 --- a/usr.sbin/ospfd/ospfd.h +++ b/usr.sbin/ospfd/ospfd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.h,v 1.16 2005/03/15 22:03:56 claudio Exp $ */ +/* $OpenBSD: ospfd.h,v 1.17 2005/03/22 22:13:48 norby Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -27,7 +27,6 @@ #include <net/if.h> #include <netinet/in.h> #include <event.h> -#include <stdbool.h> #define CONF_FILE "/etc/ospfd.conf" #define OSPFD_SOCKET "/var/run/ospfd.sock" @@ -157,9 +156,8 @@ struct area { u_int16_t rxmt_interval; u_int16_t metric; u_int8_t priority; - - bool transit; - bool stub; + u_int8_t transit; + u_int8_t stub; }; /* interface states */ @@ -298,8 +296,7 @@ struct iface { enum auth_type auth_type; u_int8_t linkstate; u_int8_t priority; - - bool passive; + u_int8_t passive; }; /* ospf_conf */ @@ -377,7 +374,7 @@ struct ctl_iface { enum iface_type type; u_int8_t linkstate; u_int8_t priority; - bool passive; + u_int8_t passive; }; struct ctl_nbr { diff --git a/usr.sbin/ospfd/ospfe.h b/usr.sbin/ospfd/ospfe.h index 4cada9ff7ce..03e95318ffb 100644 --- a/usr.sbin/ospfd/ospfe.h +++ b/usr.sbin/ospfd/ospfe.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfe.h,v 1.8 2005/03/17 21:17:12 claudio Exp $ */ +/* $OpenBSD: ospfe.h,v 1.9 2005/03/22 22:13:48 norby Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -140,8 +140,7 @@ struct nbr { u_int8_t options; u_int8_t last_rx_options; u_int8_t last_rx_bits; - - bool master; + u_int8_t master; }; /* auth.c */ @@ -208,7 +207,7 @@ int lsa_hdr_check(struct nbr *, struct lsa_hdr *); void ls_ack_list_add(struct iface *, struct lsa_hdr *); void ls_ack_list_free(struct iface *, struct lsa_entry *); void ls_ack_list_clr(struct iface *); -bool ls_ack_list_empty(struct iface *); +int ls_ack_list_empty(struct iface *); void ls_ack_tx_timer(int, short, void *); int start_ls_ack_tx_timer(struct iface *); int stop_ls_ack_tx_timer(struct iface *); @@ -221,7 +220,7 @@ int ls_req_list_del(struct nbr *, struct lsa_hdr *); struct lsa_entry *ls_req_list_get(struct nbr *, struct lsa_hdr *); void ls_req_list_free(struct nbr *, struct lsa_entry *); void ls_req_list_clr(struct nbr *); -bool ls_req_list_empty(struct nbr *); +int ls_req_list_empty(struct nbr *); void ls_req_tx_timer(int, short, void *); int start_ls_req_tx_timer(struct nbr *); int stop_ls_req_tx_timer(struct nbr *); @@ -237,7 +236,7 @@ int ls_retrans_list_del(struct nbr *, struct lsa_hdr *); struct lsa_entry *ls_retrans_list_get(struct nbr *, struct lsa_hdr *); void ls_retrans_list_free(struct nbr *, struct lsa_entry *); void ls_retrans_list_clr(struct nbr *); -bool ls_retrans_list_empty(struct nbr *); +int ls_retrans_list_empty(struct nbr *); void ls_retrans_timer(int, short, void *); diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y index afb4d61b08b..2e57ad8fa8c 100644 --- a/usr.sbin/ospfd/parse.y +++ b/usr.sbin/ospfd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.8 2005/03/12 11:03:05 norby Exp $ */ +/* $OpenBSD: parse.y,v 1.9 2005/03/22 22:13:48 norby Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -375,7 +375,7 @@ interface : INTERFACE STRING { LIST_INSERT_HEAD(&area->iface_list, iface, entry); iface->rtr_id = conf->rtr_id; - iface->passive = false; + iface->passive = 0; } optnl '{' optnl { } interfaceopts_l '}' { @@ -389,7 +389,7 @@ interfaceopts_l : interfaceopts_l interfaceoptsl interfaceoptsl : authkey nl | authtype nl - | PASSIVE nl { iface->passive = true; } + | PASSIVE nl { iface->passive = 1; } | METRIC number nl { if ($2 < MIN_METRIC || $2 > MAX_METRIC) { yyerror("metric out of range (%d-%d)", diff --git a/usr.sbin/ospfd/rde.h b/usr.sbin/ospfd/rde.h index 0b938913118..99e10ea0730 100644 --- a/usr.sbin/ospfd/rde.h +++ b/usr.sbin/ospfd/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.7 2005/03/12 11:03:05 norby Exp $ */ +/* $OpenBSD: rde.h,v 1.8 2005/03/22 22:13:48 norby Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -65,7 +65,7 @@ struct rt_node { enum path_type p_type; enum dst_type d_type; u_int8_t prefixlen; - bool invalid; + u_int8_t invalid; }; /* rde.c */ @@ -103,9 +103,9 @@ void spf_tree_clr(struct area *); void cand_list_init(void); void cand_list_add(struct vertex *); struct vertex *cand_list_pop(void); -bool cand_list_present(struct vertex *); +int cand_list_present(struct vertex *); void cand_list_clr(void); -bool cand_list_empty(void); +int cand_list_empty(void); void spf_timer(int, short, void *); int start_spf_timer(struct ospfd_conf *); diff --git a/usr.sbin/ospfd/rde_spf.c b/usr.sbin/ospfd/rde_spf.c index d34dcd58b3e..ba094dca551 100644 --- a/usr.sbin/ospfd/rde_spf.c +++ b/usr.sbin/ospfd/rde_spf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_spf.c,v 1.7 2005/03/17 16:46:15 claudio Exp $ */ +/* $OpenBSD: rde_spf.c,v 1.8 2005/03/22 22:13:48 norby Exp $ */ /* * Copyright (c) 2005 Esben Norby <norby@openbsd.org> @@ -42,7 +42,7 @@ void calc_next_hop(struct vertex *, struct vertex *); void rt_update(struct in_addr, u_int8_t, struct in_addr, u_int32_t, struct in_addr, struct in_addr, u_int8_t, u_int8_t); void rt_invalidate(void); -bool linked(struct vertex *, struct vertex *); +int linked(struct vertex *, struct vertex *); u_int8_t mask2prefixlen(in_addr_t); void @@ -118,7 +118,7 @@ spf_calc(struct area *area) if ((v = spf_root = lsa_find(area, LSA_TYPE_ROUTER, rde_router_id(), rde_router_id())) == NULL) fatalx("spf_calc: cannot find self originated router LSA"); - area->transit = false; + area->transit = 0; spf_root->cost = 0; w = NULL; @@ -436,17 +436,17 @@ cand_list_pop(void) return (c); } -bool +int cand_list_present(struct vertex *v) { struct vertex *c; TAILQ_FOREACH(c, &cand_list, cand) { if (c == v) - return (true); + return (1); } - return (false); + return (0); } void @@ -459,7 +459,7 @@ cand_list_clr(void) } } -bool +int cand_list_empty(void) { return (TAILQ_EMPTY(&cand_list)); @@ -636,7 +636,7 @@ rt_invalidate(void) if (r->invalid) rt_remove(r); else - r->invalid = true; + r->invalid = 1; } } @@ -715,7 +715,7 @@ rt_update(struct in_addr prefix, u_int8_t prefixlen, struct in_addr nexthop, rte->area = area; rte->p_type = p_type; rte->d_type = d_type; - rte->invalid = false; + rte->invalid = 0; rt_insert(rte); } else { @@ -729,7 +729,7 @@ rt_update(struct in_addr prefix, u_int8_t prefixlen, struct in_addr nexthop, rte->cost = cost; rte->area = area; rte->p_type = p_type; - rte->invalid = false; + rte->invalid = 0; } else { /* XXX better route ? */ /* consider intra vs. inter */ @@ -739,7 +739,7 @@ rt_update(struct in_addr prefix, u_int8_t prefixlen, struct in_addr nexthop, rte->cost = cost; rte->area = area; rte->p_type = p_type; - rte->invalid = false; + rte->invalid = 0; } } } @@ -799,7 +799,7 @@ get_net_link(struct vertex *v, int idx) } /* misc */ -bool +int linked(struct vertex *w, struct vertex *v) { struct lsa_rtr_link *rtr_link = NULL; @@ -814,33 +814,33 @@ linked(struct vertex *w, struct vertex *v) case LSA_TYPE_ROUTER: if (rtr_link->type == LINK_TYPE_POINTTOPOINT && rtr_link->id == htonl(v->ls_id)) - return (true); + return (1); break; case LSA_TYPE_NETWORK: if (rtr_link->id == htonl(v->ls_id)) - return (true); + return (1); break; default: fatalx("spf_calc: invalid type"); } } - return (false); + return (0); case LSA_TYPE_NETWORK: for (i = 0; i < lsa_num_links(w); i++) { net_link = get_net_link(w, i); switch (v->type) { case LSA_TYPE_ROUTER: if (net_link->att_rtr == htonl(v->ls_id)) - return (true); + return (1); break; default: fatalx("spf_calc: invalid type"); } } - return (false); + return (0); default: fatalx("spf_calc: invalid LSA type"); } - return (false); + return (0); } |