commit - f4a6eef32d65cd21b8ae3ff004c9e6df1da60025
commit + 09e53feeaa2a7c28a81c8bac20bab18c68d83883
blob - 467a787f170693fde774f862dc3d87300b5bdb4a
blob + d25ef15b637bfd35c876ac5ad62d57d130313f31
--- agentx.c
+++ agentx.c
-/* $OpenBSD: agentx.c,v 1.13 2015/12/07 04:03:27 mmcc Exp $ */
+/* $OpenBSD: agentx.c,v 1.14 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2013,2014 Bret Stephen Lambert <blambert@openbsd.org>
*
if (h->r == NULL) {
if ((h->r = snmp_agentx_pdu_alloc()) == NULL)
return (NULL);
- h->r->datalen = 0; /* XXX -- force this for receive buffers */
+ h->r->datalen = 0; /* XXX force this for receive buffers */
}
pdu = h->r;
blob - f5cc3be89576381300e43b3161c73629806c698d
blob + 94e80f5c6b2a53534886eee31af6991a53ff1264
--- ca.c
+++ ca.c
-/* $OpenBSD: ca.c,v 1.25 2017/05/27 08:33:25 claudio Exp $ */
+/* $OpenBSD: ca.c,v 1.26 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
NULL, NULL)) == NULL)
fatalx("ca_launch: cert");
- if (X509_digest(cert, EVP_sha256(), d, &dlen) != 1)
+ if (X509_digest(cert, EVP_sha256(), d, &dlen) != 1)
fatalx("ca_launch: cert");
hash_string(d, dlen, hash, sizeof(hash));
if (rlay->rl_conf.tls_key_len) {
if ((in = BIO_new_mem_buf(rlay->rl_tls_key,
rlay->rl_conf.tls_key_len)) == NULL)
- fatalx("ca_launch: key");
+ fatalx("%s: key", __func__);
if ((pkey = PEM_read_bio_PrivateKey(in,
NULL, NULL, NULL)) == NULL)
- fatalx("ca_launch: PEM");
+ fatalx("%s: PEM", __func__);
BIO_free(in);
rlay->rl_tls_pkey = pkey;
NULL, NULL)) == NULL)
fatalx("ca_launch: cacert");
- if (X509_digest(cert, EVP_sha256(), d, &dlen) != 1)
+ if (X509_digest(cert, EVP_sha256(), d, &dlen) != 1)
fatalx("ca_launch: cacert");
hash_string(d, dlen, hash, sizeof(hash));
if (rlay->rl_conf.tls_cakey_len) {
if ((in = BIO_new_mem_buf(rlay->rl_tls_cakey,
rlay->rl_conf.tls_cakey_len)) == NULL)
- fatalx("ca_launch: key");
+ fatalx("%s: key", __func__);
if ((pkey = PEM_read_bio_PrivateKey(in,
NULL, NULL, NULL)) == NULL)
- fatalx("ca_launch: PEM");
+ fatalx("%s: PEM", __func__);
BIO_free(in);
rlay->rl_tls_capkey = pkey;
IMSG_SIZE_CHECK(imsg, (&cko));
bcopy(imsg->data, &cko, sizeof(cko));
if (cko.cko_proc > env->sc_conf.prefork_relay)
- fatalx("ca_dispatch_relay: "
- "invalid relay proc");
+ fatalx("%s: invalid relay proc", __func__);
if (IMSG_DATA_SIZE(imsg) != (sizeof(cko) + cko.cko_flen))
- fatalx("ca_dispatch_relay: "
- "invalid key operation");
+ fatalx("%s: invalid key operation", __func__);
if ((pkey = pkey_find(env, cko.cko_hash)) == NULL ||
(rsa = EVP_PKEY_get1_RSA(pkey)) == NULL)
- fatalx("ca_dispatch_relay: "
- "invalid relay key or id");
+ fatalx("%s: invalid relay key or id", __func__);
DPRINTF("%s:%d: key hash %s proc %d",
__func__, __LINE__, cko.cko_hash, cko.cko_proc);
from = (u_char *)imsg->data + sizeof(cko);
if ((to = calloc(1, cko.cko_tlen)) == NULL)
- fatalx("ca_dispatch_relay: calloc");
+ fatalx("%s: calloc", __func__);
switch (imsg->hdr.type) {
case IMSG_CA_PRIVENC:
*/
imsg_composev(ibuf, cmd, 0, 0, -1, iov, cnt);
if (imsg_flush(ibuf) == -1)
- log_warn("rsae_send_imsg: imsg_flush");
+ log_warn("%s: imsg_flush", __func__);
pfd[0].fd = ibuf->fd;
pfd[0].events = POLLIN;
while (!done) {
switch (poll(pfd, 1, RELAY_TLS_PRIV_TIMEOUT)) {
case -1:
- fatal("rsae_send_imsg: poll");
+ fatal("%s: poll", __func__);
case 0:
- log_warnx("rsae_send_imsg: poll timeout");
+ log_warnx("%s: poll timeout", __func__);
break;
default:
break;
blob - 3ba5179856d6d321e1df20464b2af658b1a3a4f9
blob + 30c690f42b0a13fc2dd5920045d8c6163899b4eb
--- check_icmp.c
+++ check_icmp.c
-/* $OpenBSD: check_icmp.c,v 1.44 2016/09/02 14:45:51 reyk Exp $ */
+/* $OpenBSD: check_icmp.c,v 1.45 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
if (af == AF_INET6)
proto = IPPROTO_ICMPV6;
if ((cie->s = socket(af, SOCK_RAW | SOCK_NONBLOCK, proto)) < 0)
- fatal("icmp_setup: socket");
+ fatal("%s: socket", __func__);
val = ICMP_RCVBUF_SIZE;
if (setsockopt(cie->s, SOL_SOCKET, SO_RCVBUF, &val, sizeof(val)) == -1)
- fatal("icmp_setup: setsockopt");
+ fatal("%s: setsockopt", __func__);
cie->env = env;
cie->af = af;
}
blob - 9bb494c7275c3e2732d22405f6e44e5f1dd9c152
blob + cf51a835c8f87f5a5c4f7d9441a4d6a7c8804a90
--- check_script.c
+++ check_script.c
-/* $OpenBSD: check_script.c,v 1.20 2016/09/02 14:45:51 reyk Exp $ */
+/* $OpenBSD: check_script.c,v 1.21 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
struct table *table;
if ((table = table_find(env, host->conf.tableid)) == NULL)
- fatalx("check_script: invalid table id");
+ fatalx("%s: invalid table id", __func__);
host->last_up = host->up;
host->flags &= ~(F_CHECK_SENT|F_CHECK_DONE);
struct host *host;
if ((host = host_find(env, scr->host)) == NULL)
- fatalx("hce_dispatch_parent: invalid host id");
+ fatalx("%s: invalid host id", __func__);
if (scr->retval < 0)
host->up = HOST_UNKNOWN;
signal(SIGCHLD, SIG_DFL);
if ((pw = getpwnam(RELAYD_USER)) == NULL)
- fatal("script_exec: getpwnam");
+ fatal("%s: getpwnam", __func__);
if (chdir("/") == -1)
- fatal("script_exec: chdir(\"/\")");
+ fatal("%s: chdir(\"/\")", __func__);
if (setgroups(1, &pw->pw_gid) ||
setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) ||
setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid))
- fatal("script_exec: can't drop privileges");
+ fatal("%s: can't drop privileges", __func__);
/*
* close fds before executing an external program, to
blob - cf3a97c3f232a3eeacd3f782d078fee3e5fc53f4
blob + ea0d7fdb4a1adfc1b5ad774f0b3b6e47bdaa0851
--- check_tcp.c
+++ check_tcp.c
-/* $OpenBSD: check_tcp.c,v 1.53 2017/05/27 08:33:25 claudio Exp $ */
+/* $OpenBSD: check_tcp.c,v 1.54 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
len = sizeof(err);
if (getsockopt(s, SOL_SOCKET, SO_ERROR, &err, &len))
- fatal("tcp_write: getsockopt");
+ fatal("%s: getsockopt", __func__);
if (err != 0) {
tcp_close(cte, HOST_DOWN);
hce_notify_done(cte->host, HCE_TCP_CONNECT_FAIL);
}
if ((cte->buf = ibuf_dynamic(SMALL_READ_BUF_SIZE, UINT_MAX)) == NULL)
- fatalx("tcp_host_up: cannot create dynamic buffer");
+ fatalx("%s: cannot create dynamic buffer", __func__);
event_again(&cte->ev, cte->s, EV_TIMEOUT|EV_READ, tcp_read_buf,
&cte->tv_start, &cte->table->conf.timeout, cte);
}
} while (len > 0);
if ((cte->buf = ibuf_dynamic(SMALL_READ_BUF_SIZE, UINT_MAX)) == NULL)
- fatalx("tcp_send_req: cannot create dynamic buffer");
+ fatalx("%s: cannot create dynamic buffer", __func__);
event_again(&cte->ev, s, EV_TIMEOUT|EV_READ, tcp_read_buf,
&cte->tv_start, &cte->table->conf.timeout, cte);
return;
return;
default:
if (ibuf_add(cte->buf, rbuf, br) == -1)
- fatal("tcp_read_buf: buf_add error");
+ fatal("%s: buf_add error", __func__);
if (cte->validate_read != NULL) {
if (cte->validate_read(cte) != 0)
goto retry;
blob - 6162c2008eb81b71b084a24534b69fb294f253d4
blob + 5c5ee6f30136dffe2826c57cb5b17bf63f702acc
--- hce.c
+++ hce.c
-/* $OpenBSD: hce.c,v 1.76 2017/05/27 08:33:25 claudio Exp $ */
+/* $OpenBSD: hce.c,v 1.77 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
socket_rlimit(-1);
if (pledge("stdio recvfd inet", NULL) == -1)
- fatal("hce: pledge");
+ fatal("%s: pledge", __func__);
}
void
continue;
}
if (table->conf.check == CHECK_NOCHECK)
- fatalx("hce_launch_checks: unknown check type");
+ fatalx("%s: unknown check type", __func__);
TAILQ_FOREACH(host, &table->hosts, entry) {
if (host->flags & F_DISABLE || host->conf.parentid)
char *codemsg = NULL;
if ((hostnst = host_find(env, host->conf.id)) == NULL)
- fatalx("hce_notify_done: desynchronized");
+ fatalx("%s: desynchronized", __func__);
if ((table = table_find(env, host->conf.tableid)) == NULL)
- fatalx("hce_notify_done: invalid table id");
+ fatalx("%s: invalid table id", __func__);
if (hostnst->flags & F_DISABLE) {
if (env->sc_conf.opts & RELAYD_OPT_LOGUPDATE) {
case IMSG_HOST_DISABLE:
memcpy(&id, imsg->data, sizeof(id));
if ((host = host_find(env, id)) == NULL)
- fatalx("hce_dispatch_pfe: desynchronized");
+ fatalx("%s: desynchronized", __func__);
host->flags |= F_DISABLE;
host->up = HOST_UNKNOWN;
host->check_cnt = 0;
case IMSG_HOST_ENABLE:
memcpy(&id, imsg->data, sizeof(id));
if ((host = host_find(env, id)) == NULL)
- fatalx("hce_dispatch_pfe: desynchronized");
+ fatalx("%s: desynchronized", __func__);
host->flags &= ~(F_DISABLE);
host->up = HOST_UNKNOWN;
host->he = HCE_NONE;
case IMSG_TABLE_DISABLE:
memcpy(&id, imsg->data, sizeof(id));
if ((table = table_find(env, id)) == NULL)
- fatalx("hce_dispatch_pfe: desynchronized");
+ fatalx("%s: desynchronized", __func__);
table->conf.flags |= F_DISABLE;
TAILQ_FOREACH(host, &table->hosts, entry)
host->up = HOST_UNKNOWN;
case IMSG_TABLE_ENABLE:
memcpy(&id, imsg->data, sizeof(id));
if ((table = table_find(env, id)) == NULL)
- fatalx("hce_dispatch_pfe: desynchronized");
+ fatalx("%s: desynchronized", __func__);
table->conf.flags &= ~(F_DISABLE);
TAILQ_FOREACH(host, &table->hosts, entry)
host->up = HOST_UNKNOWN;
blob - df80dd97d4eba378f1f0f6dce2c97a2af4dfeaf4
blob + 38999e70cd0df872f9d410ac6dd86e9f7c3a2375
--- pfe.c
+++ pfe.c
-/* $OpenBSD: pfe.c,v 1.88 2017/01/24 10:49:14 benno Exp $ */
+/* $OpenBSD: pfe.c,v 1.89 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
void
pfe(struct privsep *ps, struct privsep_proc *p)
{
- int s;
+ int s;
struct pf_status status;
env = ps->ps_env;
env->sc_pf->dev = s;
}
if (ioctl(env->sc_pf->dev, DIOCGETSTATUS, &status) == -1)
- fatal("init_filter: DIOCGETSTATUS");
+ fatal("%s: DIOCGETSTATUS", __func__);
if (!status.running)
- fatalx("init_filter: pf is disabled");
+ fatalx("%s: pf is disabled", __func__);
log_debug("%s: filter init done", __func__);
proc_run(ps, p, procs, nitems(procs), pfe_init, NULL);
IMSG_SIZE_CHECK(imsg, &st);
memcpy(&st, imsg->data, sizeof(st));
if ((host = host_find(env, st.id)) == NULL)
- fatalx("pfe_dispatch_hce: invalid host id");
+ fatalx("%s: invalid host id", __func__);
host->he = st.he;
if (host->flags & F_DISABLE)
break;
if (host->check_cnt != st.check_cnt) {
log_debug("%s: host %d => %d", __func__,
host->conf.id, host->up);
- fatalx("pfe_dispatch_hce: desynchronized");
+ fatalx("%s: desynchronized", __func__);
}
if (host->up == st.up)
if ((table = table_find(env, host->conf.tableid))
== NULL)
- fatalx("pfe_dispatch_hce: invalid table id");
+ fatalx("%s: invalid table id", __func__);
log_debug("%s: state %d for host %u %s", __func__,
st.up, host->conf.id, host->conf.name);
IMSG_SIZE_CHECK(imsg, &cnl);
bcopy(imsg->data, &cnl, sizeof(cnl));
if (cnl.proc > env->sc_conf.prefork_relay)
- fatalx("pfe_dispatch_relay: "
- "invalid relay proc");
+ fatalx("%s: invalid relay proc", __func__);
if (natlook(env, &cnl) != 0)
cnl.in = -1;
proc_compose_imsg(env->sc_ps, PROC_RELAY, cnl.proc,
IMSG_SIZE_CHECK(imsg, &crs);
bcopy(imsg->data, &crs, sizeof(crs));
if (crs.proc > env->sc_conf.prefork_relay)
- fatalx("pfe_dispatch_relay: "
- "invalid relay proc");
+ fatalx("%s: invalid relay proc", __func__);
if ((rlay = relay_find(env, crs.id)) == NULL)
- fatalx("pfe_dispatch_relay: invalid relay id");
+ fatalx("%s: invalid relay id", __func__);
bcopy(&crs, &rlay->rl_stats[crs.proc], sizeof(crs));
rlay->rl_stats[crs.proc].interval =
env->sc_conf.statinterval.tv_sec;
return (-1);
id->id = table->conf.id;
if (table->conf.rdrid > 0 && rdr_find(env, table->conf.rdrid) == NULL)
- fatalx("disable_table: desynchronised");
+ fatalx("%s: desynchronised", __func__);
if (table->conf.flags & F_DISABLE)
return (0);
id->id = table->conf.id;
if (table->conf.rdrid > 0 && rdr_find(env, table->conf.rdrid) == NULL)
- fatalx("enable_table: desynchronised");
+ fatalx("%s: desynchronised", __func__);
if (!(table->conf.flags & F_DISABLE))
return (0);
if (host->up == HOST_UP) {
if ((table = table_find(env, host->conf.tableid)) == NULL)
- fatalx("disable_host: invalid table id");
+ fatalx("%s: invalid table id", __func__);
table->up--;
table->conf.flags |= F_CHANGED;
}
blob - 2dd2ddbfd3607554c5a316fb9f2b4e8558af58b7
blob + 347048ece568fc4c6e6f81429c7a6d98068f70a5
--- pfe_filter.c
+++ pfe_filter.c
-/* $OpenBSD: pfe_filter.c,v 1.61 2017/01/24 10:49:14 benno Exp $ */
+/* $OpenBSD: pfe_filter.c,v 1.62 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
i++;
}
if (i != env->sc_rdrcount)
- fatalx("init_tables: table count modified");
+ fatalx("%s: table count modified", __func__);
memset(&io, 0, sizeof(io));
io.pfrio_size = env->sc_rdrcount;
io.pfrio_buffer = tables;
if (ioctl(env->sc_pf->dev, DIOCRADDTABLES, &io) == -1)
- fatal("init_tables: cannot create tables");
+ fatal("%s: cannot create tables", __func__);
log_debug("%s: created %d tables", __func__, io.pfrio_nadd);
free(tables);
return;
toolong:
- fatal("init_tables: name too long");
+ fatal("%s: name too long", __func__);
}
void
sizeof(io.pfrio_table.pfrt_anchor)) >= PF_ANCHOR_NAME_SIZE)
goto toolong;
if (ioctl(env->sc_pf->dev, DIOCRCLRTABLES, &io) == -1)
- fatal("kill_tables: ioctl failed");
+ fatal("%s: ioctl failed", __func__);
cnt += io.pfrio_ndel;
}
log_debug("%s: deleted %d tables", __func__, cnt);
return;
toolong:
- fatal("kill_tables: name too long");
+ fatal("%s: name too long", __func__);
}
void
addlist[i].pfra_net = 128;
break;
default:
- fatalx("sync_table: unknown address family");
+ fatalx("%s: unknown address family", __func__);
break;
}
i++;
}
if (i != table->up)
- fatalx("sync_table: desynchronized");
+ fatalx("%s: desynchronized", __func__);
if (ioctl(env->sc_pf->dev, DIOCRSETADDRS, &io) == -1)
- fatal("sync_table: cannot set address list");
+ fatal("%s: cannot set address list", __func__);
if (rdr->conf.flags & F_STICKY)
cnt = kill_srcnodes(env, table);
free(addlist);
return;
toolong:
- fatal("sync_table: name too long");
+ fatal("%s: name too long", __func__);
}
int
sizeof(psnk.psnk_dst.addr.v.a.addr.v6));
break;
default:
- fatalx("kill_srcnodes: unknown address family");
+ fatalx("%s: unknown address family", __func__);
break;
}
if (ioctl(env->sc_pf->dev,
DIOCKILLSRCNODES, &psnk) == -1)
- fatal("kill_srcnodes: cannot kill src nodes");
+ fatal("%s: cannot kill src nodes", __func__);
cnt += psnk.psnk_killed;
}
sizeof(io.pfrio_table.pfrt_name))
goto toolong;
if (ioctl(env->sc_pf->dev, DIOCRCLRADDRS, &io) == -1)
- fatal("flush_table: cannot flush table addresses");
+ fatal("%s: cannot flush table addresses", __func__);
io.pfrio_esize = sizeof(io.pfrio_table);
io.pfrio_size = 1;
io.pfrio_buffer = &io.pfrio_table;
if (ioctl(env->sc_pf->dev, DIOCRCLRTSTATS, &io) == -1)
- fatal("flush_table: cannot flush table stats");
+ fatal("%s: cannot flush table stats", __func__);
log_debug("%s: flushed table %s", __func__, rdr->conf.name);
return;
toolong:
- fatal("flush_table: name too long");
+ fatal("%s: name too long", __func__);
}
int
rio.rule.rule_flag = PFRULE_STATESLOPPY;
break;
default:
- fatalx("sync_ruleset: invalid forward mode");
+ fatalx("%s: invalid forward mode", __func__);
/* NOTREACHED */
}
if (strlcpy(rio.rule.rdr.addr.v.tblname, rdr->conf.name,
sizeof(rio.rule.rdr.addr.v.tblname)) >=
sizeof(rio.rule.rdr.addr.v.tblname))
- fatal("sync_ruleset: table name too long");
+ fatal("%s: table name too long", __func__);
if (address->port.op == PF_OP_EQ ||
rdr->table->conf.flags & F_PORT) {
rio.rule.rdr.opts = PF_POOL_LEASTSTATES;
break;
default:
- fatalx("sync_ruleset: unsupported mode");
+ fatalx("%s: unsupported mode", __func__);
/* NOTREACHED */
}
if (rdr->conf.flags & F_STICKY)
return;
toolong:
- fatal("sync_ruleset: name too long");
+ fatal("%s: name too long", __func__);
}
void
return;
toolong:
- fatal("flush_rulesets: name too long");
+ fatal("%s: name too long", __func__);
}
int
bzero(&pnl, sizeof(pnl));
if ((pnl.af = cnl->src.ss_family) != cnl->dst.ss_family)
- fatalx("natlook: illegal address families");
+ fatalx("%s: illegal address families", __func__);
switch (pnl.af) {
case AF_INET:
in = (struct sockaddr_in *)&cnl->src;
goto toolong;
if (ioctl(env->sc_pf->dev, DIOCRGETTSTATS, &io) == -1)
- fatal("check_table: cannot get table stats");
+ fatal("%s: cannot get table stats", __func__);
return (tstats.pfrts_match);
toolong:
- fatal("check_table: name too long");
+ fatal("%s: name too long", __func__);
return (0);
}
blob - f7382ef514ca694bf9b9cf5ffea15e55b6ea12a1
blob + b968a340ec4631832f8cea0af131d7dfff689c65
--- pfe_route.c
+++ pfe_route.c
-/* $OpenBSD: pfe_route.c,v 1.11 2016/09/02 14:45:51 reyk Exp $ */
+/* $OpenBSD: pfe_route.c,v 1.12 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2009 - 2011 Reyk Floeter <reyk@openbsd.org>
return;
if ((env->sc_rtsock = socket(AF_ROUTE, SOCK_RAW, 0)) == -1)
- fatal("init_routes: failed to open routing socket");
+ fatal("%s: failed to open routing socket", __func__);
rtfilter = ROUTE_FILTER(0);
if (setsockopt(env->sc_rtsock, AF_ROUTE, ROUTE_MSGFILTER,
&rtfilter, sizeof(rtfilter)) == -1)
- fatal("init_routes: ROUTE_MSGFILTER");
+ fatal("%s: ROUTE_MSGFILTER", __func__);
}
void
} else if (crt->nr.prefixlen < 0)
rm.rm_hdr.rtm_flags |= RTF_HOST;
} else
- fatal("pfe_route: invalid address family");
+ fatal("%s: invalid address family", __func__);
retry:
if (write(env->sc_rtsock, &rm, len) == -1) {
blob - 3f135d3e360da351db94a03ca1fe7199e3ee8bb7
blob + 4577476b8af1298460f2532b787bfd7ea4509f11
--- proc.c
+++ proc.c
-/* $OpenBSD: proc.c,v 1.38 2017/01/09 14:49:21 reyk Exp $ */
+/* $OpenBSD: proc.c,v 1.39 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
proc_setup(ps, procs, nproc);
/*
- * Create the children sockets so we can use them
+ * Create the children sockets so we can use them
* to distribute the rest of the socketpair()s using
* proc_connect() later.
*/
/* ignore */
break;
default:
- fatalx("proc_sig_handler: unexpected signal");
+ fatalx("%s: unexpected signal", __func__);
/* NOTREACHED */
}
}
root = pw->pw_dir;
if (chroot(root) == -1)
- fatal("proc_run: chroot");
+ fatal("%s: chroot", __func__);
if (chdir("/") == -1)
- fatal("proc_run: chdir(\"/\")");
+ fatal("%s: chdir(\"/\")", __func__);
privsep_process = p->p_id;
if (setgroups(1, &pw->pw_gid) ||
setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) ||
setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid))
- fatal("proc_run: cannot drop privileges");
+ fatal("%s: cannot drop privileges", __func__);
event_init();
blob - 4b36e4a8a31402f6b8b803fafbf48e699663d943
blob + c6ff55446ade826a8b604e1db1cfedcb71c83560
--- relay.c
+++ relay.c
-/* $OpenBSD: relay.c,v 1.220 2017/05/27 08:33:25 claudio Exp $ */
+/* $OpenBSD: relay.c,v 1.221 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
TAILQ_FOREACH(rlay, env->sc_relays, rl_entry) {
if ((rlay->rl_conf.flags & (F_TLS|F_TLSCLIENT)) &&
relay_tls_ctx_create(rlay) == -1)
- fatalx("relay_launch: failed to create TLS context");
+ fatalx("%s: failed to create TLS context", __func__);
TAILQ_FOREACH(rlt, &rlay->rl_tables, rlt_entry) {
/*
rlt->rlt_nhosts = 0;
TAILQ_FOREACH(host, &rlt->rlt_table->hosts, entry) {
if (rlt->rlt_nhosts >= RELAY_MAXHOSTS)
- fatal("relay_init: "
- "too many hosts in table");
+ fatal("%s: too many hosts in table",
+ __func__);
host->idx = rlt->rlt_nhosts;
rlt->rlt_host[rlt->rlt_nhosts++] = host;
}
/* Use defaults */
break;
default:
- fatalx("relay_connected: unknown protocol");
+ fatalx("%s: unknown protocol", __func__);
}
/*
evbuffer_free(bev->output);
bev->output = con->se_out.output;
if (bev->output == NULL)
- fatal("relay_connected: invalid output buffer");
+ fatal("%s: invalid output buffer", __func__);
con->se_out.bev = bev;
/* Initialize the TLS wrapper */
/* Use defaults */
break;
default:
- fatalx("relay_input: unknown protocol");
+ fatalx("%s: unknown protocol", __func__);
}
/*
rlay->rl_conf.port);
break;
default:
- fatalx("relay_from_table: unsupported mode");
+ fatalx("%s: unsupported mode", __func__);
/* NOTREACHED */
}
if (idx == -1) {
}
/* Should not happen */
- fatalx("relay_from_table: no active hosts, desynchronized");
+ fatalx("%s: no active hosts, desynchronized", __func__);
found:
if (rlt->rlt_mode == RELAY_DSTMODE_ROUNDROBIN)
int bnds = -1;
if (relay_inflight < 1) {
- log_warnx("relay_connect_retry: no connection in flight");
+ log_warnx("%s: no connection in flight", __func__);
relay_inflight = 1;
}
con->se_retrycount, con->se_retry, relay_inflight);
if (sig != EV_TIMEOUT)
- fatalx("relay_connect_retry: called without timeout");
+ fatalx("%s: called without timeout", __func__);
evtimer_del(&con->se_inflightevt);
case IMSG_HOST_DISABLE:
memcpy(&id, imsg->data, sizeof(id));
if ((host = host_find(env, id)) == NULL)
- fatalx("relay_dispatch_pfe: desynchronized");
+ fatalx("%s: desynchronized", __func__);
if ((table = table_find(env, host->conf.tableid)) ==
NULL)
- fatalx("relay_dispatch_pfe: invalid table id");
+ fatalx("%s: invalid table id", __func__);
if (host->up == HOST_UP)
table->up--;
host->flags |= F_DISABLE;
case IMSG_HOST_ENABLE:
memcpy(&id, imsg->data, sizeof(id));
if ((host = host_find(env, id)) == NULL)
- fatalx("relay_dispatch_pfe: desynchronized");
+ fatalx("%s: desynchronized", __func__);
host->flags &= ~(F_DISABLE);
host->up = HOST_UNKNOWN;
break;
case IMSG_TABLE_DISABLE:
memcpy(&id, imsg->data, sizeof(id));
if ((table = table_find(env, id)) == NULL)
- fatalx("relay_dispatch_pfe: desynchronized");
+ fatalx("%s: desynchronized", __func__);
table->conf.flags |= F_DISABLE;
table->up = 0;
TAILQ_FOREACH(host, &table->hosts, entry)
case IMSG_TABLE_ENABLE:
memcpy(&id, imsg->data, sizeof(id));
if ((table = table_find(env, id)) == NULL)
- fatalx("relay_dispatch_pfe: desynchronized");
+ fatalx("%s: desynchronized", __func__);
table->conf.flags &= ~(F_DISABLE);
table->up = 0;
TAILQ_FOREACH(host, &table->hosts, entry)
IMSG_SIZE_CHECK(imsg, &st);
memcpy(&st, imsg->data, sizeof(st));
if ((host = host_find(env, st.id)) == NULL)
- fatalx("relay_dispatch_pfe: invalid host id");
+ fatalx("%s: invalid host id", __func__);
if (host->flags & F_DISABLE)
break;
if (host->up == st.up) {
log_debug("%s: host %d => %d", __func__,
host->conf.id, host->up);
- fatalx("relay_dispatch_pfe: desynchronized");
+ fatalx("%s: desynchronized", __func__);
}
if ((table = table_find(env, host->conf.tableid))
== NULL)
- fatalx("relay_dispatch_pfe: invalid table id");
+ fatalx("%s: invalid table id", __func__);
DPRINTF("%s: [%d] state %d for "
"host %u %s", __func__, p->p_ps->ps_instance, st.up,
/*
* This function is not publicy exported because it is a hack until libtls
- * has a proper privsep setup
+ * has a proper privsep setup
*/
void tls_config_skip_private_key_check(struct tls_config *config);
blob - 7141fcf4bcc816d341481e2bae7df0794015f672
blob + 90ad49d63c763af4fc5f9c70f2553ce66764f601
--- relay_http.c
+++ relay_http.c
-/* $OpenBSD: relay_http.c,v 1.65 2017/05/27 08:33:25 claudio Exp $ */
+/* $OpenBSD: relay_http.c,v 1.66 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2006 - 2016 Reyk Floeter <reyk@openbsd.org>
/* perform this later */
break;
default:
- fatalx("relay_action: invalid action");
+ fatalx("%s: invalid action", __func__);
/* NOTREACHED */
}
blob - 2589e51de797e41ad689b69f15a5a1c1a5c91c06
blob + 1410baf7f0f38bbb90b4fa5485f8094663f9172c
--- relay_udp.c
+++ relay_udp.c
-/* $OpenBSD: relay_udp.c,v 1.45 2017/01/09 14:49:21 reyk Exp $ */
+/* $OpenBSD: relay_udp.c,v 1.46 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2007 - 2013 Reyk Floeter <reyk@openbsd.org>
socklen_t slen;
if (priv == NULL)
- fatalx("relay_dns_result: response to invalid session");
+ fatalx("%s: response to invalid session", __func__);
if (log_getverbose() > 1)
relay_dns_log(con, buf, len);
struct relay_dns_priv *bp = b->se_priv;
if (ap == NULL || bp == NULL)
- fatalx("relay_dns_cmp: invalid session");
+ fatalx("%s: invalid session", __func__);
return (memcmp(&ap->dp_inkey, &bp->dp_inkey, sizeof(u_int16_t)));
}
blob - e3b443eb42d86a649e880c4c7a0acb4ab4ffd799
blob + a6472af10b765e44aaf5576bc3d51723dd864cea
--- relayd.c
+++ relayd.c
-/* $OpenBSD: relayd.c,v 1.167 2017/05/27 08:33:25 claudio Exp $ */
+/* $OpenBSD: relayd.c,v 1.168 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2007 - 2016 Reyk Floeter <reyk@openbsd.org>
IMSG_SIZE_CHECK(imsg, &bnd);
bcopy(imsg->data, &bnd, sizeof(bnd));
if (bnd.bnd_proc > env->sc_conf.prefork_relay)
- fatalx("pfe_dispatch_relay: "
- "invalid relay proc");
+ fatalx("%s: invalid relay proc", __func__);
switch (bnd.bnd_proto) {
case IPPROTO_TCP:
case IPPROTO_UDP:
break;
default:
- fatalx("pfe_dispatch_relay: requested socket "
- "for invalid protocol");
+ fatalx("%s: requested socket "
+ "for invalid protocol", __func__);
/* NOTREACHED */
}
s = bindany(&bnd);
if (strlcpy(ca_pkey->pkey_hash, hash, sizeof(ca_pkey->pkey_hash)) >=
sizeof(ca_pkey->pkey_hash))
return (NULL);
-
+
TAILQ_INSERT_TAIL(env->sc_pkeys, ca_pkey, pkey_entry);
return (ca_pkey);
struct rlimit rl;
if (getrlimit(RLIMIT_NOFILE, &rl) == -1)
- fatal("socket_rlimit: failed to get resource limit");
+ fatal("%s: failed to get resource limit", __func__);
log_debug("%s: max open files %llu", __func__, rl.rlim_max);
/*
else
rl.rlim_cur = MAXIMUM(rl.rlim_max, (rlim_t)maxfd);
if (setrlimit(RLIMIT_NOFILE, &rl) == -1)
- fatal("socket_rlimit: failed to set resource limit");
+ fatal("%s: failed to set resource limit", __func__);
}
char *
struct timeval tv;
struct relay_ticket_key key;
- log_debug("relayd_tls_ticket_rekey: rekeying tickets");
+ log_debug("%s: rekeying tickets", __func__);
key.tt_keyrev = arc4random();
arc4random_buf(key.tt_key, sizeof(key.tt_key));
blob - 719f470a00265d9fb86eaff6b0671f49ff3ffc21
blob + 54618ca1a4177e89985f47a0ec576e7174557c66
--- snmp.c
+++ snmp.c
-/* $OpenBSD: snmp.c,v 1.28 2016/09/02 16:14:09 reyk Exp $ */
+/* $OpenBSD: snmp.c,v 1.29 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2008 - 2014 Reyk Floeter <reyk@openbsd.org>
log_debug("%s: got new snmp socket %d", __func__, imsg->fd);
if ((snmp_agentx = snmp_agentx_alloc(env->sc_snmp)) == NULL)
- fatal("snmp_getsock: agentx alloc");
+ fatal("%s: agentx alloc", __func__);
if ((pdu = snmp_agentx_open_pdu(snmp_agentx, "relayd", NULL)) == NULL)
- fatal("snmp_getsock: agentx pdu");
+ fatal("%s: agentx pdu", __func__);
(void)snmp_agentx_send(snmp_agentx, pdu);
snmp_event_add(env, EV_WRITE);
blob - 1ff423f58661b29f728944756423f6751b7567c1
blob + cf576fbb359107045bbe7d2dd00e8f3d3fa42f22
--- ssl.c
+++ ssl.c
-/* $OpenBSD: ssl.c,v 1.32 2017/05/27 08:33:25 claudio Exp $ */
+/* $OpenBSD: ssl.c,v 1.33 2017/05/28 10:39:15 benno Exp $ */
/*
* Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
uint8_t *newcert = NULL, *foo = NULL;
/* XXX BIO_new_mem_buf is not using const so work around this */
- if ((foo = malloc(oldlen)) == NULL) {
+ if ((foo = malloc(oldlen)) == NULL) {
log_warn("%s: malloc", __func__);
return (NULL);
}
EVP_PKEY_free(pkey);
if (x509 != NULL)
X509_free(x509);
-
+
return (ret);
}