openvswitch
15 years agobrcompat: Remove policy from Netlink code.
Ben Pfaff [Tue, 30 Dec 2008 18:25:50 +0000 (10:25 -0800)]
brcompat: Remove policy from Netlink code.

Policies are only useful for data that is received by a Netlink socket.
They do not apply to data that is sent out.  Since this code does not
parse the messages that it receives at all, it does not need any policy.

15 years agobrcompat: Fix typo in user message.
Ben Pfaff [Tue, 30 Dec 2008 18:25:38 +0000 (10:25 -0800)]
brcompat: Fix typo in user message.

15 years agobrcompat: Indentation fixups.
Ben Pfaff [Tue, 30 Dec 2008 18:25:29 +0000 (10:25 -0800)]
brcompat: Indentation fixups.

In a few places four spaces were used in place of one tab. Elsewhere,
function arguments weren't lined up well.

15 years agoMake datapath compile with Xen kernel.
Ben Pfaff [Tue, 30 Dec 2008 18:01:06 +0000 (10:01 -0800)]
Make datapath compile with Xen kernel.

The Xen kernel is based on 2.6.18 but backports many features from later
kernels.  It is not always possible, therefore, to detect whether we need
to use compatibility code based on LINUX_VERSION_CODE.  This commit fixes
the problem by using configure-time tests to check for the need for the
compatibility code.

Build-tested on Linux 2.6.15 through 2.6.28 with the default configuration
(except that some kernels needed preemption turned off) and with Xen
kernel 2.6.18-92.1.10.el5.xs5.0.0.394.644.

Fixes bug #548.

15 years agoFirst cut at bridge compatibility for vswitchd.
Justin Pettit [Tue, 30 Dec 2008 06:53:08 +0000 (22:53 -0800)]
First cut at bridge compatibility for vswitchd.

This set of changes allows the bridge ioctls to be used for adding and
removing datapaths and interfaces.  To enable, one must insmod the
new "brcompat_mod.ko" kernel module.  Then, vswitchd is run with the
"--brcompat" flag.  See the man page for vswitchd for more details.

15 years agovswitchd: Fix SIGHUP behavior for bonded ports.
Ben Pfaff [Tue, 30 Dec 2008 00:17:09 +0000 (16:17 -0800)]
vswitchd: Fix SIGHUP behavior for bonded ports.

15 years agovswitchd: Properly renumber port_ifidx values on iface destruction.
Ben Pfaff [Tue, 30 Dec 2008 00:01:46 +0000 (16:01 -0800)]
vswitchd: Properly renumber port_ifidx values on iface destruction.

15 years agovswitchd: Revalidate all flows upon bridge configuration change.
Ben Pfaff [Tue, 30 Dec 2008 00:01:16 +0000 (16:01 -0800)]
vswitchd: Revalidate all flows upon bridge configuration change.

Otherwise, now-invalid flows can linger, causing trouble.

15 years agoNew function mac_learning_flush().
Ben Pfaff [Mon, 29 Dec 2008 23:55:54 +0000 (15:55 -0800)]
New function mac_learning_flush().

15 years agovswitchd: Fix svec_diff().
Ben Pfaff [Mon, 29 Dec 2008 22:29:26 +0000 (14:29 -0800)]
vswitchd: Fix svec_diff().

The logic bugs here were causing bridge.c to do too much work adding and
deleting interfaces unnecessarily and perhaps in some circumstances getting
the set of interfaces wrong entirely.

15 years agovswitchd: Comment out annoying bonding-related logging, for now.
Ben Pfaff [Mon, 29 Dec 2008 23:59:48 +0000 (15:59 -0800)]
vswitchd: Comment out annoying bonding-related logging, for now.

15 years agovswitchd: Fix svec memory leaks.
Ben Pfaff [Mon, 29 Dec 2008 21:30:48 +0000 (13:30 -0800)]
vswitchd: Fix svec memory leaks.

Pointed out by Justin.

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 agovswitchd: Implement bonding link failure detection & failover.
Ben Pfaff [Mon, 29 Dec 2008 21:07:09 +0000 (13:07 -0800)]
vswitchd: Implement bonding link failure detection & failover.

15 years agoNew functions port_array_destroy(), port_array_clear().
Ben Pfaff [Mon, 29 Dec 2008 21:06:56 +0000 (13:06 -0800)]
New functions port_array_destroy(), port_array_clear().

15 years agoDocument vswitchd.
Ben Pfaff [Sun, 28 Dec 2008 06:45:25 +0000 (22:45 -0800)]
Document vswitchd.

15 years agoFactor out common parts of manpages.
Ben Pfaff [Sat, 27 Dec 2008 23:36:49 +0000 (15:36 -0800)]
Factor out common parts of manpages.

There was a lot of duplication in the sources for the
manpages, because many of the programs have common options.
This factors out some of the duplication into include
files, using the man ".so" directive.  It also uses the
".ds" directive to define strings that should be
customized for each program's manpage.

15 years agovswitchd: Actually tag flows that go out bonded devices.
Ben Pfaff [Sat, 27 Dec 2008 05:26:46 +0000 (21:26 -0800)]
vswitchd: Actually tag flows that go out bonded devices.

The change that introduced rebalancing for bonded devices
set up the infrastructure for revalidating flows that go
out bonded devices, but neglected to actually tag those
flows.  This fixes the problem.

15 years agovswitchd: Basic bonding rebalancing works.
Ben Pfaff [Sat, 27 Dec 2008 00:47:35 +0000 (16:47 -0800)]
vswitchd: Basic bonding rebalancing works.

So far only tested with hping3.  At least, need to make sure that existing
flows get redirected through the new interface as well.

15 years agovswitchd: Work on flow statistics gathering.
Ben Pfaff [Sat, 27 Dec 2008 00:48:27 +0000 (16:48 -0800)]
vswitchd: Work on flow statistics gathering.

15 years agovswitchd: Implement stats request manager.
Ben Pfaff [Wed, 24 Dec 2008 23:09:41 +0000 (15:09 -0800)]
vswitchd: Implement stats request manager.

15 years agoMake tag_set_add() avoid adding tags that are already present.
Ben Pfaff [Wed, 24 Dec 2008 23:11:17 +0000 (15:11 -0800)]
Make tag_set_add() avoid adding tags that are already present.

15 years agoNew functions for iterating through flow stats replies.
Ben Pfaff [Wed, 24 Dec 2008 23:10:48 +0000 (15:10 -0800)]
New functions for iterating through flow stats replies.

15 years agoNew function ofpbuf_clone_data().
Ben Pfaff [Wed, 24 Dec 2008 23:09:57 +0000 (15:09 -0800)]
New function ofpbuf_clone_data().

15 years agovswitchd: Fix treatment of unbuffered packets.
Ben Pfaff [Fri, 26 Dec 2008 19:06:09 +0000 (11:06 -0800)]
vswitchd: Fix treatment of unbuffered packets.

Before, buggy code caused unbuffered packets to be dropped.  This fixes
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 agovswitchd: Automatically restart secchan if it dies.
Ben Pfaff [Wed, 24 Dec 2008 19:01:37 +0000 (11:01 -0800)]
vswitchd: Automatically restart secchan if it dies.

15 years agoImplement revalidation.
Ben Pfaff [Wed, 24 Dec 2008 01:06:17 +0000 (17:06 -0800)]
Implement revalidation.

15 years agoAdd support for tags to mac-learning library, and update client code.
Ben Pfaff [Wed, 24 Dec 2008 00:57:23 +0000 (16:57 -0800)]
Add support for tags to mac-learning library, and update client code.

15 years agoImplement generic tag library.
Ben Pfaff [Wed, 24 Dec 2008 00:57:58 +0000 (16:57 -0800)]
Implement generic tag library.

15 years agoNew functions random_uint8(), random_uint16().
Ben Pfaff [Wed, 24 Dec 2008 01:02:46 +0000 (17:02 -0800)]
New functions random_uint8(), random_uint16().

Also, reimplement random_uint32() to make fewer calls to rand().

15 years agoNew macro IS_POW2().
Ben Pfaff [Wed, 24 Dec 2008 01:02:54 +0000 (17:02 -0800)]
New macro IS_POW2().

15 years agoImplement generic hash table.
Ben Pfaff [Tue, 23 Dec 2008 22:59:48 +0000 (14:59 -0800)]
Implement generic hash table.

15 years agoNew function flow_equal().
Ben Pfaff [Tue, 23 Dec 2008 23:05:45 +0000 (15:05 -0800)]
New function flow_equal().

15 years agoInline flow_compare() and flow_hash(), for performance.
Ben Pfaff [Tue, 23 Dec 2008 23:04:54 +0000 (15:04 -0800)]
Inline flow_compare() and flow_hash(), for performance.

15 years agoMake flow_hash() use hash_lookup3(), for speed and hash quality.
Ben Pfaff [Tue, 23 Dec 2008 23:03:37 +0000 (15:03 -0800)]
Make flow_hash() use hash_lookup3(), for speed and hash quality.

15 years agoAdd faster and better-quality hash function hash_lookup3().
Ben Pfaff [Tue, 23 Dec 2008 23:01:25 +0000 (15:01 -0800)]
Add faster and better-quality hash function hash_lookup3().

15 years agoRemove misplaced comment.
Ben Pfaff [Mon, 22 Dec 2008 06:19:17 +0000 (22:19 -0800)]
Remove misplaced comment.

15 years agovswitch: Implement basic bonding.
Ben Pfaff [Sat, 20 Dec 2008 00:33:31 +0000 (16:33 -0800)]
vswitch: Implement basic bonding.

Rebalancing and link failure detection are missing, but the basics are
there (and work OK in simple testing).

15 years agovswitch: Pass --monitor to secchan processes, to allow monitoring them.
Ben Pfaff [Fri, 19 Dec 2008 23:10:18 +0000 (15:10 -0800)]
vswitch: Pass --monitor to secchan processes, to allow monitoring them.

15 years agoAdd #include <limits.h> to fix build problem with undefined "_POSIX_PIPE_BUF".
Justin Pettit [Sat, 20 Dec 2008 00:06:11 +0000 (16:06 -0800)]
Add #include <limits.h> to fix build problem with undefined "_POSIX_PIPE_BUF".

15 years agovswitchd: Fix stupid thinko.
Ben Pfaff [Thu, 18 Dec 2008 22:26:29 +0000 (14:26 -0800)]
vswitchd: Fix stupid thinko.

15 years agovswitchd: Basic working VLAN support.
Ben Pfaff [Thu, 18 Dec 2008 22:00:59 +0000 (14:00 -0800)]
vswitchd: Basic working VLAN support.

15 years agoNew functions put_openflow() and put_openflow_xid().
Ben Pfaff [Thu, 18 Dec 2008 22:01:35 +0000 (14:01 -0800)]
New functions put_openflow() and put_openflow_xid().

15 years agoAdd support for VLAN tags to the MAC learning library.
Ben Pfaff [Thu, 18 Dec 2008 22:00:23 +0000 (14:00 -0800)]
Add support for VLAN tags to the MAC learning library.

vswitchd needs to keep separate per-VLAN MAC learning tables, so this adds
a VLAN tag to each MAC learning table entry.  The existing users of the
MAC learning table don't care about VLANs, so they always pass in a VLAN
of 0.

There is a very good chance that vswitchd will need additional features in
its MAC learning table that don't fit well into the existing library.  In
that case this commit will probably be reverted and a separate MAC learning
implementation added in the vswitch directory.

15 years agocfg: Fix functions for retrieving keys.
Ben Pfaff [Thu, 18 Dec 2008 20:43:57 +0000 (12:43 -0800)]
cfg: Fix functions for retrieving keys.

They didn't work.  At all.

15 years agoInitial, skeletal implementation of vswitchd.
Ben Pfaff [Wed, 17 Dec 2008 01:19:09 +0000 (17:19 -0800)]
Initial, skeletal implementation of vswitchd.

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 agoNew functions for verify OpenFlow message types and lengths.
Ben Pfaff [Wed, 17 Dec 2008 00:38:01 +0000 (16:38 -0800)]
New functions for verify OpenFlow message types and lengths.

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

15 years agoMake secchan exit if the connection drops and can never be reconnected.
Ben Pfaff [Wed, 17 Dec 2008 00:28:50 +0000 (16:28 -0800)]
Make secchan exit if the connection drops and can never be reconnected.

In particular this happens if the controller is specified using a fd vconn,
since once disconnected a fd vconn can never be reconnected.

This behavior is useful for vswitchd, which connects to secchan over a
fd vconn.

15 years agoAdd new "fd" vconn, which takes a file descriptor number as argument.
Ben Pfaff [Wed, 17 Dec 2008 00:57:40 +0000 (16:57 -0800)]
Add new "fd" vconn, which takes a file descriptor number as argument.

This requires introducing the concept of a "reconnectable" vconn.  A vconn
is reconnectable if, when it is closed, it is possible to try to reconnect
to it using the name that was originally used.  This is the case for all
existing vconn types, but it is not true for fd vconns, because closing a
fd vconn closes the specified file descriptor, and thus attempting to
reopen it will get an EBADF error.

An rconn is not reliable if it is connected to a vconn that is not
reconnectable.

15 years agoIntroduce x2nrealloc() helper function, and use it.
Ben Pfaff [Wed, 17 Dec 2008 00:19:36 +0000 (16:19 -0800)]
Introduce x2nrealloc() helper function, and use it.

Also fixes a bug in read_cert_file() in vconn-ssl.c: "sizeof *certs"
should have been "sizeof **certs".  In fact the sizes will be identical
in all practical cases since both *certs and **certs are pointer types,
so this is not an important fix.

15 years agoMake datapath interface library more flexible.
Ben Pfaff [Wed, 17 Dec 2008 00:13:36 +0000 (16:13 -0800)]
Make datapath interface library more flexible.

A single netlink socket can address any kernel datapath, but the datapath
interface library was artificially restricting a dpif to address a single
datapath that was selected at dpif creation time.  This commit removes
that restriction.

This is useful for vswitchd, which can create and destroy any number of
datapaths and add and remove ports on them.  It's more convenient to use
a single dpif for that instead of many.

15 years agoMove DP_MAX into public header file.
Ben Pfaff [Wed, 17 Dec 2008 00:10:31 +0000 (16:10 -0800)]
Move DP_MAX into public header file.

vswitchd wants to know the maximum number of datapaths, so DP_MAX needs to
be exported.

(This is not an ideal situation.  Really the kernel should not have an
explicit limit on the number of datapaths, and userspace should be able
to query the current maximum.)

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.

16 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.

16 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.

16 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.

16 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.

16 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.

16 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.

16 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.

16 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.

16 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.

16 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().

16 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.

16 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.

16 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.

16 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.

16 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.

16 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().

16 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.

16 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.

16 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.

16 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.

16 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.

16 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.

16 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.

16 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.

16 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.