diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2013-08-12 11:54:25 +0200 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2013-08-15 23:34:23 +0200 |
commit | 6aff4b5ce86b2532edf973190c287bda4f9c521a (patch) | |
tree | a90aad2e9fb5795a5864c00f52b151cdf66f857e | |
parent | 0a09b02dcf6d08f652fc0ec7410f84f77338cfe0 (diff) | |
download | strongswan-6aff4b5ce86b2532edf973190c287bda4f9c521a.tar.bz2 strongswan-6aff4b5ce86b2532edf973190c287bda4f9c521a.tar.xz |
Show host address of peer connecting to PT-TLS socket
-rw-r--r-- | src/libcharon/plugins/tnc_pdp/tnc_pdp.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libcharon/plugins/tnc_pdp/tnc_pdp.c b/src/libcharon/plugins/tnc_pdp/tnc_pdp.c index 74f5357f1..2e9c33967 100644 --- a/src/libcharon/plugins/tnc_pdp/tnc_pdp.c +++ b/src/libcharon/plugins/tnc_pdp/tnc_pdp.c @@ -607,17 +607,23 @@ static bool pt_tls_receive_more(pt_tls_server_t *this, int fd, static bool pt_tls_receive(private_tnc_pdp_t *this, int fd, watcher_event_t event) { int pt_tls_fd; + struct sockaddr_storage addr; + socklen_t addrlen = sizeof(addr); identification_t *peer; + host_t *host; pt_tls_server_t *pt_tls; tnccs_t *tnccs; pt_tls_auth_t auth = PT_TLS_AUTH_TLS_OR_SASL; - pt_tls_fd = accept(fd, NULL, NULL); + pt_tls_fd = accept(fd, (sockaddr_t*)&addr, &addrlen); if (pt_tls_fd == -1) { DBG1(DBG_TNC, "accepting PT-TLS stream failed: %s", strerror(errno)); return FALSE; } + host = host_create_from_sockaddr((sockaddr_t*)&addr); + DBG1(DBG_TNC, "accepting PT-TLS stream from %H", host); + host->destroy(host); /* At this moment the peer identity is not known yet */ peer = identification_create_from_encoding(ID_ANY, chunk_empty), |