summaryrefslogtreecommitdiff
path: root/usr.sbin/ldpd/kroute.c
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/ldpd/kroute.c
parent0c5809174c6ffe7db6d6fd8fb53a0d2acdd81a67 (diff)
Replace manually written function names with __func__.
Diffstat (limited to 'usr.sbin/ldpd/kroute.c')
-rw-r--r--usr.sbin/ldpd/kroute.c60
1 files changed, 31 insertions, 29 deletions
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);
}