[ovs-dev] [sFlow 7/7] netflow: Break out code for sending packets into a new "collectors" module.

Justin Pettit jpettit at nicira.com
Mon Nov 23 21:23:56 UTC 2009


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

> +/* Opens the targets specified in 'targets' for sending UDP packets.  This is
> + * useful for e.g. sending NetFlow or sFlow packets.  Returns 0 if successful,
> + * otherwise a positive errno value if opening at least one collector failed.
> + *
> + * Each target in 'targets' should be a string in the format "[<port>][:<ip>]".

I think you grabbed the description from inet_open_passive() instead of inet_open_active().  I believe that should read "<host>[:<port>]".

> +
> +        error = inet_open_active(SOCK_DGRAM, name, default_port, NULL, &fd);
> +        if (!error) {
> +            c->fds[c->n_fds++] = fd;

I think you want to do the same sort of check here as you did in the previous patch, since inet_open_active() could return EAGAIN and leak the file descriptor.

Otherwise, looks good.

--Justin






More information about the dev mailing list