aboutsummaryrefslogtreecommitdiff
path: root/lib/packets.h
AgeCommit message (Collapse)Author
2013-09-24packets: Remove unused function eth_mpls_depthSimon Horman
eth_mpls_depth() has been unused as of 1ac7c9bdb2b6fdcb ("ofproto-dpif: Use execute_actions to execute controller actions"). Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-27packets: Introduce IPv6 headers not aligned on a 32-bit boundary.Ben Pfaff
This fixes the same problem for IPv6 headers treated for other headers in the previous commit. Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-27packets: Do not assume that IPv4, TCP, or ARP headers are 32-bit aligned.Ben Pfaff
Ethernet headers are 14 bytes long, so when the beginning of such a header is 32-bit aligned, the following data is misaligned. The usual trick to fix that is to start the Ethernet header on an odd-numbered 16-bit boundary. That trick works OK for Open vSwitch, but there are two problems: - OVS doesn't use that trick everywhere. Maybe it should, but it's difficult to make sure that it does consistently because the CPUs most commonly used with OVS don't care about misalignment, so we only find problems when porting. - Some protocols (GRE, VXLAN) don't use that trick, so in such a case one can properly align the inner or outer L3/L4/L7 but not both. (OVS userspace doesn't directly deal with such protocols yet, so this is just future-proofing.) - OpenFlow uses the alignment trick in a few places but not all of them. This commit starts the adoption of what I hope will be a more robust way to avoid misalignment problems and the resulting bus errors on RISC architectures. Instead of trying to ensure that 32-bit quantities are always aligned, we always read them as if they were misaligned. To ensure that they are read this way, we change their types from 32-bit types to pairs of 16-bit types. (I don't know of any protocols that offset the next header by an odd number of bytes, so a 16-bit alignment assumption seems OK.) The same would be necessary for 64-bit types in protocol headers, but we don't yet have any protocol definitions with 64-bit types. IPv6 protocol headers need the same treatment, but for those we rely on structs provided by system headers, so I'll leave them for an upcoming patch. Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-22ofproto-dpif: Add SCTP supportJoe Stringer
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Joe Stringer <joe@wand.net.nz> Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-05bfd: Optimize BFD for Megaflows.Gurucharan Shetty
The current situation is that whenever any packet enters the userspace, bfd_should_process_flow() looks at the UDP destination port to figure out whether that is a BFD packet. This means that UDP destination port cannot be wildcarded for all the other flows too. To optimize BFD for megaflows, we introduce a new 'bfd:bfd_dst_mac' field in the database. Whenever this field is set by a controller, it is assumed that all the BFD packets to/from this interface will have the destination mac address set as the one specified in the bfd:bfd_dst_mac field. If this field is set, we first look at the destination mac address of a packet and if it does not match the mac address set in bfd:bfd_dst_mac, we do not process that packet as bfd. If the field does match, we go ahead and look at the UDP destination port too. Also, change the default BFD destination mac address to "00:23:20:00:00:01". Feature #18850. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
2013-07-17Make attribute packed equivalent for MSC compilers.Linda Sun
Signed-off-by: Linda Sun <lsun@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-20ovs-dpctl: Add mega flow supportAndy Zhou
Added support to allow mega flow specified and displayed. ovs-dpctl tool is mainly used as debugging tool. This patch also implements the low level user space routines to send and receive mega flow netlink messages. Those netlink suppor routines are required for forthcoming user space mega flow patches. Added a unit test to test parsing and display of mega flows. Ethan contributed the ovs-dpctl mega flow output function. Co-authored-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Andy Zhou <azhou@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-03-06Add support for dec_mpls_ttl actionSimon Horman
This adds support for the OpenFlow 1.1+ dec_mpls_ttl action. And also adds an NX dec_mpls_ttl action. The handling of the TTL modification is entirely handled in userspace. Reviewed-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-02-06packet: packet_get_tcp_flags: use flow's innermost dl_typeSimon Horman
Use the innermost dl_type when decoding L3 and L4 data from a packet. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-02-05User-Space MPLS actions and matchesSimon Horman
This patch implements use-space datapath and non-datapath code to match and use the datapath API set out in Leo Alterman's patch "user-space datapath: Add basic MPLS support to kernel". The resulting MPLS implementation supports: * Pushing a single MPLS label * Poping a single MPLS label * Modifying an MPLS lable using set-field or load actions that act on the label value, tc and bos bit. * There is no support for manipulating the TTL this is considered future work. The single-level push pop limitation is implemented by processing push, pop and set-field/load actions in order and discarding information that would require multiple levels of push/pop to be supported. e.g. push,push -> the first push is discarded pop,pop -> the first pop is discarded This patch is based heavily on work by Ravi K. Cc: Ravi K <rkerur@gmail.com> Reviewed-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-01-28packets: Create global helper is_ip_any().Ethan Jackson
Used outside of meta-flow in future patches. Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-12-12packets: Change IP_ARGS interface to take an ovs_be32 instead of a pointer.Ben Pfaff
An ovs_be32 is a more obvious way to represent an IP address than a pointer to one. It is also more type-safe, especially since "sparse" is able to check that the argument is in network byte order. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
2012-11-14vswitchd: Fix function prototype of packet_set_ipv6()Pravin B Shelar
Follwoing patch fixes sparse error: lib/packets.c:643:1: error: symbol 'packet_set_ipv6' redeclared with different type (originally declared at lib/packets.h:493) - incompatible argument 6 (different base types) Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
2012-11-13datapath: add ipv6 'set' actionAnsis Atteka
This patch adds ipv6 set action functionality. It allows to change traffic class, flow label, hop-limit, ipv6 source and destination address fields. Acked-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Ansis Atteka <aatteka@nicira.com>
2012-10-26OF11: push_vlan supportIsaku Yamahata
This implementes push_vlan with 802.1Q. NOTE: 802.1AD (QinQ) is not supported. It requires another effort. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-09-25packets: Add ECN constants.Jesse Gross
Upcoming tunnel code will be able to handle ECN encapsulation/ decapsulation in userspace. This adds the necessary constants for ECN manipulation. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Kyle Mestery <kmestery@cisco.com>
2012-07-26packets: Remove redundant RARP header.Ethan Jackson
Rarp packets had their own header definition in the packets library. This doesn't make sense because they have the same packet format as arps. Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-06-12packets: Add ETH_TYPE_MPLS and ETH_TYPE_MPLS_MCAST.Ben Pfaff
We need these for OpenFlow 1.1 ofp_match support even if we don't support MPLS matching (which we don't, yet). Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-06-12packets: Define IPPROTO_SCTP if not provided by <netinet/in.h>.Ben Pfaff
SUSv3 doesn't require IPPROTO_SCTP so some systems might not provide it. IPPROTO_SCTP isn't used in the tree yet so this doesn't fix a real bug. Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-06-07packets: Rename compose_benign_packet().Ethan Jackson
The name compose_rarp() more clearly describes what it's doing now. Requested-by: Justin Pettit <jpettit@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-06-07packets: Use RARPs for learning packets.Ethan Jackson
Traditionally Open vSwitch had used 802.2 SNAP packets to update upstream switch learning tables when necessary. This approach had advantages in that debugging information could be embedded in the packet helping hapless admins figure out what's going on. However, since both qemu and VMware use RARP for this purpose, it seems appropriate to fall in line with the defacto standard. Requested-by: Ben Basler <bbasler@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-06-06packets: Generalize reserved RSPAN protocols.Ethan Jackson
Open vSwitch refuses to mirror certain destination addresses in addition to those classified by eth_addr_is_reserved(). Looking through the uses of eth_addr_is_reserved(), one finds that no callers should be using the additional addresses which mirroring drops. This patch folds the additional addresses dropped in the mirroring code, into the more general eth_addr_is_reserverd() function. This patch also changes the implementation in a way that is slightly less efficient, but much easier to read and extend int he future. Bug #11755. Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-06-06packets: Fix eth_addr_equal_except().Ethan Jackson
It turns out that eth_addr_equal_except() computed the exact opposite of what it purported to. It returned true if the two arguments where *not* equal. This is extremely confusing, so this patch changes it. Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-05-29packets: Adds ethernet-matching helper functionsJoe Stringer
With OpenFlow 1.1 requiring arbitrary ethernet match support, it simplifies other code if we have some extra helper functions. This patch adds eth_mask_is_exact(mask), eth_addr_bitand(src, mask, dst), eth_addr_equal_except(a, b, mask) and eth_format_masked(eth, mask, output). Signed-off-by: Joe Stringer <joe@wand.net.nz> Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-02Global replace of Nicira Networks.Raju Subramanian
Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc. Feature #10593 Signed-off-by: Raju Subramanian <rsubramanian@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-04-18dpif: Include TCP flags in "ovs-dpctl dump-flows" output.Ben Pfaff
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-02-15packets: New function packet_get_tcp_flags(), factored out of dpif.Ben Pfaff
This will acquire a new user in an upcoming commit. Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-01-10packets: New packet_set_*() helper functions.Ethan Jackson
This commit pulls code used to modify L3 and L4 header fields from dp_netdev into the packet library. An additional user will be added in a future commit. Signed-off-by: Ethan Jackson <ethan@nicira.com>
2011-12-27packet: Match userspace and kernel definition of ICMP header.Jesse Gross
Current userspace considers an ICMP header to be 4 bytes consisting of the type, code, and checksum. The kernel considers it to be 8 bytes because it also counts the two data fields that contain type-specific information (and are always present). Since flow extract will zero out headers that are not completely present this means that an ICMP packet that has a header of 5-7 bytes will be interpreted differently by userspace and kernel. This fixes the problem by adopting the kernel's version of the ICMP header in userspace. Signed-off-by: Jesse Gross <jesse@nicira.com>
2011-12-19flow: Make flow_compose() fake packets slightly more realistic.Ben Pfaff
This makes flow_extract() happier with TCP packets that this function produces. Signed-off-by: Ben Pfaff <blp@nicira.com>
2011-12-19packets: New function eth_from_hex().Ben Pfaff
An upcoming commit will add another user. Signed-off-by: Ben Pfaff <blp@nicira.com>
2011-11-23packets: New function eth_pop_vlan(), formerly dp_netdev_pop_vlan().Ben Pfaff
An upcoming commit will add a new user.
2011-11-09Support matching IPv6 flow label.Justin Pettit
Signed-off-by: Justin Pettit <jpettit@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-24datapath: Add multicast tunnel support.Ben Pfaff
Something like this, on two separate vswitches, works to try it out: route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0 ovs-vsctl \ -- add-port br0 gre0 \ -- set interface gre0 type=gre options:remote_ip=224.0.0.1 Runtime tested on Linux 3.0, build tested on Linux 2.6.18, both i386. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-22packets.h: Fix STP destination MAC address.Justin Pettit
2011-09-13packets: Add more utility functions for IPv4 and IPv6 addresses.Ben Pfaff
We had these functions scattered around the source tree anyway. packets.h is a good place to centralize them. I do plan to introduce some additional callers.
2011-09-09datapath: VLAN actions should use push/pop semanticsPravin Shelar
Currently the kernel vlan actions mirror those used by OpenFlow 1.0. i.e. MODIFY and STRIP. More flexible approach is to have an action to push a tag and pop a tag off, so that it can handle multiple levels of vlan tags. Plus it aligns with newer version of OpenFlow. As this patch replaces MODIFY with PUSH semantic, action mapping done in userpace is fixed accordingly. GSO handling for multiple levels of vlan tags is also added as Jesse suggested before. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
2011-08-08odp-util: New function odp_flow_key_from_string().Ben Pfaff
This will be used in upcoming commits.
2011-07-08packets: Remove unneeded !! from eth_addr_is_local().Ben Pfaff
There's no value in using !! on an operand of && or || as done here.
2011-05-16Fix incorrect byte order annotations.Ben Pfaff
These are not actual bugs, just deceptive use of the wrong function or type. Found by sparse.
2011-04-19lacp: Move LACP packet data to lacp header file.Ethan Jackson
2011-04-01packets: New function eth_set_vlan_tci(), from dpif-netdev.Ben Pfaff
This will soon be used in the upcoming bond library.
2011-04-01packets: New function snap_compose(); rename compose_packet() for consistency.Ben Pfaff
The following commit will introduce the first use of snap_compose().
2011-03-25packets: Move CFM related packet information to cfm header file.Ethan Jackson
2011-03-23packets: Create new compose_packet() function.Ethan Jackson
This commit generalizes compose_lacp_packet() into new compose_packet() function. This new function will be used to send CCM messages in future patches.
2011-03-17packets: Rename LACP portid and sysid to port_id and sys_id.Ethan Jackson
This seems more stylistically consistent with the rest of the code base and the sys_priority and port_priority in the same struct.
2011-03-17packets: create new compose_lacp_pdu() function.Ethan Jackson
Creates new compose_lacp_pdu() from the old compose_lacp_packet() function. This will allow a LACP PDU to be created without necessarily knowing the Ethernet Source Address required for generating the packet. Future patches rely on this functionality.
2011-02-03vswitchd: Implement Link Aggregation Control Protocol.Ethan Jackson
This commit implements LACP, a protocol which allows directly connected switches to automatically negotiate which links may participate in bonds. This commit disables LACP by default. Once sufficiently tested, LACP will be enabled in "active" mode on bonded ports, and "passive" mode on all others. Bug #4213.
2011-02-03packets: Add eth_addr_compare_3way function.Ethan Jackson
This commit adds eth_addr_compare_3way() which behaves like memcmp for Ethernet addresses.
2011-02-03lib: Correct endianness of packets.h.Ethan Jackson