summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-04-16 04:47:20 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-04-16 04:47:20 +0000
commit374e97c20bf1b025845062215ef2ff435ede7463 (patch)
tree16b18892e501ca6238d542cde1e97294b54b2005 /usr.sbin/bgpd
parent60fff3a941a1653c5e203b115b3d6abbdef961b6 (diff)
make log_conn_attempt work in an address family independent matter
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/log.c16
-rw-r--r--usr.sbin/bgpd/session.c4
-rw-r--r--usr.sbin/bgpd/session.h4
3 files changed, 13 insertions, 11 deletions
diff --git a/usr.sbin/bgpd/log.c b/usr.sbin/bgpd/log.c
index adb7b9eb139..7273db6472b 100644
--- a/usr.sbin/bgpd/log.c
+++ b/usr.sbin/bgpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.30 2004/03/11 12:41:36 henning Exp $ */
+/* $OpenBSD: log.c,v 1.31 2004/04/16 04:47:19 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -362,14 +362,16 @@ log_notification(const struct peer *peer, u_int8_t errcode, u_int8_t subcode,
}
void
-log_conn_attempt(const struct peer *peer, struct in_addr remote)
+log_conn_attempt(const struct peer *peer, struct sockaddr *sa)
{
- char *p;
+ char *p, buf[48];
- if (peer == NULL) /* connection from non-peer, drop */
- logit(LOG_INFO, "connection from non-peer %s refused",
- inet_ntoa(remote));
- else {
+
+ if (peer == NULL) { /* connection from non-peer, drop */
+ if (inet_ntop(sa->sa_family, sa, buf, sizeof(buf)) == NULL)
+ strlcpy(buf, "(unknown)", sizeof(buf));
+ logit(LOG_INFO, "connection from non-peer %s refused", buf);
+ } else {
p = log_fmt_peer(&peer->conf);
logit(LOG_INFO, "Connection attempt from %s while session is "
"in state %s", p, statenames[peer->state]);
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 0f1d125caa7..af4bceaab25 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.140 2004/04/13 22:53:29 henning Exp $ */
+/* $OpenBSD: session.c,v 1.141 2004/04/16 04:47:19 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -800,7 +800,7 @@ session_accept(int listenfd)
session_socket_blockmode(connfd, BM_NONBLOCK);
bgp_fsm(p, EVNT_CON_OPEN);
} else {
- log_conn_attempt(p, cliaddr.sin_addr);
+ log_conn_attempt(p, (struct sockaddr *)&cliaddr);
shutdown(connfd, SHUT_RDWR);
close(connfd);
}
diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h
index 943bcd1efa2..eb724a3e96d 100644
--- a/usr.sbin/bgpd/session.h
+++ b/usr.sbin/bgpd/session.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.h,v 1.40 2004/04/13 22:53:29 henning Exp $ */
+/* $OpenBSD: session.h,v 1.41 2004/04/16 04:47:19 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -186,7 +186,7 @@ void log_statechange(const struct peer *, enum session_state,
enum session_events);
void log_notification(const struct peer *, u_int8_t, u_int8_t,
u_char *, u_int16_t);
-void log_conn_attempt(const struct peer *, struct in_addr);
+void log_conn_attempt(const struct peer *, struct sockaddr *);
/* parse.y */
int parse_config(char *, struct bgpd_config *, struct mrt_head *,