2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

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.
This commit is contained in:
Ben Pfaff
2010-01-07 13:55:35 -08:00
parent 36775dad35
commit 42967038cb
2 changed files with 13 additions and 5 deletions

View File

@@ -103,14 +103,18 @@ static int ptcp_accept(int fd, const struct sockaddr *sa, size_t sa_len,
static int
ptcp_open(const char *name UNUSED, char *suffix, struct pstream **pstreamp)
{
struct sockaddr_in sin;
char bound_name[128];
int fd;
fd = inet_open_passive(SOCK_STREAM, suffix, -1, NULL);
fd = inet_open_passive(SOCK_STREAM, suffix, -1, &sin);
if (fd < 0) {
return -fd;
} else {
return new_fd_pstream("ptcp", fd, ptcp_accept, NULL, pstreamp);
}
sprintf(bound_name, "ptcp:%"PRIu16":"IP_FMT,
ntohs(sin.sin_port), IP_ARGS(&sin.sin_addr.s_addr));
return new_fd_pstream(bound_name, fd, ptcp_accept, NULL, pstreamp);
}
static int