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

socket-util: Log the kernel assigned port number when asked.

So far, we log the kernel assigned port number when the port number is
not specified. On Windows, this happens multiple times because "unix"
sockets are implemented internally via TCP ports. This means that many tests,
specially the ovs-ofctl monitor tests, need to filter out the
additional messages. Doing that is not a big deal, but I think it will
keep manifesting in future tests added by Linux developers.

With this commit, we simply don't print the kernel assigned TCP ports
on Windows when done for "unix" sockets.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Gurucharan Shetty
2014-05-19 11:58:14 -07:00
parent 5e3ee29da1
commit b52ecd9610
10 changed files with 40 additions and 26 deletions

View File

@@ -154,17 +154,18 @@ static int ptcp_accept(int fd, const struct sockaddr_storage *,
size_t, struct stream **streamp);
static int
ptcp_open(const char *name OVS_UNUSED, char *suffix, struct pstream **pstreamp,
uint8_t dscp)
new_pstream(char *suffix, struct pstream **pstreamp, int dscp,
bool kernel_print_port)
{
char bound_name[SS_NTOP_BUFSIZE + 16];
char addrbuf[SS_NTOP_BUFSIZE];
struct sockaddr_storage ss;
uint16_t port;
int error;
uint16_t port;
int fd;
fd = inet_open_passive(SOCK_STREAM, suffix, -1, &ss, dscp);
fd = inet_open_passive(SOCK_STREAM, suffix, -1, &ss, dscp,
kernel_print_port);
if (fd < 0) {
return -fd;
}
@@ -181,6 +182,13 @@ ptcp_open(const char *name OVS_UNUSED, char *suffix, struct pstream **pstreamp,
return error;
}
static int
ptcp_open(const char *name OVS_UNUSED, char *suffix, struct pstream **pstreamp,
uint8_t dscp)
{
return new_pstream(suffix, pstreamp, dscp, true);
}
static int
ptcp_accept(int fd, const struct sockaddr_storage *ss,
size_t ss_len OVS_UNUSED, struct stream **streamp)
@@ -215,7 +223,8 @@ pwindows_open(const char *name OVS_UNUSED, char *suffix,
struct pstream *listener;
suffix_new = xstrdup("0:127.0.0.1");
error = ptcp_open(name, suffix_new, pstreamp, dscp);
error = new_pstream(suffix_new, pstreamp, dscp, false);
if (error) {
goto exit;
}