sliver-openvswitch.git
15 years agoFor SNAT, don't store the pre-fragment L2 header before actions are applied. for-nox/0.4
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.

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)

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 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 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.
(cherry picked from commit 1b580f69f3dfacee49532f71abd72755a09eabd4)

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.
(cherry picked from commit 0aee2db61a1e34e6cb0a34365e51385059fc84b7)

15 years agoCrossport lib/svec.[ch] from master branch.
Ben Pfaff [Tue, 13 Jan 2009 22:21:05 +0000 (14:21 -0800)]
Crossport lib/svec.[ch] from master branch.

This is a dependency of the switch UI improvements wanted on for-nox/0.4.

15 years agoIntroduce x2nrealloc() helper function.
Ben Pfaff [Tue, 13 Jan 2009 22:24:17 +0000 (14:24 -0800)]
Introduce x2nrealloc() helper function.

Crossported from master branch because it is a dependency for svec,
which is needed by the switch UI, which is wanted in 0.4.

15 years agoCrossport lib/process.[ch] from master branch.
Ben Pfaff [Tue, 13 Jan 2009 22:20:42 +0000 (14:20 -0800)]
Crossport lib/process.[ch] from master branch.

This is a dependency of the switch UI improvements wanted on for-nox/0.4.

15 years agoNew function ds_get_line().
Ben Pfaff [Wed, 17 Dec 2008 00:39:20 +0000 (16:39 -0800)]
New function ds_get_line().

15 years agoNew function ds_put_buffer().
Ben Pfaff [Wed, 17 Dec 2008 00:39:01 +0000 (16:39 -0800)]
New function ds_put_buffer().

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 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 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 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 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 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 agoFix bug that could have caused infinite loop in ofp_print_actions().
Ben Pfaff [Thu, 8 Jan 2009 23:27:23 +0000 (15:27 -0800)]
Fix bug that could have caused infinite loop in ofp_print_actions().

Found by -Wextra noticing that len < 0 is always false.

15 years agoDo not forward multicast addresses that must not be, in learning-switch.
Ben Pfaff [Tue, 6 Jan 2009 00:00:19 +0000 (16:00 -0800)]
Do not forward multicast addresses that must not be, in learning-switch.

15 years agoNew function to test for multicast addresses that must not be forwarded.
Ben Pfaff [Mon, 5 Jan 2009 23:59:40 +0000 (15:59 -0800)]
New function to test for multicast addresses that must not be forwarded.

15 years agosecchan: Fix cut-and-paste errors in port speed determination.
Ben Pfaff [Wed, 31 Dec 2008 23:59:39 +0000 (15:59 -0800)]
secchan: Fix cut-and-paste errors in port speed determination.

15 years agoFix off-by-one error in looking up datapaths by index.
Ben Pfaff [Tue, 30 Dec 2008 18:48:59 +0000 (10:48 -0800)]
Fix off-by-one error in looking up datapaths by index.

15 years agoMake ds_cstr() always null-terminate the string.
Ben Pfaff [Mon, 29 Dec 2008 21:26:19 +0000 (13:26 -0800)]
Make ds_cstr() always null-terminate the string.

Most of the time the string in "struct ds" is
null-terminated, but there seem to be a few corner cases
where it is not.  Make ds_cstr() always put in the null
terminator, for safety.

Thanks to Justin for pointing out the problem.

15 years agoDrop message about short Ethernet frames entirely.
Ben Pfaff [Fri, 26 Dec 2008 19:04:15 +0000 (11:04 -0800)]
Drop message about short Ethernet frames entirely.

It's just not useful.

15 years agoRemove userspace switch in favor of the superior userspace datapath.
Ben Pfaff [Tue, 6 Jan 2009 22:01:20 +0000 (14:01 -0800)]
Remove userspace switch in favor of the superior userspace datapath.

15 years agoFix "make dist" by adding forgotten files to sources lists.
Ben Pfaff [Tue, 6 Jan 2009 22:03:24 +0000 (14:03 -0800)]
Fix "make dist" by adding forgotten files to sources lists.

15 years agoPrevent Debian package upgrades from prompting.
Ben Pfaff [Mon, 5 Jan 2009 18:52:57 +0000 (10:52 -0800)]
Prevent Debian package upgrades from prompting.

Before, we were using dpkg "conffiles" for our configuration.  This means
that if the admin has customized the configuration (as is necessary to
make the switch work) and the default configuration included in the package
changed, then dpkg would prompt the user interactively about what to do.

Now, we take responsibility for creating, upgrading, and removing the
configuration file ourselves, and do not prompt.

15 years agoFix learning-switch STP breakage from "out_port" in flow stats request.
Ben Pfaff [Fri, 26 Dec 2008 18:28:17 +0000 (10:28 -0800)]
Fix learning-switch STP breakage from "out_port" in flow stats request.

ofp_flow_stats_request recently added a new member, "out_port", to select
only flows that output to a particular port.  Unfortunately this code
in learning-switch.c was not updated to set that member to OFPP_NONE,
with the result that it would only get flows that output to port 0.

This bug was found when looking at this code for another reason and thus
is no guarantee that the STP code in learning-switch actually works.

15 years agoFix setting "of" device name based on unitialized dp_idx.
Justin Pettit [Tue, 23 Dec 2008 08:30:38 +0000 (00:30 -0800)]
Fix setting "of" device name based on unitialized dp_idx.

The name of the "of" device is of the form "of<dp_idx>".  The device
driver assumes the "dp_idx" field has been set in the datapath struct
before its called.  This was not the case.

15 years agoFix flag to indicate whether Flow End messages should be sent.
Justin Pettit [Fri, 19 Dec 2008 20:51:42 +0000 (12:51 -0800)]
Fix flag to indicate whether Flow End messages should be sent.

The secchan code set whether Flow End messages should based on the last
configuration request.  This means that if NetFlow messages need to be
generated, but the cotnroller doesn't flow Flow Expiration messages, the
Flow End meta-message was disabled.

15 years agoFix null pointer dereference when a delete flow command is executed.
Justin Pettit [Fri, 19 Dec 2008 20:49:09 +0000 (12:49 -0800)]
Fix null pointer dereference when a delete flow command is executed.

A set of missing parentheses was causing an attempt to send a Flow End
message even if no flow existed.  The code to send the Flow End message
would try to access data in the flow and cause a kernel panic.

15 years agosecchan: Switch in-band control traffic by hand only on OpenFlow TCP ports.
Ben Pfaff [Thu, 18 Dec 2008 19:17:36 +0000 (11:17 -0800)]
secchan: Switch in-band control traffic by hand only on OpenFlow TCP ports.

To run services, other than the controller itself, on the same IP and MAC
as the controller, sophisticated controllers such as NOX need to have some
insight into the controller's location, etc.  Before this commit, this
was not possible, because any traffic to or from the controller's MAC
address was switched "by hand" by secchan, without involving the controller
at all.

After this commit, only traffic to or from the controller's MAC *and on
the OpenFlow TCP or SSL port* is switched by hand, which should fix the
problem.

15 years agoDon't use separate asynchronous event connection for user datapath.
Ben Pfaff [Wed, 17 Dec 2008 22:39:06 +0000 (14:39 -0800)]
Don't use separate asynchronous event connection for user datapath.

Commit 14439fa80c, "Maintain separate async and sync connections to nl:0
in secchan," modified secchan to use two separate connections to the
datapath, one for asynchronous events, one for requests and replies.  This
technique doesn't work for the user datapath, which always sends
asynchronous events on all its connections.  Fortunately, it isn't
necessary for the user datapath, either, because the user datapath is
smart enough not to drop message replies.

Tested by Justin.

15 years agoAdd support for exporting flow information in NetFlow v5 format.
Justin Pettit [Wed, 17 Dec 2008 22:24:22 +0000 (14:24 -0800)]
Add support for exporting flow information in NetFlow v5 format.

This is implemented by having the datapath send a new meta-Flow End message
that contains all the information needed by NetFlow v5 and the OpenFlow
Flow Expiration messages.  secchan grabs these Flow End messages and
generates any requested Flow End and NetFlow messages.  The Flow End
message is implemented as a Nicira vendor extension, but it is only used
internally between the datapath and secchan, so the switch is still fully
compatible with OpenFlow v0.8.9.

NOTE: This change has not been ported to "switch", which means that it is
not able to generate NetFlow messages.  "switch" is no longer maintained
and will be removed from the repository on January 1, 2009.

15 years agoFix usage line about specifying local datapath in secchan.
Justin Pettit [Wed, 17 Dec 2008 08:04:02 +0000 (00:04 -0800)]
Fix usage line about specifying local datapath in secchan.

15 years agoImprove formatting of process termination messages in secchan logging.
Ben Pfaff [Wed, 17 Dec 2008 00:35:56 +0000 (16:35 -0800)]
Improve formatting of process termination messages in secchan logging.

My expectation was that strsignal() returns the signal's name, e.g.
SIGTERM.  It actually returns an English explanation, so that the existing
code would log a message like "terminated by signal Terminated".  This
commit changes the message to the more sensible "terminated by signal 15
(Terminated)".

Also, the recently approved POSIX 2008 standardized strsignal() and in
particular says that it may return NULL for unknown signal numbers, so
this commit fixes the behavior on NULL return.

15 years agovlog: Optimize logging disabled, rate-limited messages.
Ben Pfaff [Wed, 17 Dec 2008 00:32:27 +0000 (16:32 -0800)]
vlog: Optimize logging disabled, rate-limited messages.

Previously the arguments of rate-limited messages were always evaluated
and passed to vlog_rate_limit().  This commit short-circuits the case
where the vlog levels would prevent any messages from being logged even
without considering rate limiting.

15 years agoReduce rate limit for short-packet messages even further.
Ben Pfaff [Wed, 17 Dec 2008 00:29:36 +0000 (16:29 -0800)]
Reduce rate limit for short-packet messages even further.

These messages appear a lot in a virtualized environment, and they really
are not meaningful there.

15 years agoFix typo in comment.
Ben Pfaff [Wed, 17 Dec 2008 00:30:19 +0000 (16:30 -0800)]
Fix typo in comment.

15 years agoAdd reminder comment to lib/learning-switch.c.
Ben Pfaff [Wed, 17 Dec 2008 00:07:41 +0000 (16:07 -0800)]
Add reminder comment to lib/learning-switch.c.

(This doesn't change the semantics of the code at all.)

15 years agoFix mangled header guards in ofp-print.h.
Ben Pfaff [Fri, 12 Dec 2008 22:56:57 +0000 (14:56 -0800)]
Fix mangled header guards in ofp-print.h.

15 years agoImprove secchan.8 manpage.
Ben Pfaff [Fri, 12 Dec 2008 01:14:18 +0000 (17:14 -0800)]
Improve secchan.8 manpage.

15 years agoFix typo in error message.
Ben Pfaff [Fri, 12 Dec 2008 01:00:43 +0000 (17:00 -0800)]
Fix typo in error message.

15 years agoStyle fix: f(x) is better than f((x))
Ben Pfaff [Fri, 12 Dec 2008 00:41:25 +0000 (16:41 -0800)]
Style fix: f(x) is better than f((x))

15 years agoAdd userspace datapath to openflow.
Ben Pfaff [Thu, 11 Dec 2008 22:07:08 +0000 (14:07 -0800)]
Add userspace datapath to openflow.

15 years agoUpdate required Autoconf version in INSTALL.
Ben Pfaff [Thu, 11 Dec 2008 22:06:34 +0000 (14:06 -0800)]
Update required Autoconf version in INSTALL.

The AC_PREREQ was updated some time ago but the documentation lagged
behind.

15 years agoMake ds_put_char_multiple() use the provided character instead of a space.
Ben Pfaff [Thu, 11 Dec 2008 17:35:24 +0000 (09:35 -0800)]
Make ds_put_char_multiple() use the provided character instead of a space.

Fortunately this function was only used for formatting log messages, in
a context where spaces were the normal padding character.

Found by Chris Eagle.

15 years agoCleanup some formatting in openflow.h.
Justin Pettit [Wed, 3 Dec 2008 07:55:12 +0000 (23:55 -0800)]
Cleanup some formatting in openflow.h.

15 years agoChange references in comments from "ofp_vendor" to "ofp_vendor_header".
Justin Pettit [Wed, 3 Dec 2008 06:17:36 +0000 (22:17 -0800)]
Change references in comments from "ofp_vendor" to "ofp_vendor_header".

15 years agoUpdate prerequisite Autoconf version to 2.60 (from 2.59).
Ben Pfaff [Tue, 2 Dec 2008 16:27:31 +0000 (08:27 -0800)]
Update prerequisite Autoconf version to 2.60 (from 2.59).

We use the MKDIR_P variable that only Autoconf 2.60 and
later supports, but we were only requiring Autoconf 2.59
or later.  This fixes the problem.

Also, we were not explicitly invoking AC_PROG_MKDIR_P from
configure.ac, even though we were using $(MKDIR_P).  Some
other macro must have been internally invoking
AC_PROG_MKDIR_P, but it's not good to depend on that, so
this commit adds an explicit call to it.

15 years agoFix compatibility back to Linux 2.6.15 and 2.4.32.
Justin Pettit [Tue, 2 Dec 2008 06:23:14 +0000 (22:23 -0800)]
Fix compatibility back to Linux 2.6.15 and 2.4.32.

15 years agoAdd missing "%s" to VLOG_WARN_RL call.
Ben Pfaff [Tue, 2 Dec 2008 05:26:57 +0000 (21:26 -0800)]
Add missing "%s" to VLOG_WARN_RL call.

Thanks to Justin for pointing out the problem.

15 years agoOfficially call this code version 0.8.9~1.
Justin Pettit [Tue, 2 Dec 2008 05:08:43 +0000 (21:08 -0800)]
Officially call this code version 0.8.9~1.

15 years agoAdd support for listing and deleting entries based on an output port.
Justin Pettit [Mon, 1 Dec 2008 22:34:23 +0000 (14:34 -0800)]
Add support for listing and deleting entries based on an output port.

To support this, an "out_port" field has been added to the "ofp_flow_mod",
"ofp_flow_stats_request", and "ofp_aggregate_stats_request" messages.  If an
"out_port" contains a value other than "OFPP_NONE", it introduces a constraint
when matching.  This constraint is that the rule must contain an output action
directed at that port.  Other constraints such as ofp_match structs and
priorities are still used; this is purely an *additional* constraint.  Note
that to get previous behavior, though, "out_port" must be set to "OFPP_NONE",
since "0" is a valid port id.  This only applies to the delete and
delete_strict flow mod commands; the field is ignored by add, modify, and
modify_strict.

15 years agoAdd DATAPATH_ID to switch packaging, to enable persistent DPIDs.
Ben Pfaff [Wed, 26 Nov 2008 19:38:28 +0000 (11:38 -0800)]
Add DATAPATH_ID to switch packaging, to enable persistent DPIDs.

15 years agoAllow the datapath ID to be configured by changing the ofX MAC address.
Ben Pfaff [Wed, 26 Nov 2008 19:27:06 +0000 (11:27 -0800)]
Allow the datapath ID to be configured by changing the ofX MAC address.

Previously, you could change the MAC address but that had no effect on
the datapath ID, so that there was no way to change the datapath ID at all.

15 years agoSimplify code in stream_recv().
Ben Pfaff [Thu, 27 Nov 2008 00:18:16 +0000 (16:18 -0800)]
Simplify code in stream_recv().

There is no need to test whether retval is nonzero at this point in the
code: we already know that it is negative from the two previous "if"
branches.

15 years agoMake dpif_close() accept a null pointer.
Ben Pfaff [Thu, 27 Nov 2008 00:07:56 +0000 (16:07 -0800)]
Make dpif_close() accept a null pointer.

It's customary for destructor functions to accept and ignore null pointers.

This commit does not fix any known bug.

15 years agorconn_destroy() should close monitoring connections, to avoid a leak.
Ben Pfaff [Thu, 27 Nov 2008 00:27:21 +0000 (16:27 -0800)]
rconn_destroy() should close monitoring connections, to avoid a leak.

Our current code base never closes an rconn that has a monitoring
connection, so this does not fix any larger problem.

15 years agoFree txbuf, rxbuf in vconn-ssl and vconn-stream destructors.
Ben Pfaff [Thu, 27 Nov 2008 00:25:55 +0000 (16:25 -0800)]
Free txbuf, rxbuf in vconn-ssl and vconn-stream destructors.

This bug was causing secchan to leak a little bit of memory on almost every
connection close.  This is most visible when openflow-monitor is running,
because openflow-monitor connects to secchan once per second.

15 years agoAdd support for understanding ICMP type and code in flow entries.
Justin Pettit [Thu, 27 Nov 2008 04:57:54 +0000 (20:57 -0800)]
Add support for understanding ICMP type and code in flow entries.

15 years agoMaintain separate async and sync connections to nl:0 in secchan.
Ben Pfaff [Fri, 21 Nov 2008 21:05:37 +0000 (13:05 -0800)]
Maintain separate async and sync connections to nl:0 in secchan.

When a network link is flooded with traffic, secchan's OpenFlow socket
queue becomes congested with traffic.  This leaves no room for replies
to OpenFlow requests relayed to that socket by secchan.

This commit modifies secchan to use separate sockets for asynchronous
traffic and for OpenFlow requests/replies, which should avoid the problem.

15 years agoDynamically allocate switch status categories.
Ben Pfaff [Fri, 21 Nov 2008 20:35:20 +0000 (12:35 -0800)]
Dynamically allocate switch status categories.

I got tired of increasing the statically allocated number of categories
whenever we exceeded it, so this will make things simpler.

15 years agoGet rid of unused parameter to rate_limit_start().
Ben Pfaff [Fri, 21 Nov 2008 20:23:01 +0000 (12:23 -0800)]
Get rid of unused parameter to rate_limit_start().

15 years agoDon't rate-limit packet_ins from flows that the controller set up.
Ben Pfaff [Fri, 21 Nov 2008 18:48:00 +0000 (10:48 -0800)]
Don't rate-limit packet_ins from flows that the controller set up.

15 years agoPrevent accidentally passing an integer value to IP_ARGS.
Ben Pfaff [Thu, 20 Nov 2008 18:10:59 +0000 (10:10 -0800)]
Prevent accidentally passing an integer value to IP_ARGS.

15 years agoFix printing of IP addresses in ofp_print_action().
Ben Pfaff [Thu, 20 Nov 2008 18:07:22 +0000 (10:07 -0800)]
Fix printing of IP addresses in ofp_print_action().

IP_ARGS takes a pointer, not a raw IP address.

Thanks to kk yap for reporting the problem.

15 years agoUse "%zu" to print size_t, not "%"PRIu16.
Ben Pfaff [Thu, 20 Nov 2008 17:53:27 +0000 (09:53 -0800)]
Use "%zu" to print size_t, not "%"PRIu16.

15 years agoCopy skbs when we save them.
Ben Pfaff [Thu, 13 Nov 2008 20:48:02 +0000 (12:48 -0800)]
Copy skbs when we save them.

15 years agoSimplify code for constructing skb in recv_packet_out().
Ben Pfaff [Thu, 13 Nov 2008 20:50:03 +0000 (12:50 -0800)]
Simplify code for constructing skb in recv_packet_out().

15 years agoFix double-free: NF_HOOK sometimes frees the sk_buff passed in.
Ben Pfaff [Thu, 13 Nov 2008 19:29:20 +0000 (11:29 -0800)]
Fix double-free: NF_HOOK sometimes frees the sk_buff passed in.

NF_HOOK is supposed to *always* consume the sk_buff passed in, either
internally or through the okfn argument.  We assumed that it never
consumed its sk_buff, which was OK in the case where it called okfn,
since our okfn (snat_pre_route_finish) never freed its sk_buff, but
not when one of the netfilter hooks dropped or stole the packet, because
then we'd assume that it still existed and free it a second time.

The other users of NF_HOOK in this file, in snat_skb() and
snat_skb_finish(), do not need to be fixed because they always pass a
copy of their sk_buff argument to NF_HOOK and expect it to be freed.

15 years agoNo need to test argument of kfree_skb() for non-null.
Ben Pfaff [Thu, 13 Nov 2008 18:26:15 +0000 (10:26 -0800)]
No need to test argument of kfree_skb() for non-null.

15 years agoNever free an skb that has been passed to genlmsg_reply().
Ben Pfaff [Thu, 13 Nov 2008 18:25:06 +0000 (10:25 -0800)]
Never free an skb that has been passed to genlmsg_reply().

genlmsg_reply() always consumes its argument, not just in the success case.

15 years agoPull arp header before grabbing the pointer to it.
Ben Pfaff [Thu, 13 Nov 2008 20:44:35 +0000 (12:44 -0800)]
Pull arp header before grabbing the pointer to it.

15 years agoPull data into headers properly, and checksum ICMP replies correctly.
Ben Pfaff [Wed, 12 Nov 2008 22:42:51 +0000 (14:42 -0800)]
Pull data into headers properly, and checksum ICMP replies correctly.

15 years agoReset mac header in flow_extract(), because it might initially be null.
Ben Pfaff [Wed, 12 Nov 2008 00:51:56 +0000 (16:51 -0800)]
Reset mac header in flow_extract(), because it might initially be null.

__alloc_skb() sets the mac header to null, and not all call chains
reset it.

15 years agoUse skb_copy_bits() to copy data that might not be pulled into headers.
Ben Pfaff [Wed, 12 Nov 2008 00:18:32 +0000 (16:18 -0800)]
Use skb_copy_bits() to copy data that might not be pulled into headers.

15 years agoVerify in fwd_port_input() that 'skb' has no destructor.
Ben Pfaff [Tue, 11 Nov 2008 23:41:04 +0000 (15:41 -0800)]
Verify in fwd_port_input() that 'skb' has no destructor.

15 years agoVerify in execute_actions() that 'skb' is not shared.
Ben Pfaff [Tue, 11 Nov 2008 23:40:48 +0000 (15:40 -0800)]
Verify in execute_actions() that 'skb' is not shared.

15 years agoFix datapath make_writable() function.
Ben Pfaff [Tue, 11 Nov 2008 23:40:28 +0000 (15:40 -0800)]
Fix datapath make_writable() function.

- We weren't necessarily pulling enough into the headers in the non-shared
  case, since the IP header by itself can be longer than 40 bytes.

- The skb is guaranteed not to have a destructor at this point.

15 years agoMake datapath's flow_extract() properly pull data into the headers.
Ben Pfaff [Tue, 11 Nov 2008 23:35:26 +0000 (15:35 -0800)]
Make datapath's flow_extract() properly pull data into the headers.

Otherwise we might be reading headers that aren't really there.

15 years agoAdd comment.
Ben Pfaff [Tue, 11 Nov 2008 23:48:08 +0000 (15:48 -0800)]
Add comment.

15 years agoDon't oops in dp_output_control() for skbs with null ->dev.
Ben Pfaff [Tue, 11 Nov 2008 02:26:25 +0000 (18:26 -0800)]
Don't oops in dp_output_control() for skbs with null ->dev.

This shouldn't ordinarily happen, since normal packets are received from
a real device, but some packets can be spontaneously generated within
the switch and thus have null ->dev.  (Possibly that is itself a bug
that we should track down; not sure.)

15 years agoVerify in fwd_port_input() that we are not passed packets that are shared.
Ben Pfaff [Tue, 11 Nov 2008 22:03:31 +0000 (14:03 -0800)]
Verify in fwd_port_input() that we are not passed packets that are shared.

15 years agoWhen a packet arrives via bridging, clone it if it is shared.
Ben Pfaff [Tue, 11 Nov 2008 21:57:07 +0000 (13:57 -0800)]
When a packet arrives via bridging, clone it if it is shared.

Otherwise we will mangle the packet for anyone who came before us
(e.g. tcpdump via AF_PACKET).

15 years agoMake sure that do_port_input() always puts a MAC header on packets.
Ben Pfaff [Tue, 11 Nov 2008 04:56:13 +0000 (20:56 -0800)]
Make sure that do_port_input() always puts a MAC header on packets.

Prompted by persistent oopses on packets received by e1000e, in which
skb_mac_header() for the packet always returned null.