aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2010-09-10ovs-ofctl: Add support for drop_spoofed_arp action.Ben Pfaff
Requested-by: Michael Mao <mmao@nicira.com>
2010-09-01ofpbuf: Add ofpbuf_new_with_headroom(), ofpbuf_clone_with_headroom().Ben Pfaff
These new functions simplify an increasingly common usage pattern. Suggested-by: Jesse Gross <jesse@nicira.com>
2010-08-30treewide: Remove trailing whitespaceJoe Perches
Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Simon Horman <horms@verge.net.au> Signed-off-by: Jesse Gross <jesse@nicira.com>
2010-08-27stream-ssl: Use OPENSSL_free() to free memory from X509_NAME_oneline().Ben Pfaff
Reported-by: Tsvi Slonim <tsvi@toroki.com>
2010-08-27datapath: Avoid accesses past the end of skbuff data in actions.Ben Pfaff
Some of the flow actions that modify skbuff data did not check that the skbuff was long enough before doing so. This commit fixes that problem. Previously, the strategy for avoiding this was to only indicate the layer-3 nw_proto field in the flow if the corresponding layer-4 header was fully present, so that if, for example, nw_proto was IPPROTO_TCP, this meant that a TCP header was present. The original motivation for this patch was to add corresponding code to only indicate a layer-2 dl_type if the corresponding layer-3 header was fully present. But I'm now convinced that this approach is conceptually wrong, because the meaning of a layer-N header should not be affected by the meaning of a layer-(N+1) header. This commit switches to a new approach. Now, when a header is missing, its fields in the flow are simply zeroed and have no effect on the "type" field for the outer header. Responsibility for ensuring that a header is fully present is now shifted to the actions that wish to modify that header. Signed-off-by: Ben Pfaff <blp@nicira.com>
2010-08-27learning-switch: Ignore "packet_in"s caused by OFPP_CONTROLLER actions.Ben Pfaff
It seems best to ignore "packet_in"s caused by OFPP_CONTROLLER actions in learning-switch, since someone might be experimenting and it's best not to interfere with that.
2010-08-27ofproto: Avoid user->kernel->user round-trip for many controller actions.Ben Pfaff
When an OpenFlow flow says to send packets to the controller, until now ofproto has executed that using dpif_execute(), which passes the packet up to the kernel. The kernel queues the packet into its "action" queue, and then later ofproto pulls the packet back down from the kernel and sends it to the controller. However, this is unnecessary. Open vSwitch can just recognize in advance that it will get the packet back and handle it directly, skipping the round trip. This commit implements this optimization. This generally affects only the first packet in a flow, since generally the rest come directly down from the kernel. It only optimizes the "easy" case where the first action in a flow is to send the packet to the controller, since this seems to be the common case in the flows that I'm looking at now.
2010-08-26dpif-netdev: Expand tabs.Ben Pfaff
2010-08-26Add Nicira extension to OpenFlow for dropping spoofed ARP packets.Ben Pfaff
"ARP spoofing" is when a host claims an incorrect association between an IP address and a MAC address for deceptive purposes. OpenFlow by itself can prevent a host from sending out ARP replies from an incorrect MAC address in the Ethernet L2 header, but it cannot control the MAC addresses inside the ARP L3 packet. This commit adds a new action that can be used to drop these spoofed packets. CC: Paul Ingram <paul@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
2010-08-25Implement initial Python bindings for Open vSwitch database.Ben Pfaff
These initial bindings pass a few hundred of the corresponding tests for C implementations of various bits of the Open vSwitch library API. The poorest part of them is actually the Python IDL interface in ovs.db.idl, which has not received enough attention yet. It appears to work, but it doesn't yet support writes (transactions) and it is difficult to use. I hope to improve it as it becomes clear what semantics Python applications actually want from an IDL.
2010-08-25daemon: Improve comments.Ben Pfaff
Elsewhere we put the name of command-line options that control global variables in the comment, so do so here as well. Also fix a comment typo.
2010-08-25reconnect: Fix typo in comment.Ben Pfaff
2010-08-25json: Remove unused return value from json_parser_push().Ben Pfaff
No point in returning a value that no caller uses.
2010-08-25poll-loop: Fix obsolete comment.Ben Pfaff
The poll loop used to have support for autonomous subroutines, but it no longer does.
2010-08-25jsonrpc: Indentation fix.Ben Pfaff
2010-08-25stream, vconn: Fix comments.Ben Pfaff
All streams and all vconns are "active", so there's no point in noting that requirement in comments. (A long time ago, active and passive vconns were conflated instead of having passive vconns broken out as pvconns. But active and passive streams have always been distinct.)
2010-08-25json: Remove write-only variable from json_lex_number().Ben Pfaff
2010-08-25ovsdb: Remove unused ovsdb_datum_from_json_unique().Ben Pfaff
This function was not used outside of the test-ovsdb program. It seems like we might as well remove it.
2010-08-24netdev-tunnel: Add CAPWAP userspace interface.Jesse Gross
Provide a userspace interface to the CAPWAP UDP transport tunneling mechanism in the kernel. Signed-off-by: Jesse Gross <jesse@nicira.com>
2010-08-24netdev: Don't assume all netdevs are available at runtime.Jesse Gross
Currently we print a warning if a user tries to configure a netdev that is not in the list that userspace knows about. However, it is possible that a given netdev maybe be enabled but when it tries to create a device it finds out that it can't (not supported by kernel module, hardware not present, etc.). This makes the behavior the same in both cases. Signed-off-by: Jesse Gross <jesse@nicira.com>
2010-08-24netdev-gre: Genericize GRE netdev.Jesse Gross
Since the GRE netdev doesn't actually implement any of the GRE protocol, none of the code is really specific to GRE. This commit makes the netdev a little more generic so that additional tunnel types can easily piggyback on it in the future. Signed-off-by: Jesse Gross <jesse@nicira.com>
2010-08-24datapath: Abstract tunneling implementation from GRE.Jesse Gross
Much of the code in the GRE implementation is not specific to the GRE protocol but is actually common to all types of tunnels. In order to support future types of tunnels, move this code into a common library. Signed-off-by: Jesse Gross <jesse@nicira.com>
2010-08-23terminal: Remove vlog modules.Jesse Gross
The terminal modules in vlog-modules.def weren't removed when the code was, which breaks compilation due to a check for this condition.
2010-08-23Remove ezio-term and ovs-switchui utilities.Ben Pfaff
These utilities were useful when Nicira was building switches with 16x2 LCD front panel displays, but they aren't useful for other environments and even Nicira does not use that kind of switch any longer. So remove them and all the build infrastructure on which they depended.
2010-08-20gre: Don't require incoming checksum.Jesse Gross
The current meaning of the GRE checksum option is to include checksums on transmit and require packets to have them on receive. In addition, incoming packets with checksums are always validated regardless of this option. Requiring checksums on receive creates surprising behavior and interoperability issues. This disables the requirement on receive. The new behavior is that the sender decides whether to checksum packets and the receiver will validate packets with checksums (similar to UDP). Signed-off-by: Jesse Gross <jesse@nicira.com>
2010-08-20gre: Disable checksums by default.Jesse Gross
GRE checksums aren't really all that useful because they only add value for the GRE and inner Ethernet header. However, they are expensive since they cover the entire packet, even though most of the data is protected by L3 and L4 checksums. Therefore disable checksumming by default to improve performance. In addition, since CAPWAP doesn't support checksums this makes it consistent with GRE. Signed-off-by: Jesse Gross <jesse@nicira.com>
2010-08-20backtrace: Use generic code to find the bottom of the stack.Tsvi Slonim
This fixes an ugly GCC warning without using inline asm.
2010-08-20socket-util: Suppress uninitialized variable warning with old GCC.Bryan Phillippe
2010-08-20vconn-stream: printf() specifier for int is %d (not %zu)Bryan Phillippe
2010-08-20socket-util: Remove stray printf() from make_unix_socket().Bryan Phillippe
2010-08-19Fix SSL boilerplate descriptions in manpages.Ben Pfaff
Some of the SSL boilerplate was specific to switches, but it was included in OVSDB programs also. Make it more generic. Also document SSL options in some manpages where they were missing.
2010-08-13odp-util: Avoid branch in odp_actions_add().Ben Pfaff
I have no idea why, but the test and branch in odp_actions_add() has always bugged me. This commit eliminates it.
2010-08-13uuid: Fix warnings carelessly introduced a few commits ago.Ben Pfaff
Commit e251c8 "uuid: Break code to read /dev/urandom into a new module" carelessly introduced a few warnings, which this commit fixes up.
2010-08-13Remove vestigial support for Spanning Tree Protocol.Ben Pfaff
Open vSwitch has never properly supported IEEE 802.1D Spanning Tree Protocol (STP), but it has various bits and pieces that claim to support it. This commit deletes them, to reduce the amount of dead code in the tree. We can always reintroduce it later if it proves to be a good idea. Bug #1175.
2010-08-12random: Get random seed from /dev/urandom.Ben Pfaff
Even though this PRNG is not meant to be cryptographically secure, there is no reason not to get a high-quality seed. CC: Stephen Hemminger <shemminger@vyatta.com>
2010-08-12uuid: Break code to read /dev/urandom into a new module.Ben Pfaff
This code is useful for seeding other random number generators, so we might as well make it a separate source file.
2010-08-12util: Make ovs_fatal() understand EOF also.Ben Pfaff
ovs_error() interprets EOF as "end of file" when printing an error message, so ovs_fatal() might as well.
2010-08-12daemon: Make sure that vlog is initialized when a process daemonizes.Ben Pfaff
If a process daemonizes itself, then it should be possible to control that process's log levels with "ovs-appctl vlog/set" and related commands. The vlog_init() function registers those commands. But vlog_init() doesn't normally get called until the first log message is issued. This can take a while, especially for ovs-controller, where I first noticed the problem. This commit fixes the problem by calling vlog_init() from daemonize_start(), which always gets called as a process daemonizes.
2010-08-11random: Implement a decent random number generator.Ben Pfaff
Until now this library has based its random number upon those returned by libc's rand() function. This has always bugged me--it is not a good solution since rand() varies in quality so much. This commit changes the random library to use a simple but high-quality PRNG.
2010-08-11bridge: Don't pay attention to columns that vswitchd doesn't need.Ben Pfaff
Not replicating unneeded columns has some value in avoiding CPU time and bandwidth to the database. In ovs-vswitchd, setting cur_cfg as write-only also have great value in avoiding extra reconfiguration steps. When ovs-vsctl is used in its default mode this essentially avoids half of the reconfigurations that ovs-vswitchd currently does. What happens now is: 1. ovs-vsctl updates the database and increments next_cfg. 2. ovs-vswitchd notices the change to the database, reconfigures itself, then increments cur_cfg to match next_cfg. 3. The database sends the change to cur_cfg back to ovs-vswitchd. 4. ovs-vswitchd reconfigures itself a second time. By not replicating cur_cfg we avoid step 3 and save a whole reconfiguration step. Also, now that the database contains interface statistics, this avoids reconfiguring every time that statistics are updated.
2010-08-11ovsdb-idl: Make it possible to omit or pay less attention to columns.Ben Pfaff
ovs-vswitchd has no need to replicate some parts of the database. In particular, it doesn't need to replicate the bits that it never reads, such as the external_ids column in the Open_vSwitch table. This saves some memory, CPU time, and bandwidth to the database. Another type of column that benefits from special treatment is "write-only columns", that is, those that ovs-vswitchd writes and keeps up-to-date but never expects another client to write, such as the cur_cfg column in the Open_vSwitch table. If the IDL reports that the database has changed when ovs-vswitchd updates such a column, then ovs-vswitchd reconfigures itself for no reason, wasting CPU time. This commit also adds support for such columns.
2010-08-11stream-ssl: Enable SSL session caching.Ben Pfaff
2010-08-11stream-ssl: Remove unused 'connect_error' member.Ben Pfaff
Never read, never written.
2010-08-10dpif-netdev: Properly track whether there is a vlan header.Ben Pfaff
It looks to me like the current dpif-netdev implementation doesn't handle the case where a packet comes in without a VLAN and then is subjected to multiple ODPAT_SET_VLAN_* operations. dp_netdev_modify_vlan_tci() just checks the flow key each time to see whether there's a VLAN, but it doesn't update the flow key to note that there is now a VLAN. One fix would be to update the flow key, but it's "const" these days. Instead, add a check for whether the Ethernet type is ETH_TYPE_VLAN, which should be equivalent.
2010-08-10dpif-netdev: Tolerate undersized packets.Ben Pfaff
Actions that modify packets need to tolerate packets that are too small. Most of the actions already implicitly do this check, since they check for appropriate values in the flow key that would only be there if the corresponding data was present. But actions to modify the Ethernet header didn't have a guarantee that the packet was at least 14 bytes long, and actions to modify the VLAN didn't have such a guarantee either, so this adds appropriate checks. Problem found by code inspection.
2010-08-10datapath: Fix handling of 802.1Q and SNAP headers.Ben Pfaff
The kernel and user datapaths have code that assumes that 802.1Q headers are used only inside Ethernet II frames, not inside SNAP-encapsulated frames. But the kernel and user flow_extract() implementations would interpret 802.1Q headers inside SNAP headers as being valid VLANs. This would cause packet corruption if any VLAN-related actions were to be taken, so change the two flow_extract() implementations only to accept 802.1Q as an Ethernet II frame type, not as a SNAP-encoded frame type. 802.1Q-2005 says that this is correct anyhow: Where the ISS instance used to transmit and receive tagged frames is provided by a media access control method that can support Ethernet Type encoding directly (e.g., is an IEEE 802.3 or IEEE 802.11 MAC) or is media access method independent (e.g., 6.6), the TPID is Ethernet Type encoded, i.e., is two octets in length and comprises solely the assigned Ethernet Type value. Where the ISS instance is provided by a media access method that cannot directly support Ethernet Type encoding (e.g., is an IEEE 802.5 or FDDI MAC), the TPID is encoded according to the rule for a Subnetwork Access Protocol (Clause 10 of IEEE Std 802) that encapsulates Ethernet frames over LLC, and comprises the SNAP header (AA-AA-03) followed by the SNAP PID (00-00-00) followed by the two octets of the assigned Ethernet Type value. All of the media that OVS handles supports Ethernet Type fields, so to me that means that we don't have to handle 802.1Q-inside-SNAP. On the other hand, we *do* have to handle SNAP-inside-802.1Q, because this is actually allowed by the standards. So this commit also adds that support. I verified that, with this change, both SNAP and Ethernet packets are properly recognized both with and without 802.1Q encapsulation. I was a bit surprised to find out that Linux does not accept SNAP-encapsulated IP frames on Ethernet. Here's a summary of how frames are handled before and after this commit: Common cases ------------ Ethernet +------------+ 1. |dst|src|TYPE| +------------+ Ethernet LLC SNAP +------------+ +--------+ +-----------+ 2. |dst|src| len| |aa|aa|03| |000000|TYPE| +------------+ +--------+ +-----------+ Ethernet 802.1Q +------------+ +---------+ 3. |dst|src|8100| |VLAN|TYPE| +------------+ +---------+ Ethernet 802.1Q LLC SNAP +------------+ +---------+ +--------+ +-----------+ 4. |dst|src|8100| |VLAN| LEN| |aa|aa|03| |000000|TYPE| +------------+ +---------+ +--------+ +-----------+ Unusual cases ------------- Ethernet LLC SNAP 802.1Q +------------+ +--------+ +-----------+ +---------+ 5. |dst|src| len| |aa|aa|03| |000000|8100| |VLAN|TYPE| +------------+ +--------+ +-----------+ +---------+ Ethernet LLC +------------+ +--------+ 6. |dst|src| len| |xx|xx|xx| +------------+ +--------+ Ethernet LLC SNAP +------------+ +--------+ +-----------+ 7. |dst|src| len| |aa|aa|03| |xxxxxx|xxxx| +------------+ +--------+ +-----------+ Ethernet 802.1Q LLC +------------+ +---------+ +--------+ 8. |dst|src|8100| |VLAN| LEN| |xx|xx|xx| +------------+ +---------+ +--------+ Ethernet 802.1Q LLC SNAP +------------+ +---------+ +--------+ +-----------+ 9. |dst|src|8100| |VLAN| LEN| |aa|aa|03| |xxxxxx|xxxx| +------------+ +---------+ +--------+ +-----------+ Behavior -------- --------------- --------------- ------------------------------------- Before After this commit this commit dl_type dl_vlan dl_type dl_vlan Notes ------- ------- ------- ------- ------------------------------------- 1. TYPE ffff TYPE ffff no change 2. TYPE ffff TYPE ffff no change 3. TYPE VLAN TYPE VLAN no change 4. LEN VLAN TYPE VLAN proposal fixes behavior 5. TYPE VLAN 8100 ffff 802.1Q says this is invalid framing 6. 05ff ffff 05ff ffff no change 7. 05ff ffff 05ff ffff no change 8. LEN VLAN 05ff VLAN proposal fixes behavior 9. LEN VLAN 05ff VLAN proposal fixes behavior Signed-off-by: Ben Pfaff <blp@nicira.com>
2010-08-06json: Add extern "C" { ... } to headers.Ben Pfaff
This makes it easier for external C++ projects to import the header. CC: Jeremy Stribling <strib@nicira.com>
2010-08-06tag: Be more precise about choosing tags to add, in tag_set_add().Ben Pfaff
It is not necessary to add a "tag" if all of the bits in it are already present in some member of the set. This commit adds that optimization.
2010-08-06tag: Use existing macro instead of constant.Ben Pfaff
N_TAG_BITS is always 32, currently, because tag_type is a typedef for uint32_t, so this does not fix an actual bug.
2010-08-05stream-ssl: Make changing keys and certificate at runtime reliable.Ben Pfaff
OpenSSL is picky about the order in which keys and certificates are changed: you have to change the certificate first, then the key. It doesn't document this, but deep in the source code, in a function that sets a new certificate, it has this comment: /* don't fail for a cert/key mismatch, just free * current private key (when switching to a different * cert & key, first this function should be used, * then ssl_set_pkey */ Brilliant, guys, thanks a lot. Bug #2921.