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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.)
Ben Pfaff [Tue, 11 Nov 2008 21:33:24 +0000 (13:33 -0800)]
In handle_arp_snat() and snat_pre_route() pull enough payload into the headers.
There is no guarantee that the device put any data at all into the header.
The e1000 device, for example, appears to not put any data into the header
when the packet is longer than its configured copybreak value, which is
256 bytes by default. So we need to do it ourselves.
Ben Pfaff [Tue, 11 Nov 2008 22:08:41 +0000 (14:08 -0800)]
Orphan and clone packets transmitted on dp_dev (proper fix for bug #478).
We need to orphan packets transmitted on dp_dev so that any socket that
the packets came from is no longer charged for them. If we don't do
this, then the sk_buff will be destructed eventually, but it is
harder to predict when.
We need to clone packets because we are sticking them on
&dp_dev->xmit_queue, which is done by modifying the sk_buff, which we
can only do if it is not shared.
Ben Pfaff [Wed, 5 Nov 2008 18:03:07 +0000 (10:03 -0800)]
Make ofp-switch-setup preserve config variables that it does not set itself.
Before, it would delete them. This probably kept ofp-switch-setup from
working at all given the changes in openflow-switch.default. Now, it
should do better (but it has not been tested).
Ben Pfaff [Tue, 4 Nov 2008 22:26:38 +0000 (14:26 -0800)]
Use "set -e" command instead of "#! /bin/sh -e" magic.
Otherwise, running the script through an explicit shell invocation, such
as "sh -x <script>" for debugging, will fail to set -e and therefore the
script's behavior will change.