diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/relayd/config.c | 11 | ||||
-rw-r--r-- | usr.sbin/relayd/parse.y | 58 | ||||
-rw-r--r-- | usr.sbin/relayd/pfe_filter.c | 4 | ||||
-rw-r--r-- | usr.sbin/relayd/proc.c | 6 | ||||
-rw-r--r-- | usr.sbin/relayd/relay.c | 17 | ||||
-rw-r--r-- | usr.sbin/relayd/relay_http.c | 5 | ||||
-rw-r--r-- | usr.sbin/relayd/relayd.h | 6 | ||||
-rw-r--r-- | usr.sbin/relayd/ssl_privsep.c | 8 |
8 files changed, 61 insertions, 54 deletions
diff --git a/usr.sbin/relayd/config.c b/usr.sbin/relayd/config.c index 6c26e9e24de..5874d17e27e 100644 --- a/usr.sbin/relayd/config.c +++ b/usr.sbin/relayd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.5 2012/10/03 08:40:40 reyk Exp $ */ +/* $OpenBSD: config.c,v 1.6 2012/10/04 20:53:30 reyk Exp $ */ /* * Copyright (c) 2011 Reyk Floeter <reyk@openbsd.org> @@ -673,10 +673,12 @@ config_setprotonode(struct relayd *env, enum privsep_procid id, pn->conf.valuelen = pn->value ? strlen(pn->value) : 0; if (pn->label != 0 && pn->labelname == NULL) pn->labelname = strdup(pn_id2name(pn->label)); - pn->conf.labelnamelen = pn->labelname ? strlen(pn->labelname) : 0; + pn->conf.labelnamelen = pn->labelname ? + strlen(pn->labelname) : 0; pn->conf.len = sizeof(*pn) + - pn->conf.keylen + pn->conf.valuelen + pn->conf.labelnamelen; + pn->conf.keylen + pn->conf.valuelen + + pn->conf.labelnamelen; if (pn->conf.len > (MAX_IMSGSIZE - IMSG_HEADER_SIZE)) return (-1); @@ -760,7 +762,8 @@ config_getprotonode(struct relayd *env, struct imsg *imsg) if (pn.conf.labelnamelen) { if ((pn.labelname = get_string(p + s, pn.conf.labelnamelen)) == NULL) { - log_debug("%s: failed to get labelname", __func__); + log_debug("%s: failed to get labelname", + __func__); return (-1); } s += pn.conf.labelnamelen; diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y index 707403554ed..dc3c7f1b501 100644 --- a/usr.sbin/relayd/parse.y +++ b/usr.sbin/relayd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.166 2012/10/03 08:40:40 reyk Exp $ */ +/* $OpenBSD: parse.y,v 1.167 2012/10/04 20:53:30 reyk Exp $ */ /* * Copyright (c) 2007-2011 Reyk Floeter <reyk@openbsd.org> @@ -578,7 +578,7 @@ tabledef : TABLE table { TAILQ_INIT(&tb->hosts); table = tb; dstmode = RELAY_DSTMODE_DEFAULT; - } tabledefopts_l { + } tabledefopts_l { if (TAILQ_EMPTY(&table->hosts)) { yyerror("table %s has no hosts", table->conf.name); @@ -609,7 +609,7 @@ tablelist : host { | include ; -tablespec : table { +tablespec : table { struct table *tb; if ((tb = calloc(1, sizeof (*tb))) == NULL) fatal("out of memory"); @@ -668,7 +668,8 @@ tableopts : CHECK tablecheck "divisible by global interval"); YYERROR; } - table->conf.skip_cnt = ($2 / conf->sc_interval.tv_sec) - 1; + table->conf.skip_cnt = + ($2 / conf->sc_interval.tv_sec) - 1; } | MODE dstmode { switch ($2) { @@ -1213,7 +1214,8 @@ relay : RELAY STRING { if ((r = calloc(1, sizeof (*r))) == NULL) fatal("out of memory"); - if (strlcpy(r->rl_conf.name, $2, sizeof(r->rl_conf.name)) >= + if (strlcpy(r->rl_conf.name, $2, + sizeof(r->rl_conf.name)) >= sizeof(r->rl_conf.name)) { yyerror("relay name truncated"); free(r); @@ -1375,8 +1377,8 @@ forwardspec : STRING port retry { struct address *h; if (rlay->rl_conf.dstss.ss_family != AF_UNSPEC) { - yyerror("relay %s target or redirection already " - "specified", rlay->rl_conf.name); + yyerror("relay %s target or redirection " + "already specified", rlay->rl_conf.name); free($1); YYERROR; } @@ -2806,41 +2808,41 @@ getservice(char *n) int is_if_in_group(const char *ifname, const char *groupname) { - unsigned int len; - struct ifgroupreq ifgr; - struct ifg_req *ifg; + unsigned int len; + struct ifgroupreq ifgr; + struct ifg_req *ifg; int s; int ret = 0; if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) err(1, "socket"); - memset(&ifgr, 0, sizeof(ifgr)); - strlcpy(ifgr.ifgr_name, ifname, IFNAMSIZ); - if (ioctl(s, SIOCGIFGROUP, (caddr_t)&ifgr) == -1) { - if (errno == EINVAL || errno == ENOTTY) + memset(&ifgr, 0, sizeof(ifgr)); + strlcpy(ifgr.ifgr_name, ifname, IFNAMSIZ); + if (ioctl(s, SIOCGIFGROUP, (caddr_t)&ifgr) == -1) { + if (errno == EINVAL || errno == ENOTTY) goto end; err(1, "SIOCGIFGROUP"); - } + } - len = ifgr.ifgr_len; - ifgr.ifgr_groups = - (struct ifg_req *)calloc(len / sizeof(struct ifg_req), + len = ifgr.ifgr_len; + ifgr.ifgr_groups = + (struct ifg_req *)calloc(len / sizeof(struct ifg_req), sizeof(struct ifg_req)); - if (ifgr.ifgr_groups == NULL) - err(1, "getifgroups"); - if (ioctl(s, SIOCGIFGROUP, (caddr_t)&ifgr) == -1) - err(1, "SIOCGIFGROUP"); - - ifg = ifgr.ifgr_groups; - for (; ifg && len >= sizeof(struct ifg_req); ifg++) { - len -= sizeof(struct ifg_req); + if (ifgr.ifgr_groups == NULL) + err(1, "getifgroups"); + if (ioctl(s, SIOCGIFGROUP, (caddr_t)&ifgr) == -1) + err(1, "SIOCGIFGROUP"); + + ifg = ifgr.ifgr_groups; + for (; ifg && len >= sizeof(struct ifg_req); ifg++) { + len -= sizeof(struct ifg_req); if (strcmp(ifg->ifgrq_group, groupname) == 0) { ret = 1; break; } - } - free(ifgr.ifgr_groups); + } + free(ifgr.ifgr_groups); end: close(s); diff --git a/usr.sbin/relayd/pfe_filter.c b/usr.sbin/relayd/pfe_filter.c index 0cafed503c7..a92871c1dea 100644 --- a/usr.sbin/relayd/pfe_filter.c +++ b/usr.sbin/relayd/pfe_filter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfe_filter.c,v 1.50 2012/09/18 10:11:53 henning Exp $ */ +/* $OpenBSD: pfe_filter.c,v 1.51 2012/10/04 20:53:30 reyk Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -489,7 +489,7 @@ sync_ruleset(struct relayd *env, struct rdr *rdr, int enable) if (rio.rule.rt == PF_ROUTETO) { memcpy(&rio.rule.route, &rio.rule.rdr, - sizeof(rio.rule.route)); + sizeof(rio.rule.route)); rio.rule.rdr.addr.type = PF_ADDR_NONE; } diff --git a/usr.sbin/relayd/proc.c b/usr.sbin/relayd/proc.c index 6bd38273992..6bf51b384c4 100644 --- a/usr.sbin/relayd/proc.c +++ b/usr.sbin/relayd/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.3 2011/09/04 20:26:58 bluhm Exp $ */ +/* $OpenBSD: proc.c,v 1.4 2012/10/04 20:53:30 reyk Exp $ */ /* * Copyright (c) 2010,2011 Reyk Floeter <reyk@openbsd.org> @@ -119,8 +119,8 @@ proc_setup(struct privsep *ps) /* * find out how many instances of this peer there are. */ - if (i >= j || ps->ps_instances[i] == 0|| - ps->ps_instances[j] == 0) + if (i >= j || ps->ps_instances[i] == 0 || + ps->ps_instances[j] == 0) continue; if (ps->ps_instances[i] > 1 && diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c index 0289de67b80..f31c6420eba 100644 --- a/usr.sbin/relayd/relay.c +++ b/usr.sbin/relayd/relay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay.c,v 1.155 2012/10/03 08:40:40 reyk Exp $ */ +/* $OpenBSD: relay.c,v 1.156 2012/10/04 20:53:30 reyk Exp $ */ /* * Copyright (c) 2006 - 2012 Reyk Floeter <reyk@openbsd.org> @@ -626,7 +626,7 @@ relay_connected(int fd, short sig, void *arg) if (error) errno = error; relay_abort_http(con, 500, "socket error", 0); - return; + return; } if ((rlay->rl_conf.flags & F_SSLCLIENT) && (out->ssl == NULL)) { @@ -1320,7 +1320,7 @@ relay_connect_retry(int fd, short sig, void *arg) } /* we waited for RELAY_OUTOF_FD_RETRIES seconds, give up */ event_add(&rlay->rl_ev, NULL); - relay_abort_http(con, 504, "connection timed out", 0); + relay_abort_http(con, 504, "connection timed out", 0); return; } @@ -1339,7 +1339,7 @@ relay_connect_retry(int fd, short sig, void *arg) con->se_retrycount++; - if ((errno == ENFILE || errno == EMFILE) && + if ((errno == ENFILE || errno == EMFILE) && (con->se_retrycount < con->se_retry)) { event_del(&rlay->rl_ev); evtimer_add(&con->se_inflightevt, &evtpause); @@ -1431,14 +1431,15 @@ relay_connect(struct rsession *con) log_debug("%s: session %d: " "forward failed: %s, %s", __func__, con->se_id, strerror(errno), - con->se_retry ? "next retry" : "last retry"); + con->se_retry ? + "next retry" : "last retry"); goto retry; } - log_debug("%s: session %d: forward failed: %s", __func__, - con->se_id, strerror(errno)); + log_debug("%s: session %d: forward failed: %s", + __func__, con->se_id, strerror(errno)); return (-1); } - } + } relay_inflight--; DPRINTF("%s: inflight decremented, now %d",__func__, diff --git a/usr.sbin/relayd/relay_http.c b/usr.sbin/relayd/relay_http.c index d02356ca16f..f3ead69df45 100644 --- a/usr.sbin/relayd/relay_http.c +++ b/usr.sbin/relayd/relay_http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay_http.c,v 1.1 2012/09/20 12:30:20 reyk Exp $ */ +/* $OpenBSD: relay_http.c,v 1.2 2012/10/04 20:53:30 reyk Exp $ */ /* * Copyright (c) 2006 - 2012 Reyk Floeter <reyk@openbsd.org> @@ -227,7 +227,8 @@ relay_read_http(struct bufferevent *bev, void *arg) * the carriage return? And some browsers seem to * include the line length in the content-length. */ - cre->toread = strtonum(pk.value, 0, ULLONG_MAX, &errstr); + cre->toread = strtonum(pk.value, 0, ULLONG_MAX, + &errstr); if (errstr) { relay_abort_http(con, 500, errstr, 0); goto abort; diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h index b02b62496a2..db459cdc486 100644 --- a/usr.sbin/relayd/relayd.h +++ b/usr.sbin/relayd/relayd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.h,v 1.160 2012/10/03 08:40:40 reyk Exp $ */ +/* $OpenBSD: relayd.h,v 1.161 2012/10/04 20:53:30 reyk Exp $ */ /* * Copyright (c) 2006 - 2012 Reyk Floeter <reyk@openbsd.org> @@ -59,7 +59,7 @@ #define RELAY_STATINTERVAL 60 #define RELAY_BACKLOG 10 #define RELAY_MAXLOOKUPLEVELS 5 -#define RELAY_OUTOF_FD_RETRIES 5 +#define RELAY_OUTOF_FD_RETRIES 5 #define CONFIG_RELOAD 0x00 #define CONFIG_TABLES 0x01 @@ -1080,7 +1080,7 @@ void socket_rlimit(int); char *get_string(u_int8_t *, size_t); void *get_data(u_int8_t *, size_t); int accept_reserve(int sockfd, struct sockaddr *addr, - socklen_t *addrlen, int reserve, volatile int *); + socklen_t *addrlen, int reserve, volatile int *); /* carp.c */ int carp_demote_init(char *, int); diff --git a/usr.sbin/relayd/ssl_privsep.c b/usr.sbin/relayd/ssl_privsep.c index 8a0eb44ce52..bb58c052606 100644 --- a/usr.sbin/relayd/ssl_privsep.c +++ b/usr.sbin/relayd/ssl_privsep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_privsep.c,v 1.8 2010/08/26 13:00:19 marco Exp $ */ +/* $OpenBSD: ssl_privsep.c,v 1.9 2012/10/04 20:53:30 reyk Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. @@ -230,13 +230,13 @@ ssl_by_mem_ctrl(X509_LOOKUP *lu, int cmd, const char *buf, if ((inf = PEM_X509_INFO_read_bio(in, NULL, NULL, NULL)) == NULL) goto done; - for(i = 0; i < sk_X509_INFO_num(inf); i++) { + for (i = 0; i < sk_X509_INFO_num(inf); i++) { itmp = sk_X509_INFO_value(inf, i); - if(itmp->x509) { + if (itmp->x509) { X509_STORE_add_cert(lu->store_ctx, itmp->x509); count++; } - if(itmp->crl) { + if (itmp->crl) { X509_STORE_add_crl(lu->store_ctx, itmp->crl); count++; } |