build: Add travis continuous integration support

This enables the use of travis-ci via github. Linking any ovs
github repo to travis-ci [0] will automatically lead to a build
and testsuite run being triggered for each new commit or pull
requests against the repo.

The introduction of any warnings will cause the build to fail as
both gcc and clang are invoked with -Werror.

The build matrix currently includes:
  * --disable-ssl
  * --with-linux=linux-3.14.7
  * --with-dpdk=1.7.0

Each of these builds is performed with gcc+sparse and clang. The
testsuite is only run for the --with-linux build to keep the total
build time on an acceptable level.

Build failures are reported to the author and commiter by email,
through the travis-ci web UI, and in the github pull request.

A full build report example can be found here [1]

[0] http://travis-ci.org/
[1] https://travis-ci.org/tgraf/ovs/builds/33485228

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif-xlate: Only learn MAC addresses upon handling packets.

MAC learning, like flow entry learning via the "learn" action, should only
happen if a packet was actually received.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
ofproto-dpif-xlate: Skip pushing stats if there are no packets to push.

xlate_push_stats() mostly does nothing if 'stats->n_packets' is 0.  This
commit allows it to skip more complicated internal logic in that case.

The one case I see in which xlate_push_stats() does do something if
'stats->n_packets' is 0 is in the case of a cached fin_timeout translation.
That translation changes the idle and hard timeouts of a flow if tcp_flags
has FIN or RST set, even if n_packets is 0.  But I don't think that can
happen anyway; how would FIN or RST be set without receiving a packet?

More broadly, the xlate_push_stats handles two functions - pushing stats
and implementing side-effects from actions. If there are no packets, the
stats shouldn't need updating. If there were no packets, then no packets
could have hit actions for things such as mac learning/openflow learning,
so xlate_push_stats() should be a no-op.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
ofproto-dpif-xlate: Drop 'may_learn' parameter from xlate_push_stats().

Both existing callers calculated 'may_learn' as 'stats->n_packets > 0', so
it was redundant.  Because xlate_push_stats() is now entirely a no-op if
'stats->n_packets' is 0, we can now delete the tests entirely from the
cases that previously only ran if 'may_learn'.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
datapath: Remove flow member from struct ovs_skb_cb

struct ovs_skb_cb is full on kernels < 3.11 due to compatibility code.
This patch removes the 'flow' member in order to make room for data
needed by layer 3 flow/port support that will be added in an upcoming
patch.  The 'flow' memeber was chosen for removal because it's only used
in ovs_execute_actions().

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
debian: Fix debian packaging build failures due to dot-files in tree.

openvswitch/* no longer matches all the files since commit 826bc7b61345a5d
(build: Add travis continuous integration support) added files with names
beginning with ".".

VMware-BZ: #1298353
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
debian: Ignore openvswitch-vtep directory generated during packaging.

Signed-off-by: Ben Pfaff <blp@nicira.com>
odp-util: Initialize tun_key and tun_key_mask

tun_key_to_attr() accesses tp_src and tp_dst which are currently
uinitialized.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
debian: Really fix packaging given new dot-files.

commit a5c1096abb1 (debian: Fix debian packaging build failures due to
dot-files in tree.) contained an error that I've made before and should
have noticed.  This commit should really fix the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
miniflow: Remove unused values_inline branch from miniflow_move()

The branch is unused as size < sizeof dst->inline_values must
always be true for inlined values. Hitting the branch would lead
to corruption as inline_values is accessed out of bounds.

Remove branch and add assertion.

Cc: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
json: Fix leaked nodes in json_hash_object()

nodes is allocated through shash_sort() but never freed.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
vswitch.xml: Fix a typo.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
test-controller: Rename to ovs-testcontroller, again install.

mininet uses the Open vSwitch controller by default, for testing.

CC: 757761@bugs.debian.org
Reported-at: https://bugs.debian.org/757761
Requested-by: Tomasz Buchert <tomasz.buchert@inria.fr>
Requested-by: Dariusz Dwornikowski <dariusz.dwornikowski@cs.put.poznan.pl>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
build: Use errtrace to simplify travis-ci failure detection

Causes the build script to fail if any command inside the
script returns nonzero.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
odp-util: Only add recirc_id mask to Netlink message if mask is provided

Current unconditional call may result in NULL being passed to
nl_msg_put_u32().

Cc: Andy Zhou <azhou@nicira.com>
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
dpif-netdev: Fix leaked port, port->rxq, port->type in error path

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
[blp@nicira.com added free of port->type]
Signed-off-by: Ben Pfaff <blp@nicira.com>
debian: Fix cross build.

Cross-building openvswitch with debuild -aARCH (or equivalent) fails
because the target architecture is not getting passed to configure.
Thus binaries like ovs-appctl get built using the build host
architecture.

Signed-off-by: Ed Swierk <eswierk@skyportsystems.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
AUTHORS: Add Ed Swierk.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Revert "miniflow: Remove unused values_inline branch from miniflow_move()"

This reverts commit 29d2aa3aa74ab97df0f00af5bddaa12485c1d39a.

Turns out the code was correct but the dynamic nature of miniflow
inline storage was poorly documented.  A following patch fixes the
documentation.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
lib/flow.h: Improve struct miniflow comment and definition.

Miniflows can nowadays be dynamically allocated to different inline
sizes, as done by lib/classifier.c, but this had not been documented
at the struct miniflow definition.

Also, MINI_N_INLINE had a different value for 32-bit and 64-bit builds
due to a historical reason.  Now we use 8 for both.

Finally, use change the storage type of 'values_inline' to uint8_t, as
uint64_t looks kind of wide for a boolean, even though we intend the
bit be carved out from the uint64_t where 'map' resides.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>