[ovs-dev] [sFlow 5/7] socket-util: Generalize tcp_open_*() to UDP, as inet_open_*().

Justin Pettit jpettit at nicira.com
Mon Nov 23 19:19:48 UTC 2009


On Nov 19, 2009, at 1:49 PM, Ben Pfaff wrote:

> diff --git a/lib/socket-util.c b/lib/socket-util.c
> index e400bb5..0b3be44 100644
> --- a/lib/socket-util.c
> +++ b/lib/socket-util.c
> @@ -291,10 +291,12 @@ guess_netmask(uint32_t ip)
>             : htonl(0));                          /* ??? */
> }
> 
> -/* Opens a non-blocking TCP socket and connects to 'target', which should be a
> - * string in the format "<host>[:<port>]".  <host> is required.  If
> - * 'default_port' is nonzero then <port> is optional and defaults to
> - * 'default_port'.
> +/* Opens a non-blocking IPV4 socket of the specified 'style' and connects to

This is extremely minor, but the "V" is capitalized here, and lower-case in the inet_open_passive comment.  I prefer the lower case form.

> int
> -tcp_open_active(const char *target_, uint16_t default_port,
> -                struct sockaddr_in *sinp, int *fdp)
> +inet_open_active(int style, const char *target_, uint16_t default_port,
> +                 struct sockaddr_in *sinp, int *fdp)

This function is IPv4-specific, but the name sounds more general to me.  If/when we support IPv6, will we be able to use this prototype?

These are really just nits.  Looks good.

--Justin






More information about the dev mailing list