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:
@@ -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
|
||||
|
Reference in New Issue
Block a user