Looks good thanks. Do you happen to know why punix_open() was passing true for the parameter()?
Ethan On Tue, May 22, 2012 at 5:19 PM, Ben Pfaff <b...@nicira.com> wrote: > 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 <b...@nicira.com> > --- > lib/socket-util.c | 15 ++------------- > lib/socket-util.h | 4 ++-- > lib/stream-unix.c | 4 ++-- > tests/test-unix-socket.c | 6 +++--- > 4 files changed, 9 insertions(+), 20 deletions(-) > > diff --git a/lib/socket-util.c b/lib/socket-util.c > index 82a33c2..53d0fb6 100644 > --- a/lib/socket-util.c > +++ b/lib/socket-util.c > @@ -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: > diff --git a/lib/socket-util.h b/lib/socket-util.h > index 56c72cd..4a1df12 100644 > --- a/lib/socket-util.h > +++ b/lib/socket-util.h > @@ -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); > diff --git a/lib/stream-unix.c b/lib/stream-unix.c > index 99a9962..689dcf1 100644 > --- a/lib/stream-unix.c > +++ b/lib/stream-unix.c > @@ -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; > diff --git a/tests/test-unix-socket.c b/tests/test-unix-socket.c > index 9279fda..c5c6a2b 100644 > --- a/tests/test-unix-socket.c > +++ b/tests/test-unix-socket.c > @@ -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); > } > -- > 1.7.2.5 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev