openvswitch
15 years agoAdd AC_SYS_LARGEFILE, to allow writing log files over 2 GB.
Ben Pfaff [Thu, 5 Feb 2009 17:28:54 +0000 (09:28 -0800)]
Add AC_SYS_LARGEFILE, to allow writing log files over 2 GB.

15 years agoChanged control protocol name to OpenFlow Management Protocol.
Justin Pettit [Wed, 4 Feb 2009 22:26:11 +0000 (14:26 -0800)]
Changed control protocol name to OpenFlow Management Protocol.

15 years agoFirst cut of OpenFlow control protocol draft specification.
Justin Pettit [Wed, 4 Feb 2009 19:48:03 +0000 (11:48 -0800)]
First cut of OpenFlow control protocol draft specification.

15 years agoDon't define skb_copy_{to,from}_linear_data_offset if it is available.
Ben Pfaff [Tue, 3 Feb 2009 18:27:22 +0000 (10:27 -0800)]
Don't define skb_copy_{to,from}_linear_data_offset if it is available.

Linux 2.6.22 introduced functions skb_copy_from_linear_data_offset()
and skb_copy_to_linear_data_offset().  In earlier versions we defined them.
But Xen backports these functions, so this became a duplicate definition.
So check for them at configure time instead of depending on the kernel
version number.

15 years agodatapath: Fix up checksum on Xen before forwarding to controller.
Ben Pfaff [Mon, 2 Feb 2009 17:55:32 +0000 (09:55 -0800)]
datapath: Fix up checksum on Xen before forwarding to controller.

On Xen, the datapath can receive a packet that lacks a correct checksum
from a VM, because the VMs expect to use the host's hardware TX
checksumming.  Until now, we haven't fixed up the checksum before we sent
the packet to the controller.  The controller doesn't normally verify
the checksum (nor can it in general, since it doesn't necessarily get the
entire packet), so that part isn't a problem.

The problem here is in the buffered packet.  fwd_save_skb() makes a copy
(not a clone) of the packet, but skb_copy() doesn't make a copy of the
skbuff's proto_csum_blank, which is what dev_queue_xmit() uses (via
skb_checksum_setup()) to decide whether checksumming needs to be forced.
Thus, the buffered packet is transmitted with a bad checksum.

A partial solution would be to copy proto_csum_blank from the original
skb into the buffered copy, or to make the buffers use clones instead of
copies (they really should do this anyhow).  But this would still send
a bad checksum to the controller.  So instead we do the full checksum
calculation before we send the packet to the controller.

This change affects only Xen.  This situation cannot occur without Xen,
because any packets that arrive on physical interfaces must already have
correct checksums.

15 years agodatapath: Move all fwd_save_skb() calls into a single location.
Ben Pfaff [Fri, 30 Jan 2009 18:58:50 +0000 (10:58 -0800)]
datapath: Move all fwd_save_skb() calls into a single location.

15 years agoFix build issues with recent SNAT changes on older kernels.
Justin Pettit [Mon, 26 Jan 2009 21:42:16 +0000 (13:42 -0800)]
Fix build issues with recent SNAT changes on older kernels.

Recent changes that fixed fragmented packets for SNAT-enabled builds
used calls not implemented in older kernels.  These changes add those
calls to the compatibility layer and clean up a few warnings in those
older kernel builds.

15 years agoMove veth.c to Linux 2.6 compatibility directory.
Justin Pettit [Mon, 26 Jan 2009 20:45:56 +0000 (12:45 -0800)]
Move veth.c to Linux 2.6 compatibility directory.

The veth driver is only available on more recent kernels.  veth.c
contains a port to 2.6.18.  Since this is only needed for 2.6.18, the
source is being moved to the compatibility directory.

15 years agoFor SNAT, don't store the pre-fragment L2 header before actions are applied.
Justin Pettit [Mon, 26 Jan 2009 09:05:39 +0000 (01:05 -0800)]
For SNAT, don't store the pre-fragment L2 header before actions are applied.

The IP fragment code doesn't always write the L2 header when generating
new fragments.  This problem was fixed in an earlier commit.
Unfortunately, we stored the pre-fragment L2 header when the packet
first arrived--before other packet modifications were applied.  This
meant that the results of any OpenFlow L2 modification actions were lost.
This patch pushes the storage of the L2 header until right before the
packet is transmitted (and possibly refragmented).

Thanks to Dan for catching this behavior.
(cherry picked from commit b4cd6fb07e0751832a22759e27c6ba63e3538c8b)

15 years agoAdd comment.
Ben Pfaff [Mon, 26 Jan 2009 17:56:11 +0000 (09:56 -0800)]
Add comment.

Thanks to Martin via DK for suggestion.

15 years agoMove setting Nicira datapath ID out of kernel.
Justin Pettit [Sat, 24 Jan 2009 01:30:16 +0000 (17:30 -0800)]
Move setting Nicira datapath ID out of kernel.

When generating the datapath id/mac address for an OpenFlow device, the
kernel checks the DMI for a suitable one in a Nicira UUID.  If one is
not found, then a random address is generated.  This patch makes it so
that a random address is always generated.  The DMI Nicira UUID check is
now done in the init script, which overrides the random address
generated when the datapath was created.  Ripping code out of the kernel
is good.

15 years agoBackport the veth driver to Linux 2.6.18. Build for that version only.
Ben Pfaff [Fri, 23 Jan 2009 18:23:58 +0000 (10:23 -0800)]
Backport the veth driver to Linux 2.6.18.  Build for that version only.

15 years agoMake choices to build and to distribute modules independent of each other.
Ben Pfaff [Fri, 23 Jan 2009 01:10:47 +0000 (17:10 -0800)]
Make choices to build and to distribute modules independent of each other.

15 years agoEliminate unused second argument to OFP_CHECK_LINUX in configure scripts.
Ben Pfaff [Fri, 23 Jan 2009 00:58:31 +0000 (16:58 -0800)]
Eliminate unused second argument to OFP_CHECK_LINUX in configure scripts.

15 years agoIgnore more files.
Ben Pfaff [Fri, 23 Jan 2009 00:51:58 +0000 (16:51 -0800)]
Ignore more files.

15 years agoAdd unit test for flow extraction.
Ben Pfaff [Mon, 19 Jan 2009 19:00:50 +0000 (11:00 -0800)]
Add unit test for flow extraction.

This tests only flow_extract() in lib/flow.c.  We should really test
the flow extraction in the kernel module also.

15 years agoAdd new function ofp_match_to_string() to ofp-print library.
Ben Pfaff [Sat, 17 Jan 2009 01:18:20 +0000 (17:18 -0800)]
Add new function ofp_match_to_string() to ofp-print library.

15 years agoMove flow_fill_match() from udatapath to lib, so that other code can use it.
Ben Pfaff [Sat, 17 Jan 2009 01:17:47 +0000 (17:17 -0800)]
Move flow_fill_match() from udatapath to lib, so that other code can use it.

15 years agoImplement pcap file reader/writer library and use it in ofp_packet_to_string().
Ben Pfaff [Mon, 19 Jan 2009 18:53:37 +0000 (10:53 -0800)]
Implement pcap file reader/writer library and use it in ofp_packet_to_string().

15 years agoFix minor bug in flow_extract().
Ben Pfaff [Mon, 19 Jan 2009 18:53:03 +0000 (10:53 -0800)]
Fix minor bug in flow_extract().

We were treating 802.2 frames that were too short to have a SNAP header as
if they had a dl_type of 0, when really they were supposed to have a
dl_type of OFP_DL_TYPE_NOT_ETH_TYPE.

This bug probably didn't affect anything in practice, because it is very
unusual to have a 802.2 frame that is too short to have a SNAP header,
because any frame that goes over a physical wire will be padded out so
that it is longer than that.

15 years agoMake port status change messages reliable.
Ben Pfaff [Wed, 7 Jan 2009 17:28:19 +0000 (09:28 -0800)]
Make port status change messages reliable.

Until now, port status change messages were sent out by the datapath
implementations and simply relayed by secchan.  In the kernel
implementation, they were unreliable because they were sent out over the
multicast socket used for packet-in events: if many packet-in messages
arrived and filled up that socket's receive buffer, then any subsequent
port status change messages were dropped.

This change moves port status change detection from the datapath
implementations into secchan, making them reliable, by using a
netdev_monitor.

(An alternate implementation would have been to detect the socket
receive buffer overflow and poll the network devices.  The current
implementation was chosen because it removes code from the datapaths,
which is the direction we want to move in for the future.)

15 years agonetdev: Implement netdev_monitor, for monitoring network device status changes.
Ben Pfaff [Wed, 7 Jan 2009 17:29:50 +0000 (09:29 -0800)]
netdev: Implement netdev_monitor, for monitoring network device status changes.

15 years agonetdev: Make carrier status available in device flags.
Ben Pfaff [Wed, 7 Jan 2009 01:26:12 +0000 (17:26 -0800)]
netdev: Make carrier status available in device flags.

Before, network device carrier status was available only through
netdev_get_link_status().  However, Linux makes it available in network
device flags, so we might as well use it.

15 years agoNew hash table keyed on string data.
Ben Pfaff [Wed, 7 Jan 2009 01:20:23 +0000 (17:20 -0800)]
New hash table keyed on string data.

15 years agonetdev: New function netdev_nodev_get_flags().
Ben Pfaff [Wed, 14 Jan 2009 23:35:12 +0000 (15:35 -0800)]
netdev: New function netdev_nodev_get_flags().

An upcoming change will move detection of netdev flags changes into
secchan.  That change will require polling the flags for many network
devices.  Opening and closing that many network devices, or keeping
around fds for them, is a waste of time (or fds).

But it's easy to get flags for any number of netdevs from a single file
descriptor, so add a function to do this.

15 years agoMake nl_policy_parse() compatible with non-Generic Netlink packets.
Ben Pfaff [Wed, 7 Jan 2009 01:06:48 +0000 (17:06 -0800)]
Make nl_policy_parse() compatible with non-Generic Netlink packets.

Some packets that are not Generic Netlink packets nevertheless use its
attribute format.  By making the caller pass in the offset to the
attributes we can support these packet formats too.

(Another approach would be to make the caller pull off the headers.)

15 years agoAdd lookup3-based hash for bytes, and remove FNV hash entirely.
Ben Pfaff [Tue, 6 Jan 2009 20:55:14 +0000 (12:55 -0800)]
Add lookup3-based hash for bytes, and remove FNV hash entirely.

The lookup3 hash is superior to FNV.  This change makes OpenFlow use
lookup3 exclusively, by adding a variant of it that can hash arbitrary
byte sequences.

15 years agoAdd support for dynamic library symbols to ofp-parse-leaks.
Ben Pfaff [Mon, 19 Jan 2009 23:19:40 +0000 (15:19 -0800)]
Add support for dynamic library symbols to ofp-parse-leaks.

In adding support for the leak checker to NOX, it became clear that we
needed to support fetching symbols for dynamically loaded libraries,
because most of NOX is in fact in such libraries.  This adds that support.

15 years agoFix fragment issue for large IP packets when SNAT action enabled.
Justin Pettit [Wed, 21 Jan 2009 02:22:49 +0000 (18:22 -0800)]
Fix fragment issue for large IP packets when SNAT action enabled.

The Netfilter code automatically reassembles IP fragments.  We need to
explicitly have them refragmented before transmitting. (Bug #823)
(cherry picked from commit dfc7aa676ab44db7a49284a80798c7be5369db85)

15 years agoImprove handling of unexpected 'status' in process_status_msg().
Ben Pfaff [Wed, 21 Jan 2009 00:28:38 +0000 (16:28 -0800)]
Improve handling of unexpected 'status' in process_status_msg().

This function was getting passed -1 as 'status' due to a bug elsewhere,
and it was outputting ", core dumped" as the result, which clearly isn't
very helpful.  This improves the situation.

15 years agoprocess: New function process_escape_args().
Ben Pfaff [Wed, 21 Jan 2009 00:27:27 +0000 (16:27 -0800)]
process: New function process_escape_args().

15 years agoDebian packaging: Remove IP addresses from netdevs within a switch.
Ben Pfaff [Wed, 21 Jan 2009 00:24:00 +0000 (16:24 -0800)]
Debian packaging: Remove IP addresses from netdevs within a switch.

15 years agoNew function netdev_enumerate().
Ben Pfaff [Tue, 20 Jan 2009 21:34:13 +0000 (13:34 -0800)]
New function netdev_enumerate().

15 years agoNew function svec_join().
Ben Pfaff [Tue, 20 Jan 2009 21:34:02 +0000 (13:34 -0800)]
New function svec_join().

15 years agoDebian packaging: Add several new settings to /etc/default/openflow-switch.
Ben Pfaff [Tue, 20 Jan 2009 21:33:44 +0000 (13:33 -0800)]
Debian packaging: Add several new settings to /etc/default/openflow-switch.

15 years agoprocess: Avoid stealing pclose()'s exit status.
Ben Pfaff [Wed, 21 Jan 2009 00:06:59 +0000 (16:06 -0800)]
process: Avoid stealing pclose()'s exit status.

When we use popen() and pclose(), pclose() wants to return the process's
exit status, but it can't if the SIGCHLD handler gets it first.  So,
instead of asking for any child process exit status in sigchld_handler(),
only ask for the exit status of registered PIDs.

15 years agodaemon: Fix behavior in read_pidfile() when pid file is not locked.
Ben Pfaff [Wed, 21 Jan 2009 00:34:11 +0000 (16:34 -0800)]
daemon: Fix behavior in read_pidfile() when pid file is not locked.

15 years agodaemon: Fix bogus error message in read_pidfile() when pidfile is empty.
Ben Pfaff [Wed, 21 Jan 2009 00:33:52 +0000 (16:33 -0800)]
daemon: Fix bogus error message in read_pidfile() when pidfile is empty.

15 years agodaemon: Fix segfault in read_pidfile() when pidfile does not exist.
Ben Pfaff [Wed, 21 Jan 2009 00:33:32 +0000 (16:33 -0800)]
daemon: Fix segfault in read_pidfile() when pidfile does not exist.

15 years agodebian: Avoid aborting on switch startup when $COMMANDS is empty.
Ben Pfaff [Mon, 19 Jan 2009 23:54:22 +0000 (15:54 -0800)]
debian: Avoid aborting on switch startup when $COMMANDS is empty.

15 years agoFix typo in comment.
Ben Pfaff [Mon, 19 Jan 2009 19:23:43 +0000 (11:23 -0800)]
Fix typo in comment.

15 years agoReopen log file in addition to reading conf file when vswitchd receives sighup
Keith Amidon [Tue, 13 Jan 2009 23:30:40 +0000 (15:30 -0800)]
Reopen log file in addition to reading conf file when vswitchd receives sighup

This only reopens the vswitchd log file.  The child secchan processes
for each bridge are not requested to do the same thing.  Since secchan
in general logs very little data, rotating those files isn't being
done right now, so this is probably okay.  At some point we should
probably correct it however.

15 years agovswitchd: Reduce flow idle time when flow table grows large.
Ben Pfaff [Fri, 16 Jan 2009 18:37:13 +0000 (10:37 -0800)]
vswitchd: Reduce flow idle time when flow table grows large.

This change halves the number of steady-state flows in the flow table
for hping3 --faster --quiet, from over 5000 to less than 2500.  It does
cause some oscillation in flow table size, because there is a harsh step
function in idle time when the flow table goes from 1000 to 1001 flows,
from 2001 to 2002 flows, and from 4003 to 4004 flows, but I doubt that is
a problem.  (If it is, we can introduce some randomness.)

15 years agovswitchd: Don't reset idle timer when updating flows.
Ben Pfaff [Fri, 16 Jan 2009 18:23:51 +0000 (10:23 -0800)]
vswitchd: Don't reset idle timer when updating flows.

When a flow was revalidated, we would use a OFPFC_ADD flow_mod message to
change the flow's actions.  However, this resets the idle-timer countdown.
In extreme circumstances, such as when VMs are being continuously migrated,
this meant that completely idle flows would never expire, because their
idle timers would keep getting reset more often than every 5 seconds, and
so the flow table would keep growing, never shrinking.

Now, when we revalidate an existing flow and update its actions, we use
an OFPFC_MODIFY_STRICT flow_mod message, which also updates actions but
does not reset the idle-timer countdown.

15 years agoRevert "brcompat: Don't re-read configuration file from inside bridge code."
Ben Pfaff [Fri, 16 Jan 2009 18:11:04 +0000 (10:11 -0800)]
Revert "brcompat: Don't re-read configuration file from inside bridge code."

This reverts commit 2b34f542b1015b69c589bc4fa324d236cd35dd5f, because
not re-reading the config file from phy_port_changed() meant that, later,
the next time we modified the config file we would do it based on the
older version, not the version that we just wrote out.

15 years agovswitchd: Delete flows on a deleted interface when revalidating.
Ben Pfaff [Fri, 16 Jan 2009 18:08:51 +0000 (10:08 -0800)]
vswitchd: Delete flows on a deleted interface when revalidating.

When an interface is deleted from a datapath by an entity other than
vswitchd (e.g. by a vif being deleted), we would revalidate all the
flows and change them to drop packets.  But that's a waste of flow
table space.  This commit changes the behavior in this case to delete
those flows entirely.

This commit is complicated by the need to deal gracefully with flows
on datapath interfaces that we don't know about, e.g. from the local port
if the local port is not part of the bridge or from interfaces added to
a datapath by an external mechanism (e.g. added with "dpctl addif"
manually).  We don't want to delete those flows, even though they resemble
the ones that we do want to delete, because they potentially save us from
processing a lot of packet-in messages that we don't care about.  So we
mark those flows with a new "need_drop" flag.

15 years agoNew functions make_flow_mod(), make_del_flow().
Ben Pfaff [Fri, 16 Jan 2009 17:45:43 +0000 (09:45 -0800)]
New functions make_flow_mod(), make_del_flow().

15 years agovswitchd: Avoid mishandling duplicate object names.
Ben Pfaff [Fri, 16 Jan 2009 00:33:51 +0000 (16:33 -0800)]
vswitchd: Avoid mishandling duplicate object names.

If a port was named twice in bridge.BRNAME.port, we would add two different
ports with the same name to bridge BRNAME.  Fix the problem.

Also, be more vigilant about duplicate names for other kinds of objects,
even though it should be difficult or impossible to end up with them.

15 years agoNew function svec_sort_unique(), svec_is_unique(), svec_get_duplicate().
Ben Pfaff [Fri, 16 Jan 2009 00:08:31 +0000 (16:08 -0800)]
New function svec_sort_unique(), svec_is_unique(), svec_get_duplicate().

15 years agobrcompat: Don't re-read configuration file from inside bridge code.
Ben Pfaff [Fri, 16 Jan 2009 00:08:00 +0000 (16:08 -0800)]
brcompat: Don't re-read configuration file from inside bridge code.

brc_modify_config() re-reads the configuration files by calling cfg_read(),
but we don't want to do that when we're deep inside the bridge code, in
the call to brc_modify_config() from phy_port_changed().  So only call
cfg_read() from the callers of brc_modify_config() that are in brcompat.c.

Also, each cfg_read() call was followed by a call to bridge_reconfigure(),
which is what reconfigure() in vswitchd.c does, so just use that function
instead of open-coding the pair of calls.

This should not have caused a real problem, because no pointers into
configuration data are retained by bridge code, but it still seems like
the "correct" way to do things.

15 years agobrcompat: Drop write-only variable.
Ben Pfaff [Thu, 15 Jan 2009 23:34:13 +0000 (15:34 -0800)]
brcompat: Drop write-only variable.

15 years agovlog: Add INFO level and apply it to messages for "normal" behavior.
Ben Pfaff [Thu, 15 Jan 2009 22:57:59 +0000 (14:57 -0800)]
vlog: Add INFO level and apply it to messages for "normal" behavior.

Fixes bug #246.

15 years agovconn: Ignore async messages before version negotiation completes.
Ben Pfaff [Thu, 15 Jan 2009 22:31:55 +0000 (14:31 -0800)]
vconn: Ignore async messages before version negotiation completes.

The kernel can send a packet_in or other asynchronous message to
the secchan before the version negotiation step is finished, which
causes the secchan to drop the connection and try again.  This commit
fixes the problem.

Fixes bug #368.

15 years agosecchan: Document --rate-limit and --burst-limit options in manpage.
Ben Pfaff [Thu, 15 Jan 2009 21:55:52 +0000 (13:55 -0800)]
secchan: Document --rate-limit and --burst-limit options in manpage.

Fixes bug #674.

15 years agosecchan: Divide options in manpage into labeled subsections.
Ben Pfaff [Thu, 15 Jan 2009 21:44:04 +0000 (13:44 -0800)]
secchan: Divide options in manpage into labeled subsections.

15 years agodebian: Move ofp-switch-setup and manpage into correct package.
Ben Pfaff [Thu, 15 Jan 2009 17:57:19 +0000 (09:57 -0800)]
debian: Move ofp-switch-setup and manpage into correct package.

These files were accidentally included in the openflow-switch package,
but they were supposed to be in openflow-switch-config.

15 years agodpctl: Fix "add-flow" and "add-flows" when actions are specified.
Ben Pfaff [Wed, 14 Jan 2009 22:08:40 +0000 (14:08 -0800)]
dpctl: Fix "add-flow" and "add-flows" when actions are specified.

Thanks to Justin for noticing the problem.

15 years agoMerge branch 'master' of nicira.dyndns.org:/srv/git/openflow/
Justin Pettit [Wed, 14 Jan 2009 22:53:10 +0000 (14:53 -0800)]
Merge branch 'master' of nicira.dyndns.org:/srv/git/openflow/

15 years agoCheck wildcards for in_port != out_port output validation.
Justin Pettit [Wed, 14 Jan 2009 22:52:59 +0000 (14:52 -0800)]
Check wildcards for in_port != out_port output validation.

OpenFlow requires that traffic that is to be sent out the interface it
came in on use the OFPP_IN_PORT virtual port.  The action validation
code that enforces this ignored the wildcards field, which meant it was
using the garbage 'in_port' value for this check.

15 years agoAdd missing #includes.
Ben Pfaff [Wed, 14 Jan 2009 21:39:20 +0000 (13:39 -0800)]
Add missing #includes.

15 years agoAllow controller to set MAC address to use in ARP responses for SNAT IPs.
root [Wed, 14 Jan 2009 01:30:08 +0000 (17:30 -0800)]
Allow controller to set MAC address to use in ARP responses for SNAT IPs.

This allows the controller to set a MAC address to use in response to
an ARP request for the NAT IP address on a non-NAT interface.  This is
useful if a NAT'd device needs to communicate with a non-NAT'd device,
when they are on the same interface on the OpenFlow switch.  When the
non-NAT'd device requests the MAC address of the NAT IP address, the
switch responds with the supplied MAC address (often the L3 router
behind it).  This allows communication in both directions to bounce off
the L3 router and not confuse controller.

15 years agovswitchd: Fix more memory leaks.
Ben Pfaff [Wed, 14 Jan 2009 01:03:01 +0000 (17:03 -0800)]
vswitchd: Fix more memory leaks.

15 years agoFix typo.
Ben Pfaff [Wed, 14 Jan 2009 00:22:07 +0000 (16:22 -0800)]
Fix typo.

15 years agovswitchd: Fix typo in comment.
Ben Pfaff [Wed, 14 Jan 2009 00:21:55 +0000 (16:21 -0800)]
vswitchd: Fix typo in comment.

15 years agobrcompat: Don't try to write the config file if it isn't configured.
Ben Pfaff [Wed, 14 Jan 2009 00:21:37 +0000 (16:21 -0800)]
brcompat: Don't try to write the config file if it isn't configured.

15 years agoleak-checker: Make output file unbuffered.
Ben Pfaff [Wed, 14 Jan 2009 00:21:18 +0000 (16:21 -0800)]
leak-checker: Make output file unbuffered.

This way, we get an up-to-date record when the process is killed.

15 years agovswitchd: Fix memory leak.
Ben Pfaff [Tue, 13 Jan 2009 23:29:58 +0000 (15:29 -0800)]
vswitchd: Fix memory leak.

15 years agoFix bugs in leak checker.
Ben Pfaff [Tue, 13 Jan 2009 23:10:11 +0000 (15:10 -0800)]
Fix bugs in leak checker.

Oops.

15 years agovswitchd: Fix memory leaks.
Ben Pfaff [Tue, 13 Jan 2009 22:03:24 +0000 (14:03 -0800)]
vswitchd: Fix memory leaks.

15 years agoFix memory leak in nl_sock_transact().
Ben Pfaff [Tue, 13 Jan 2009 21:54:46 +0000 (13:54 -0800)]
Fix memory leak in nl_sock_transact().

15 years agoImplement simple memory leak detector.
Ben Pfaff [Tue, 13 Jan 2009 21:46:15 +0000 (13:46 -0800)]
Implement simple memory leak detector.

Initially, make it available only in secchan and vswitchd.  But it's easy
to add it elsewhere too.

15 years agoAdd ability to open null fds to process_start().
Ben Pfaff [Tue, 13 Jan 2009 21:15:55 +0000 (13:15 -0800)]
Add ability to open null fds to process_start().

15 years agoAdd libpcre3-dev to build-dependencies.
Ben Pfaff [Tue, 13 Jan 2009 00:50:20 +0000 (16:50 -0800)]
Add libpcre3-dev to build-dependencies.

15 years agoNew function process_run().
Ben Pfaff [Tue, 13 Jan 2009 00:49:55 +0000 (16:49 -0800)]
New function process_run().

15 years agoMerge master and vswitchd branches
Ben Pfaff [Tue, 13 Jan 2009 01:21:33 +0000 (17:21 -0800)]
Merge master and vswitchd branches

15 years agoMake dpctl accept an arbitrary number of actions.
Ben Pfaff [Fri, 9 Jan 2009 21:28:12 +0000 (13:28 -0800)]
Make dpctl accept an arbitrary number of actions.

This cleanup has been wanted for a while.

As a side effect, this change deletes some dead code pointed out by Chris
Eagle via Fortify: many of the deleted comparisons against act_len were
never true because of the sizes of the objects invovled.

15 years agolearning-switch: Remove unused variable.
Ben Pfaff [Fri, 9 Jan 2009 01:21:46 +0000 (17:21 -0800)]
learning-switch: Remove unused variable.

Found by Chris Eagle via Fortify.

15 years agofatal-signal: Fix bug in call_hooks() recursion detection.
Ben Pfaff [Fri, 9 Jan 2009 01:20:34 +0000 (17:20 -0800)]
fatal-signal: Fix bug in call_hooks() recursion detection.

Found by Chris Eagle via Fortify.

15 years agoUse xstrdup() instead of xasprintf() for duplicating constant string.
Ben Pfaff [Fri, 9 Jan 2009 01:16:41 +0000 (17:16 -0800)]
Use xstrdup() instead of xasprintf() for duplicating constant string.

15 years agodpctl: Fix use-after-free in "probe" command.
Ben Pfaff [Fri, 9 Jan 2009 01:13:30 +0000 (17:13 -0800)]
dpctl: Fix use-after-free in "probe" command.

Found by Chris Eagle via Fortify.

15 years agonetdev: Fix file descriptor leak.
Ben Pfaff [Fri, 9 Jan 2009 01:10:34 +0000 (17:10 -0800)]
netdev: Fix file descriptor leak.

This could be important since it leaks a file descriptor on every
netdev_open(), but only if an IPv6 address is configured on the network
device (which is rare and indicates an error condition for OpenFlow).

Found by Chris Eagle via Fortify.

15 years agodatapath: Check DMI strings for NULL.
Ben Pfaff [Fri, 9 Jan 2009 01:06:54 +0000 (17:06 -0800)]
datapath: Check DMI strings for NULL.

dmi_get_system_info() can return NULL, so check for it.

Found by Chris Eagle via Fortify.

15 years agodatapath: Avoid pointer arithmetic on possibly-NULL pointer.
Ben Pfaff [Fri, 9 Jan 2009 01:06:19 +0000 (17:06 -0800)]
datapath: Avoid pointer arithmetic on possibly-NULL pointer.

Pointer arithmetic on a null pointer yields undefined behavior, even
though it doesn't really matter in the real world (normally).

Found by Chris Eagle via Fortify.

15 years agodaemon: report error if daemon child process fails to start properly
Ben Pfaff [Fri, 9 Jan 2009 01:00:06 +0000 (17:00 -0800)]
daemon: report error if daemon child process fails to start properly

Found by Chris Eagle via Fortify.

15 years agodpctl: Exit unsuccessfully if a write to stdout or stderr failed.
Ben Pfaff [Fri, 9 Jan 2009 00:56:50 +0000 (16:56 -0800)]
dpctl: Exit unsuccessfully if a write to stdout or stderr failed.

A program should exit with an error if its output failed, so check for
this before termination.

Found by Chris Eagle via Fortify.

15 years agoUse strtok_r() instead of strtok().
Ben Pfaff [Fri, 9 Jan 2009 00:49:31 +0000 (16:49 -0800)]
Use strtok_r() instead of strtok().

Not a bug but a style issue, since this code doesn't call and isn't called
by other code that uses strtok().

Found by Chris Eagle via Fortify.

15 years agodhcp-client: Don't report long time to expiration after lease expires.
Ben Pfaff [Fri, 9 Jan 2009 00:47:01 +0000 (16:47 -0800)]
dhcp-client: Don't report long time to expiration after lease expires.

There is a race between time advancing past the lease expiration time
and actually transitioning to the expired state.  Fix this race.

Found by Chris Eagle via Fortify.

15 years agodhcp-client: Add comment about time going backward.
Ben Pfaff [Fri, 9 Jan 2009 00:45:34 +0000 (16:45 -0800)]
dhcp-client: Add comment about time going backward.

Issue raised by Chris Eagle via Fortify.

15 years agodatapath: Make 'length' local variable unsigned, for consistency.
Ben Pfaff [Fri, 9 Jan 2009 00:40:16 +0000 (16:40 -0800)]
datapath: Make 'length' local variable unsigned, for consistency.

This is a style issue, not a bug, if you chase down what the function
and the caller are doing.

Found by Chris Eagle via Fortify.

15 years agoUse a uint16_t variable to store a 16-bit value, not an int.
Ben Pfaff [Fri, 9 Jan 2009 00:35:47 +0000 (16:35 -0800)]
Use a uint16_t variable to store a 16-bit value, not an int.

This is a style issue, not a bug, because the int only ever held
values in the range 0...UINT16_MAX.

Found by Chris Eagle via Fortify.

15 years agoMark memory allocation functions with __attribute__((malloc)).
Ben Pfaff [Fri, 9 Jan 2009 00:32:21 +0000 (16:32 -0800)]
Mark memory allocation functions with __attribute__((malloc)).

This may improve optimization, and it may make it easier for tools such
as Fortify to see what is going on.

15 years agodatapath: Fix tracking of number of flows in hash table.
Ben Pfaff [Sat, 10 Jan 2009 00:45:54 +0000 (16:45 -0800)]
datapath: Fix tracking of number of flows in hash table.

Fixes bug #684.

Thanks to Reid for noticing the problem.

15 years agodatapath: Add log level annotations to printk messages.
Ben Pfaff [Sat, 10 Jan 2009 00:24:56 +0000 (16:24 -0800)]
datapath: Add log level annotations to printk messages.

General approach is:

- KERN_EMERG: Conditions that prevent the modules from loading.

- KERN_ERR: Conditions that indicate an OpenFlow kernel code bug.

- KERN_WARNING: Conditions that might indicate a bug in OpenFlow kernel
  code or other kernel code.

- KERN_NOTICE: Conditions that might indicate a bug in secchan or the
  OpenFlow controller, or minor conditions that are typically transient.

15 years agoAdd datapath device name to printk's.
Justin Pettit [Fri, 9 Jan 2009 23:41:42 +0000 (15:41 -0800)]
Add datapath device name to printk's.

To aid debugging, this prints the datapath device name to printk
messages.  Not doing this wasn't a big deal when only a single datapath
was running, but it's very confusing when there are multiple.

15 years agovswitchd: Delete 'ifaces' pointer to interface when deleting interface.
Ben Pfaff [Fri, 9 Jan 2009 23:18:36 +0000 (15:18 -0800)]
vswitchd: Delete 'ifaces' pointer to interface when deleting interface.

Otherwise we dereference a dangling pointer to the interface when we
look up the interface by datapath port index, causing a segfault.

Introduced in commit 150ac45, "vswitchd: Eliminate "can't forward to bad
port" when interfaces disappear," which deletes an interface that is known
to be in the datapath port index table.

15 years agorconn: Fix segfault when the idle timeout races with connection failure.
Ben Pfaff [Fri, 9 Jan 2009 22:30:25 +0000 (14:30 -0800)]
rconn: Fix segfault when the idle timeout races with connection failure.

Noticed in Xen VM migration torture test (thanks Henrik!)

15 years agoDelete extermally removed interfaces from bridge compatibility config.
Justin Pettit [Fri, 9 Jan 2009 22:12:24 +0000 (14:12 -0800)]
Delete extermally removed interfaces from bridge compatibility config.

The bridge compatibility code was not notified when interfaces were
removed from datapaths.  This fixes that.

15 years agovswitchd: Eliminate "can't forward to bad port" when interfaces disappear.
Ben Pfaff [Fri, 9 Jan 2009 20:51:19 +0000 (12:51 -0800)]
vswitchd: Eliminate "can't forward to bad port" when interfaces disappear.

When an interface was deleted from a datapath by a process other than
vswitchd (which is not supposed to happen), vswitchd would not realize it
and would continue to set up flows for that interface (and leave in place
existing flows).  This caused the kernel to complain "can't forward to bad
port" for each packet on these flows.

Xen triggered this by destroying vifs that were on vswitchd-controlled
datapaths (which removes them from any datapath that they are on).

This fixes the problem, by making vswitchd notice when interfaces
disappear and fixing up the flow table.

15 years agodatapath: Don't drop oversize GSO frames, since GSO will break them up.
Ben Pfaff [Fri, 9 Jan 2009 19:46:06 +0000 (11:46 -0800)]
datapath: Don't drop oversize GSO frames, since GSO will break them up.

Fixes TCP performance problems on Xen.

All credit to Justin for diagnosis.

15 years agoAdd support for sysfs and ethtool.
Justin Pettit [Fri, 9 Jan 2009 01:16:33 +0000 (17:16 -0800)]
Add support for sysfs and ethtool.

Add support for sysfs when the bridge compatibility module is running.
Currently, this only works for 2.6.18 kernels.  Working on all kernels
should be fixed soon.  Also, add ethtool support to the datapath device.