mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
socket-util: Remove 'passcred' parameter from make_unix_socket().
Nothing in the tree ever tries to send or receive credentials over a Unix domain socket so there's no point in configuring them to be received. Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -384,12 +384,11 @@ bind_unix_socket(int fd, struct sockaddr *sun, socklen_t sun_len)
|
||||
/* Creates a Unix domain socket in the given 'style' (either SOCK_DGRAM or
|
||||
* SOCK_STREAM) that is bound to '*bind_path' (if 'bind_path' is non-null) and
|
||||
* connected to '*connect_path' (if 'connect_path' is non-null). If 'nonblock'
|
||||
* is true, the socket is made non-blocking. If 'passcred' is true, the socket
|
||||
* is configured to receive SCM_CREDENTIALS control messages.
|
||||
* is true, the socket is made non-blocking.
|
||||
*
|
||||
* Returns the socket's fd if successful, otherwise a negative errno value. */
|
||||
int
|
||||
make_unix_socket(int style, bool nonblock, bool passcred OVS_UNUSED,
|
||||
make_unix_socket(int style, bool nonblock,
|
||||
const char *bind_path, const char *connect_path)
|
||||
{
|
||||
int error;
|
||||
@@ -457,16 +456,6 @@ make_unix_socket(int style, bool nonblock, bool passcred OVS_UNUSED,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SCM_CREDENTIALS
|
||||
if (passcred) {
|
||||
int enable = 1;
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable))) {
|
||||
error = errno;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return fd;
|
||||
|
||||
error:
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc.
|
||||
* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,7 +38,7 @@ int get_socket_rcvbuf(int sock);
|
||||
int check_connection_completion(int fd);
|
||||
int drain_rcvbuf(int fd);
|
||||
void drain_fd(int fd, size_t n_packets);
|
||||
int make_unix_socket(int style, bool nonblock, bool passcred,
|
||||
int make_unix_socket(int style, bool nonblock,
|
||||
const char *bind_path, const char *connect_path);
|
||||
int get_unix_name_len(socklen_t sun_len);
|
||||
ovs_be32 guess_netmask(ovs_be32 ip);
|
||||
|
@@ -46,7 +46,7 @@ unix_open(const char *name, char *suffix, struct stream **streamp,
|
||||
const char *connect_path = suffix;
|
||||
int fd;
|
||||
|
||||
fd = make_unix_socket(SOCK_STREAM, true, false, NULL, connect_path);
|
||||
fd = make_unix_socket(SOCK_STREAM, true, NULL, connect_path);
|
||||
if (fd < 0) {
|
||||
VLOG_ERR("%s: connection failed (%s)", connect_path, strerror(-fd));
|
||||
return -fd;
|
||||
@@ -79,7 +79,7 @@ punix_open(const char *name OVS_UNUSED, char *suffix,
|
||||
{
|
||||
int fd, error;
|
||||
|
||||
fd = make_unix_socket(SOCK_STREAM, true, true, suffix, NULL);
|
||||
fd = make_unix_socket(SOCK_STREAM, true, suffix, NULL);
|
||||
if (fd < 0) {
|
||||
VLOG_ERR("%s: binding failed: %s", suffix, strerror(errno));
|
||||
return errno;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010 Nicira, Inc.
|
||||
* Copyright (c) 2010, 2012 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,7 +42,7 @@ main(int argc, char *argv[])
|
||||
alarm(5);
|
||||
|
||||
/* Create a listening socket under name 'sockname1'. */
|
||||
sock1 = make_unix_socket(SOCK_STREAM, false, false, sockname1, NULL);
|
||||
sock1 = make_unix_socket(SOCK_STREAM, false, sockname1, NULL);
|
||||
if (sock1 < 0) {
|
||||
ovs_fatal(-sock1, "%s: bind failed", sockname1);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ main(int argc, char *argv[])
|
||||
|
||||
/* Connect to 'sockname2' (which should be the same file, perhaps under a
|
||||
* different name). */
|
||||
sock2 = make_unix_socket(SOCK_STREAM, false, false, NULL, sockname2);
|
||||
sock2 = make_unix_socket(SOCK_STREAM, false, NULL, sockname2);
|
||||
if (sock2 < 0) {
|
||||
ovs_fatal(-sock2, "%s: connect failed", sockname2);
|
||||
}
|
||||
|
Reference in New Issue
Block a user