datapath: Avoid null deref when GSO is for verifying header integrity only.

skb_gso_segment() has the following comment:

 *    It may return NULL if the skb requires no segmentation.  This is
 *    only possible when GSO is used for verifying header integrity.

Somehow queue_gso_packets() has never hit this case before, but some
failures have suddenly been reported.  This commit should fix the problem.

Additional commentary by Jesse: We shouldn't normally be hitting this case
because we're actually trying to do GSO, not header validation.  However, I
guess the guest/backend must be generating a packet with an MSS, which
tricks us into thinking that it's GSO, but no GSO is actually requested.
In the case of the bridge, header validation does take place so the
situation is handled already.  It seems not ideal that the network backend
doesn't sanitize these packets but it's probably good that we handle
it in any case.

Bug #14772.
Reported-by: Deepesh Govindan <dgovindan@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
datapath: Move LRO check from transmit to receive.

Commit 24b019f808211a95078efd916064af0975ca5733 (datapath: Disable
LRO from userspace instead of the kernel.) accidentally moved the
check for LRO packets from the receive path to transmit.  Since
this check is supposed to protect OVS (and other parts of the system)
from packets that it cannot handle it is obviously not useful on
egress.  Therefore, this commit moves it back to the receive side.

The primary problem that this caused is upcalls to userspace tried
to segment the packet even though no segmentation information is
available.  This would later cause NULL pointer dereferences when
skb_gso_segment() did nothing.

Bug #14772

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Revert "datapath: Avoid null deref when GSO is for verifying header integrity only."

This reverts commit 00c7faf3e5b7d4020e995a1429cf94313f197171.

In general, it should not be possible have a NULL return value from
skb_gso_segment() since we're not actually trying to verify the
header integrity.  No other callers with similar needs have NULL
checks.  The actual cause of the problem was LRO packets, which
OVS isn't equipped to handle.  The commit
33e031e99cc630baf1b0cb9256710dee7d9ab66d (datapath: Move LRO check
from transmit to receive.) solves that problem by fixing the LRO
check.  In order to avoid possibly masking any other problems, this
reverts the GSO check which should no longer be needed.

Signed-off-by: Jesse Gross <jesse@nicira.com>
ofproto: Remove redundant call to ofconn_get_ofproto

This is a cosmetic change. Remove the redundant call to ofconn_get_ofproto
in handle_flow_mod.

Signed-off-by: Paraneetharan Chandrasekaran <paraneetharanc@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Merge branch 'master' into bsd-port-threaded
datapath: Don't dump partial action lists in flows.

After commit 9b405f1aa8d175dc63ad3ffe5d0fe05d5ee09162 (datapath: More
flexible kernel/userspace tunneling attribute.), it was possible for a
flow dump to return a partial action list.  It's better to return no
action list at all in this situation since then userspace will know
that it should request the full thing if it wants rather than have
incorrect results.  Therefore, this prevents those partial lists in
situations where we have a very large number of actions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath: Return correct error code when dumping flow actions.

Currently, if there isn't enough space to store the actions in a
flow during a dump we return -ENOMEM.  However, the standard error
in this situation is -EMSGSIZE so this changes the behavior to match.
This issue was introduced in 354d4c98a8cdaae3525848f564e58a9016bcd3af
 (datapath: Fix nelink attribute size for flow.).

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Merge branch 'master' into bsd-port-threaded