summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorRenato Westphal <renato@cvs.openbsd.org>2016-05-23 15:14:09 +0000
committerRenato Westphal <renato@cvs.openbsd.org>2016-05-23 15:14:09 +0000
commit3933df1e77dc6104250a7c08c4122a3d5e5c0803 (patch)
tree4aae165bc5ce5f1a13c936b055dee3f59bf98c2a /usr.sbin
parent0c5809174c6ffe7db6d6fd8fb53a0d2acdd81a67 (diff)
Replace manually written function names with __func__.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ldpd/accept.c12
-rw-r--r--usr.sbin/ldpd/address.c10
-rw-r--r--usr.sbin/ldpd/adjacency.c22
-rw-r--r--usr.sbin/ldpd/control.c24
-rw-r--r--usr.sbin/ldpd/hello.c24
-rw-r--r--usr.sbin/ldpd/init.c8
-rw-r--r--usr.sbin/ldpd/interface.c43
-rw-r--r--usr.sbin/ldpd/keepalive.c4
-rw-r--r--usr.sbin/ldpd/kroute.c60
-rw-r--r--usr.sbin/ldpd/labelmapping.c4
-rw-r--r--usr.sbin/ldpd/lde.c52
-rw-r--r--usr.sbin/ldpd/lde_lib.c12
-rw-r--r--usr.sbin/ldpd/ldpd.c12
-rw-r--r--usr.sbin/ldpd/ldpe.c6
-rw-r--r--usr.sbin/ldpd/log.c6
-rw-r--r--usr.sbin/ldpd/neighbor.c57
-rw-r--r--usr.sbin/ldpd/notification.c6
-rw-r--r--usr.sbin/ldpd/packet.c34
18 files changed, 195 insertions, 201 deletions
diff --git a/usr.sbin/ldpd/accept.c b/usr.sbin/ldpd/accept.c
index d1f660830ec..a117c1dc709 100644
--- a/usr.sbin/ldpd/accept.c
+++ b/usr.sbin/ldpd/accept.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: accept.c,v 1.3 2013/10/31 16:56:22 deraadt Exp $ */
+/* $OpenBSD: accept.c,v 1.4 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2012 Claudio Jeker <claudio@openbsd.org>
@@ -65,7 +65,7 @@ accept_add(int fd, void (*cb)(int, short, void *), void *arg)
event_set(&av->ev, av->fd, EV_READ, accept_cb, av);
event_add(&av->ev, NULL);
- log_debug("accept_add: accepting on fd %d", fd);
+ log_debug("%s: accepting on fd %d", __func__, fd);
return (0);
}
@@ -77,7 +77,7 @@ accept_del(int fd)
LIST_FOREACH(av, &accept_queue.queue, entry)
if (av->fd == fd) {
- log_debug("accept_del: %d removed from queue", fd);
+ log_debug("%s: %d removed from queue", __func__, fd);
event_del(&av->ev);
LIST_REMOVE(av, entry);
free(av);
@@ -90,7 +90,7 @@ accept_pause(void)
{
struct timeval evtpause = { 1, 0 };
- log_debug("accept_pause");
+ log_debug(__func__);
accept_unarm();
evtimer_add(&accept_queue.evt, &evtpause);
}
@@ -99,7 +99,7 @@ void
accept_unpause(void)
{
if (evtimer_pending(&accept_queue.evt, NULL)) {
- log_debug("accept_unpause");
+ log_debug(__func__);
evtimer_del(&accept_queue.evt);
accept_arm();
}
@@ -132,6 +132,6 @@ accept_cb(int fd, short event, void *arg)
void
accept_timeout(int fd, short event, void *bula)
{
- log_debug("accept_timeout");
+ log_debug(__func__);
accept_arm();
}
diff --git a/usr.sbin/ldpd/address.c b/usr.sbin/ldpd/address.c
index 50bcd1756a6..9067f102ed3 100644
--- a/usr.sbin/ldpd/address.c
+++ b/usr.sbin/ldpd/address.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: address.c,v 1.17 2015/07/21 04:52:29 renato Exp $ */
+/* $OpenBSD: address.c,v 1.18 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -46,10 +46,10 @@ send_address(struct nbr *nbr, struct if_addr *if_addr)
struct ibuf *buf;
u_int16_t size, iface_count = 0;
- log_debug("send_address: neighbor ID %s", inet_ntoa(nbr->id));
+ log_debug("%s: neighbor ID %s", __func__, inet_ntoa(nbr->id));
if ((buf = ibuf_open(LDP_MAX_LEN)) == NULL)
- fatal("send_address");
+ fatal(__func__);
if (if_addr == NULL)
LIST_FOREACH(if_addr, &leconf->addr_list, entry)
@@ -165,10 +165,10 @@ send_address_withdraw(struct nbr *nbr, struct if_addr *if_addr)
struct ibuf *buf;
u_int16_t size;
- log_debug("send_address_withdraw: neighbor ID %s", inet_ntoa(nbr->id));
+ log_debug("%s: neighbor ID %s", __func__, inet_ntoa(nbr->id));
if ((buf = ibuf_open(LDP_MAX_LEN)) == NULL)
- fatal("send_address_withdraw");
+ fatal(__func__);
size = LDP_HDR_SIZE + sizeof(struct ldp_msg) +
sizeof(struct address_list_tlv) + sizeof(struct in_addr);
diff --git a/usr.sbin/ldpd/adjacency.c b/usr.sbin/ldpd/adjacency.c
index da6b429897f..a95aa60135d 100644
--- a/usr.sbin/ldpd/adjacency.c
+++ b/usr.sbin/ldpd/adjacency.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adjacency.c,v 1.7 2015/07/21 04:52:29 renato Exp $ */
+/* $OpenBSD: adjacency.c,v 1.8 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -45,11 +45,11 @@ adj_new(struct nbr *nbr, struct hello_source *source, struct in_addr addr)
{
struct adj *adj;
- log_debug("adj_new: LSR ID %s, %s", inet_ntoa(nbr->id),
+ log_debug("%s: LSR ID %s, %s", __func__, inet_ntoa(nbr->id),
print_hello_src(source));
if ((adj = calloc(1, sizeof(*adj))) == NULL)
- fatal("adj_new");
+ fatal(__func__);
adj->nbr = nbr;
memcpy(&adj->source, source, sizeof(*source));
@@ -75,7 +75,7 @@ adj_new(struct nbr *nbr, struct hello_source *source, struct in_addr addr)
void
adj_del(struct adj *adj)
{
- log_debug("adj_del: LSR ID %s, %s", inet_ntoa(adj->nbr->id),
+ log_debug("%s: LSR ID %s, %s", __func__, inet_ntoa(adj->nbr->id),
print_hello_src(&adj->source));
adj_stop_itimer(adj);
@@ -141,7 +141,7 @@ adj_itimer(int fd, short event, void *arg)
{
struct adj *adj = arg;
- log_debug("adj_itimer: LDP ID %s", inet_ntoa(adj->nbr->id));
+ log_debug("%s: LDP ID %s", __func__, inet_ntoa(adj->nbr->id));
switch (adj->source.type) {
case HELLO_LINK:
@@ -171,7 +171,7 @@ adj_start_itimer(struct adj *adj)
tv.tv_sec = adj->holdtime;
if (evtimer_add(&adj->inactivity_timer, &tv) == -1)
- fatal("adj_start_itimer");
+ fatal(__func__);
}
void
@@ -179,7 +179,7 @@ adj_stop_itimer(struct adj *adj)
{
if (evtimer_pending(&adj->inactivity_timer, NULL) &&
evtimer_del(&adj->inactivity_timer) == -1)
- fatal("adj_stop_itimer");
+ fatal(__func__);
}
/* targeted neighbors */
@@ -190,7 +190,7 @@ tnbr_new(struct ldpd_conf *xconf, struct in_addr addr)
struct tnbr *tnbr;
if ((tnbr = calloc(1, sizeof(*tnbr))) == NULL)
- fatal("tnbr_new");
+ fatal(__func__);
tnbr->addr.s_addr = addr.s_addr;
tnbr->hello_holdtime = xconf->thello_holdtime;
@@ -258,7 +258,7 @@ tnbr_hello_timer(int fd, short event, void *arg)
timerclear(&tv);
tv.tv_sec = tnbr->hello_interval;
if (evtimer_add(&tnbr->hello_timer, &tv) == -1)
- fatal("tnbr_hello_timer");
+ fatal(__func__);
}
void
@@ -271,7 +271,7 @@ tnbr_start_hello_timer(struct tnbr *tnbr)
timerclear(&tv);
tv.tv_sec = tnbr->hello_interval;
if (evtimer_add(&tnbr->hello_timer, &tv) == -1)
- fatal("tnbr_start_hello_timer");
+ fatal(__func__);
}
void
@@ -279,7 +279,7 @@ tnbr_stop_hello_timer(struct tnbr *tnbr)
{
if (evtimer_pending(&tnbr->hello_timer, NULL) &&
evtimer_del(&tnbr->hello_timer) == -1)
- fatal("tnbr_stop_hello_timer");
+ fatal(__func__);
}
struct ctl_adj *
diff --git a/usr.sbin/ldpd/control.c b/usr.sbin/ldpd/control.c
index 85e9fba7050..b6929be0e87 100644
--- a/usr.sbin/ldpd/control.c
+++ b/usr.sbin/ldpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.20 2016/05/23 14:57:45 renato Exp $ */
+/* $OpenBSD: control.c,v 1.21 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -49,7 +49,7 @@ control_init(void)
if ((fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK,
0)) == -1) {
- log_warn("control_init: socket");
+ log_warn("%s: socket", __func__);
return (-1);
}
@@ -59,14 +59,14 @@ control_init(void)
if (unlink(LDPD_SOCKET) == -1)
if (errno != ENOENT) {
- log_warn("control_init: unlink %s", LDPD_SOCKET);
+ log_warn("%s: unlink %s", __func__, LDPD_SOCKET);
close(fd);
return (-1);
}
old_umask = umask(S_IXUSR|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH);
if (bind(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) {
- log_warn("control_init: bind: %s", LDPD_SOCKET);
+ log_warn("%s: bind: %s", __func__, LDPD_SOCKET);
close(fd);
umask(old_umask);
return (-1);
@@ -74,7 +74,7 @@ control_init(void)
umask(old_umask);
if (chmod(LDPD_SOCKET, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) == -1) {
- log_warn("control_init: chmod");
+ log_warn("%s: chmod", __func__);
close(fd);
(void)unlink(LDPD_SOCKET);
return (-1);
@@ -90,7 +90,7 @@ control_listen(void)
{
if (listen(control_fd, CONTROL_BACKLOG) == -1) {
- log_warn("control_listen: listen");
+ log_warn("%s: listen", __func__);
return (-1);
}
@@ -125,12 +125,12 @@ control_accept(int listenfd, short event, void *bula)
accept_pause();
else if (errno != EWOULDBLOCK && errno != EINTR &&
errno != ECONNABORTED)
- log_warn("control_accept: accept");
+ log_warn("%s: accept", __func__);
return;
}
if ((c = calloc(1, sizeof(struct ctl_conn))) == NULL) {
- log_warn("control_accept");
+ log_warn(__func__);
close(connfd);
return;
}
@@ -175,7 +175,7 @@ control_close(int fd)
struct ctl_conn *c;
if ((c = control_connbyfd(fd)) == NULL) {
- log_warn("control_close: fd %d: not found", fd);
+ log_warn("%s: fd %d: not found", __func__, fd);
return;
}
@@ -199,7 +199,7 @@ control_dispatch_imsg(int fd, short event, void *bula)
int verbose;
if ((c = control_connbyfd(fd)) == NULL) {
- log_warn("control_dispatch_imsg: fd %d: not found", fd);
+ log_warn("%s: fd %d: not found", __func__, fd);
return;
}
@@ -278,8 +278,8 @@ control_dispatch_imsg(int fd, short event, void *bula)
log_verbose(verbose);
break;
default:
- log_debug("control_dispatch_imsg: "
- "error handling imsg %d", imsg.hdr.type);
+ log_debug("%s: error handling imsg %d", __func__,
+ imsg.hdr.type);
break;
}
imsg_free(&imsg);
diff --git a/usr.sbin/ldpd/hello.c b/usr.sbin/ldpd/hello.c
index 1ef5b19fde3..4d580e83b31 100644
--- a/usr.sbin/ldpd/hello.c
+++ b/usr.sbin/ldpd/hello.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hello.c,v 1.28 2015/07/21 04:52:29 renato Exp $ */
+/* $OpenBSD: hello.c,v 1.29 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -73,7 +73,7 @@ send_hello(enum hello_type type, struct iface *iface, struct tnbr *tnbr)
}
if ((buf = ibuf_open(LDP_MAX_LEN)) == NULL)
- fatal("send_hello");
+ fatal(__func__);
size = LDP_HDR_SIZE + sizeof(struct ldp_msg) +
sizeof(struct hello_prms_tlv) +
@@ -121,7 +121,7 @@ recv_hello(struct iface *iface, struct in_addr src, char *buf, u_int16_t len)
r = tlv_decode_hello_prms(buf, len, &holdtime, &flags);
if (r == -1) {
- log_debug("recv_hello: neighbor %s: failed to decode params",
+ log_debug("%s: neighbor %s: failed to decode params", __func__,
inet_ntoa(lsr_id));
return;
}
@@ -152,9 +152,8 @@ recv_hello(struct iface *iface, struct in_addr src, char *buf, u_int16_t len)
source.target = tnbr;
} else {
if (ldp.lspace_id != 0) {
- log_debug("recv_hello: invalid label space "
- "ID %u, interface %s", ldp.lspace_id,
- iface->name);
+ log_debug("%s: invalid label space ID %u, interface %s",
+ __func__, ldp.lspace_id, iface->name);
return;
}
source.type = HELLO_LINK;
@@ -168,16 +167,16 @@ recv_hello(struct iface *iface, struct in_addr src, char *buf, u_int16_t len)
r = tlv_decode_opt_hello_prms(buf, len, &transport_addr,
&conf_number);
if (r == -1) {
- log_debug("recv_hello: neighbor %s: failed to decode "
- "optional params", inet_ntoa(lsr_id));
+ log_debug("%s: neighbor %s: failed to decode optional params",
+ __func__, inet_ntoa(lsr_id));
return;
}
if (transport_addr.s_addr == INADDR_ANY)
transport_addr.s_addr = src.s_addr;
if (r != len) {
- log_debug("recv_hello: neighbor %s: unexpected data in message",
- inet_ntoa(lsr_id));
+ log_debug("%s: neighbor %s: unexpected data in message",
+ __func__, inet_ntoa(lsr_id));
return;
}
@@ -193,9 +192,10 @@ recv_hello(struct iface *iface, struct in_addr src, char *buf, u_int16_t len)
adj = adj_new(nbr, &source, transport_addr);
if (nbr->addr.s_addr != transport_addr.s_addr)
- log_warnx("recv_hello: neighbor %s: multiple "
+ log_warnx("%s: neighbor %s: multiple "
"adjacencies advertising different "
- "transport addresses", inet_ntoa(lsr_id));
+ "transport addresses", __func__,
+ inet_ntoa(lsr_id));
}
}
diff --git a/usr.sbin/ldpd/init.c b/usr.sbin/ldpd/init.c
index 906da3595ff..b888d8be954 100644
--- a/usr.sbin/ldpd/init.c
+++ b/usr.sbin/ldpd/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.15 2014/10/25 03:23:49 lteo Exp $ */
+/* $OpenBSD: init.c,v 1.16 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -47,10 +47,10 @@ send_init(struct nbr *nbr)
struct ibuf *buf;
u_int16_t size;
- log_debug("send_init: neighbor ID %s", inet_ntoa(nbr->id));
+ log_debug("%s: neighbor ID %s", __func__, inet_ntoa(nbr->id));
if ((buf = ibuf_open(LDP_MAX_LEN)) == NULL)
- fatal("send_init");
+ fatal(__func__);
size = LDP_HDR_SIZE + sizeof(struct ldp_msg) + SESS_PRMS_SIZE;
@@ -73,7 +73,7 @@ recv_init(struct nbr *nbr, char *buf, u_int16_t len)
struct ldp_msg init;
struct sess_prms_tlv sess;
- log_debug("recv_init: neighbor ID %s", inet_ntoa(nbr->id));
+ log_debug("%s: neighbor ID %s", __func__, inet_ntoa(nbr->id));
bcopy(buf, &init, sizeof(init));
diff --git a/usr.sbin/ldpd/interface.c b/usr.sbin/ldpd/interface.c
index f30c073b96c..abaf4e93573 100644
--- a/usr.sbin/ldpd/interface.c
+++ b/usr.sbin/ldpd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.26 2015/09/27 17:30:38 stsp Exp $ */
+/* $OpenBSD: interface.c,v 1.27 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -84,7 +84,7 @@ if_del(struct iface *iface)
if (iface->state == IF_STA_ACTIVE)
if_reset(iface);
- log_debug("if_del: interface %s", iface->name);
+ log_debug("%s: interface %s", __func__, iface->name);
while ((if_addr = LIST_FIRST(&iface->addr_list)) != NULL) {
LIST_REMOVE(if_addr, entry);
@@ -121,7 +121,7 @@ if_addr_new(struct kaddr *kaddr)
struct if_addr *if_addr;
if ((if_addr = calloc(1, sizeof(*if_addr))) == NULL)
- fatal("if_addr_new");
+ fatal(__func__);
if_addr->addr.s_addr = kaddr->addr.s_addr;
if_addr->mask.s_addr = kaddr->mask.s_addr;
@@ -158,7 +158,7 @@ if_hello_timer(int fd, short event, void *arg)
timerclear(&tv);
tv.tv_sec = iface->hello_interval;
if (evtimer_add(&iface->hello_timer, &tv) == -1)
- fatal("if_hello_timer");
+ fatal(__func__);
}
void
@@ -171,7 +171,7 @@ if_start_hello_timer(struct iface *iface)
timerclear(&tv);
tv.tv_sec = iface->hello_interval;
if (evtimer_add(&iface->hello_timer, &tv) == -1)
- fatal("if_start_hello_timer");
+ fatal(__func__);
}
void
@@ -179,7 +179,7 @@ if_stop_hello_timer(struct iface *iface)
{
if (evtimer_pending(&iface->hello_timer, NULL) &&
evtimer_del(&iface->hello_timer) == -1)
- fatal("if_stop_hello_timer");
+ fatal(__func__);
}
int
@@ -188,7 +188,7 @@ if_start(struct iface *iface)
struct in_addr addr;
struct timeval now;
- log_debug("if_start: %s", iface->name);
+ log_debug("%s: %s", __func__, iface->name);
gettimeofday(&now, NULL);
iface->uptime = now.tv_sec;
@@ -208,7 +208,7 @@ if_reset(struct iface *iface)
struct in_addr addr;
struct adj *adj;
- log_debug("if_reset: %s", iface->name);
+ log_debug("%s: %s", __func__, iface->name);
while ((adj = LIST_FIRST(&iface->adj_list)) != NULL) {
LIST_REMOVE(adj, iface_entry);
@@ -287,8 +287,8 @@ if_set_mcast_ttl(int fd, u_int8_t ttl)
{
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL,
(char *)&ttl, sizeof(ttl)) < 0) {
- log_warn("if_set_mcast_ttl: error setting "
- "IP_MULTICAST_TTL to %d", ttl);
+ log_warn("%s: error setting IP_MULTICAST_TTL to %d",
+ __func__, ttl);
return (-1);
}
@@ -299,7 +299,7 @@ int
if_set_tos(int fd, int tos)
{
if (setsockopt(fd, IPPROTO_IP, IP_TOS, (int *)&tos, sizeof(tos)) < 0) {
- log_warn("if_set_tos: error setting IP_TOS to 0x%x", tos);
+ log_warn("%s: error setting IP_TOS to 0x%x", __func__, tos);
return (-1);
}
@@ -311,7 +311,7 @@ if_set_recvif(int fd, int enable)
{
if (setsockopt(fd, IPPROTO_IP, IP_RECVIF, &enable,
sizeof(enable)) < 0) {
- log_warn("if_set_recvif: error setting IP_RECVIF");
+ log_warn("%s: error setting IP_RECVIF", __func__);
return (-1);
}
return (0);
@@ -333,7 +333,7 @@ if_set_reuse(int fd, int enable)
{
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &enable,
sizeof(int)) < 0) {
- log_warn("if_set_reuse: error setting SO_REUSEADDR");
+ log_warn("%s: error setting SO_REUSEADDR", __func__);
return (-1);
}
@@ -366,7 +366,7 @@ if_join_group(struct iface *iface, struct in_addr *addr)
break;
if (ifg == NULL) {
if ((ifg = calloc(1, sizeof(*ifg))) == NULL)
- fatal("if_join_group");
+ fatal(__func__);
ifg->addr.s_addr = addr->s_addr;
ifg->ifindex = iface->ifindex;
LIST_INSERT_HEAD(&ifglist, ifg, entry);
@@ -382,8 +382,8 @@ if_join_group(struct iface *iface, struct in_addr *addr)
if (setsockopt(iface->discovery_fd, IPPROTO_IP,
IP_ADD_MEMBERSHIP, (void *)&mreq, sizeof(mreq)) < 0) {
- log_warn("if_join_group: error IP_ADD_MEMBERSHIP, "
- "interface %s address %s", iface->name,
+ log_warn("%s: error IP_ADD_MEMBERSHIP, "
+ "interface %s address %s", __func__, iface->name,
inet_ntoa(*addr));
LIST_REMOVE(ifg, entry);
free(ifg);
@@ -423,9 +423,8 @@ if_leave_group(struct iface *iface, struct in_addr *addr)
if (setsockopt(iface->discovery_fd, IPPROTO_IP,
IP_DROP_MEMBERSHIP, (void *)&mreq, sizeof(mreq)) < 0) {
- log_warn("if_leave_group: error IP_DROP_MEMBERSHIP, "
- "interface %s address %s", iface->name,
- inet_ntoa(*addr));
+ log_warn("%s: error IP_DROP_MEMBERSHIP, interface %s "
+ "address %s", __func__, iface->name, inet_ntoa(*addr));
return (-1);
}
@@ -441,8 +440,8 @@ if_set_mcast(struct iface *iface)
if (setsockopt(iface->discovery_fd, IPPROTO_IP, IP_MULTICAST_IF,
&if_addr->addr.s_addr, sizeof(if_addr->addr.s_addr)) < 0) {
- log_debug("if_set_mcast: error setting "
- "IP_MULTICAST_IF, interface %s", iface->name);
+ log_debug("%s: error setting IP_MULTICAST_IF, interface %s",
+ __func__, iface->name);
return (-1);
}
@@ -456,7 +455,7 @@ if_set_mcast_loop(int fd)
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
(char *)&loop, sizeof(loop)) < 0) {
- log_warn("if_set_mcast_loop: error setting IP_MULTICAST_LOOP");
+ log_warn("%s: error setting IP_MULTICAST_LOOP", __func__);
return (-1);
}
diff --git a/usr.sbin/ldpd/keepalive.c b/usr.sbin/ldpd/keepalive.c
index 5d19b8fe264..e22937a5a9b 100644
--- a/usr.sbin/ldpd/keepalive.c
+++ b/usr.sbin/ldpd/keepalive.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keepalive.c,v 1.12 2014/10/25 03:23:49 lteo Exp $ */
+/* $OpenBSD: keepalive.c,v 1.13 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -43,7 +43,7 @@ send_keepalive(struct nbr *nbr)
u_int16_t size;
if ((buf = ibuf_open(LDP_MAX_LEN)) == NULL)
- fatal("send_keepalive");
+ fatal(__func__);
size = LDP_HDR_SIZE + sizeof(struct ldp_msg);
diff --git a/usr.sbin/ldpd/kroute.c b/usr.sbin/ldpd/kroute.c
index cdff6bab1fb..47993c40942 100644
--- a/usr.sbin/ldpd/kroute.c
+++ b/usr.sbin/ldpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.47 2015/09/27 17:30:38 stsp Exp $ */
+/* $OpenBSD: kroute.c,v 1.48 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -169,14 +169,14 @@ kr_init(int fs)
if ((kr_state.fd = socket(AF_ROUTE,
SOCK_RAW | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)) == -1) {
- log_warn("kr_init: socket");
+ log_warn("%s: socket", __func__);
return (-1);
}
/* not interested in my own messages */
if (setsockopt(kr_state.fd, SOL_SOCKET, SO_USELOOPBACK,
&opt, sizeof(opt)) == -1)
- log_warn("kr_init: setsockopt(SO_USELOOPBACK)");
+ log_warn("%s: setsockopt(SO_USELOOPBACK)", __func__);
/* filter out unwanted messages */
rtfilter = ROUTE_FILTER(RTM_ADD) | ROUTE_FILTER(RTM_GET) |
@@ -186,13 +186,13 @@ kr_init(int fs)
if (setsockopt(kr_state.fd, PF_ROUTE, ROUTE_MSGFILTER,
&rtfilter, sizeof(rtfilter)) == -1)
- log_warn("kr_init: setsockopt(ROUTE_MSGFILTER)");
+ log_warn("%s: setsockopt(ROUTE_MSGFILTER)", __func__);
/* grow receive buffer, don't wanna miss messages */
optlen = sizeof(default_rcvbuf);
if (getsockopt(kr_state.fd, SOL_SOCKET, SO_RCVBUF,
&default_rcvbuf, &optlen) == -1)
- log_warn("kr_init getsockopt SOL_SOCKET SO_RCVBUF");
+ log_warn("%s: getsockopt SOL_SOCKET SO_RCVBUF", __func__);
else
for (rcvbuf = MAX_RTSOCK_BUF;
rcvbuf > default_rcvbuf &&
@@ -213,7 +213,7 @@ kr_init(int fs)
if ((kr_state.ioctl_fd = socket(AF_INET,
SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)) == -1) {
- log_warn("kr_init: ioctl socket");
+ log_warn("%s: ioctl socket", __func__);
return (-1);
}
@@ -230,7 +230,7 @@ kr_change(struct kroute *kroute)
kn = kroute_find_gw(kroute->prefix.s_addr, kroute->prefixlen,
RTP_ANY, kroute->nexthop);
if (kn == NULL) {
- log_warnx("kr_change: lost FEC %s/%d nexthop %s",
+ log_warnx("%s: lost FEC %s/%d nexthop %s", __func__,
inet_ntoa(kroute->prefix), kroute->prefixlen,
inet_ntop(AF_INET, &kroute->nexthop, buf, sizeof(buf)));
return (-1);
@@ -398,7 +398,7 @@ kr_show_route(struct imsg *imsg)
switch (imsg->hdr.type) {
case IMSG_CTL_KROUTE:
if (imsg->hdr.len != IMSG_HEADER_SIZE + sizeof(flags)) {
- log_warnx("kr_show_route: wrong imsg len");
+ log_warnx("%s: wrong imsg len", __func__);
return;
}
memcpy(&flags, imsg->data, sizeof(flags));
@@ -416,7 +416,7 @@ kr_show_route(struct imsg *imsg)
case IMSG_CTL_KROUTE_ADDR:
if (imsg->hdr.len != IMSG_HEADER_SIZE +
sizeof(struct in_addr)) {
- log_warnx("kr_show_route: wrong imsg len");
+ log_warnx("%s: wrong imsg len", __func__);
return;
}
memcpy(&addr, imsg->data, sizeof(addr));
@@ -427,7 +427,7 @@ kr_show_route(struct imsg *imsg)
&kn->r, sizeof(kn->r));
break;
default:
- log_debug("kr_show_route: error handling imsg");
+ log_debug("%s: error handling imsg", __func__);
break;
}
main_imsg_compose_ldpe(IMSG_CTL_END, imsg->hdr.pid, NULL, 0);
@@ -598,7 +598,7 @@ kroute_insert(struct kroute *kr)
if (kp == NULL) {
kp = calloc(1, sizeof(struct kroute_prefix));
if (kp == NULL)
- fatal("kroute_insert");
+ fatal(__func__);
kp->prefix.s_addr = kr->prefix.s_addr;
kp->prefixlen = kr->prefixlen;
TAILQ_INIT(&kp->priorities);
@@ -610,7 +610,7 @@ kroute_insert(struct kroute *kr)
if (kprio == NULL) {
kprio = calloc(1, sizeof(struct kroute_priority));
if (kprio == NULL)
- fatal("kroute_insert");
+ fatal(__func__);
kprio->kp = kp;
kprio->priority = kr->priority;
TAILQ_INIT(&kprio->nexthops);
@@ -631,7 +631,7 @@ done:
if (kn == NULL) {
kn = calloc(1, sizeof(struct kroute_node));
if (kn == NULL)
- fatal("kroute_insert");
+ fatal(__func__);
kn->kprio = kprio;
memcpy(&kn->r, kr, sizeof(struct kroute));
TAILQ_INSERT_TAIL(&kprio->nexthops, kn, entry);
@@ -663,7 +663,7 @@ kroute_remove(struct kroute *kr)
kn = kroute_find_gw(kr->prefix.s_addr, kr->prefixlen, kr->priority,
kr->nexthop);
if (kn == NULL) {
- log_warnx("kroute_remove failed to find %s/%u",
+ log_warnx("%s failed to find %s/%u", __func__,
inet_ntoa(kr->prefix), kr->prefixlen);
return (-1);
}
@@ -683,7 +683,7 @@ kroute_remove(struct kroute *kr)
if (TAILQ_EMPTY(&kp->priorities)) {
if (RB_REMOVE(kroute_tree, &krt, kp) == NULL) {
- log_warnx("kroute_remove failed for %s/%u",
+ log_warnx("%s failed for %s/%u", __func__,
inet_ntoa(kp->prefix), kp->prefixlen);
return (-1);
}
@@ -899,7 +899,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("%s: kif_update(%u)", __func__, ifindex);
return;
}
link_new = (kif->k.flags & IFF_UP) &&
@@ -934,7 +934,8 @@ if_newaddr(u_short ifindex, struct sockaddr_in *ifa, struct sockaddr_in *mask,
if (ifa == NULL || ifa->sin_family != AF_INET)
return;
if ((kif = kif_find(ifindex)) == NULL) {
- log_warnx("if_newaddr: corresponding if %d not found", ifindex);
+ log_warnx("%s: corresponding if %d not found", __func__,
+ ifindex);
return;
}
a = ntohl(ifa->sin_addr.s_addr);
@@ -943,7 +944,7 @@ if_newaddr(u_short ifindex, struct sockaddr_in *ifa, struct sockaddr_in *mask,
return;
if ((ka = calloc(1, sizeof(struct kif_addr))) == NULL)
- fatal("if_newaddr");
+ fatal(__func__);
ka->addr.ifindex = ifindex;
ka->addr.addr.s_addr = ifa->sin_addr.s_addr;
if (mask)
@@ -972,7 +973,8 @@ if_deladdr(u_short ifindex, struct sockaddr_in *ifa, struct sockaddr_in *mask,
if (ifa == NULL || ifa->sin_family != AF_INET)
return;
if ((kif = kif_find(ifindex)) == NULL) {
- log_warnx("if_deladdr: corresponding if %d not found", ifindex);
+ log_warnx("%s: corresponding if %d not found", __func__,
+ ifindex);
return;
}
@@ -1136,7 +1138,7 @@ retry:
return (0);
}
}
- log_warn("send_rtmsg: action %u, AF %d, prefix %s/%u",
+ log_warn("%s action %u, AF %d, prefix %s/%u", __func__,
hdr.rtm_type, family, inet_ntoa(kroute->prefix),
kroute->prefixlen);
return (0);
@@ -1166,7 +1168,7 @@ fetchtable(void)
return (-1);
}
if ((buf = malloc(len)) == NULL) {
- log_warn("fetchtable");
+ log_warn(__func__);
return (-1);
}
if (sysctl(mib, 7, buf, &len, NULL, 0) == -1) {
@@ -1201,7 +1203,7 @@ fetchifs(u_short ifindex)
return (-1);
}
if ((buf = malloc(len)) == NULL) {
- log_warn("fetchif");
+ log_warn(__func__);
return (-1);
}
if (sysctl(mib, 6, buf, &len, NULL, 0) == -1) {
@@ -1225,7 +1227,7 @@ dispatch_rtmsg(void)
if ((n = read(kr_state.fd, &buf, sizeof(buf))) == -1) {
if (errno == EAGAIN || errno == EINTR)
return (0);
- log_warn("dispatch_rtmsg: read error");
+ log_warn("%s: read error", __func__);
return (-1);
}
@@ -1358,7 +1360,7 @@ rtmsg_process(char *buf, size_t len)
*/
if ((kprio = kroute_find_prio(prefix.s_addr,
prefixlen, prio)) == NULL) {
- log_warnx("dispatch_rtmsg route not found");
+ log_warnx("%s: route not found", __func__);
return (-1);
}
kn = TAILQ_FIRST(&kprio->nexthops);
@@ -1402,7 +1404,7 @@ rtmsg_process(char *buf, size_t len)
/* get the correct route */
if ((kn = kroute_find_gw(prefix.s_addr, prefixlen,
prio, nexthop)) == NULL) {
- log_warnx("dispatch_rtmsg route not found");
+ log_warnx("%s: route not found", __func__);
return (-1);
}
if (kroute_remove(&kn->r) == -1)
@@ -1454,7 +1456,7 @@ kmpw_set(struct kpw *kpw)
kif = kif_find(kpw->ifindex);
if (kif == NULL) {
- log_warn("kmpw_set: failed to find mpw by index (%u)",
+ log_warn("%s: failed to find mpw by index (%u)", __func__,
kpw->ifindex);
return;
}
@@ -1473,13 +1475,13 @@ kmpw_unset(struct kpw *kpw)
kif = kif_find(kpw->ifindex);
if (kif == NULL) {
- log_warn("kmpw_unset: failed to find mpw by index (%u)",
+ log_warn("%s: failed to find mpw by index (%u)", __func__,
kpw->ifindex);
return;
}
if (kif->kpw == NULL) {
- log_warn("kmpw_unset: %s is not set", kif->k.ifname);
+ log_warn("%s: %s is not set", __func__, kif->k.ifname);
return;
}
@@ -1505,7 +1507,7 @@ kmpw_install(const char *ifname, struct kpw *kpw)
break;
default:
- log_warn("kmpw_install: unhandled pseudowire type (%#X)",
+ log_warn("%s: unhandled pseudowire type (%#X)", __func__,
kpw->pw_type);
}
diff --git a/usr.sbin/ldpd/labelmapping.c b/usr.sbin/ldpd/labelmapping.c
index 18742bac66f..617e5f82ca8 100644
--- a/usr.sbin/ldpd/labelmapping.c
+++ b/usr.sbin/ldpd/labelmapping.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: labelmapping.c,v 1.34 2015/07/21 05:02:57 renato Exp $ */
+/* $OpenBSD: labelmapping.c,v 1.35 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -67,7 +67,7 @@ send_labelmessage(struct nbr *nbr, u_int16_t type, struct mapping_head *mh)
/* generate pdu */
if (first) {
if ((buf = ibuf_open(LDP_MAX_LEN)) == NULL)
- fatal("send_labelmapping");
+ fatal(__func__);
/* real size will be set up later */
gen_ldp_hdr(buf, 0);
diff --git a/usr.sbin/ldpd/lde.c b/usr.sbin/ldpd/lde.c
index fa9c29a5e5a..2877d21ef87 100644
--- a/usr.sbin/ldpd/lde.c
+++ b/usr.sbin/ldpd/lde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lde.c,v 1.40 2015/12/05 13:11:48 claudio Exp $ */
+/* $OpenBSD: lde.c,v 1.41 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -235,8 +235,8 @@ lde_dispatch_imsg(int fd, short event, void *bula)
case IMSG_LABEL_MAPPING_FULL:
nbr = lde_nbr_find(imsg.hdr.peerid);
if (nbr == NULL) {
- log_debug("lde_dispatch_imsg: cannot find "
- "lde neighbor");
+ log_debug("%s: cannot find lde neighbor",
+ __func__);
return;
}
@@ -253,8 +253,8 @@ lde_dispatch_imsg(int fd, short event, void *bula)
nbr = lde_nbr_find(imsg.hdr.peerid);
if (nbr == NULL) {
- log_debug("lde_dispatch_imsg: cannot find "
- "lde neighbor");
+ log_debug("%s: cannot find lde neighbor",
+ __func__);
return;
}
@@ -289,14 +289,14 @@ lde_dispatch_imsg(int fd, short event, void *bula)
nbr = lde_nbr_find(imsg.hdr.peerid);
if (nbr == NULL) {
- log_debug("lde_dispatch_imsg: cannot find "
- "lde neighbor");
+ log_debug("%s: cannot find lde neighbor",
+ __func__);
return;
}
if (lde_address_add(nbr, &addr) < 0) {
- log_debug("lde_dispatch_imsg: cannot add "
- "address %s, it already exists",
+ log_debug("%s: cannot add address %s, it "
+ "already exists", __func__,
inet_ntoa(addr));
}
@@ -308,14 +308,14 @@ lde_dispatch_imsg(int fd, short event, void *bula)
nbr = lde_nbr_find(imsg.hdr.peerid);
if (nbr == NULL) {
- log_debug("lde_dispatch_imsg: cannot find "
- "lde neighbor");
+ log_debug("%s: cannot find lde neighbor",
+ __func__);
return;
}
if (lde_address_del(nbr, &addr) < 0) {
- log_debug("lde_dispatch_imsg: cannot delete "
- "address %s, it does not exists",
+ log_debug("%s: cannot delete address %s, it "
+ "does not exists", __func__,
inet_ntoa(addr));
}
@@ -327,8 +327,8 @@ lde_dispatch_imsg(int fd, short event, void *bula)
nbr = lde_nbr_find(imsg.hdr.peerid);
if (nbr == NULL) {
- log_debug("lde_dispatch_imsg: cannot find "
- "lde neighbor");
+ log_debug("%s: cannot find lde neighbor",
+ __func__);
return;
}
@@ -377,7 +377,7 @@ lde_dispatch_imsg(int fd, short event, void *bula)
log_verbose(verbose);
break;
default:
- log_debug("lde_dispatch_imsg: unexpected imsg %d",
+ log_debug("%s: unexpected imsg %d", __func__,
imsg.hdr.type);
break;
}
@@ -432,8 +432,7 @@ lde_dispatch_parent(int fd, short event, void *bula)
switch (imsg.hdr.type) {
case IMSG_NETWORK_ADD:
if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(kr)) {
- log_warnx("lde_dispatch_parent: "
- "wrong imsg len");
+ log_warnx("%s: wrong imsg len", __func__);
break;
}
memcpy(&kr, imsg.data, sizeof(kr));
@@ -446,8 +445,7 @@ lde_dispatch_parent(int fd, short event, void *bula)
break;
case IMSG_NETWORK_DEL:
if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(kr)) {
- log_warnx("lde_dispatch_parent: "
- "wrong imsg len");
+ log_warnx("%s: wrong imsg len", __func__);
break;
}
memcpy(&kr, imsg.data, sizeof(kr));
@@ -524,7 +522,7 @@ lde_dispatch_parent(int fd, short event, void *bula)
nconf = NULL;
break;
default:
- log_debug("lde_dispatch_parent: unexpected imsg %d",
+ log_debug("%s: unexpected imsg %d", __func__,
imsg.hdr.type);
break;
}
@@ -875,7 +873,7 @@ lde_nbr_new(u_int32_t peerid, struct in_addr *id)
struct lde_nbr *nbr;
if ((nbr = calloc(1, sizeof(*nbr))) == NULL)
- fatal("lde_nbr_new");
+ fatal(__func__);
nbr->id.s_addr = id->s_addr;
nbr->peerid = peerid;
@@ -944,7 +942,7 @@ lde_map_add(struct lde_nbr *ln, struct fec_node *fn, int sent)
me = calloc(1, sizeof(*me));
if (me == NULL)
- fatal("lde_map_add");
+ fatal(__func__);
me->fec = fn->fec;
me->nexthop = ln;
@@ -1026,7 +1024,7 @@ lde_wdraw_add(struct lde_nbr *ln, struct fec_node *fn)
lw = calloc(1, sizeof(*lw));
if (lw == NULL)
- fatal("lde_wdraw_add");
+ fatal(__func__);
lw->fec = fn->fec;
@@ -1053,13 +1051,13 @@ lde_address_add(struct lde_nbr *lr, struct in_addr *addr)
return (-1);
if ((address = calloc(1, sizeof(*address))) == NULL)
- fatal("lde_address_add");
+ fatal(__func__);
address->addr.s_addr = addr->s_addr;
TAILQ_INSERT_TAIL(&lr->addr_list, address, entry);
- log_debug("lde_address_add: added %s", inet_ntoa(*addr));
+ log_debug("%s: added %s", __func__, inet_ntoa(*addr));
return (0);
}
@@ -1090,7 +1088,7 @@ lde_address_del(struct lde_nbr *lr, struct in_addr *addr)
free(address);
- log_debug("lde_address_del: deleted %s", inet_ntoa(*addr));
+ log_debug("%s: deleted %s", __func__, inet_ntoa(*addr));
return (0);
}
diff --git a/usr.sbin/ldpd/lde_lib.c b/usr.sbin/ldpd/lde_lib.c
index d95da676cf7..75eee0c2ff8 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.40 2015/07/21 04:52:29 renato Exp $ */
+/* $OpenBSD: lde_lib.c,v 1.41 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -124,7 +124,7 @@ int
fec_remove(struct fec_tree *fh, struct fec *f)
{
if (RB_REMOVE(fec_tree, fh, f) == NULL) {
- log_warnx("fec_remove failed for %s", log_fec(f));
+ log_warnx("%s failed for %s", __func__, log_fec(f));
return (-1);
}
return (0);
@@ -223,10 +223,10 @@ fec_free(void *arg)
while ((fnh = LIST_FIRST(&fn->nexthops)))
fec_nh_del(fnh);
if (!LIST_EMPTY(&fn->downstream))
- log_warnx("fec_free: fec %s downstream list not empty",
+ log_warnx("%s: fec %s downstream list not empty", __func__,
log_fec(&fn->fec));
if (!LIST_EMPTY(&fn->upstream))
- log_warnx("fec_free: fec %s upstream list not empty",
+ log_warnx("%s: fec %s upstream list not empty", __func__,
log_fec(&fn->fec));
free(fn);
@@ -245,7 +245,7 @@ fec_add(struct fec *fec)
fn = calloc(1, sizeof(*fn));
if (fn == NULL)
- fatal("fec_add");
+ fatal(__func__);
memcpy(&fn->fec, fec, sizeof(fn->fec));
fn->local_label = NO_LABEL;
@@ -278,7 +278,7 @@ fec_nh_add(struct fec_node *fn, struct in_addr nexthop)
fnh = calloc(1, sizeof(*fnh));
if (fnh == NULL)
- fatal("fec_nh_add");
+ fatal(__func__);
fnh->nexthop.s_addr = nexthop.s_addr;
fnh->remote_label = NO_LABEL;
diff --git a/usr.sbin/ldpd/ldpd.c b/usr.sbin/ldpd/ldpd.c
index 8e8396e1ddc..4de47ec6a1c 100644
--- a/usr.sbin/ldpd/ldpd.c
+++ b/usr.sbin/ldpd/ldpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpd.c,v 1.28 2016/02/02 17:51:11 sthen Exp $ */
+/* $OpenBSD: ldpd.c,v 1.29 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -372,7 +372,7 @@ main_dispatch_ldpe(int fd, short event, void *bula)
log_verbose(verbose);
break;
default:
- log_debug("main_dispatch_ldpe: error handling imsg %d",
+ log_debug("%s: error handling imsg %d", __func__,
imsg.hdr.type);
break;
}
@@ -424,16 +424,14 @@ main_dispatch_lde(int fd, short event, void *bula)
sizeof(struct kroute))
fatalx("invalid size of IMSG_KLABEL_CHANGE");
if (kr_change(imsg.data))
- log_warn("main_dispatch_lde: error changing "
- "route");
+ log_warn("%s: error changing route", __func__);
break;
case IMSG_KLABEL_DELETE:
if (imsg.hdr.len - IMSG_HEADER_SIZE !=
sizeof(struct kroute))
fatalx("invalid size of IMSG_KLABEL_DELETE");
if (kr_delete(imsg.data))
- log_warn("main_dispatch_lde: error deleting "
- "route");
+ log_warn("%s: error deleting route", __func__);
break;
case IMSG_KPWLABEL_CHANGE:
if (imsg.hdr.len - IMSG_HEADER_SIZE !=
@@ -452,7 +450,7 @@ main_dispatch_lde(int fd, short event, void *bula)
kmpw_unset(kpw);
break;
default:
- log_debug("main_dispatch_lde: error handling imsg %d",
+ log_debug("%s: error handling imsg %d", __func__,
imsg.hdr.type);
break;
}
diff --git a/usr.sbin/ldpd/ldpe.c b/usr.sbin/ldpd/ldpe.c
index d8becc2c963..ecaae74d995 100644
--- a/usr.sbin/ldpd/ldpe.c
+++ b/usr.sbin/ldpd/ldpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpe.c,v 1.43 2016/05/23 14:59:50 renato Exp $ */
+/* $OpenBSD: ldpe.c,v 1.44 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -261,7 +261,7 @@ ldpe(struct ldpd_conf *xconf, int pipe_parent2ldpe[2], int pipe_ldpe2lde[2],
control_listen();
if ((pkt_ptr = calloc(1, IBUF_READ_SIZE)) == NULL)
- fatal("ldpe");
+ fatal(__func__);
/* initialize interfaces */
LIST_FOREACH(iface, &leconf->iface_list, entry)
@@ -687,7 +687,7 @@ mapping_list_add(struct mapping_head *mh, struct map *map)
me = calloc(1, sizeof(*me));
if (me == NULL)
- fatal("mapping_list_add");
+ fatal(__func__);
me->map = *map;
TAILQ_INSERT_TAIL(mh, me, entry);
diff --git a/usr.sbin/ldpd/log.c b/usr.sbin/ldpd/log.c
index cf28c293012..ee380cb47f9 100644
--- a/usr.sbin/ldpd/log.c
+++ b/usr.sbin/ldpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.15 2015/07/21 04:52:29 renato Exp $ */
+/* $OpenBSD: log.c,v 1.16 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -400,8 +400,8 @@ log_rtmsg(u_char rtm_type)
if (rtm_type > 0 &&
rtm_type < sizeof(msgtypes)/sizeof(msgtypes[0]))
- log_debug("rtmsg_process: %s", msgtypes[rtm_type]);
+ log_debug("kernel message: %s", msgtypes[rtm_type]);
else
- log_debug("rtmsg_process: rtm_type %d out of range",
+ log_debug("kernel message: rtm_type %d out of range",
rtm_type);
}
diff --git a/usr.sbin/ldpd/neighbor.c b/usr.sbin/ldpd/neighbor.c
index 5e2797d56f2..81b42a8ab74 100644
--- a/usr.sbin/ldpd/neighbor.c
+++ b/usr.sbin/ldpd/neighbor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: neighbor.c,v 1.52 2015/07/21 05:02:57 renato Exp $ */
+/* $OpenBSD: neighbor.c,v 1.53 2016/05/23 15:14:07 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -141,10 +141,9 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event)
if (nbr_fsm_tbl[i].state == -1) {
/* event outside of the defined fsm, ignore it. */
- log_warnx("nbr_fsm: neighbor ID %s, "
- "event %s not expected in state %s",
- inet_ntoa(nbr->id), nbr_event_names[event],
- nbr_state_name(old_state));
+ log_warnx("%s: neighbor ID %s, event %s not expected in "
+ "state %s", __func__, inet_ntoa(nbr->id),
+ nbr_event_names[event], nbr_state_name(old_state));
return (0);
}
@@ -152,9 +151,9 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event)
nbr->state = new_state;
if (old_state != nbr->state) {
- log_debug("nbr_fsm: event %s resulted in action %s and "
+ log_debug("%s: event %s resulted in action %s and "
"changing state for neighbor ID %s from %s to %s",
- nbr_event_names[event],
+ __func__, nbr_event_names[event],
nbr_action_names[nbr_fsm_tbl[i].action],
inet_ntoa(nbr->id), nbr_state_name(old_state),
nbr_state_name(nbr->state));
@@ -213,10 +212,10 @@ nbr_new(struct in_addr id, struct in_addr addr)
struct nbr *nbr;
struct nbr_params *nbrp;
- log_debug("nbr_new: LSR ID %s", inet_ntoa(id));
+ log_debug("%s: LSR ID %s", __func__, inet_ntoa(id));
if ((nbr = calloc(1, sizeof(*nbr))) == NULL)
- fatal("nbr_new");
+ fatal(__func__);
LIST_INIT(&nbr->adj_list);
nbr->state = NBR_STA_PRESENT;
@@ -250,7 +249,7 @@ nbr_new(struct in_addr id, struct in_addr addr)
void
nbr_del(struct nbr *nbr)
{
- log_debug("nbr_del: LSR ID %s", inet_ntoa(nbr->id));
+ log_debug("%s: LSR ID %s", __func__, inet_ntoa(nbr->id));
nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION);
pfkey_remove(nbr);
@@ -329,7 +328,7 @@ nbr_ktimer(int fd, short event, void *arg)
timerclear(&tv);
tv.tv_sec = (time_t)(nbr->keepalive / KEEPALIVE_PER_PERIOD);
if (evtimer_add(&nbr->keepalive_timer, &tv) == -1)
- fatal("nbr_ktimer");
+ fatal(__func__);
}
void
@@ -343,7 +342,7 @@ nbr_start_ktimer(struct nbr *nbr)
tv.tv_sec = (time_t)(nbr->keepalive / KEEPALIVE_PER_PERIOD);
if (evtimer_add(&nbr->keepalive_timer, &tv) == -1)
- fatal("nbr_start_ktimer");
+ fatal(__func__);
}
void
@@ -351,7 +350,7 @@ nbr_stop_ktimer(struct nbr *nbr)
{
if (evtimer_pending(&nbr->keepalive_timer, NULL) &&
evtimer_del(&nbr->keepalive_timer) == -1)
- fatal("nbr_stop_ktimer");
+ fatal(__func__);
}
/* Keepalive timeout: if the nbr hasn't sent keepalive */
@@ -361,7 +360,7 @@ nbr_ktimeout(int fd, short event, void *arg)
{
struct nbr *nbr = arg;
- log_debug("nbr_ktimeout: neighbor ID %s", inet_ntoa(nbr->id));
+ log_debug("%s: neighbor ID %s", __func__, inet_ntoa(nbr->id));
session_shutdown(nbr, S_KEEPALIVE_TMR, 0, 0);
}
@@ -375,7 +374,7 @@ nbr_start_ktimeout(struct nbr *nbr)
tv.tv_sec = nbr->keepalive;
if (evtimer_add(&nbr->keepalive_timeout, &tv) == -1)
- fatal("nbr_start_ktimeout");
+ fatal(__func__);
}
void
@@ -383,7 +382,7 @@ nbr_stop_ktimeout(struct nbr *nbr)
{
if (evtimer_pending(&nbr->keepalive_timeout, NULL) &&
evtimer_del(&nbr->keepalive_timeout) == -1)
- fatal("nbr_stop_ktimeout");
+ fatal(__func__);
}
/* Init delay timer: timer to retry to iniziatize session */
@@ -393,7 +392,7 @@ nbr_idtimer(int fd, short event, void *arg)
{
struct nbr *nbr = arg;
- log_debug("nbr_idtimer: neighbor ID %s", inet_ntoa(nbr->id));
+ log_debug("%s: neighbor ID %s", __func__, inet_ntoa(nbr->id));
if (nbr_session_active_role(nbr))
nbr_establish_connection(nbr);
@@ -426,7 +425,7 @@ nbr_start_idtimer(struct nbr *nbr)
}
if (evtimer_add(&nbr->initdelay_timer, &tv) == -1)
- fatal("nbr_start_idtimer");
+ fatal(__func__);
}
void
@@ -434,7 +433,7 @@ nbr_stop_idtimer(struct nbr *nbr)
{
if (evtimer_pending(&nbr->initdelay_timer, NULL) &&
evtimer_del(&nbr->initdelay_timer) == -1)
- fatal("nbr_stop_idtimer");
+ fatal(__func__);
}
int
@@ -465,16 +464,15 @@ nbr_connect_cb(int fd, short event, void *arg)
len = sizeof(error);
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
- log_warn("nbr_connect_cb getsockopt SOL_SOCKET SO_ERROR");
+ log_warn("%s: getsockopt SOL_SOCKET SO_ERROR", __func__);
return;
}
if (error) {
close(nbr->fd);
errno = error;
- log_debug("nbr_connect_cb: error while "
- "connecting to %s: %s", inet_ntoa(nbr->addr),
- strerror(errno));
+ log_debug("%s: error while connecting to %s: %s", __func__,
+ inet_ntoa(nbr->addr), strerror(errno));
return;
}
@@ -492,8 +490,7 @@ nbr_establish_connection(struct nbr *nbr)
nbr->fd = socket(AF_INET, SOCK_STREAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0);
if (nbr->fd == -1) {
- log_warn("nbr_establish_connection: error while "
- "creating socket");
+ log_warn("%s: error while creating socket", __func__);
return (-1);
}
@@ -517,8 +514,8 @@ nbr_establish_connection(struct nbr *nbr)
if (bind(nbr->fd, (struct sockaddr *) &local_sa,
sizeof(struct sockaddr_in)) == -1) {
- log_warn("nbr_establish_connection: error while "
- "binding socket to %s", inet_ntoa(local_sa.sin_addr));
+ log_warn("%s: error while binding socket to %s", __func__,
+ inet_ntoa(local_sa.sin_addr));
close(nbr->fd);
return (-1);
}
@@ -544,8 +541,8 @@ nbr_establish_connection(struct nbr *nbr)
event_add(&nbr->ev_connect, NULL);
return (0);
}
- log_warn("nbr_establish_connection: error while "
- "connecting to %s", inet_ntoa(nbr->addr));
+ log_warn("%s: error while connecting to %s", __func__,
+ inet_ntoa(nbr->addr));
close(nbr->fd);
return (-1);
}
@@ -581,7 +578,7 @@ nbr_params_new(struct in_addr addr)
struct nbr_params *nbrp;
if ((nbrp = calloc(1, sizeof(*nbrp))) == NULL)
- fatal("nbr_params_new");
+ fatal(__func__);
nbrp->addr.s_addr = addr.s_addr;
nbrp->auth.method = AUTH_NONE;
diff --git a/usr.sbin/ldpd/notification.c b/usr.sbin/ldpd/notification.c
index 70045451cff..cc0c7ac8dba 100644
--- a/usr.sbin/ldpd/notification.c
+++ b/usr.sbin/ldpd/notification.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: notification.c,v 1.18 2015/07/21 04:52:29 renato Exp $ */
+/* $OpenBSD: notification.c,v 1.19 2016/05/23 15:14:08 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -45,11 +45,11 @@ send_notification_full(struct tcp_conn *tcp, struct notify_msg *nm)
u_int16_t size;
if (tcp->nbr)
- log_debug("send_notification_full: nbr ID %s, status %s",
+ log_debug("%s: nbr ID %s, status %s", __func__,
inet_ntoa(tcp->nbr->id), notification_name(nm->status));
if ((buf = ibuf_open(LDP_MAX_LEN)) == NULL)
- fatal("send_notification");
+ fatal(__func__);
/* calculate size */
size = LDP_HDR_SIZE + sizeof(struct ldp_msg) + STATUS_SIZE;
diff --git a/usr.sbin/ldpd/packet.c b/usr.sbin/ldpd/packet.c
index 576616c9e87..690a661225e 100644
--- a/usr.sbin/ldpd/packet.c
+++ b/usr.sbin/ldpd/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.42 2016/05/23 14:49:56 renato Exp $ */
+/* $OpenBSD: packet.c,v 1.43 2016/05/23 15:14:08 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -90,14 +90,14 @@ send_packet(int fd, struct iface *iface, void *pkt, size_t len,
/* set outgoing interface for multicast traffic */
if (iface && IN_MULTICAST(ntohl(dst->sin_addr.s_addr)))
if (if_set_mcast(iface) == -1) {
- log_warn("send_packet: error setting multicast "
- "interface, %s", iface->name);
+ log_warn("%s: error setting multicast interface, %s",
+ __func__, iface->name);
return (-1);
}
if (sendto(fd, pkt, len, 0, (struct sockaddr *)dst,
sizeof(*dst)) == -1) {
- log_warn("send_packet: error sending packet to %s",
+ log_warn("%s: error sending packet to %s", __func__,
inet_ntoa(dst->sin_addr));
return (-1);
}
@@ -141,7 +141,7 @@ disc_recv_packet(int fd, short event, void *bula)
if ((r = recvmsg(fd, &msg, 0)) == -1) {
if (errno != EAGAIN && errno != EINTR)
- log_debug("disc_recv_packet: read error: %s",
+ log_debug("%s: read error: %s", __func__,
strerror(errno));
return;
}
@@ -200,7 +200,7 @@ disc_recv_packet(int fd, short event, void *bula)
recv_hello(iface, src.sin_addr, buf, len);
break;
default:
- log_debug("recv_packet: unknown LDP packet type, source %s",
+ log_debug("%s: unknown LDP packet type, source %s", __func__,
inet_ntoa(src.sin_addr));
}
}
@@ -237,9 +237,9 @@ tcp_new(int fd, struct nbr *nbr)
struct tcp_conn *tcp;
if ((tcp = calloc(1, sizeof(*tcp))) == NULL)
- fatal("tcp_new");
+ fatal(__func__);
if ((tcp->rbuf = calloc(1, sizeof(struct ibuf_read))) == NULL)
- fatal("tcp_new");
+ fatal(__func__);
if (nbr)
tcp->nbr = nbr;
@@ -286,7 +286,7 @@ session_accept(int fd, short event, void *bula)
accept_pause();
} else if (errno != EWOULDBLOCK && errno != EINTR &&
errno != ECONNABORTED)
- log_debug("sess_recv_packet: accept error: %s",
+ log_debug("%s: accept error: %s", __func__,
strerror(errno));
return;
}
@@ -327,14 +327,14 @@ session_read(int fd, short event, void *arg)
u_int16_t pdu_len;
if (event != EV_READ) {
- log_debug("session_read: spurious event");
+ log_debug("%s: spurious event", __func__);
return;
}
if ((n = read(fd, tcp->rbuf->buf + tcp->rbuf->wpos,
sizeof(tcp->rbuf->buf) - tcp->rbuf->wpos)) == -1) {
if (errno != EINTR && errno != EAGAIN) {
- log_warn("session_read: read error");
+ log_warn("%s: read error", __func__);
if (nbr)
nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION);
else
@@ -346,7 +346,7 @@ session_read(int fd, short event, void *arg)
}
if (n == 0) {
/* connection closed */
- log_debug("session_read: connection closed by remote end");
+ log_debug("%s: connection closed by remote end", __func__);
if (nbr)
nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION);
else
@@ -495,8 +495,8 @@ session_read(int fd, short event, void *arg)
pdu_len, type);
break;
default:
- log_debug("session_read: unknown LDP packet "
- "from nbr %s", inet_ntoa(nbr->id));
+ log_debug("%s: unknown LDP packet from nbr %s",
+ __func__, inet_ntoa(nbr->id));
if (!(ntohs(ldp_msg->type) & UNKNOWN_FLAG)) {
session_shutdown(nbr, S_UNKNOWN_MSG,
ldp_msg->msgid, ldp_msg->type);
@@ -538,7 +538,7 @@ session_write(int fd, short event, void *arg)
nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION);
}
} else
- log_debug("session_write: spurious event");
+ log_debug("%s: spurious event", __func__);
evbuf_event_add(&tcp->wbuf);
}
@@ -547,7 +547,7 @@ void
session_shutdown(struct nbr *nbr, u_int32_t status, u_int32_t msgid,
u_int32_t type)
{
- log_debug("session_shutdown: nbr ID %s", inet_ntoa(nbr->id));
+ log_debug("%s: nbr ID %s", __func__, inet_ntoa(nbr->id));
send_notification_nbr(nbr, status, msgid, type);
@@ -560,7 +560,7 @@ session_shutdown(struct nbr *nbr, u_int32_t status, u_int32_t msgid,
void
session_close(struct nbr *nbr)
{
- log_debug("session_close: closing session with nbr ID %s",
+ log_debug("%s: closing session with nbr ID %s", __func__,
inet_ntoa(nbr->id));
tcp_close(nbr->tcp);