2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 12:58:00 +00:00

49 Commits

Author SHA1 Message Date
Alex Wang
db5a101931 clang: Fix the alignment warning.
This commit fixes the warning issued by 'clang' when pointer is casted
to one with greater alignment.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-07-23 12:34:41 -07:00
Ben Pfaff
8c45d00f56 packets: Make eth_addr_is_reserved() thread-safe.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
2013-07-23 11:37:48 -07:00
Simon Horman
799a91bb80 Always update ethertype on mpls_pop
The ethertype should always be updated on mpls_pop
as there may be a transition between MPLS unicast (0x8847) and
MPLS multicast (0x8848).

Ben Pfaff tells me that this is consistent with the
behaviour described in EXT-194 of the JIRA bug tracker.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-05 14:46:42 -07:00
Ben Pfaff
f0ac9da996 packets: Fix typo in reserved multicast Ethernet addresses.
The reserved multicast Ethernet addresses begin with 01:80:c2, not
01:08:c2.

Reported-by: Padmanabhan Krishnan <kprad1@yahoo.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-06-05 09:44:32 -07:00
Simon Horman
cff78c8844 Remove encal_dl_type from struct flow
There were plans to use this in conjunction with inner/outer flows,
however that plan has been changed in favour of using recirculation.
This leaves us with the current usage.

encal_dl_type is currently only used to allow decoding of packets used in
the test suite. However, this is a bit of a fudge and the packets may be
provided as hexadecimal instead.

Also remove comments from parse_l2_5_onward() relating to MPLS which are
not in keeping with the commenting throughout the rest of the function.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
2013-03-15 15:05:41 -07:00
Simon Horman
b676167a6f Add support for dec_mpls_ttl action
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-03-06 08:28:42 -08:00
Simon Horman
e8c16d8366 packet: packet_get_tcp_flags: use flow's innermost dl_type
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-06 09:20:04 -08:00
Simon Horman
2555b1db93 packet: Correctly set ethertype in pop_mpls()
The ethertype should be set before resetting l2_5 in order
for the packet to be updated correctly.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-02-06 09:18:24 -08:00
Simon Horman
b02475c53b User-Space MPLS actions and matches
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-02-05 09:17:45 -08:00
Ethan Jackson
48cecbdc39 packets: Create global helper is_ip_any().
Used outside of meta-flow in future patches.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2013-01-28 19:09:58 -08:00
Ben Pfaff
3e6c955de6 Remove useless use of <assert.h>.
These files #included <assert.h> but didn't ever use assert.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-01-16 16:03:55 -08:00
Ben Pfaff
ed36537ebf packets: Change IP_ARGS interface to take an ovs_be32 instead of a pointer.
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-12-12 15:26:21 -08:00
Ansis Atteka
bc7a5acdff datapath: add ipv6 'set' action
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-11-13 13:51:59 +02:00
Ethan Jackson
7cb57d10a9 packets: Remove redundant RARP header.
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-07-26 17:18:13 -07:00
Ben Pfaff
7d48a4cca4 packets: First-hop router redundancy protocol MAC addresses are not BPDUs.
Commit c93f9a78c349 (packets: Update the reserved protocols list.) added
a number of first-hop router redundancy protocol MAC addresses to the
list of BPDU MAC addresses.  This means that packets destined to those MAC
addresses are dropped when other-config:forward-bpdu is set to false on a
bridge (the default setting).

However, this behavior is incorrect, because these MAC addresses are not
special in the way that, say, STP frames are special.  STP is a
switch-to-switch protocol that end hosts have no use for, but end hosts do
speak directly to routers on the MAC addresses assigned by VRRP and the
other protocols in this category.  Therefore, dropping packets in this
category means that end hosts can no longer talk to their first-hop router,
if that router is running one of these protocols.

This commit also refines the match used for EDP and EAPS, and adds Cisco
CFM to the protocols that are dropped.

After this commit, the following destination MACs are dropped:

    - 01:08:c2:00:00:00
    - 01:08:c2:00:00:01
    - 01:08:c2:00:00:02
    - 01:08:c2:00:00:03
    - 01:08:c2:00:00:04
    - 01:08:c2:00:00:05
    - 01:08:c2:00:00:06
    - 01:08:c2:00:00:07
    - 01:08:c2:00:00:08
    - 01:08:c2:00:00:09
    - 01:08:c2:00:00:0a
    - 01:08:c2:00:00:0b
    - 01:08:c2:00:00:0c
    - 01:08:c2:00:00:0d
    - 01:08:c2:00:00:0e
    - 01:08:c2:00:00:0f

    - 00:e0:2b:00:00:00
    - 00:e0:2b:00:00:04
    - 00:e0:2b:00:00:06

    - 01:00:0c:00:00:00
    - 01:00:0c:cc:cc:cc
    - 01:00:0c:cc:cc:cd
    - 01:00:0c💿cd:cd

    - 01:00:0c:cc:cc:c0
    - 01:00:0c:cc:cc:c1
    - 01:00:0c:cc:cc:c2
    - 01:00:0c:cc:cc:c3
    - 01:00:0c:cc:cc:c4
    - 01:00:0c:cc:cc:c5
    - 01:00:0c:cc:cc:c6
    - 01:00:0c:cc:cc:c7

Bug #12618.
CC: Ben Basler <bbasler@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-07-26 16:29:30 -07:00
Ben Pfaff
ff0b06eef1 Allow general masking of IPv6 addresses rather than just CIDR masks.
OF1.2 and later make these fields fully maskable so we might as well also.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-06-12 21:19:25 -07:00
Ben Pfaff
c08201d664 Allow general masking of IPv4 addresses rather than just CIDR masks.
OF1.1 and later make these fields fully maskable so we might as well also.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-06-12 21:19:22 -07:00
Ethan Jackson
2ea838acb2 packets: Rename compose_benign_packet().
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-07 18:24:29 -07:00
Ethan Jackson
38f7147c3e packets: Use RARPs for learning packets.
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-07 17:25:30 -07:00
Ethan Jackson
c93f9a78c3 packets: Update the reserved protocols list.
The protocols added in this patch should be considered "reserved"
and not forward when "forward-bpdu" is false, nor should they be
mirrored.

Bug #11755.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-06-06 18:22:53 -07:00
Ethan Jackson
05be4e2c6a packets: Generalize reserved RSPAN protocols.
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-06 17:43:33 -07:00
Joe Stringer
73c0ce349b flow: Adds support for arbitrary ethernet masking
Arbitrary ethernet mask support is one step on the way to support for OpenFlow
1.1+. This patch set seeks to add this capability without breaking current
protocol support.

Signed-off-by: Joe Stringer <joe@wand.net.nz>
[blp@nicira.com made some updates, see
 http://openvswitch.org/pipermail/dev/2012-May/017585.html]
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-29 12:24:07 -07:00
Joe Stringer
3b4d8ad307 packets: Adds ethernet-matching helper functions
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-29 11:08:11 -07:00
Raju Subramanian
e0edde6fee Global replace of Nicira Networks.
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-05-02 17:08:02 -07:00
Ben Pfaff
7393104d1a dpif: Include TCP flags in "ovs-dpctl dump-flows" output.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-04-18 20:28:40 -07:00
Jesse Gross
734ec5ec13 packet: Add additional TCP flags extraction on IPv6.
Commit 11460e2316b88f0bd0ea0005d94338d800ea16bd
(flow: Enable retrieval of TCP flags from IPv6 traffic.) updated
one of the TCP flags extraction functions in userspace but missed
the other.  This updates that function and converts the other to
use it to reduce duplication.

Bug #10194

Signed-off-by: Jesse Gross <jesse@nicira.com>
2012-03-26 15:53:42 -07:00
Ben Pfaff
12113c394a packets: New function packet_get_tcp_flags(), factored out of dpif.
This will acquire a new user in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-02-15 10:18:10 -08:00
Ethan Jackson
c97664b30f packets: New packet_set_*() helper functions.
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>
2012-01-10 14:30:15 -08:00
Ethan Jackson
2f4ca41b9c packets: Mask out CFI bit in eth_push_vlan().
We should never push a VLAN tag with the CFI bit set.  This patch
defensively enforces this invariant.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-01-10 14:30:01 -08:00
Ben Pfaff
e22f17535e packets: New function eth_from_hex().
An upcoming commit will add another user.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2011-12-19 14:53:41 -08:00
Ben Pfaff
f4ebc25ea0 packets: New function eth_pop_vlan(), formerly dp_netdev_pop_vlan().
An upcoming commit will add a new user.
2011-11-23 15:32:37 -08:00
Ethan Jackson
75a4ead16d cfm: Support tagged CCM PDUs.
This patch also causes eth_compose() to set the l2 and l3 pointers
of the packets which it modifies.
2011-11-03 14:01:33 -07:00
Edward Tomasz Napierała
6ca00f6f17 Fix build on FreeBSD.
Patch below fixes build on FreeBSD; tested on 10.0-CURRENT.

Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2011-11-01 09:11:52 -07:00
Ben Pfaff
aad29cd1a1 packets: Add more utility functions for IPv4 and IPv6 addresses.
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-13 11:46:08 -07:00
Pravin Shelar
d9065a90b6 datapath: VLAN actions should use push/pop semantics
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-09-09 18:13:26 -07:00
Ethan Jackson
81aee5f901 lacp: Move LACP packet data to lacp header file. 2011-04-19 13:49:35 -07:00
Ben Pfaff
eda1f38d41 packets: Reserve headroom for VLAN header in eth_compose(), snap_compose().
This allows callers to add a VLAN header to the composed packet and send
it out on a VLAN without copying the whole payload.
2011-04-01 15:52:19 -07:00
Ben Pfaff
7c66b273a2 packets: New function eth_set_vlan_tci(), from dpif-netdev.
This will soon be used in the upcoming bond library.
2011-04-01 15:52:19 -07:00
Ben Pfaff
2c5f293cc8 packets: Fix potential use-after-free in compose_benign_packet().
The second call to ofpbuf_put_zeros() could cause the 'eth' pointer to
be invalidated.

It appears that this does not fix a real bug because the existing callers
all preallocate 128 bytes of tailroom, but the interface doesn't document
that requirement.
2011-04-01 15:52:19 -07:00
Ben Pfaff
5de1bb5cc9 packets: New function snap_compose(); rename compose_packet() for consistency.
The following commit will introduce the first use of snap_compose().
2011-04-01 15:52:19 -07:00
Ethan Jackson
40f78b38e7 packets: Create new compose_packet() function.
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-23 13:16:38 -07:00
Ethan Jackson
07a6cf771d packets: create new compose_lacp_pdu() function.
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-03-17 12:49:34 -07:00
Ethan Jackson
8834f25e99 vswitchd: Tweak LACP values.
Hardware sets the default LACP partner information to 0 so this
commit follows.  The collector delay is a more interesting
case.  Hardware sets it to 32768 and Linux sets it to 0.  The
collector delay relates to a part of the LACP protocol which we
don't implement so we follow Linux in this case.
2011-02-07 11:27:51 -08:00
Ethan Jackson
c25c91fd5e vswitchd: Implement Link Aggregation Control Protocol.
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-03 12:26:58 -08:00
Justin Pettit
d31f1109f1 nicira-ext: Support matching IPv6 traffic.
Provides ability to match over IPv6 traffic in the same manner as IPv4.
Currently, the matching fields include:

    - IPv6 source and destination addresses (ipv6_src and ipv6_dst)
    - Traffic Class (nw_tos)
    - Next Header (nw_proto)
    - ICMPv6 Type and Code (icmp_type and icmp_code)
    - TCP and UDP Ports over IPv6 (tp_src and tp_dst)

When defining IPv6 rules, the Nicira Extensible Match (NXM) extension to
OVS must be used.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2011-02-02 12:53:26 -08:00
Ben Pfaff
093ca5b366 Fix bug in parsing large datapath IDs.
Datapath IDs are unsigned, but dpid_from_string() was parsing them as
signed integers, which caused high values to be capped at INT64_MAX.

Also, document that datapath IDs may not be all-zero.

Reported-by: Pankaj Thakkar <thakkar@nicira.com>
Reported-by: Teemu Koponen <koponen@nicira.com>
2010-10-21 10:40:20 -07:00
Justin Pettit
b123cc3ce4 ofproto: Use 64-bit datapath id and management id (OpenFlow 0.9)
The length of a datapath was changed from 48 bits to 64 bits in OpenFlow
0.9.  For parity, we increased the management id size to match.

NOTE: This is the final commit in the OpenFlow 0.9 set.  Starting with
this commit, OVS is OpenFlow 0.9-compliant.
2010-02-20 02:22:27 -08:00
Ben Pfaff
7634353824 vswitchd: Initial conversion to database-based configuration.
This has seen very little testing, so some features are almost certainly
busted.  Port mirroring is not yet converted, so it will definitely not
work.
2009-12-03 11:28:40 -08:00
Ben Pfaff
b9e8b45a39 Factor out code for composing benign packets.
The bonding code in vswitch sends out gratuitous learning packets that
are supposed to teach switches but not cause anything else to happen on
the network.  Some upcoming code wants to synthesize packets with similar
properties, so factor this code into a new function so that it can be
used in both places.
2009-09-16 15:12:27 -07:00