diff options
author | Renato Westphal <renato@cvs.openbsd.org> | 2013-10-15 20:21:27 +0000 |
---|---|---|
committer | Renato Westphal <renato@cvs.openbsd.org> | 2013-10-15 20:21:27 +0000 |
commit | ce38752c2223de9f1a89440447cd431d731e3a92 (patch) | |
tree | 444a8725545fc812f6ae50c171c8a9711dcfcc09 /usr.sbin | |
parent | 9f5335e4b55dca498205858504e957335b9cf308 (diff) |
Fix whitespace and other style issues.
OK claudio@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ldpd/accept.c | 4 | ||||
-rw-r--r-- | usr.sbin/ldpd/adjacency.c | 14 | ||||
-rw-r--r-- | usr.sbin/ldpd/hello.c | 15 | ||||
-rw-r--r-- | usr.sbin/ldpd/init.c | 7 | ||||
-rw-r--r-- | usr.sbin/ldpd/kroute.c | 7 | ||||
-rw-r--r-- | usr.sbin/ldpd/lde.c | 6 | ||||
-rw-r--r-- | usr.sbin/ldpd/lde.h | 5 | ||||
-rw-r--r-- | usr.sbin/ldpd/lde_lib.c | 8 | ||||
-rw-r--r-- | usr.sbin/ldpd/ldpd.c | 3 | ||||
-rw-r--r-- | usr.sbin/ldpd/ldpe.h | 4 | ||||
-rw-r--r-- | usr.sbin/ldpd/neighbor.c | 6 |
11 files changed, 35 insertions, 44 deletions
diff --git a/usr.sbin/ldpd/accept.c b/usr.sbin/ldpd/accept.c index 4f1a585f83a..d54a5e31155 100644 --- a/usr.sbin/ldpd/accept.c +++ b/usr.sbin/ldpd/accept.c @@ -1,4 +1,4 @@ -/* $OpenBSD: accept.c,v 1.1 2012/04/12 17:33:43 claudio Exp $ */ +/* $OpenBSD: accept.c,v 1.2 2013/10/15 20:21:24 renato Exp $ */ /* * Copyright (c) 2012 Claudio Jeker <claudio@openbsd.org> @@ -56,7 +56,7 @@ accept_add(int fd, void (*cb)(int, short, void *), void *arg) struct accept_ev *av; if ((av = calloc(1, sizeof(*av))) == NULL) - return -1; + return (-1); av->fd = fd; av->accept_cb = cb; av->arg = arg; diff --git a/usr.sbin/ldpd/adjacency.c b/usr.sbin/ldpd/adjacency.c index 726ea5a5cea..07ac2e42fe0 100644 --- a/usr.sbin/ldpd/adjacency.c +++ b/usr.sbin/ldpd/adjacency.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adjacency.c,v 1.2 2013/10/15 20:13:47 renato Exp $ */ +/* $OpenBSD: adjacency.c,v 1.3 2013/10/15 20:21:24 renato Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -77,7 +77,7 @@ void adj_del(struct adj *adj) { log_debug("adj_del: LSR ID %s, %s", inet_ntoa(adj->nbr->id), - print_hello_src(&adj->source)); + print_hello_src(&adj->source)); adj_stop_itimer(adj); @@ -120,14 +120,18 @@ print_hello_src(struct hello_source *src) { static char buffer[64]; - if (src->type == HELLO_LINK) + switch (src->type) { + case HELLO_LINK: snprintf(buffer, sizeof(buffer), "iface %s", src->link.iface->name); - else + break; + case HELLO_TARGETED: snprintf(buffer, sizeof(buffer), "source %s", inet_ntoa(src->target->addr)); + break; + } - return buffer; + return (buffer); } /* adjacency timers */ diff --git a/usr.sbin/ldpd/hello.c b/usr.sbin/ldpd/hello.c index 8cbdcf7642b..fff514570fd 100644 --- a/usr.sbin/ldpd/hello.c +++ b/usr.sbin/ldpd/hello.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hello.c,v 1.21 2013/10/15 20:13:47 renato Exp $ */ +/* $OpenBSD: hello.c,v 1.22 2013/10/15 20:21:24 renato Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -197,19 +197,14 @@ recv_hello(struct iface *iface, struct in_addr src, char *buf, u_int16_t len) case HELLO_LINK: if (holdtime == 0) holdtime = LINK_DFLT_HOLDTIME; - if (iface->hello_holdtime < holdtime) - adj->holdtime = iface->hello_holdtime; - else - adj->holdtime = holdtime; + + adj->holdtime = min(iface->hello_holdtime, holdtime); break; case HELLO_TARGETED: if (holdtime == 0) holdtime = TARGETED_DFLT_HOLDTIME; - if (tnbr->hello_holdtime < holdtime) - adj->holdtime = tnbr->hello_holdtime; - else - adj->holdtime = holdtime; - break; + + adj->holdtime = min(tnbr->hello_holdtime, holdtime); } if (adj->holdtime != INFINITE_HOLDTIME) diff --git a/usr.sbin/ldpd/init.c b/usr.sbin/ldpd/init.c index 4e726f5dbd3..5cb8243e87a 100644 --- a/usr.sbin/ldpd/init.c +++ b/usr.sbin/ldpd/init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init.c,v 1.13 2013/10/15 19:59:52 renato Exp $ */ +/* $OpenBSD: init.c,v 1.14 2013/10/15 20:21:25 renato Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -107,10 +107,7 @@ recv_init(struct nbr *nbr, char *buf, u_int16_t len) return (-1); } - if (leconf->keepalive < ntohs(sess.keepalive_time)) - nbr->keepalive = leconf->keepalive; - else - nbr->keepalive = ntohs(sess.keepalive_time); + nbr->keepalive = min(leconf->keepalive, ntohs(sess.keepalive_time)); if (!nbr_pending_idtimer(nbr)) nbr_fsm(nbr, NBR_EVT_INIT_RCVD); diff --git a/usr.sbin/ldpd/kroute.c b/usr.sbin/ldpd/kroute.c index 8a1efcdb0dd..b7f03b6ec72 100644 --- a/usr.sbin/ldpd/kroute.c +++ b/usr.sbin/ldpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.29 2013/06/04 00:41:18 claudio Exp $ */ +/* $OpenBSD: kroute.c,v 1.30 2013/10/15 20:21:25 renato Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -553,7 +553,7 @@ kroute_insert(struct kroute_node *kr) if ((krh = RB_INSERT(kroute_tree, &krt, kr)) != NULL) { /* - * Multiple FEC, add to ordered list + * Multiple FEC, add to ordered list */ if (kr->r.priority < krh->r.priority) { /* head element */ @@ -847,7 +847,7 @@ if_change(u_short ifindex, int flags, struct if_data *ifd, kif = kif_update(ifindex, flags, ifd, sdl, &link_old); if (!kif) { - log_warn("if_change: kif_update(%u)", ifindex); + log_warn("if_change: kif_update(%u)", ifindex); return; } link_new = (kif->k.flags & IFF_UP) && @@ -1072,7 +1072,6 @@ send_rtmsg(int fd, int action, struct kroute *kroute, u_int32_t family) } } - retry: if (writev(fd, iov, iovcnt) == -1) { if (errno == ESRCH) { diff --git a/usr.sbin/ldpd/lde.c b/usr.sbin/ldpd/lde.c index 0a3591d9381..521af1607c1 100644 --- a/usr.sbin/ldpd/lde.c +++ b/usr.sbin/ldpd/lde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lde.c,v 1.24 2013/06/04 00:45:00 claudio Exp $ */ +/* $OpenBSD: lde.c,v 1.25 2013/10/15 20:21:25 renato Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -703,7 +703,7 @@ lde_map_del(struct lde_nbr *ln, struct lde_map *me, int sent) fec_remove(&ln->sent_map, &me->fec); else fec_remove(&ln->recv_map, &me->fec); - + lde_map_free(me); } @@ -747,7 +747,7 @@ lde_req_del(struct lde_nbr *ln, struct lde_req *lre, int sent) fec_remove(&ln->sent_req, &lre->fec); else fec_remove(&ln->recv_req, &lre->fec); - + free(lre); } diff --git a/usr.sbin/ldpd/lde.h b/usr.sbin/ldpd/lde.h index a46b53697bd..7619bfe6e91 100644 --- a/usr.sbin/ldpd/lde.h +++ b/usr.sbin/ldpd/lde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lde.h,v 1.20 2013/06/03 17:01:59 claudio Exp $ */ +/* $OpenBSD: lde.h,v 1.21 2013/10/15 20:21:25 renato Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -41,7 +41,7 @@ struct fec { */ struct lde_req { struct fec fec; - u_int32_t msgid; + u_int32_t msgid; }; /* mapping entries */ @@ -112,7 +112,6 @@ struct lde_req *lde_req_add(struct lde_nbr *, struct fec *, int); void lde_req_del(struct lde_nbr *, struct lde_req *, int); struct lde_nbr *lde_find_address(struct in_addr); - int lde_address_add(struct lde_nbr *, struct in_addr *); struct lde_nbr_address *lde_address_find(struct lde_nbr *, struct in_addr *); int lde_address_del(struct lde_nbr *, struct in_addr *); diff --git a/usr.sbin/ldpd/lde_lib.c b/usr.sbin/ldpd/lde_lib.c index a30778649ae..d8234a0e6d9 100644 --- a/usr.sbin/ldpd/lde_lib.c +++ b/usr.sbin/ldpd/lde_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lde_lib.c,v 1.30 2013/06/03 16:56:47 claudio Exp $ */ +/* $OpenBSD: lde_lib.c,v 1.31 2013/10/15 20:21:25 renato Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -92,7 +92,6 @@ fec_find(struct fec_tree *fh, struct fec *f) return (RB_FIND(fec_tree, fh, f)); } - int fec_insert(struct fec_tree *fh, struct fec *f) { @@ -123,7 +122,6 @@ fec_clear(struct fec_tree *fh, void (*free_cb)(void *)) } } - /* routing table functions */ void rt_dump(pid_t pid) @@ -447,7 +445,7 @@ lde_check_mapping(struct map *map, struct lde_nbr *ln) /* LMp.15 install FEC in FIB */ lde_send_change_klabel(rn, rl); - /* Record the mapping from this peer LMp.16 */ + /* Record the mapping from this peer LMp.16 */ if (me == NULL) me = lde_map_add(ln, rn, 0); me->label = map->label; @@ -597,7 +595,7 @@ lde_check_withdraw(struct map *map, struct lde_nbr *ln) /* if ordered distribution */ /* walk over upstream list and send withdraws for LSP that depend on * the removed LSP */ - + /* if independent distribution and adv on demand */ /* Generate Event: Recognize New FEC for FEC. */ } diff --git a/usr.sbin/ldpd/ldpd.c b/usr.sbin/ldpd/ldpd.c index 9d53b5c13cd..ce67583d6d5 100644 --- a/usr.sbin/ldpd/ldpd.c +++ b/usr.sbin/ldpd/ldpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldpd.c,v 1.17 2013/06/04 02:25:28 claudio Exp $ */ +/* $OpenBSD: ldpd.c,v 1.18 2013/10/15 20:21:25 renato Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -264,7 +264,6 @@ main(int argc, char *argv[]) /* remove unneded stuff from config */ /* ... */ - event_dispatch(); ldpd_shutdown(); diff --git a/usr.sbin/ldpd/ldpe.h b/usr.sbin/ldpd/ldpe.h index 8a6c9048c20..3b7e7730c39 100644 --- a/usr.sbin/ldpd/ldpe.h +++ b/usr.sbin/ldpd/ldpe.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ldpe.h,v 1.28 2013/10/15 20:13:47 renato Exp $ */ +/* $OpenBSD: ldpe.h,v 1.29 2013/10/15 20:21:26 renato Exp $ */ /* * Copyright (c) 2004, 2005, 2008 Esben Norby <norby@openbsd.org> @@ -19,6 +19,7 @@ #ifndef _LDPE_H_ #define _LDPE_H_ +#define min(x,y) ((x) <= (y) ? (x) : (y)) #define max(x,y) ((x) > (y) ? (x) : (y)) #include <sys/types.h> @@ -224,7 +225,6 @@ void session_accept(int, short, void *); struct tcp_conn *tcp_new(int, struct nbr *); void tcp_close(struct tcp_conn *); - void session_read(int, short, void *); void session_write(int, short, void *); void session_close(struct nbr *); diff --git a/usr.sbin/ldpd/neighbor.c b/usr.sbin/ldpd/neighbor.c index a9bd0f5d7fd..8e703cec584 100644 --- a/usr.sbin/ldpd/neighbor.c +++ b/usr.sbin/ldpd/neighbor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: neighbor.c,v 1.38 2013/06/04 02:39:10 claudio Exp $ */ +/* $OpenBSD: neighbor.c,v 1.39 2013/10/15 20:21:26 renato Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -288,9 +288,9 @@ int nbr_session_active_role(struct nbr *nbr) { if (ntohl(ldpe_router_id()) > ntohl(nbr->addr.s_addr)) - return 1; + return (1); - return 0; + return (0); } /* timers */ |