meta-flow: Fix uninitialized data parsing tnl_flags in mf_parse().

Also, add an assertion that the field is the expected size.

This bug was introduced in commit 2fdf762a006f (vswitchd: Log all tunnel
parameters of given flow.)

Found by valgrind.

Bug #14357.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
ofp-util: Fix uninitialized bytes in OF1.0 and OF1.1 table stats replies.

Also, use ovs_strlcpy() instead of strcpy() just to be a teensy bit safer.

Found by valgrind.

Bug #14357.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
ofproto-dpif-governor: Fix small memory leak.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
connmgr: Fix memory leak destroying ofmonitor.

This should be pretty minor because it only leaks memory if the match does
not fit in the inline area of a miniflow and minimask.  I imagine that the
most common match used for an ofmonitor is "match everything", which
wouldn't leak.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
ovsdb-server: Fix memory leak when manager table has no status column.

This is a corner case.  I doubt that it's triggered in practice outside the
unit tests.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
openflow: Print in_port as string for reserved/special ports.

Currently, when we add a flow with in_port=65534, we get the
following warning.

"ofp_util|WARN|referring to port LOCAL as 65534 is deprecated
for compatibility with future versions of OpenFlow."

But ovs-ofctl, while dumping flows uses 65534 instead of LOCAL.
The same is true for other reserved ports.

This patch corrects that.

Bug #14118.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
ovs-ofctl: Remove 'ANY' as a wildcard.

Currently we use "*" or ANY to mark a field in flow syntax
as a wildcard. With ANY being a valid openflow port now,
there is a conflict for in_port field. So at the least, we
need to remove ANY from being considered as a wildcard for
in_port. But this may cause general confusion and it may be
a better idea to remove 'ANY' as a wildcard for all fields.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
ofproto-dpif: More efficient implementation of get_odp_port().

Avoids unnecessary hash bucket traversal (ofproto_get_port()), since we
have the ofport_dpif already after odp_port_to_ofport().

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
[blp@nicira.com simplified the test]
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath: Fix a kernel crash when adding a 2nd VXLAN port with existing UDP port

When creating a second VXLAN tunnel port with the same UDP
port as an existing VXLAN tunnel port, make sure to set
*vxport before returning. Fixes a kernel crash.

Reported-by: Todd Ruch <Todd.Ruch@wwtas.com>
Signed-off-by: Kyle Mestery <kmestery@cisco.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
ofproto-dpif: Eliminate unneeded call to ofproto_dpif_cast().

I noticed this was unneeded while looking over commit 7c33b18807804f
(ofproto-dpif: More efficient implementation of get_odp_port().).

Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath: Change ENOENT return value to ENODEV in lookup_vport().

This reduces the number of valid "no such device" error values that
need special attention by the caller.

Userspace code will need to keep on checking for both ENODEV and
ENOENT as long as older kernel modules are around.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
dpif: Document.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto: Fix remaining incorrect users of OVSP_LOCAL.

In the switch to a single datapath, the simple mapping between
OFPP_LOCAL and OVSP_LOCAL was broken.  Unfortunately, a couple of
translations were missed, so this commit fixes them.

Reported-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
classifier: Fix theoretical leak in classifier_destroy().

The open-coded version of destroy_table() in classifier_destroy() didn't
free the table's minimatch.  Use destroy_table() to do it properly.

This is only a theoretical leak because all the existing callers actually
remove all the rules from their classifiers before they destroy them
(outside of the tests/ directory, which I didn't examine) and so they don't
ever have anything left to remove in classifier_destroy().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
tests: Fix memory leaks in test-classifier program.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
Add Openflow 1.3 test for asynchronous message control.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath: Use FIELD_SIZEOF() in dp_init().

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Jesse Gross <jesse@nicira.com>
netdev-vport: Remove useless struct netdev_vport.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
ofproto-dpif: Use proper special value for the reserved PID.

The compose_slow_path() function used UINT16_MAX for
dpif_port_get_pid(), when it should be UINT32_MAX to get the proper
reserved PID.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
dpif-linux: Log the correct port-PID mapping.

When adding a port, the code previously logged the requested port number
(which is generally UINT32_MAX) instead of the assigned port number.

Signed-off-by: Justin Pettit <jpettit@nicira.com>