lib/netdev-bsd: simplify multiple struct definitions

Use a macro helper to initialize different netdev_*_class for bsd, like
in lib/netdev-linux.c
This helps adding other netdev types for bsd

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/pcap-file: add 'ovs_' prefix to pcap functions

This is done to avoid collisions and confusions with libpcap symbols,
like pcap_read()

Signed-off-by: Luigi Rizzo <rizzo@iet.unipi.it>
Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
dpif-linux: Fix flow_dump_next annotation.

The 'dpif_' parameter of dpif_linux_flow_dump_next() was marked as
OVS_UNUSED, even though it's passed down to dpif_linux_flow_get__().

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath: Fix ovs_dp_cmd_msg_size()

commit c58cc9a460fd158e5250e59902e96ac677dc115f (datapath: Allow user space to
announce ability to accept unaligned Netlink messages) introduced
OVS_DP_ATTR_USER_FEATURES netlink attribute in datapath responses,
but the attribute size was not taken into account in ovs_dp_cmd_msg_size().

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath: use const in some local vars and casts

In few functions, const formal parameters are assigned or cast to
non-const.
These changes suppress warnings if compiled with -Wcast-qual.

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
netlink: Rename 'dump->seq' to 'dump->nl_seq'

An upcoming patch will introduce another, completely unrelated seq to
'struct nl_dump'. Giving this one a better name should reduce confusion.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
netdev-dummy: Add support for active stream

The dummy ports thus far only support passive connections. It can
listen for multiple incoming connection requests but not make active
connections. This patch adds support of active stream, so that a
dummy port can be configured with either passive or active connections.

The net result is that dummy ports can now connect to each other,
without being patch ports. This feature will be useful in adding test
cases of future commits.

Signed-off-by: Andy Zhou <azhou@nicira.com>
ofproto: Handle negative number of threads.

As of now, setting other_config:n-handler-threads to a negative
value causes ovs-vswitchd to crash.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
syslog: Add LOG_LOCALX definitions.

LOG_LOCAL0 is used in lib/vlog.c.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
syslog: Provide stub functions for openlog and syslog.

One option to implement openlog and syslog functionality in Windows
is to use windows event logger. But it looks like it involves changing
registry settings and in general looks complicated.

For the time being, do nothing for syslog. All the information needed for
debugging will be present through the 'file' option anyways.

We can start OVS daemons on Windows with "-vfile:info -vsyslog:off".

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
daemon: Cleanup some functions.

Some functions are unused and some functions can be
declared as static.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ovs-dev.py: Only build the Linux datapath with GCC.

In practice, Linux kernel modules are only built with GCC, so it
doesn't make much sense to spend time compiling them with clang.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
getopt_long: Copy over the implementation from netbsd.

Windows does not have a getopt_long function. This commit
copies over the getopt_long implementation from netbsd with
some minor modifications and is used only on Windows platform.

Modifications on top of the version in NetBSD repo.
* Remove header files not available in Visual Studio.
* Remove some unwanted #defines.
* Add Open vSwitch specific header files like config.h, vlog.h, util.h
* Add the following #define's
define __UNCONST(a)    ((void *)(unsigned long)(const void *)(a))
define _DIAGASSERT(q) ovs_assert(q)
define warnx VLOG_WARN
* Add extern declaration in getopt.h for optarg, optind.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>