]> git.ipfire.org Git - people/ms/strongswan.git/commitdiff
Show host address of peer connecting to PT-TLS socket
authorAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 12 Aug 2013 09:54:25 +0000 (11:54 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 15 Aug 2013 21:34:23 +0000 (23:34 +0200)
src/libcharon/plugins/tnc_pdp/tnc_pdp.c

index 74f5357f12e7be1dac217f9e38ff10fca77102b3..2e9c3396747b2e8747bae54452a4ec556a9b413d 100644 (file)
@@ -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),