aboutsummaryrefslogtreecommitdiff
path: root/datapath
AgeCommit message (Collapse)Author
2012-10-25datapath: Fix Tunnel options TOSPravin B Shelar
Use DSCP bits from ToS set on tunnel. This is a crossport of commit 749ae9504293dbb695dd67402acbd47acbcbeb83 from master. Bug #8822. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2012-10-25datapath: Release rtnl_lock if ovs_vport_cmd_build_info() failedAnsis Atteka
This patch fixes a possible lock-up bug where rtnl_lock might not get released. This is a crossport of commit 7a6c067d1ad65ae4abdb723b25a4ab591d1d2bc3 from master. Acked-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Ansis Atteka <aatteka@nicira.com>
2012-10-25flow: Add length check when retrieving TCP flags.Jesse Gross
When collecting TCP flags we check that the IP header indicates that a TCP header is present but not that the packet is actually long enough to contain the header. This adds a check to prevent reading off the end of the packet. In practice, this is only likely to result in reading of bad data and not a crash due to the presence of struct skb_shared_info at the end of the packet. This is a crossport of commit 9c47b45a3bb56009bf2553c493d097eeadd7e5c2 from master. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
2012-10-25datapath: Move CSUM_MANGLED_0 definition to net checksum header.Pravin B Shelar
Following patch fixes compilation error on older kernel. This is a crossport of commit 08d19ca9fef29b23826f1fb52e2368a9077783ca from master. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2012-10-25datapath: Fix checksum update for actions on UDP packets.Jesse Gross
When modifying IP addresses or ports on a UDP packet we don't correctly follow the rules for unchecksummed packets. This meant that packets without a checksum can be given a incorrect new checksum and packets with a checksum can become marked as being unchecksummed. This fixes it to handle those requirements. This is a crossport of commit 55ce87bcd542cc26def11000c9dee7690b7c3155 from master. Bug #8937. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2012-10-24datapath: Honor dp_ifindex, when specified, for vport lookup by name.Ben Pfaff
When OVS_VPORT_ATTR_NAME is specified and dp_ifindex is nonzero, the logical behavior would be for the vport name lookup scope to be limited to the specified datapath, but in fact the dp_ifindex value was ignored. This commit causes the search scope to be honored. This is a crossport of commit 24ce832d5e076e5686b15d2aadd39e8c0818e932 from master. Bug #9889. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2012-09-03datapath: Fix FLOW_BUFSIZE definition.Jesse Gross
This is analogous to the change made in userspace with 2508ac16defd417b94fb69689b6b1da4fbc76282 (odp-util: Update ODPUTIL_FLOW_KEY_BYTES for current kernel flow format.). The extra space for vlan encapsulation was not included in the allocation for maximum length flows. Found by code inspection and to my knowledge has never been hit, likely because skb allocations are padded out to a cacheline, making userspace more susceptible to this problem than the kernel. In theory, however, the right combination of flow and packet size could result in a kernel panic. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Kyle Mestery <kmestery@cisco.com>
2012-08-31datapath: Reset upper layer protocol info on internal devices.Jesse Gross
It's possible that packets that are sent on internal devices (from the OVS perspective) have already traversed the local IP stack. After they go through the internal device, they will again travel through the IP stack which may get confused by the presence of existing information in the skb. The problem can be observed when switching between namespaces. This clears out that information to avoid problems but deliberately leaves other metadata alone. This is to provide maximum flexibility in chaining together OVS and other Linux components. Bug #10995 Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2012-08-03datapath: Relax set header validation.Jesse Gross
When installing a flow with an action to set a particular field we need to validate that the packets that are part of the flow actually contain that header. With IP we use zeroed addresses and with TCP/UDP the check is for zeroed ports. This check is overly broad and can catch packets like DHCP requests that have a zero source address in a legitimate header. This changes the check to look for a zeroed protocol number for IP or for both ports be zero for TCP/UDP before considering the header to not exist. Bug #12769 Reported-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
2012-07-10datapath: Check gso_type for correct sk_buff in queue_gso_packets().Ben Pfaff
At the point where it was used, skb_shinfo(skb)->gso_type referred to a post-GSO sk_buff. Thus, it would always be 0. We want to know the pre-GSO gso_type, so we need to obtain it before segmenting. Before this change, the kernel would pass inconsistent data to userspace: packets for UDP fragments with nonzero offset would be passed along with flow keys that indicate a zero offset (that is, the flow key for "later" fragments claimed to be "first" fragments). This inconsistency tended to confuse Open vSwitch userspace, causing it to log messages about "failed to flow_del" the flows with "later" fragments. Bug #12394. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2012-06-12datapath: Check currect return value from skb_gso_segment()Pravin B Shelar
Fix return check typo. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com> Bug #11933
2012-05-08datapath: Validation of IPv6 set port action uses IPv4 headerPravin B Shelar
When the kernel validates set TCP/UDP port actions, it looks at the ports in the existing flow to make sure that the L4 header exists. However, these actions always use the IPv4 version of the struct. Following patch fixes this by checking for flow ip protocol first. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com> Bug #11205
2012-01-24datapath: Fix version check for 3.2.Jesse Gross
We support Linux 3.2 and all of its patch levels but the current check only allows for 3.2.0. Reported-by: Justin Pettit <jpettit@nicira.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
2012-01-20datapath: Correct GRE checksum offset.Jesse Gross
If a statically defined GRE key is used with checksums then the checksum will overwrite the key. This is because the key is set at header caching time and the checksum is set at packet processing time and we don't update the offset on packet processing because we don't do anything with the key. Reported-by: Christos Argyropoulos <cargious@netmode.ntua.gr> Signed-off-by: Jesse Gross <jesse@nicira.com>
2012-01-17datapath: Enforce mutual exclusion between bridge and brcompat_mod.Ben Pfaff
In kernels 2.6.36, Open vSwitch can (and does) safely coexist with the Linux bridge module, but it does not make sense to load both bridge and brcompat_mod at the same time. Until now, nothing has prevented both from loading; when they both load, confusion (at best) results. This fixes the problem by enforcing mutual exclusion. Bug #9226. Launchpad bug #917309. Reported-by: Rogério Vinhal Nunes Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2012-01-11datapath: Fix multipart datapath dumps.Ben Pfaff
The logic to split up the list of datapaths into multiple Netlink messages was simply wrong, causing the list to be terminated after the first part. Only about the first 50 datapaths would be dumped. This fixes the problem. Bug #9124. Reported-by: Paul Ingram <paul@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-12-06datapath: small potential memory leak in ovs_vport_alloc()Dan Carpenter
We're unlikely to hit this leak, but the static checkers complain if we don't take care of it. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
2011-11-30datapath: Don't use ipv6_addr_copy().Jesse Gross
It was dropped upstream in favor of direct structure assignment. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2011-11-22datapath: Fix build after global symbol rename.Jesse Gross
ovs_netdev_get_vport() did not get renamed in one of the blocks for older kernels. Signed-off-by: Jesse Gross <jesse@nicira.com>
2011-11-22datapath: Scope global symbols with ovs_ prefix.Jesse Gross
OVS has quite a few global symbols that should be scoped with a prefix to prevent collisions with other modules in the kernel. Suggested-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2011-11-21datapath: Remove unused variable in dp_notify.c.Jesse Gross
Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2011-11-21datapath: Always notify in initial namespace for port deletions.Jesse Gross
We currently notify for port deletions in the namespace of the device that was deleted. In general this should be initial namespace because that's the only place where we look but it's possible that the device was moved after being attached. However, it's not semantically correct because we really care about the namespace of the userspace process, not that of the device. This switches to genlmsg_multicast() which always uses the initial namespace and seems more appropriate anyways. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2011-11-21datapath: Directly use methods for protecting RCU/RTNL data.Jesse Gross
We currently have a wrapper to protect the datapath ports array. However, this can lead to confusion over exactly what lock is protecting the access (either RTNL or RCU). This removes the wrapper in favor of directly accessing the data, which also has the benefit of being less permissive about what lock we allow so it can be restricted to the one that we expect. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2011-11-21datapath: Add genl_dereference() and use it.Jesse Gross
We currently use a specialized version of what amounts to genl_dereference() to protect the flow table. This prepares to propose genl_dereference() upstream and uses it instead of our version. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2011-11-21datapath: Use u64_stats_sync for datapath and vport stats.Jesse Gross
We currently use a seqcount to prevent reading partial 64-bit stats on 32-bit CPUs. u64_stats_sync uses the same logic but elides it on 64-bit and uniprocessor machines. This improves performance (primarily on non-x86 architectures) at the cost of not guaranteeing that packet and byte counts were necessarily read together. Suggested-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2011-11-18datapath: Better handle vlan packets sent to userspace.Jesse Gross
We no longer clone packets that are sent via the userspace action because placing them in Netlink attributes makes a copy so we generally don't touch the original. The one exception to this is accelerated vlan tags, which are currently inserted into the original packet as long as it isn't cloned. Although the clone check prevents us from causing problems for past packets it has issues for future processing: * It turns accelerated tags into non-accelerated tags. This isn't inherently a problem but some cards may not properly support offloads with in-band tags. * It doesn't update CHECKSUM_COMPLETE if there is one. * If the operation fails, it will free the packet resulting in a later use-after-free. This patch fixes the above issues with a conservative approach. It's possible to do it more efficiently but it probably doesn't matter in most cases. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2011-11-18datapath: Fix unaligned access when storing stats.Jesse Gross
Both datapath and vport stats contain 64-bit members in a struct but we write them directly in Netlink attributes which only guarantee 32-bit alignment. This causes problems on RISC architectures that care about alignment so this computes the stats on the stack and then memcpy's them. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2011-11-18datapath: Fix pop_vlan().Pravin B Shelar
Following patch fixes bug in pop_vlan code by updating ethernet header len. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-17datapath: Update startup banner.Jesse Gross
The (to be) upstream version prints out "Open vSwitch switching datapath" on module load. This updates the OVS tree to keep them in sync. Signed-off-by: Jesse Gross <jesse@nicira.com>
2011-11-17datapath: Fix whitespace error.Jesse Gross
Signed-off-by: Jesse Gross <jesse@nicira.com>
2011-11-16datapath: Dont export get_dp().Pravin B Shelar
Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@jessegross.com>
2011-11-16datapath: Fix flow table sparse RCU annotations.Jesse Gross
Some overzealous marking of pointers as __rcu caused sparse to flag errors. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2011-11-16datapath: Reformat copyright messages.Jesse Gross
Many of our kernel copyright messages make reference to code being copied from the Linux kernel, which is a bit odd for code in the kernel. This changes them to use the standard GNU GPL boilerplate instead. It does not change the actual license, which continues to be GPLv2. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2011-11-15datapath: Properly validate length of OVS_KEY_ATTR_ENCAP attributes.Ben Pfaff
Without this, every VLAN packet goes to userspace because VLAN flows cannot be set up. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-14datapath: Don't drop packets with partial vlan tags.Ben Pfaff
In the future it is likely that our vlan support will expand to include multiply tagged packets. When this happens, we would ideally like for it to be consistent with our current tagging. Currently, if we receive a packet with a partial VLAN tag we will automatically drop it in the kernel, which is unique among the protocols we support. The only other reason to drop a packet is a memory allocation error. For a doubly tagged packet, we will parse the first tag and indicate that another tag was present but do not drop if the second tag is incorrect as we do not parse it. This changes the behavior of the vlan parser to match other protocols and also deeper tags by indicating the presence of a broken tag with the 802.1Q EtherType but no vlan information. This shifts the policy decision to userspace on whether to drop broken tags and allows us to uniformly add new levels of tag parsing. Although additional levels of control are provided to userspace, this maintains the current behavior of dropping packets with a broken tag when using the NORMAL action because that is the correct behavior for an 802.1Q-aware switch. The userspace flow parser actually already had the new behavior so this corrects an inconsistency. Reported-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-14datapath: Describe policy for extending flow key, implement needed changes.Ben Pfaff
When the datapath was converted to use Netlink attributes for describing flow keys, I had a vague idea of how it could be smoothly extensible, but I didn't actually implement extensibility or carefully think it through. This commit adds a document that describes how flow keys can be extended in a compatible fashion and adapts the existing interface to match what it says. This commit doesn't actually implement extensibility. I already have a separate patch series out for that. This patch series borrows from that one heavily, but the extensibility series will need to be reworked somewhat once this one is in. This commit is only lightly tested because I don't have a good test setup for VLANs. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-14datapath: Allow flow key Netlink attributes to appear in any order.Ben Pfaff
This is more conventional use of Netlink. For upstreaming, 'u64 attrs' can be changed to u32 and the uses of 1ULL can be changed to 1. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-12datapath: Rearrange ovs_key_lens.Ben Pfaff
This seems clearer to me. It should not cause any behavioral change. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-11datapath: Use correct ethernet addr len.Pravin B Shelar
Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-10datapath: remove actions.hPravin B Shelar
There are only two symbols in actions.h. Compatibility function is moved to compat.h and execute_actions() declaration is moved to datapath.h Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-10datapath: Don't use Nicira's OUI for generating mac-address.Pravin B Shelar
Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-10datapath: Remove unnecessary definition of is_internal_vport()Pravin B Shelar
Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-10datapath: Use skb_copy_and_csum_dev() to csum upcall packet.Pravin B Shelar
Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-10datapath: Kernel flow metadata parsing should be less restrictiveAnsis Atteka
The function flow_metadata_from_nlattrs() is very restrictive about the ordering and type of metadata attributes that it receives. This patch will change flow_metadata_from_nlattrs() behavior by ignoring attributes that it does not understand and allowing them to be passed in arbitrary order. Issue #8167 Signed-off-by: Ansis Atteka <aatteka@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-09datapath: Fix compiler warning on older kernel.Pravin B Shelar
commit 6455100f38e9312346f4d58511595f695d813537 (datapath: Fix coding style issues) introduced this issue. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-09datapath: Fix comment formatting.Jesse Gross
A few of the recently added fields in struct sw_flow_key had comments that weren't properly aligned. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
2011-11-09datapath: Rename ipv6_tos to ipv6_tclass.Justin Pettit
IPv6 uses the term "traffic class" for what IPv4 calls "type-of-service". This commit renames the the "ipv6_tos" field to "ipv6_tclass" in the "ovs-key_ipv6" struct to be more consistent with the IPv6 terminology. Suggested-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Justin Pettit <jpettit@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-09Support matching and modifying IP TTL.Justin Pettit
Add support matching the IPv4 TTL and IPv6 hop limit fields. This commit also adds support for modifying the IPv4 TTL. Modifying the IPv6 hop limit isn't currently supported, since we don't support modifying IPv6 headers. We will likely want to change the user-space interface, since basic matching and setting the TTL are not generally useful. We will probably want the ability to match on extraordinary events (such as TTL of 0 or 1) and a decrement action. Feature #8024 Signed-off-by: Justin Pettit <jpettit@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-09Support matching and modifying IP ECN bits.Justin Pettit
Signed-off-by: Justin Pettit <jpettit@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-09Don't overload IP TOS with the frag matching bits.Justin Pettit
This will be useful later when we add support for matching the ECN bits within the TOS field. Signed-off-by: Justin Pettit <jpettit@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>