summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-01-22 19:07:35 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-01-22 19:07:35 +0000
commit1957879869158db7f6b1660c4b962537bd81f6e5 (patch)
tree5de6304c22f130dd21c7b9bc91854472787009ba /usr.sbin/bgpd
parent6cdaf7fdfeecbb521f4cf141d85ac7f0de778639 (diff)
log_peer_err -> log_peer_warn
log_peer_errx -> log_peer_warnx
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/log.c6
-rw-r--r--usr.sbin/bgpd/session.c62
-rw-r--r--usr.sbin/bgpd/session.h6
3 files changed, 37 insertions, 37 deletions
diff --git a/usr.sbin/bgpd/log.c b/usr.sbin/bgpd/log.c
index c98287f12fe..91d28642e03 100644
--- a/usr.sbin/bgpd/log.c
+++ b/usr.sbin/bgpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.17 2004/01/22 03:18:04 henning Exp $ */
+/* $OpenBSD: log.c,v 1.18 2004/01/22 19:07:33 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -159,7 +159,7 @@ vlog(int pri, const char *fmt, va_list ap)
void
-log_peer_err(const struct peer *peer, const char *emsg, ...)
+log_peer_warn(const struct peer *peer, const char *emsg, ...)
{
char *p, *nfmt;
va_list ap;
@@ -181,7 +181,7 @@ log_peer_err(const struct peer *peer, const char *emsg, ...)
}
void
-log_peer_errx(const struct peer *peer, const char *emsg, ...)
+log_peer_warnx(const struct peer *peer, const char *emsg, ...)
{
char *p, *nfmt;
va_list ap;
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index befdb4c8f5c..0abde2e03ff 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.89 2004/01/22 03:18:04 henning Exp $ */
+/* $OpenBSD: session.c,v 1.90 2004/01/22 19:07:34 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -222,7 +222,7 @@ session_main(struct bgpd_config *config, struct peer *cpeers, int pipe_m2s[2],
/* deletion due? */
if (p->conf.reconf_action == RECONF_DELETE) {
bgp_fsm(p, EVNT_STOP);
- log_peer_errx(p, "removed");
+ log_peer_warnx(p, "removed");
if (last != NULL)
last->next = next;
else
@@ -730,7 +730,7 @@ session_connect(struct peer *peer)
return (-1);
if ((peer->sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
- log_peer_err(peer, "session_connect socket");
+ log_peer_warn(peer, "session_connect socket");
bgp_fsm(peer, EVNT_CON_OPENFAIL);
return (-1);
}
@@ -741,7 +741,7 @@ session_connect(struct peer *peer)
if (peer->conf.local_addr.sin_addr.s_addr)
if (bind(peer->sock, (struct sockaddr *)&peer->conf.local_addr,
sizeof(peer->conf.local_addr))) {
- log_peer_err(peer, "session_connect bind");
+ log_peer_warn(peer, "session_connect bind");
bgp_fsm(peer, EVNT_CON_OPENFAIL);
return (-1);
}
@@ -756,7 +756,7 @@ session_connect(struct peer *peer)
if ((n = connect(peer->sock, (struct sockaddr *)&peer->conf.remote_addr,
sizeof(peer->conf.remote_addr))) == -1)
if (errno != EINPROGRESS) {
- log_peer_err(peer, "connect");
+ log_peer_warn(peer, "connect");
bgp_fsm(peer, EVNT_CON_OPENFAIL);
return (-1);
}
@@ -778,20 +778,20 @@ session_setup_socket(struct peer *p)
/* set TTL to foreign router's distance - 1=direct n=multihop */
if (setsockopt(p->sock, IPPROTO_IP, IP_TTL, &ttl,
sizeof(ttl)) == -1) {
- log_peer_err(p, "session_setup_socket setsockopt TTL");
+ log_peer_warn(p, "session_setup_socket setsockopt TTL");
return (-1);
}
/* set TCP_NODELAY */
if (setsockopt(p->sock, IPPROTO_TCP, TCP_NODELAY, &nodelay,
sizeof(nodelay)) == -1) {
- log_peer_err(p, "session_setup_socket setsockopt TCP_NODELAY");
+ log_peer_warn(p, "session_setup_socket setsockopt TCP_NODELAY");
return (-1);
}
/* set precedence, see rfc1771 appendix 5 */
if (setsockopt(p->sock, IPPROTO_IP, IP_TOS, &pre, sizeof(pre)) == -1) {
- log_peer_err(p, "session_setup_socket setsockopt TOS");
+ log_peer_warn(p, "session_setup_socket setsockopt TOS");
return (-1);
}
@@ -867,9 +867,9 @@ session_open(struct peer *peer)
if (errs == 0) {
if ((n = buf_close(&peer->wbuf, buf)) < 0) {
if (n == -2)
- log_peer_errx(peer, "Connection closed");
+ log_peer_warnx(peer, "Connection closed");
else
- log_peer_err(peer, "Write error");
+ log_peer_warn(peer, "Write error");
buf_free(buf);
bgp_fsm(peer, EVNT_CON_FATAL);
}
@@ -911,9 +911,9 @@ session_keepalive(struct peer *peer)
if ((n = buf_close(&peer->wbuf, buf)) < 0) {
if (n == -2)
- log_peer_errx(peer, "Connection closed");
+ log_peer_warnx(peer, "Connection closed");
else
- log_peer_err(peer, "Write error");
+ log_peer_warn(peer, "Write error");
buf_free(buf);
bgp_fsm(peer, EVNT_CON_FATAL);
return;
@@ -960,9 +960,9 @@ session_update(u_int32_t peerid, void *data, size_t datalen)
if ((n = buf_close(&p->wbuf, buf)) < 0) {
if (n == -2)
- log_peer_errx(p, "Connection closed");
+ log_peer_warnx(p, "Connection closed");
else
- log_peer_err(p, "Write error");
+ log_peer_warn(p, "Write error");
buf_free(buf);
bgp_fsm(p, EVNT_CON_FATAL);
}
@@ -1007,9 +1007,9 @@ session_notification(struct peer *peer, u_int8_t errcode, u_int8_t subcode,
if ((n = buf_close(&peer->wbuf, buf)) < 0) {
if (n == -2)
- log_peer_errx(peer, "Connection closed");
+ log_peer_warnx(peer, "Connection closed");
else
- log_peer_err(peer, "Write error");
+ log_peer_warn(peer, "Write error");
buf_free(buf);
bgp_fsm(peer, EVNT_CON_FATAL);
}
@@ -1035,7 +1035,7 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *peer)
logit(LOG_CRIT, "unknown socket error");
else {
errno = error;
- log_peer_err(peer, "socket error");
+ log_peer_warn(peer, "socket error");
}
bgp_fsm(peer, EVNT_CON_OPENFAIL);
} else
@@ -1065,9 +1065,9 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *peer)
if (pfd->revents & POLLOUT && peer->wbuf.queued) {
if ((error = msgbuf_write(&peer->wbuf)) < 0) {
if (error == -2)
- log_peer_errx(peer, "Connection closed");
+ log_peer_warnx(peer, "Connection closed");
else
- log_peer_err(peer, "Write error");
+ log_peer_warn(peer, "Write error");
bgp_fsm(peer, EVNT_CON_FATAL);
}
if (!(pfd->revents & POLLIN))
@@ -1079,7 +1079,7 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *peer)
sizeof(peer->rbuf->buf) - peer->rbuf->wpos)) ==
-1) {
if (errno != EINTR) {
- log_peer_err(peer, "read error");
+ log_peer_warn(peer, "read error");
bgp_fsm(peer, EVNT_CON_FATAL);
}
return (1);
@@ -1163,7 +1163,7 @@ parse_header(struct peer *peer, u_char *data, u_int16_t *len, u_int8_t *type)
p = data;
for (i = 0; i < 16; i++) {
if (memcmp(p, &one, 1)) {
- log_peer_errx(peer, "received message: sync error");
+ log_peer_warnx(peer, "received message: sync error");
session_notification(peer, ERR_HEADER, ERR_HDR_SYNC,
NULL, 0);
bgp_fsm(peer, EVNT_CON_FATAL);
@@ -1177,7 +1177,7 @@ parse_header(struct peer *peer, u_char *data, u_int16_t *len, u_int8_t *type)
memcpy(type, p, 1);
if (*len < MSGSIZE_HEADER || *len > MAX_PKTSIZE) {
- log_peer_errx(peer, "received message: illegal length: %u byte",
+ log_peer_warnx(peer, "received message: illegal length: %u byte",
*len);
session_notification(peer, ERR_HEADER, ERR_HDR_LEN,
&olen, sizeof(olen));
@@ -1187,7 +1187,7 @@ parse_header(struct peer *peer, u_char *data, u_int16_t *len, u_int8_t *type)
switch (*type) {
case OPEN:
if (*len < MSGSIZE_OPEN_MIN) {
- log_peer_errx(peer,
+ log_peer_warnx(peer,
"received OPEN: illegal len: %u byte", *len);
session_notification(peer, ERR_HEADER, ERR_HDR_LEN,
&olen, sizeof(olen));
@@ -1196,7 +1196,7 @@ parse_header(struct peer *peer, u_char *data, u_int16_t *len, u_int8_t *type)
break;
case NOTIFICATION:
if (*len < MSGSIZE_NOTIFICATION_MIN) {
- log_peer_errx(peer,
+ log_peer_warnx(peer,
"received NOTIFICATION: illegal len: %u byte",
*len);
session_notification(peer, ERR_HEADER, ERR_HDR_LEN,
@@ -1206,7 +1206,7 @@ parse_header(struct peer *peer, u_char *data, u_int16_t *len, u_int8_t *type)
break;
case UPDATE:
if (*len < MSGSIZE_UPDATE_MIN) {
- log_peer_errx(peer,
+ log_peer_warnx(peer,
"received UPDATE: illegal len: %u byte", *len);
session_notification(peer, ERR_HEADER, ERR_HDR_LEN,
&olen, sizeof(olen));
@@ -1215,7 +1215,7 @@ parse_header(struct peer *peer, u_char *data, u_int16_t *len, u_int8_t *type)
break;
case KEEPALIVE:
if (*len != MSGSIZE_KEEPALIVE) {
- log_peer_errx(peer,
+ log_peer_warnx(peer,
"received KEEPALIVE: illegal len: %u byte", *len);
session_notification(peer, ERR_HEADER, ERR_HDR_LEN,
&olen, sizeof(olen));
@@ -1223,7 +1223,7 @@ parse_header(struct peer *peer, u_char *data, u_int16_t *len, u_int8_t *type)
}
break;
default:
- log_peer_errx(peer, "received msg with unknown type %u", *type);
+ log_peer_warnx(peer, "received msg with unknown type %u", *type);
session_notification(peer, ERR_HEADER, ERR_HDR_TYPE,
type, 1);
return (-1);
@@ -1252,7 +1252,7 @@ parse_open(struct peer *peer)
if (version != BGP_VERSION) {
if (version > BGP_VERSION)
- log_peer_errx(peer,
+ log_peer_warnx(peer,
"peer wants unrecognized version %u", version);
session_notification(peer, ERR_OPEN,
ERR_OPEN_VERSION, &version, sizeof(version));
@@ -1263,7 +1263,7 @@ parse_open(struct peer *peer)
p += sizeof(as);
if (peer->conf.remote_as != ntohs(as)) {
- log_peer_errx(peer, "peer AS %u unacceptable", ntohs(as));
+ log_peer_warnx(peer, "peer AS %u unacceptable", ntohs(as));
session_notification(peer, ERR_OPEN, ERR_OPEN_AS, NULL, 0);
return (-1);
}
@@ -1273,7 +1273,7 @@ parse_open(struct peer *peer)
holdtime = ntohs(oholdtime);
if (holdtime && holdtime < peer->conf.min_holdtime) {
- log_peer_errx(peer, "peer requests unacceptable holdtime %u",
+ log_peer_warnx(peer, "peer requests unacceptable holdtime %u",
holdtime);
session_notification(peer, ERR_OPEN, ERR_OPEN_HOLDTIME,
NULL, 0);
@@ -1293,7 +1293,7 @@ parse_open(struct peer *peer)
/* check bgpid for validity, must be a valid ip address - HOW? */
/* if ( bgpid invalid ) {
- log_peer_errx(peer, "peer BGPID %lu unacceptable",
+ log_peer_warnx(peer, "peer BGPID %lu unacceptable",
ntohl(bgpid));
session_notification(peer, ERR_OPEN, ERR_OPEN_BGPID,
NULL, 0);
diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h
index 540049ff287..3d245aa75f7 100644
--- a/usr.sbin/bgpd/session.h
+++ b/usr.sbin/bgpd/session.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.h,v 1.20 2004/01/17 19:35:36 claudio Exp $ */
+/* $OpenBSD: session.h,v 1.21 2004/01/22 19:07:34 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -162,8 +162,8 @@ struct peer *getpeerbyip(in_addr_t);
int imsg_compose_parent(int, pid_t, void *, u_int16_t);
/* log.c */
-void log_peer_err(const struct peer *, const char *, ...);
-void log_peer_errx(const struct peer *, const char *, ...);
+void log_peer_warn(const struct peer *, const char *, ...);
+void log_peer_warnx(const struct peer *, const char *, ...);
void log_statechange(const struct peer *, enum session_state,
enum session_events);
void log_notification(const struct peer *, u_int8_t, u_int8_t,