aboutsummaryrefslogtreecommitdiff
path: root/lib/socket-util.h
AgeCommit message (Collapse)Author
2013-08-09netdev-linux, netdev-bsd: Make access to AF_INET socket thread-safe.Ben Pfaff
The only uses of 'af_inet_sock', in both drivers, were ioctls, so it seemed like a good abstraction to write a function that just does such an ioctl, and to factor out shared code into socket-util. Signed-off-by: Ben Pfaff <blp@nicira.com> CC: Ed Maste <emaste@freebsd.org>
2013-04-22include some headers to satisfy header file dependencies on NetBSD-6YAMAMOTO Takashi
while this change don't seem to be necessary on NetBSD-current, NetBSD-6 is the latest release at this point. Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-11-20socket-util: Remove get_socket_error().Ben Pfaff
It has no remaining users. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
2012-09-28lib: Add xpipe_nonblocking helperEd Maste
Signed-off-by: Ed Maste <emaste@adaranet.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-09-26socket-util: export set_dscp()Isaku Yamahata
It will be used later for dynamic dscp change to listening socket. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-07-18socket-util: Add functions for sending fds over Unix domain sockets.Ben Pfaff
These will be used in upcoming commits. This commit also adds corresponding definitions to the "sparse" header, so that sparse still works. Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-07-18socket-util: New function xset_nonblocking().Ben Pfaff
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-07-18socket-util: Remove 'passcred' parameter from make_unix_socket().Ben Pfaff
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>
2012-05-02Global replace of Nicira Networks.Raju Subramanian
Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc. Feature #10593 Signed-off-by: Raju Subramanian <rsubramanian@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-04-17vswitch: Use consistent representation of DSCP bits.Ethan Jackson
There are two sensible ways to represent the 6 DSCP bits of an IP packet. One could represent them as an integer in the range 0 to 63. Or one could represent them as they would appear in the tos field (0 to 63) << 2. Before this patch, OVS had used the former method for the DSCP bits in the Queue Table, and the latter for the DSCP in the Controller and Manager tables. Since the ability to set DSCP bits in the Controller and Manager tables is so new that it hasn't been released yet, this patch changes it to use the existing style employed in the Queue table. Hopefully this should make the code and configuration less confusing. Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-04-17socket-util: Remove DSCP_INVALID.Ethan Jackson
The DSCP_INVALID flag allowed callers to prevent socket-util from modify the DSCP bits of newly created sockets. However, the two really important callers (implementations of the controller and manager tables) never used it. Furthermore, the other callers would be fine always setting the DSCP bits to zero. This patch removes the DSCP_INVALID option in an effort to simplify the code. Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-03-23Allow configuring DSCP on controller and manager connections.Mehak Mahajan
The changes allow the user to specify a separate dscp value for the controller connection and the manager connection. The value will take effect on resetting the connections. If no value is specified a default value of 192 is chosen for each of the connections. Feature #10074 Requested-by: Rajiv Ramanathan <rramanathan@nicira.com> Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
2011-10-14socket-util: New function get_socket_rcvbuf().Ben Pfaff
This will be used in an upcoming commit.
2011-09-22Include <sys/time.h> in socket-util.hSimon Horman
sys/time.h appears to be required for a definition of timespec on Android. Observed when compiling using the Android NDK r6b (Android API level 13).
2011-09-22Include <sys/socket.h> in socket-util.hSimon Horman
This appears to be necessary to get a definition of socket_t when compiling using the Android NDK r6b (Android API level 13).
2011-09-13socket-util: inet_parse_passive() had incorrect argument type.Ethan Jackson
This patch fixes the following compiler warning: lib/socket-util.c:621:5: error: comparison is always false due to limited range of data type [-Werror=type-limits]
2011-07-27socket-util: New function lookup_hostname().Ben Pfaff
This is equivalent to lookup_ip() except that it accepts DNS names also.
2011-07-27socket-util: Factor inet_parse_passive() out of inet_open_passive().Ben Pfaff
2011-05-16Convert remaining network-byte-order "uint<N>_t"s into "ovs_be<N>"s.Ben Pfaff
I looked at almost every uint<N>_t in the tree to determine whether it was really in network byte order, and converted the ones that were. The only remaining ones, modulo my mistakes, are in openflow.h. I'm not sure whether we should convert those, because there might be some value in remaining close to upstream for this header.
2011-05-13poll-loop: Make wakeup logging more portable and easier to understand.Ben Pfaff
Until now, when the poll_loop module's log level was turned up to "debug", it would log a backtrace of the call stack for the event that caused poll() to wake up in poll_block(). This was pretty useful from time to time to find out why ovs-vswitchd was using more CPU than expected, because we could find out what was causing it to wake up. But there were some issues. One is simply that the backtrace was printed as a series of hexadecimal numbers, so GDB or another debugger was needed to translate it into human-readable format. Compiler optimizations meant that even the human-readable backtrace wasn't, in my experience, as helpful as it could have been. And, of course, one needed to have the binary to interpret the backtrace. When the backtrace couldn't be interpreted or wasn't meaningful, there was essentially nothing to fall back on. This commit changes the way that "debug" logging for poll_block() wakeups works. Instead of logging a backtrace, it logs the source code file name and line number of the call to a poll_loop function, using __FILE__ and __LINE__. This is by itself much more meaningful than a sequence of hexadecimal numbers, since no additional interpretation is necessary. It can be useful even if the Open vSwitch version is only approximately known. In addition to the file and line, this commit adds, for wakeups caused by file descriptors, information about the file descriptor itself: what kind of file it is (regular file, directory, socket, etc.), the name of the file (on Linux only), and the local and remote endpoints for socket file descriptors. Here are a few examples of the new output format: 932-ms timeout at ../ofproto/in-band.c:507 [POLLIN] on fd 20 (192.168.0.20:35388<->192.168.0.3:6633) at ../lib/stream-fd.c:149 [POLLIN] on fd 7 (FIFO pipe:[48049]) at ../lib/fatal-signal.c:168
2011-04-04Log anything that could prevent a daemon from starting.Ben Pfaff
If a daemon doesn't start, we need to know why. Being able to consistently consult the log to find out is helpful.
2011-02-02nicira-ext: Support matching IPv6 traffic.Justin Pettit
Provides ability to match over IPv6 traffic in the same manner as IPv4. Currently, the matching fields include: - IPv6 source and destination addresses (ipv6_src and ipv6_dst) - Traffic Class (nw_tos) - Next Header (nw_proto) - ICMPv6 Type and Code (icmp_type and icmp_code) - TCP and UDP Ports over IPv6 (tp_src and tp_dst) When defining IPv6 rules, the Nicira Extensible Match (NXM) extension to OVS must be used. Signed-off-by: Justin Pettit <jpettit@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2010-04-26socket-util: Move get_mtime() here from stream-ssl.Ben Pfaff
An upcoming commit will add a new user for this function in another file, so export it and move it to a common library file.
2010-04-26socket-util: Factor out new function inet_parse_active().Ben Pfaff
An upcoming commit needs to parse connection strings without connecting to them, so this change enables that.
2010-02-15ovsdb: Factor out code to fsync a file's containing directory.Ben Pfaff
In an upcoming commit, another function wants to do the same thing, so break it out into a helper function.
2010-01-07socket-util: Make inet_open_passive() pass back the bound address.Ben Pfaff
This feature is useful in an upcoming commit.
2010-01-07socket-util: Allow binding without a port number in inet_open_passive().Ben Pfaff
The test-vconn program binds a socket to a nonspecific port number. To add SSL support to this program, it needs to be able to use SSL, and the stream library is the easiest way to do that. But the stream library can't bind to a nonspecific port. This commit adds that feature, by adding it to the function that the stream SSL library uses as a building block.
2009-11-23socket-util: Generalize tcp_open_*() to UDP, as inet_open_*().Ben Pfaff
The tcp_open_active() and tcp_open_passive() functions don't really have any strong dependencies on TCP. With a couple of simple changes they can be used for UDP also. Since this is useful for Netflow, this commit does so.
2009-07-16Merge citrix branch into master.Ben Pfaff
2009-07-16Add function get_null_fd(), to reduce code redundancy.Ben Pfaff
2009-06-15Merge changes from citrix branch into master.Ben Pfaff
2009-06-15Update primary code license to Apache 2.0.Ben Pfaff
2009-06-12vconn: Factor out common code from TCP and SSL vconns.Ben Pfaff
The TCP and SSL vconn implementations had a lot of common code to make and accept TCP connections, which this commit factors out into common functions in socket-util.c. Also adds the ability to bind ptcp and pssl vconns to a particular IP address instead of the wildcard address.
2009-07-08Import from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45.v0.90.0Ben Pfaff