diff options
author | 2010-07-12 14:35:13 +0000 | |
---|---|---|
committer | 2010-07-12 14:35:13 +0000 | |
commit | 4324a0516608e4ce2ec0f1553a33b0c4484fa591 (patch) | |
tree | 63fc1f995afedd5c18a568bedb10710c54277457 | |
parent | need to copy f() parameters, otherwise strange bugs with sub expressions (diff) | |
download | wireguard-openbsd-4324a0516608e4ce2ec0f1553a33b0c4484fa591.tar.xz wireguard-openbsd-4324a0516608e4ce2ec0f1553a33b0c4484fa591.zip |
Merge duplicate log messages into one log_warn().
ok claudio@
-rw-r--r-- | usr.sbin/bgpd/kroute.c | 38 | ||||
-rw-r--r-- | usr.sbin/ldpd/kroute.c | 22 | ||||
-rw-r--r-- | usr.sbin/ospf6d/kroute.c | 19 | ||||
-rw-r--r-- | usr.sbin/ospfd/kroute.c | 20 | ||||
-rw-r--r-- | usr.sbin/ripd/kroute.c | 23 |
5 files changed, 31 insertions, 91 deletions
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c index aeed6d4e535..10c5bd68606 100644 --- a/usr.sbin/bgpd/kroute.c +++ b/usr.sbin/bgpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.182 2010/06/03 21:19:06 claudio Exp $ */ +/* $OpenBSD: kroute.c,v 1.183 2010/07/12 14:35:13 bluhm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -2651,8 +2651,7 @@ send_rtmsg(int fd, int action, struct ktable *kt, struct kroute *kroute) retry: if (writev(fd, iov, iovcnt) == -1) { - switch (errno) { - case ESRCH: + if (errno == ESRCH) { if (hdr.rtm_type == RTM_CHANGE) { hdr.rtm_type = RTM_ADD; goto retry; @@ -2661,20 +2660,11 @@ retry: inet_ntoa(kroute->prefix), kroute->prefixlen); return (0); - } else { - log_warnx("send_rtmsg: action %u, " - "prefix %s/%u: %s", hdr.rtm_type, - inet_ntoa(kroute->prefix), - kroute->prefixlen, strerror(errno)); - return (0); } - break; - default: - log_warnx("send_rtmsg: action %u, prefix %s/%u: %s", - hdr.rtm_type, inet_ntoa(kroute->prefix), - kroute->prefixlen, strerror(errno)); - return (0); } + log_warn("send_rtmsg: action %u, prefix %s/%u", hdr.rtm_type, + inet_ntoa(kroute->prefix), kroute->prefixlen); + return (0); } return (0); @@ -2767,8 +2757,7 @@ send_rt6msg(int fd, int action, struct ktable *kt, struct kroute6 *kroute) retry: if (writev(fd, iov, iovcnt) == -1) { - switch (errno) { - case ESRCH: + if (errno == ESRCH) { if (hdr.rtm_type == RTM_CHANGE) { hdr.rtm_type = RTM_ADD; goto retry; @@ -2777,20 +2766,11 @@ retry: log_in6addr(&kroute->prefix), kroute->prefixlen); return (0); - } else { - log_warnx("send_rt6msg: action %u, " - "prefix %s/%u: %s", hdr.rtm_type, - log_in6addr(&kroute->prefix), - kroute->prefixlen, strerror(errno)); - return (0); } - break; - default: - log_warnx("send_rt6msg: action %u, prefix %s/%u: %s", - hdr.rtm_type, log_in6addr(&kroute->prefix), - kroute->prefixlen, strerror(errno)); - return (0); } + log_warn("send_rt6msg: action %u, prefix %s/%u", hdr.rtm_type, + log_in6addr(&kroute->prefix), kroute->prefixlen); + return (0); } return (0); diff --git a/usr.sbin/ldpd/kroute.c b/usr.sbin/ldpd/kroute.c index 5a41668f44f..38e27a8c0ce 100644 --- a/usr.sbin/ldpd/kroute.c +++ b/usr.sbin/ldpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.19 2010/07/08 09:41:05 claudio Exp $ */ +/* $OpenBSD: kroute.c,v 1.20 2010/07/12 14:35:13 bluhm Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -1055,8 +1055,7 @@ send_rtmsg(int fd, int action, struct kroute *kroute, u_int32_t family) retry: if (writev(fd, iov, iovcnt) == -1) { - switch (errno) { - case ESRCH: + if (errno == ESRCH) { if (hdr.rtm_type == RTM_CHANGE && family == AF_MPLS) { hdr.rtm_type = RTM_ADD; goto retry; @@ -1065,21 +1064,12 @@ retry: inet_ntoa(kroute->prefix), kroute->prefixlen); return (0); - } else { - log_warnx("send_rtmsg: action %u, " - "prefix %s/%u: %s", hdr.rtm_type, - inet_ntoa(kroute->prefix), - kroute->prefixlen, strerror(errno)); - return (0); } - break; - default: - log_warnx("send_rtmsg: action %u, " - "AF %d prefix %s/%u: %s", hdr.rtm_type, - family, inet_ntoa(kroute->prefix), - kroute->prefixlen, strerror(errno)); - return (0); } + log_warn("send_rtmsg: action %u, AF %d, prefix %s/%u", + hdr.rtm_type, family, inet_ntoa(kroute->prefix), + kroute->prefixlen); + return (0); } if (hr_label == MPLS_LABEL_IMPLNULL) { diff --git a/usr.sbin/ospf6d/kroute.c b/usr.sbin/ospf6d/kroute.c index 5ef15e843f8..5debe86d37e 100644 --- a/usr.sbin/ospf6d/kroute.c +++ b/usr.sbin/ospf6d/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.25 2010/07/06 13:24:35 bluhm Exp $ */ +/* $OpenBSD: kroute.c,v 1.26 2010/07/12 14:35:13 bluhm Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -1110,8 +1110,7 @@ send_rtmsg(int fd, int action, struct kroute *kroute) retry: if (writev(fd, iov, iovcnt) == -1) { - switch (errno) { - case ESRCH: + if (errno == ESRCH) { if (hdr.rtm_type == RTM_CHANGE) { hdr.rtm_type = RTM_ADD; goto retry; @@ -1119,19 +1118,11 @@ retry: log_info("route %s/%u vanished before delete", log_sockaddr(&prefix), kroute->prefixlen); return (0); - } else { - log_warn("send_rtmsg: action %u, " - "prefix %s/%u", hdr.rtm_type, - log_sockaddr(&prefix), kroute->prefixlen); - return (0); } - break; - default: - log_warn("send_rtmsg: action %u, prefix %s/%u", - hdr.rtm_type, log_sockaddr(&prefix), - kroute->prefixlen); - return (0); } + log_warn("send_rtmsg: action %u, prefix %s/%u", hdr.rtm_type, + log_sockaddr(&prefix), kroute->prefixlen); + return (0); } return (0); diff --git a/usr.sbin/ospfd/kroute.c b/usr.sbin/ospfd/kroute.c index 28abc58fbe3..a799353e46c 100644 --- a/usr.sbin/ospfd/kroute.c +++ b/usr.sbin/ospfd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.85 2010/07/09 15:38:28 claudio Exp $ */ +/* $OpenBSD: kroute.c,v 1.86 2010/07/12 14:35:13 bluhm Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -1178,8 +1178,7 @@ send_rtmsg(int fd, int action, struct kroute *kroute) retry: if (writev(fd, iov, iovcnt) == -1) { - switch (errno) { - case ESRCH: + if (errno == ESRCH) { if (hdr.rtm_type == RTM_CHANGE) { hdr.rtm_type = RTM_ADD; goto retry; @@ -1188,20 +1187,11 @@ retry: inet_ntoa(kroute->prefix), kroute->prefixlen); return (0); - } else { - log_warnx("send_rtmsg: action %u, " - "prefix %s/%u: %s", hdr.rtm_type, - inet_ntoa(kroute->prefix), - kroute->prefixlen, strerror(errno)); - return (0); } - break; - default: - log_warnx("send_rtmsg: action %u, prefix %s/%u: %s", - hdr.rtm_type, inet_ntoa(kroute->prefix), - kroute->prefixlen, strerror(errno)); - return (0); } + log_warn("send_rtmsg: action %u, prefix %s/%u", hdr.rtm_type, + inet_ntoa(kroute->prefix), kroute->prefixlen); + return (0); } return (0); diff --git a/usr.sbin/ripd/kroute.c b/usr.sbin/ripd/kroute.c index 014f9286c70..af1f7680bbe 100644 --- a/usr.sbin/ripd/kroute.c +++ b/usr.sbin/ripd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.21 2010/01/02 14:40:54 michele Exp $ */ +/* $OpenBSD: kroute.c,v 1.22 2010/07/12 14:35:13 bluhm Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -801,8 +801,7 @@ send_rtmsg(int fd, int action, struct kroute *kroute) retry: if (writev(fd, iov, iovcnt) == -1) { - switch (errno) { - case ESRCH: + if (errno == ESRCH) { if (hdr.rtm_type == RTM_CHANGE) { hdr.rtm_type = RTM_ADD; goto retry; @@ -811,22 +810,12 @@ retry: inet_ntoa(kroute->prefix), mask2prefixlen(kroute->netmask.s_addr)); return (0); - } else { - log_warnx("send_rtmsg: action %u, " - "prefix %s/%u: %s", hdr.rtm_type, - inet_ntoa(kroute->prefix), - mask2prefixlen(kroute->netmask.s_addr), - strerror(errno)); - return (0); } - break; - default: - log_warnx("send_rtmsg: action %u, prefix %s/%u: %s", - hdr.rtm_type, inet_ntoa(kroute->prefix), - mask2prefixlen(kroute->netmask.s_addr), - strerror(errno)); - return (0); } + log_warn("send_rtmsg: action %u, prefix %s/%u", + hdr.rtm_type, inet_ntoa(kroute->prefix), + mask2prefixlen(kroute->netmask.s_addr)); + return (0); } return (0); |