summaryrefslogtreecommitdiff
path: root/lib/stream-ssl.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-01-07 13:55:35 -0800
committerBen Pfaff <blp@nicira.com>2010-01-07 15:00:51 -0800
commit42967038cbbb56b894e99eb17e5de7cfb11de9cf (patch)
tree5a9a1eb979fb339908b91bbd23e2f699c0e46f7f /lib/stream-ssl.c
parent36775dad3505929f8370166c33e8e0f04ca96c1c (diff)
downloadopenvswitch-42967038cbbb56b894e99eb17e5de7cfb11de9cf.tar.gz
stream: Make passive SSL and TCP streams report bound addresses as names.
The names of passive SSL and TCP streams were being poorly reported: TCP always simply reported "ptcp", and SSL reported whatever was passed in. This commit makes them report the addresses that were actually bound by the TCP/IP stack, which is more useful for testing, debugging, and logging.
Diffstat (limited to 'lib/stream-ssl.c')
-rw-r--r--lib/stream-ssl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c
index 442a1e6a5..11bbf4ada 100644
--- a/lib/stream-ssl.c
+++ b/lib/stream-ssl.c
@@ -710,9 +710,11 @@ pssl_pstream_cast(struct pstream *pstream)
}
static int
-pssl_open(const char *name, char *suffix, struct pstream **pstreamp)
+pssl_open(const char *name UNUSED, char *suffix, struct pstream **pstreamp)
{
struct pssl_pstream *pssl;
+ struct sockaddr_in sin;
+ char bound_name[128];
int retval;
int fd;
@@ -725,9 +727,11 @@ pssl_open(const char *name, char *suffix, struct pstream **pstreamp)
if (fd < 0) {
return -fd;
}
+ sprintf(bound_name, "pssl:%"PRIu16":"IP_FMT,
+ ntohs(sin.sin_port), IP_ARGS(&sin.sin_addr.s_addr));
pssl = xmalloc(sizeof *pssl);
- pstream_init(&pssl->pstream, &pssl_pstream_class, name);
+ pstream_init(&pssl->pstream, &pssl_pstream_class, bound_name);
pssl->fd = fd;
*pstreamp = &pssl->pstream;
return 0;