openvswitch
15 years agodpctl: Remove nl: special case that no longer makes sense.
Ben Pfaff [Wed, 11 Mar 2009 23:22:53 +0000 (16:22 -0700)]
dpctl: Remove nl: special case that no longer makes sense.

It looks like this was always broken anyway, since the "name" that was
computed was never used.

15 years agoUpdate Xen init scripts & default config for changes to config file handling.
Keith Amidon [Wed, 11 Mar 2009 22:28:10 +0000 (15:28 -0700)]
Update Xen init scripts & default config for changes to config file handling.

15 years agovswitch: Don't delete all flows on SIGHUP if a controller is configured.
Ben Pfaff [Wed, 11 Mar 2009 22:38:22 +0000 (15:38 -0700)]
vswitch: Don't delete all flows on SIGHUP if a controller is configured.

This was intended to only take effect when we had been running standalone
and were now connecting to a controller, but the test was reversed.
Instead of just reversing the test, this change also deletes flows when
we switch from connected to standalone as well.

15 years agocfg: Fix cfg_unlock() to remove the lockfile unconditionally.
Ben Pfaff [Wed, 11 Mar 2009 21:43:53 +0000 (14:43 -0700)]
cfg: Fix cfg_unlock() to remove the lockfile unconditionally.

Calling remove_lockfile() does the wrong thing here, because it only
removes stale lockfiles.  Here, the lockfile is not stale, because we know
that we own it.  Therefore, we can remove it unconditionally.

15 years agocfg: Make lock_fd, dirty static.
Ben Pfaff [Wed, 11 Mar 2009 21:34:23 +0000 (14:34 -0700)]
cfg: Make lock_fd, dirty static.

These aren't used elsewhere, so there is no reason for them to be extern.

15 years agodpif: More consistently initialize dpifs in failure cases.
Ben Pfaff [Wed, 11 Mar 2009 21:32:50 +0000 (14:32 -0700)]
dpif: More consistently initialize dpifs in failure cases.

15 years agodpif: Fix fd leak in dpif_create().
Ben Pfaff [Wed, 11 Mar 2009 21:32:24 +0000 (14:32 -0700)]
dpif: Fix fd leak in dpif_create().

15 years agolockfile: Fix inverted comparison.
Ben Pfaff [Wed, 11 Mar 2009 21:33:32 +0000 (14:33 -0700)]
lockfile: Fix inverted comparison.

remove_lockfile() returns a negative errno value on error, 0 on success.

Minor style fix also.

15 years agolockfile: Remove fd parameter to remove_lockfile().
Ben Pfaff [Wed, 11 Mar 2009 21:24:39 +0000 (14:24 -0700)]
lockfile: Remove fd parameter to remove_lockfile().

There is no reason that remove_lockfile() should close a fd passed in to
it.  The caller can do that just as well.

15 years agocfg: Initialize lock_fd to -1.
Ben Pfaff [Wed, 11 Mar 2009 21:23:15 +0000 (14:23 -0700)]
cfg: Initialize lock_fd to -1.

Otherwise cfg_unlock() will close stdin on the first call.  Since
create_lockfile() calls remove_lockfile() as its first action, that's
on every useful execution.

15 years agoFix 64-bit alignment issue in management protocol message.
Keith Amidon [Wed, 11 Mar 2009 20:27:28 +0000 (13:27 -0700)]
Fix 64-bit alignment issue in management protocol message.

15 years agoExample configuration in comments in the configuration files.
Keith Amidon [Wed, 4 Mar 2009 23:35:59 +0000 (15:35 -0800)]
Example configuration in comments in the configuration files.

15 years agovswitch: Disallow bridges named "dpN" or "nl:N".
Ben Pfaff [Wed, 11 Mar 2009 20:43:47 +0000 (13:43 -0700)]
vswitch: Disallow bridges named "dpN" or "nl:N".

Natasha discovered that naming a datapath numerically, e.g.
"bridge.dp0.port = <device>", provokes an error.  The easiest fix is to
just disallow this.

Fixes bug #1030.

15 years agosecchan: Don't infinite-loop in switch_status_destroy().
Ben Pfaff [Wed, 11 Mar 2009 20:41:36 +0000 (13:41 -0700)]
secchan: Don't infinite-loop in switch_status_destroy().

Duh.

15 years agodatapath: Always return EFAULT to userspace when copy_to/from_user() fails.
Ben Pfaff [Wed, 11 Mar 2009 20:41:15 +0000 (13:41 -0700)]
datapath: Always return EFAULT to userspace when copy_to/from_user() fails.

copy_from_user() and copy_to_user() return the number of bytes that could
not be copied, not a conventional error code, so we need to translate it
into -EFAULT ourselves.

15 years agodatapath: Refuse module load if an active bridge exists.
Ben Pfaff [Wed, 11 Mar 2009 18:13:01 +0000 (11:13 -0700)]
datapath: Refuse module load if an active bridge exists.

Loading when an active bridge exists will cause an OOPS as soon as any
packet is received on a bridged interface, because the datapath will
attempt to interpret the bridge's "struct net_bridge_port" as a datapath
"struct net_bridge_port", which is completely wrong.

15 years agodatapath: End load-time greeting message with new-line.
Ben Pfaff [Wed, 11 Mar 2009 18:08:14 +0000 (11:08 -0700)]
datapath: End load-time greeting message with new-line.

15 years agoFix help output that indicated multiple config files can be read.
Justin Pettit [Wed, 11 Mar 2009 07:49:18 +0000 (00:49 -0700)]
Fix help output that indicated multiple config files can be read.

15 years agoFirst cut of management control protocol.
Justin Pettit [Wed, 11 Mar 2009 06:59:36 +0000 (23:59 -0700)]
First cut of management control protocol.

Defines a management control protocol between the switch and NOX.
Currently, this is only used by vswitchd.  It allows the configuration
and monitoring of a switch as a whole, as opposed to the flow table view
provided by OpenFlow.  To enable, add the appropriate "mgmt" keys to
"vswitchd.conf".  Better docs will be forthcoming...

15 years agoIgnore vim swap files.
Justin Pettit [Wed, 11 Mar 2009 06:48:50 +0000 (23:48 -0700)]
Ignore vim swap files.

15 years agovswitch: Choose the datapath ID more intelligently.
Ben Pfaff [Wed, 11 Mar 2009 00:01:52 +0000 (17:01 -0700)]
vswitch: Choose the datapath ID more intelligently.

The new algorithm needs to be documented (along with a lot of new vswitch
settings).

15 years agocfg: Add ability to parse datapath IDs.
Ben Pfaff [Wed, 11 Mar 2009 00:01:16 +0000 (17:01 -0700)]
cfg: Add ability to parse datapath IDs.

15 years agocfg: Fix collision between CFG_VLAN and CFG_REQUIRED.
Ben Pfaff [Tue, 10 Mar 2009 23:37:43 +0000 (16:37 -0700)]
cfg: Fix collision between CFG_VLAN and CFG_REQUIRED.

15 years agodpctl: New command "get-name", for symmetry with "get-idx".
Ben Pfaff [Tue, 10 Mar 2009 23:14:11 +0000 (16:14 -0700)]
dpctl: New command "get-name", for symmetry with "get-idx".

The utility of both commands is now seriously in question, however, since
all dpctl commands now accept both names and numbers.

15 years agodpctl: Allow initial set of interfaces to be specified on "adddp" command.
Ben Pfaff [Tue, 10 Mar 2009 23:13:35 +0000 (16:13 -0700)]
dpctl: Allow initial set of interfaces to be specified on "adddp" command.

Commands such as e.g. "dpctl adddp dp0 eth0 eth1 eth2" are now accepted.

15 years agovswitch: Fix sense of comparison.
Ben Pfaff [Tue, 10 Mar 2009 23:58:06 +0000 (16:58 -0700)]
vswitch: Fix sense of comparison.

We only want to reconnect if the controller is *different*, not if it
is the same.

15 years agosecchan: In ofproto_set_controller(), only reconnect if controller really changed.
Ben Pfaff [Tue, 10 Mar 2009 23:54:00 +0000 (16:54 -0700)]
secchan: In ofproto_set_controller(), only reconnect if controller really changed.

The vswitchd bridge code tries not to call this function if it doesn't
have to, but it's not doing a good job.  We should fix it in vswitchd, but
it's also a good idea to do it here.

15 years agodpctl: Accept port names (e.g. "NORMAL") on in_port in flow specifications.
Ben Pfaff [Tue, 10 Mar 2009 22:23:14 +0000 (15:23 -0700)]
dpctl: Accept port names (e.g. "NORMAL") on in_port in flow specifications.

15 years agoofp-print: Make flow statistics and actions slightly easier to read.
Ben Pfaff [Tue, 10 Mar 2009 22:15:06 +0000 (15:15 -0700)]
ofp-print: Make flow statistics and actions slightly easier to read.

15 years agoofp-print: Support printing NXAST_RESUBMIT Nicira action.
Ben Pfaff [Tue, 10 Mar 2009 22:12:05 +0000 (15:12 -0700)]
ofp-print: Support printing NXAST_RESUBMIT Nicira action.

15 years agosecchan: Fix segfault in handling OFPP_TABLE, NXAST_RESUBMIT actions.
Ben Pfaff [Tue, 10 Mar 2009 22:06:49 +0000 (15:06 -0700)]
secchan: Fix segfault in handling OFPP_TABLE, NXAST_RESUBMIT actions.

15 years agoImplement OFPP_NORMAL action in secchan and hook into vswitchd.
Ben Pfaff [Tue, 10 Mar 2009 21:03:13 +0000 (14:03 -0700)]
Implement OFPP_NORMAL action in secchan and hook into vswitchd.

Bonded interface accounting and rebalancing has been removed and needs to
be added back in.

Handling of ARP packets arriving on bonded interfaces is also known to
be broken.

15 years agovswitch: Work in terms of ODP port numbers.
Ben Pfaff [Tue, 10 Mar 2009 21:04:16 +0000 (14:04 -0700)]
vswitch: Work in terms of ODP port numbers.

The vswitch used to be an OpenFlow client, so all of its internals were in
terms of OpenFlow port numbering.  When it was converted to be a datapath
client instead, a shim layer that converted between OpenFlow and ODP port
numbering was inserted, so that it could still work internally in terms of
OpenFlow port numbers.

This commit makes the vswitch use ODP port numbering internally, removing
this shim layer.

15 years agosecchan: Purge buffered packets on startup.
Ben Pfaff [Tue, 10 Mar 2009 17:41:30 +0000 (10:41 -0700)]
secchan: Purge buffered packets on startup.

This keeps packets that can be minutes old from getting forwarded.

15 years agosecchan: Fix memory leak, and flush all flows on ofproto destruction.
Ben Pfaff [Tue, 10 Mar 2009 17:14:14 +0000 (10:14 -0700)]
secchan: Fix memory leak, and flush all flows on ofproto destruction.

15 years agosecchan: New function ofproto_flush_flows() to flush all flows.
Ben Pfaff [Tue, 10 Mar 2009 17:13:27 +0000 (10:13 -0700)]
secchan: New function ofproto_flush_flows() to flush all flows.

15 years agoclassifier: New enum CLS_INC_ALL, for convenience.
Ben Pfaff [Tue, 10 Mar 2009 17:12:40 +0000 (10:12 -0700)]
classifier: New enum CLS_INC_ALL, for convenience.

15 years agosecchan: Make ofproto_add_flow() able to add a permanent flow.
Ben Pfaff [Tue, 10 Mar 2009 16:55:41 +0000 (09:55 -0700)]
secchan: Make ofproto_add_flow() able to add a permanent flow.

15 years agosecchan: Add wildcard support to ofproto_add_flow(), ofproto_delete_flow().
Ben Pfaff [Tue, 10 Mar 2009 17:44:23 +0000 (10:44 -0700)]
secchan: Add wildcard support to ofproto_add_flow(), ofproto_delete_flow().

15 years agosecchan: Keep track of ofproto even when translating nested actions.
Ben Pfaff [Mon, 9 Mar 2009 18:28:01 +0000 (11:28 -0700)]
secchan: Keep track of ofproto even when translating nested actions.

Allowing vswitch to hook OFPP_NORMAL will require nested actions (via
NXAST_RESUBMIT) to access the ofproto, so we need to be able to get to it
in that case.

15 years agovswitch: Fix typo in comment.
Ben Pfaff [Tue, 10 Mar 2009 18:12:14 +0000 (11:12 -0700)]
vswitch: Fix typo in comment.

15 years agosecchan: Drop unused function.
Ben Pfaff [Tue, 10 Mar 2009 20:34:24 +0000 (13:34 -0700)]
secchan: Drop unused function.

15 years agovswitch: Drop unused extern declaration.
Ben Pfaff [Tue, 10 Mar 2009 19:29:43 +0000 (12:29 -0700)]
vswitch: Drop unused extern declaration.

This was entirely unused.

15 years agovconn: Delete fd-based vconns.
Ben Pfaff [Mon, 9 Mar 2009 22:39:46 +0000 (15:39 -0700)]
vconn: Delete fd-based vconns.

These vconns were only a crappy kluge for communication between vswitchd
and its subordinate secchans.  We are better off rid of them.

15 years agovswitch: Eliminate OpenFlow connection to ofproto.
Ben Pfaff [Mon, 9 Mar 2009 22:37:16 +0000 (15:37 -0700)]
vswitch: Eliminate OpenFlow connection to ofproto.

The vswitch interface to the ofproto is now entirely a functional
interface, instead of going partially over an OpenFlow connection that
"loops back" to the ofproto via a socketpair.  So this commit drops
the code that connects and maintains that connection.

15 years agoStop using vswitch OpenFlow connection to ofproto, by adding ofproto features.
Ben Pfaff [Mon, 9 Mar 2009 22:49:35 +0000 (15:49 -0700)]
Stop using vswitch OpenFlow connection to ofproto, by adding ofproto features.

15 years agosecchan: Make netflow expiration arguments more sensible.
Ben Pfaff [Mon, 9 Mar 2009 21:12:25 +0000 (14:12 -0700)]
secchan: Make netflow expiration arguments more sensible.

This cleanup is useful preparation for adding a flow expiration hook for
vswitchd to use, since that hook wants to receive essentially the same
information.

15 years agosecchan: Optimize flow expiration when not connected.
Ben Pfaff [Mon, 9 Mar 2009 20:50:16 +0000 (13:50 -0700)]
secchan: Optimize flow expiration when not connected.

There is no point in composing a flow-expiration message for an ofconn
whose rconn is not connected.

This optimization might be a win for a standalone vswitch.

15 years agosecchan: Add comments.
Ben Pfaff [Mon, 9 Mar 2009 20:58:01 +0000 (13:58 -0700)]
secchan: Add comments.

15 years agoMove ODP-related functions into new module "odp-util".
Ben Pfaff [Mon, 9 Mar 2009 18:25:37 +0000 (11:25 -0700)]
Move ODP-related functions into new module "odp-util".

This allows code outside ofproto.c to use it, which will soon be useful
to allow vswitchd to hook OFPP_NORMAL.

15 years agosecchan: Retain original input port for NXAST_RESUBMIT action.
Ben Pfaff [Mon, 9 Mar 2009 18:07:06 +0000 (11:07 -0700)]
secchan: Retain original input port for NXAST_RESUBMIT action.

The NXAST_RESUBMIT action causes a secondary lookup in the flow table with
a different input port value.  However, we want to retain the original
input port for processing the result of that secondary lookup.  Otherwise,
output to OFPP_IN_PORT will send the packet to the wrong port, and output
to the input port without specifying OFPP_IN_PORT will be mistakenly
allowed.

15 years agosecchan: Fix typo in comment.
Ben Pfaff [Mon, 9 Mar 2009 18:03:24 +0000 (11:03 -0700)]
secchan: Fix typo in comment.

15 years agosecchan: Add clarifying comment.
Ben Pfaff [Mon, 9 Mar 2009 19:56:29 +0000 (12:56 -0700)]
secchan: Add clarifying comment.

15 years agovswitch: Fix memory leak in error path.
Ben Pfaff [Mon, 9 Mar 2009 20:12:54 +0000 (13:12 -0700)]
vswitch: Fix memory leak in error path.

15 years agodpif: New function dpif_id() for getting the datapath index.
Ben Pfaff [Sat, 7 Mar 2009 00:37:01 +0000 (16:37 -0800)]
dpif: New function dpif_id() for getting the datapath index.

Using this function instead of referring to the "minor" member directly
helps with abstraction.

15 years agovswitch: Fix file descriptor leak.
Ben Pfaff [Sat, 7 Mar 2009 00:29:51 +0000 (16:29 -0800)]
vswitch: Fix file descriptor leak.

Need to close all the dpifs that we open.

15 years agosecchan: Remove an invalid optimization.
Ben Pfaff [Sat, 7 Mar 2009 00:16:19 +0000 (16:16 -0800)]
secchan: Remove an invalid optimization.

15 years agoRepair recently broken cfg_has_section().
Justin Pettit [Mon, 9 Mar 2009 01:07:46 +0000 (18:07 -0700)]
Repair recently broken cfg_has_section().

15 years agoHave secchan reply to OpenFlow echo requests.
Justin Pettit [Mon, 9 Mar 2009 01:04:58 +0000 (18:04 -0700)]
Have secchan reply to OpenFlow echo requests.

15 years agoInclude limits.h for UINT_MAX definition.
Justin Pettit [Thu, 5 Mar 2009 19:59:24 +0000 (11:59 -0800)]
Include limits.h for UINT_MAX definition.

15 years agoKeep secchan and vswitchd from consuming 100% CPU when a datapath is deleted.
Ben Pfaff [Fri, 6 Mar 2009 22:34:46 +0000 (14:34 -0800)]
Keep secchan and vswitchd from consuming 100% CPU when a datapath is deleted.

Before this commit, "dpctl deldp x" would cause secchan or vswitchd to
consume 100% CPU if they were responsible for the given datapath.  This
fixes the problem.

15 years agovswitch: Keep existing datapaths when starting up.
Ben Pfaff [Fri, 6 Mar 2009 22:12:36 +0000 (14:12 -0800)]
vswitch: Keep existing datapaths when starting up.

Until now, vswitchd has deleted all existing datapaths when it started up,
and then re-created the ones that are actually configured.  This is a very
"clean", conservative design, but it has undesirable effects in practice.
In particular, if any datapath has a local port with an IP address
configured on it, then deleting the datapath and recreating it will drop
that IP address, which can mean that your machine just lost connectivity
to the outside world.

So, with this commit, now vswitchd only deletes datapaths at startup that
don't have configured bridges, preserving local port IP addresses.

15 years agodpif: New function dpif_get_name().
Ben Pfaff [Fri, 6 Mar 2009 22:03:24 +0000 (14:03 -0800)]
dpif: New function dpif_get_name().

This function is equivalent to querying the ODPP_LOCAL port, but its name
better reflects the caller's intent, and its interface is slightly more
convenient.

15 years agoMake ODP_DP_CREATE distinguish conflicting name from conflicting number.
Ben Pfaff [Fri, 6 Mar 2009 22:02:06 +0000 (14:02 -0800)]
Make ODP_DP_CREATE distinguish conflicting name from conflicting number.

There's no point in retrying with a different number if the name conflicts.

15 years agoshash: Don't free block we didn't allocate in shash_destroy().
Ben Pfaff [Fri, 6 Mar 2009 21:58:47 +0000 (13:58 -0800)]
shash: Don't free block we didn't allocate in shash_destroy().

15 years agoflow: Properly translate port numbers in flow_from_match().
Ben Pfaff [Fri, 6 Mar 2009 21:30:09 +0000 (13:30 -0800)]
flow: Properly translate port numbers in flow_from_match().

The OpenFlow and datapath port numbers for the local port are different.
We were translating them in one direction (in flow_to_match()) but not
in the other (in flow_from_match()).

This fixes a performance problem (we were setting up the wrong flow).

15 years agonetdev: Don't log a warning for unsupported ethtool operations.
Ben Pfaff [Fri, 6 Mar 2009 18:58:13 +0000 (10:58 -0800)]
netdev: Don't log a warning for unsupported ethtool operations.

Plenty of devices don't support ethtool, and we don't use ethtool for
anything essential, so there's no point in logging a warning here.

15 years agodpif: Don't log a warning in dpifmon_poll() for missing device.
Ben Pfaff [Fri, 6 Mar 2009 18:57:30 +0000 (10:57 -0800)]
dpif: Don't log a warning in dpifmon_poll() for missing device.

We were using dpif_port_query_by_name() here to see whether the device is
part of the datapath, so there's no point in logging a warning if it isn't.

15 years agosecchan: Fix use-after-free by allocating rule actions as separate blocks.
Ben Pfaff [Fri, 6 Mar 2009 17:52:08 +0000 (09:52 -0800)]
secchan: Fix use-after-free by allocating rule actions as separate blocks.

The ofproto code tried to cleverly save memory and time by allocating
rule actions as a flexible array member at the end of "struct rule".  When
the actions changed, this required a realloc() call.  Unfortunately, there
are sometimes pointers to rules (e.g. the "super" pointer from subrules)
that were not getting adjusted to point to the new location.

It's better to just allocate actions separately, so fix it by doing that.

15 years agoCleanup .gitignore for 2.4 datapath builds.
Justin Pettit [Fri, 6 Mar 2009 08:34:37 +0000 (00:34 -0800)]
Cleanup .gitignore for 2.4 datapath builds.

15 years agoMore files for git to ignore for 2.6 datapath builds.
Justin Pettit [Fri, 6 Mar 2009 08:34:01 +0000 (00:34 -0800)]
More files for git to ignore for 2.6 datapath builds.

15 years agoCleanup files for git to ignore in datapath linux-2.6 build directory.
Justin Pettit [Fri, 6 Mar 2009 08:24:45 +0000 (00:24 -0800)]
Cleanup files for git to ignore in datapath linux-2.6 build directory.

15 years agoOnly build SSL components if build configured with HAVE_OPENSSL.
Justin Pettit [Fri, 6 Mar 2009 08:01:25 +0000 (00:01 -0800)]
Only build SSL components if build configured with HAVE_OPENSSL.

15 years agoAdd limits.h for UINT_MAX definition.
Justin Pettit [Fri, 6 Mar 2009 08:01:00 +0000 (00:01 -0800)]
Add limits.h for UINT_MAX definition.

15 years agosecchan: Correctly maintain rule's number of actions.
Ben Pfaff [Fri, 6 Mar 2009 01:34:42 +0000 (17:34 -0800)]
secchan: Correctly maintain rule's number of actions.

We were reallocating memory properly but not updating the "n_actions"
member, which sometimes led to reading past the end of a block.

This problem possibly caused segfaults, since the OpenFlow->ODP action
translation code assumes that OpenFlow actions are prevalidated, and
random memory is not necessarily valid OpenFlow actions :-)

Spotted by Valgrind.

15 years agodpif: Suppress spurious error from Valgrind.
Ben Pfaff [Fri, 6 Mar 2009 01:00:46 +0000 (17:00 -0800)]
dpif: Suppress spurious error from Valgrind.

15 years agoAdd header for interacting with Valgrind, where it is available.
Ben Pfaff [Fri, 6 Mar 2009 00:59:49 +0000 (16:59 -0800)]
Add header for interacting with Valgrind, where it is available.

15 years agonetdev: Fall back to /proc/net/dev on kernels that don't support RTM_GETLINK.
Ben Pfaff [Thu, 5 Mar 2009 23:09:00 +0000 (15:09 -0800)]
netdev: Fall back to /proc/net/dev on kernels that don't support RTM_GETLINK.

RTM_GETLINK is the best way to get network device statistics, but it was
only enabled in all kernels in 2.6.19.  So now test for support at startup
and fall back to reading /proc/net/dev if RTM_GETLINK does not work.

15 years agodpif: Make it harder to randomly corrupt memory.
Ben Pfaff [Thu, 5 Mar 2009 21:57:35 +0000 (13:57 -0800)]
dpif: Make it harder to randomly corrupt memory.

15 years agosecchan: Initialize odp_flow members in other places that they were missed.
Ben Pfaff [Thu, 5 Mar 2009 21:57:17 +0000 (13:57 -0800)]
secchan: Initialize odp_flow members in other places that they were missed.

This might fix more memory corruption of the same form as commit 60822fb1,
"secchan: Fix random memory corruption due to uninitialized pointer."

15 years agosecchan: Fix memory leaks.
Ben Pfaff [Thu, 5 Mar 2009 21:43:26 +0000 (13:43 -0800)]
secchan: Fix memory leaks.

15 years agosecchan: Revalidate subrules when adding a wildcarded rule without displacement.
Ben Pfaff [Thu, 5 Mar 2009 21:36:37 +0000 (13:36 -0800)]
secchan: Revalidate subrules when adding a wildcarded rule without displacement.

Natasha noticed that adding a rule would not properly change the
destinations of already-established flows.  This should fix the problem.

15 years agodatapath: Fix querying the local port by name.
Ben Pfaff [Thu, 5 Mar 2009 21:13:30 +0000 (13:13 -0800)]
datapath: Fix querying the local port by name.

Before, this would return an ENOENT error.

15 years agovswitchd: Start adding ports at index 1, since index 0 is reserved.
Ben Pfaff [Thu, 5 Mar 2009 21:07:31 +0000 (13:07 -0800)]
vswitchd: Start adding ports at index 1, since index 0 is reserved.

Otherwise we get a spurious error message (although we do go on to try the
next port, so the message isn't a big deal).

15 years agodpif: Improve logging messages, to ease debugging.
Ben Pfaff [Thu, 5 Mar 2009 21:06:45 +0000 (13:06 -0800)]
dpif: Improve logging messages, to ease debugging.

15 years agovswitchd: Integrate secchan into vswitchd.
Ben Pfaff [Thu, 5 Mar 2009 20:30:36 +0000 (12:30 -0800)]
vswitchd: Integrate secchan into vswitchd.

This change means that vswitchd is now a single process that manages all
of the datapaths, instead of a parent process and any number of secchan
subprocesses.

It may be better to fork off processes that each manage a few bridges, to
take advantage of multiple cores.  Perhaps this is upcoming.

There are numerous new configuration file directives that are, sadly, not
yet documented.

15 years agoofproto: Make ofproto_set_controller() able to disconnect from controller.
Ben Pfaff [Thu, 5 Mar 2009 20:29:02 +0000 (12:29 -0800)]
ofproto: Make ofproto_set_controller() able to disconnect from controller.

The vswitch wants to do this.

15 years agoofproto: Change semantics of configuration parameters.
Ben Pfaff [Thu, 5 Mar 2009 20:28:36 +0000 (12:28 -0800)]
ofproto: Change semantics of configuration parameters.

Before, a value of 0 meant "no change".  Now, it means "use the default
value".  This turns out to be more useful.

15 years agovconn-ssl: Log all errors when trying to create a connection, not just the first.
Ben Pfaff [Thu, 5 Mar 2009 20:27:46 +0000 (12:27 -0800)]
vconn-ssl: Log all errors when trying to create a connection, not just the first.

This will, I hope, help administrators to see whether just one setting or
all of them are unconfigured.

15 years agosocket-util: New function guess_netmask().
Ben Pfaff [Thu, 5 Mar 2009 20:26:22 +0000 (12:26 -0800)]
socket-util: New function guess_netmask().

15 years agorconn: Tolerate negative argument in rconn_set_max_backoff().
Ben Pfaff [Thu, 5 Mar 2009 20:26:07 +0000 (12:26 -0800)]
rconn: Tolerate negative argument in rconn_set_max_backoff().

This argument is likely to come directly from the user, so it helps callers
if they don't have to validate carefully.

15 years agomore cfg fixes
Ben Pfaff [Thu, 5 Mar 2009 20:25:10 +0000 (12:25 -0800)]
more cfg fixes

15 years agoexecuter: Make default dir part of executer.c, not main.c.
Ben Pfaff [Thu, 5 Mar 2009 20:24:56 +0000 (12:24 -0800)]
executer: Make default dir part of executer.c, not main.c.

That way the vswitch can get the default without having to know it too.

15 years agovswitchd: Remove stray debug printf().
Ben Pfaff [Thu, 5 Mar 2009 20:23:13 +0000 (12:23 -0800)]
vswitchd: Remove stray debug printf().

15 years agocfg: Fix behavior of cfg_get(0, "a") when a key "a.b" exists.
Ben Pfaff [Thu, 5 Mar 2009 19:13:49 +0000 (11:13 -0800)]
cfg: Fix behavior of cfg_get(0, "a") when a key "a.b" exists.

The intent of cfg_get_*(0, "a") is to get the first value of a key with
the exact name "a", but in the presence of a key with a longer name, e.g.
"a.b", it would return the value of that key instead.

This file really needs a unit test!  I'm really not certain that
the fix didn't break other things (e.g. cfg_has_section()).

15 years agodpif: Don't rely on caller to keep dpif arg valid, in dpifmon_create().
Ben Pfaff [Thu, 5 Mar 2009 19:01:45 +0000 (11:01 -0800)]
dpif: Don't rely on caller to keep dpif arg valid, in dpifmon_create().

dpifmon_create() stored away the dpif pointer that it was passed and
continued to use it, but ofproto_create() didn't keep that dpif in a
constant place in memory, so dpifmon_poll() would randomly fail with
errors like "Bad file descriptor".  Having the dpifmon keep its own
fd to a dpif is more reliable.

Additional possible fix to Dan's problem.

15 years agodpif: Fix uninitialized memory accesses.
Ben Pfaff [Thu, 5 Mar 2009 18:46:33 +0000 (10:46 -0800)]
dpif: Fix uninitialized memory accesses.

Found by Valgrind.

This may fix some problems found by Dan.

15 years agoofp-print: Use ntohs() for 16-bit field, not ntohl().
Ben Pfaff [Thu, 5 Mar 2009 01:42:35 +0000 (17:42 -0800)]
ofp-print: Use ntohs() for 16-bit field, not ntohl().

Noticed by Natasha.

15 years agosecchan: Remove obsolete debug printf()s.
Ben Pfaff [Thu, 5 Mar 2009 01:34:04 +0000 (17:34 -0800)]
secchan: Remove obsolete debug printf()s.

15 years agosecchan: Flush datapath flow table when initializing the switch.
Ben Pfaff [Thu, 5 Mar 2009 01:32:53 +0000 (17:32 -0800)]
secchan: Flush datapath flow table when initializing the switch.

The switch can't recover the entire OpenFlow state from the datapath, so
it has the choice of either guessing at some missing information (which
seems undesirable) or just flushing the table.  The latter is easier, so
do that.