Looks good, thanks. Ethan
On Fri, Aug 17, 2012 at 4:34 PM, Ben Pfaff <b...@nicira.com> wrote: > Some Open vSwitch utilities can do useful work when they are not run as > root. Without this commit, these utilities will log a warning on failure > to use the SO_RCVBUFFORCE socket option if they open any Netlink sockets. > This will always happen, it does not report anything unexpected or > fixable as non-root, and sometimes it makes users wonder if something is > wrong, so there is no benefit to logging it. This commit drops it in that > case. > > Signed-off-by: Ben Pfaff <b...@nicira.com> > --- > lib/netlink-socket.c | 8 ++++++-- > 1 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c > index 49a8493..5ab27a7 100644 > --- a/lib/netlink-socket.c > +++ b/lib/netlink-socket.c > @@ -129,8 +129,12 @@ nl_sock_create(int protocol, struct nl_sock **sockp) > rcvbuf = 1024 * 1024; > if (setsockopt(sock->fd, SOL_SOCKET, SO_RCVBUFFORCE, > &rcvbuf, sizeof rcvbuf)) { > - VLOG_WARN_RL(&rl, "setting %d-byte socket receive buffer failed > (%s)", > - rcvbuf, strerror(errno)); > + /* Only root can use SO_RCVBUFFORCE. Everyone else gets EPERM. > + * Warn only if the failure is therefore unexpected. */ > + if (errno != EPERM || !getuid()) { > + VLOG_WARN_RL(&rl, "setting %d-byte socket receive buffer failed " > + "(%s)", rcvbuf, strerror(errno)); > + } > } > > retval = get_socket_rcvbuf(sock->fd); > -- > 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