openvswitch
16 years agoFix use-after-free bug.
Ben Pfaff [Wed, 28 May 2008 23:02:00 +0000 (16:02 -0700)]
Fix use-after-free bug.

16 years agoFix typo in error message.
Ben Pfaff [Wed, 28 May 2008 23:01:49 +0000 (16:01 -0700)]
Fix typo in error message.

16 years agoMake in-band communication work.
Ben Pfaff [Wed, 21 May 2008 21:31:33 +0000 (14:31 -0700)]
Make in-band communication work.

16 years agoMake the OFPP_LOCAL port work in the kernel OpenFlow implementation.
Ben Pfaff [Wed, 21 May 2008 18:36:43 +0000 (11:36 -0700)]
Make the OFPP_LOCAL port work in the kernel OpenFlow implementation.

16 years agoBreak MAC learning out of controller into library.
Ben Pfaff [Wed, 21 May 2008 17:06:58 +0000 (10:06 -0700)]
Break MAC learning out of controller into library.

This is preparation for use of MAC learning in the secure channel.

16 years agoNew functions for getting and setting network device flags.
Ben Pfaff [Wed, 21 May 2008 21:11:59 +0000 (14:11 -0700)]
New functions for getting and setting network device flags.

This allows us to open network devices without bringing them up
and setting them for promiscuous mode, which will be useful in the
secchan for in-band communication.

16 years agoExpose device IP addresses through netdev.
Ben Pfaff [Wed, 28 May 2008 17:26:03 +0000 (10:26 -0700)]
Expose device IP addresses through netdev.

This will be useful for the secure channel later.

16 years agoMove netdev from switch to lib.
Ben Pfaff [Wed, 21 May 2008 21:57:15 +0000 (14:57 -0700)]
Move netdev from switch to lib.

This is in preparation for the secure channel wanting to access
network devices.

16 years agoPrint actions in ofp_flow_mod messages.
Ben Pfaff [Tue, 20 May 2008 23:46:57 +0000 (16:46 -0700)]
Print actions in ofp_flow_mod messages.

16 years agoPretty-print port numbers when printing ofp_switch_features messages.
Ben Pfaff [Wed, 28 May 2008 17:46:40 +0000 (10:46 -0700)]
Pretty-print port numbers when printing ofp_switch_features messages.

16 years agoPrint special ports by name in ofp_packet_in messages.
Ben Pfaff [Tue, 20 May 2008 23:46:39 +0000 (16:46 -0700)]
Print special ports by name in ofp_packet_in messages.

16 years agoPut newline before packet info in ofp_packet_out pretty-print output.
Ben Pfaff [Tue, 20 May 2008 23:46:15 +0000 (16:46 -0700)]
Put newline before packet info in ofp_packet_out pretty-print output.

16 years agoPrint more special ports by name in ofp-print.c.
Ben Pfaff [Sat, 17 May 2008 03:20:14 +0000 (20:20 -0700)]
Print more special ports by name in ofp-print.c.

16 years agoGet rid of obsolete, commented-out debugging code in datapath.c.
Ben Pfaff [Fri, 16 May 2008 19:41:47 +0000 (12:41 -0700)]
Get rid of obsolete, commented-out debugging code in datapath.c.

16 years agoDemote warning about runt frames to debug message.
Ben Pfaff [Wed, 21 May 2008 17:49:02 +0000 (10:49 -0700)]
Demote warning about runt frames to debug message.

This message is not too useful since there are various legitimate
ways that we can end up with runt frames, e.g. frames that only
ever passed through virtual network devices and never touched a
physical Ethernet.

16 years agoAlways do exact-match on undefined flow fields, so that such flows can be in table...
Ben Pfaff [Sat, 17 May 2008 00:00:36 +0000 (17:00 -0700)]
Always do exact-match on undefined flow fields, so that such flows can be in table-hash.

16 years agoDon't allow CONFIG_PREEMPT with Linux 2.6.x before 2.6.21, because it's busted.
Ben Pfaff [Fri, 16 May 2008 23:02:34 +0000 (16:02 -0700)]
Don't allow CONFIG_PREEMPT with Linux 2.6.x before 2.6.21, because it's busted.

16 years agoFix buggy table-linear iterator function.
Ben Pfaff [Mon, 19 May 2008 20:39:24 +0000 (13:39 -0700)]
Fix buggy table-linear iterator function.

Apparently the linear table iteration had never really been tested,
since most flows go into table-hash.  It didn't work.  This fixes it.

16 years agoDon't ever send frames on OpenFlow devices to the host stack.
Ben Pfaff [Wed, 28 May 2008 00:42:16 +0000 (17:42 -0700)]
Don't ever send frames on OpenFlow devices to the host stack.

On Linux 2.6 only, we would send frames received on OpenFlow devices to
the host TCP/IP stack if the dest Ethernet address matched the device's
Ethernet address (or under some other conditions).  This caused confusion
when the host stack was configured for forwarding, because received IP
packets would be forwarded to other interfaces with IP addresses even if
the device on which they were received was configured with no IP address.
(This was discovered by Murphy.  Thanks Murphy!)

This change drops this "feature".  A more or less equivalent feature that
may be less prone to confusion and which works on any kernel version will
be added in a future commit via the of%d device.

This also allowed factoring out common code from the bridge hooks.

16 years ago- When deleting an entry, remove the entry from "iter_node" as well as "node".
root [Fri, 23 May 2008 04:38:16 +0000 (21:38 -0700)]
- When deleting an entry, remove the entry from "iter_node" as well as "node".
- Clean code up a bit to make it more consistent.

16 years ago- Add Stanford License.
Justin Pettit [Tue, 20 May 2008 19:44:56 +0000 (12:44 -0700)]
- Add Stanford License.
- Remove unnecessary printk.

16 years agoMake sure destroy function was defined before trying to call it.
Justin Pettit [Tue, 20 May 2008 19:43:19 +0000 (12:43 -0700)]
Make sure destroy function was defined before trying to call it.

16 years agoCleanup extraneous printing of spaces when dumping flows.
Justin Pettit [Tue, 20 May 2008 00:35:01 +0000 (17:35 -0700)]
Cleanup extraneous printing of spaces when dumping flows.

16 years agoAdd-on hardware tables initial implementation.
Ben Pfaff [Mon, 28 Apr 2008 20:28:45 +0000 (13:28 -0700)]
Add-on hardware tables initial implementation.

Incorporates suggestions from Justin.

16 years agoPrepare for 0.8.1 release.
Justin Pettit [Thu, 15 May 2008 00:06:39 +0000 (17:06 -0700)]
Prepare for 0.8.1 release.

16 years agoRemove definition of unused function "hash_in6".
Justin Pettit [Thu, 15 May 2008 00:06:12 +0000 (17:06 -0700)]
Remove definition of unused function "hash_in6".

16 years agoFix problem with identifying SNAP frames when extracting flows.
Justin Pettit [Wed, 14 May 2008 22:50:30 +0000 (15:50 -0700)]
Fix problem with identifying SNAP frames when extracting flows.

The ssap field was being checked twice to see if it was SNAP, when one of the checks should have been dsap.

16 years agoDon't try to use the IP addresses from ARP packets when matching.
Justin Pettit [Sat, 10 May 2008 07:45:06 +0000 (00:45 -0700)]
Don't try to use the IP addresses from ARP packets when matching.

16 years agoFix compiler warning about mismatch with format type.
Justin Pettit [Sat, 10 May 2008 07:37:41 +0000 (00:37 -0700)]
Fix compiler warning about mismatch with format type.

16 years agoIPv6 is not supported in OpenFlow, so don't try to parse it.
Justin Pettit [Sat, 10 May 2008 07:27:13 +0000 (00:27 -0700)]
IPv6 is not supported in OpenFlow, so don't try to parse it.

16 years agoZero-out invalid fields when extracting a "match" and transforming it into a "flow".
Justin Pettit [Fri, 9 May 2008 18:22:45 +0000 (11:22 -0700)]
Zero-out invalid fields when extracting a "match" and transforming it into a "flow".

When the controller wishes to add a flow entry to the switch, it sends a request with a description of matching flows in a "match".  The switch was adding these exactly as described into the flow tables.  However, when packets arrived, all invalid fields (e.g., the TCP/UDP ports in a non-TCP/UDP packet) are set to zero.  If the rule being added by the controller had not set these invalid fields to zero, the packets would never match.  We now zero out these fields when extracing a "match".

-- Reported by Brandon H. --

16 years agoImplement the OFPP_ALL virtual port.
Justin Pettit [Fri, 9 May 2008 17:28:50 +0000 (10:28 -0700)]
Implement the OFPP_ALL virtual port.

-- Reported by Brandon H. --

16 years agoWhen printing flow expired messages, we should end the line with "\n" instead of...
root [Thu, 8 May 2008 01:19:24 +0000 (18:19 -0700)]
When printing flow expired messages, we should end the line with "\n" instead of "n".

16 years agoFixed problem where the first line of a stats reply message was not showing up on...
Justin Pettit [Wed, 7 May 2008 22:35:53 +0000 (15:35 -0700)]
Fixed problem where the first line of a stats reply message was not showing up on its own line.

16 years agoTreat flows without any wildcards as maximum priority.
Ben Pfaff [Wed, 7 May 2008 22:21:30 +0000 (15:21 -0700)]
Treat flows without any wildcards as maximum priority.

Otherwise, we give the table implementations the opportunity to screw up
by distinguishing between two flows without wildcards but with apparently
different priorities that are required to be treated as the same priority.

16 years agoWhen deleting flows, only insist on matching priority with strict matching.
Ben Pfaff [Wed, 7 May 2008 21:43:06 +0000 (14:43 -0700)]
When deleting flows, only insist on matching priority with strict matching.

(The code before this change would only ever delete flows if strict
matching was turned on.)

16 years agoMark the "vlan_eth_header" struct as packed, because it's getting padded on some...
Justin Pettit [Wed, 7 May 2008 05:11:06 +0000 (22:11 -0700)]
Mark the "vlan_eth_header" struct as packed, because it's getting padded on some architectures.

-- Reported by GigaFin --

16 years agoClean-up some compiler warnings related to printing numbers.
root [Tue, 6 May 2008 01:47:50 +0000 (18:47 -0700)]
Clean-up some compiler warnings related to printing numbers.

16 years agoFix a secure channel memory leak that appears only under high load.
Ben Pfaff [Mon, 5 May 2008 22:49:22 +0000 (15:49 -0700)]
Fix a secure channel memory leak that appears only under high load.

16 years agoFix memory leak in secure channel.
Ben Pfaff [Mon, 5 May 2008 21:44:24 +0000 (14:44 -0700)]
Fix memory leak in secure channel.

Thanks to Reid for noticing and helping to track down this leak.

16 years agoFix compilation on Linux 2.6.20: declare NLMSG_DEFAULT_SIZE with this kernel.
Ben Pfaff [Mon, 5 May 2008 19:08:00 +0000 (12:08 -0700)]
Fix compilation on Linux 2.6.20: declare NLMSG_DEFAULT_SIZE with this kernel.

NLMSG_DEFAULT_SIZE was introduced in 2.6.20-rc1 in commit 339bf98ff,
"[NETLINK]: Do precise netlink message allocations where possible", but
we only defined it for kernels 2.6.18 and earlier.  This change fixes
up the discrepancy.

16 years agoSupport pre-Linux 2.6.20 genetlink, which didn't have "done" functions for dumps.
Ben Pfaff [Mon, 5 May 2008 18:41:48 +0000 (11:41 -0700)]
Support pre-Linux 2.6.20 genetlink, which didn't have "done" functions for dumps.

16 years agoCompile fix for Linux 2.6.26-rc1: don't use the removed list_for_each_safe_rcu macro.
Ben Pfaff [Mon, 5 May 2008 18:14:02 +0000 (11:14 -0700)]
Compile fix for Linux 2.6.26-rc1: don't use the removed list_for_each_safe_rcu macro.

There is no need for a "safe" version of the RCU list iteration macros,
because the ordinary version of the macros is "safe".  Linux 2.6.26-rc1
removed these "safe" versions, so this change modifies OpenFlow's uses
of these macros to use the ordinary versions.  This also simplifies the
code because we don't need to use the list_entry macros any longer.

16 years agoCheck whether kernel has been configured by "version.h" instead of "utsrelease.h...
Justin Pettit [Mon, 5 May 2008 18:36:15 +0000 (11:36 -0700)]
Check whether kernel has been configured by "version.h" instead of "utsrelease.h", since that convention wasn't introduced until 2.6.18.

16 years agoOfficially designate the v0.8.0 release.
Justin Pettit [Mon, 5 May 2008 18:27:39 +0000 (11:27 -0700)]
Officially designate the v0.8.0 release.

16 years agoGet rid of compiler warning under gcc 4.2.
Justin Pettit [Mon, 5 May 2008 05:29:48 +0000 (22:29 -0700)]
Get rid of compiler warning under gcc 4.2.

16 years agoFix problem introduced by kernel threads when building for 2.4.20.
Justin Pettit [Mon, 5 May 2008 04:07:24 +0000 (21:07 -0700)]
Fix problem introduced by kernel threads when building for 2.4.20.

16 years agoClean-up OpenFlow main header a bit.
Justin Pettit [Mon, 5 May 2008 04:05:51 +0000 (21:05 -0700)]
Clean-up OpenFlow main header a bit.

16 years agoFix typo in comment.
Justin Pettit [Sat, 3 May 2008 04:53:15 +0000 (21:53 -0700)]
Fix typo in comment.

16 years agoFinishing touches on v0.8.0 release candidate.
Justin Pettit [Sat, 3 May 2008 04:51:02 +0000 (21:51 -0700)]
Finishing touches on v0.8.0 release candidate.

16 years ago- Update man pages to reflect recent spat of changes.
Justin Pettit [Sat, 3 May 2008 04:46:39 +0000 (21:46 -0700)]
- Update man pages to reflect recent spat of changes.
- Clean-up man pages.

16 years agoSend the features request before the set config to be OpenFlow-compliant.
Justin Pettit [Sat, 3 May 2008 00:43:16 +0000 (17:43 -0700)]
Send the features request before the set config to be OpenFlow-compliant.

16 years agoAdd build directory to include path.
Ben Pfaff [Sat, 3 May 2008 00:32:39 +0000 (17:32 -0700)]
Add build directory to include path.

Otherwise generated headers (forward_t.h) will not be found at build
time.

16 years agoSuppress Automake warnings about GNU make extensions in Modules.mk files.
Ben Pfaff [Sat, 3 May 2008 00:10:12 +0000 (17:10 -0700)]
Suppress Automake warnings about GNU make extensions in Modules.mk files.

16 years agoImplement aggregate flow statistics in kernel and userspace switches.
Ben Pfaff [Fri, 2 May 2008 23:57:54 +0000 (16:57 -0700)]
Implement aggregate flow statistics in kernel and userspace switches.

16 years agoReduce spurious recompilations for Linux 2.4 datapath.
Ben Pfaff [Fri, 2 May 2008 22:51:08 +0000 (15:51 -0700)]
Reduce spurious recompilations for Linux 2.4 datapath.

We need object files to depend on the build directories, so that the
build directories get created before we try to output files into them.
But making them depend directly on the build directories means that
whenever a build directory changes (including any change to the set of
files inside it) all the source files get recompiled.  So, instead, make
them depend on dummy files inside the directories, which will only get
modified if someone does it intentionally.

16 years agoRemove MAX_ACTIONS (which was 16) as a limit on the number of actions in a flow table...
Ben Pfaff [Fri, 2 May 2008 18:37:04 +0000 (11:37 -0700)]
Remove MAX_ACTIONS (which was 16) as a limit on the number of actions in a flow table entry.

Now the number of actions is limited, as a practical matter, to the size
of the buffer that the kernel provides for Netlink dumps, which is usually
4096 bytes.  A flow statistics entry must fit in a single one of these
buffers.  Actions are 8 bytes each, so this is about 500 actions
considering overhead.

16 years agoSend actions as part of flow statistics messages.
Ben Pfaff [Fri, 2 May 2008 17:52:53 +0000 (10:52 -0700)]
Send actions as part of flow statistics messages.

16 years agoAdd max_idle field to flow stats messages.
Ben Pfaff [Fri, 2 May 2008 01:26:21 +0000 (18:26 -0700)]
Add max_idle field to flow stats messages.

16 years ago- Add priority to flow expiration messages.
Justin Pettit [Fri, 2 May 2008 00:10:20 +0000 (17:10 -0700)]
- Add priority to flow expiration messages.
- Clear contents of "pad" field port status messages.

16 years agoConvert tabs to spaces to fix indentation issues.
Ben Pfaff [Fri, 2 May 2008 00:01:25 +0000 (17:01 -0700)]
Convert tabs to spaces to fix indentation issues.

16 years agoImplement new statistics format in kernel and userspace switches.
Ben Pfaff [Fri, 2 May 2008 00:02:13 +0000 (17:02 -0700)]
Implement new statistics format in kernel and userspace switches.

This change really cuts the muster!

16 years agoDrop prototype for function that does not exist.
Ben Pfaff [Wed, 30 Apr 2008 21:16:35 +0000 (14:16 -0700)]
Drop prototype for function that does not exist.

16 years agoClear padding bytes in fill_flow_stats(), to avoid state leakage.
Ben Pfaff [Wed, 30 Apr 2008 23:26:33 +0000 (16:26 -0700)]
Clear padding bytes in fill_flow_stats(), to avoid state leakage.

Found by valgrind.

16 years agoInitialize n_flows member in table-hash.
Ben Pfaff [Wed, 30 Apr 2008 22:33:21 +0000 (15:33 -0700)]
Initialize n_flows member in table-hash.

Found by valgrind.

16 years agoInitialize rconn "connected" member.
Ben Pfaff [Wed, 30 Apr 2008 22:12:05 +0000 (15:12 -0700)]
Initialize rconn "connected" member.

Found by valgrind.

16 years agoNew utility function xmemdup().
Ben Pfaff [Wed, 30 Apr 2008 22:11:40 +0000 (15:11 -0700)]
New utility function xmemdup().

16 years agoAdd support for OFPP_TABLE virtual port to user-space switch.
Justin Pettit [Thu, 1 May 2008 23:30:09 +0000 (16:30 -0700)]
Add support for OFPP_TABLE virtual port to user-space switch.

16 years ago- Add support for OpenFlow error message type.
Justin Pettit [Thu, 1 May 2008 00:38:03 +0000 (17:38 -0700)]
- Add support for OpenFlow error message type.
- Ensure OpenFlow messages fit in 16-bit length field.

16 years agoRevamp OpenFlow kernel module build system.
Ben Pfaff [Mon, 28 Apr 2008 20:28:31 +0000 (13:28 -0700)]
Revamp OpenFlow kernel module build system.

The new build system supports using a build tree separate from the
source tree, which makes it easier to build for multiple targets
using a single source tree.  It also factors out the means for specifying
the modules to be built and the source files that comprise those
modules into simple files named Modules.mk.  This is intended to
make it easier to add support for separate hardware table modules in
an upcoming commit.

16 years agoFix problem displaying duration when printing flow stats.
Justin Pettit [Tue, 29 Apr 2008 22:55:45 +0000 (15:55 -0700)]
Fix problem displaying duration when printing flow stats.

16 years ago- On flow entries with wildcards, match priority field when doing a "strict" delete.
Justin Pettit [Tue, 29 Apr 2008 22:00:28 +0000 (15:00 -0700)]
- On flow entries with wildcards, match priority field when doing a "strict" delete.
- Remove group_id from flow entries.
- Show priority when print flow mod messages.

16 years agoFix openflow.h compilation with GCC 2.95.
Ben Pfaff [Sat, 26 Apr 2008 18:03:54 +0000 (11:03 -0700)]
Fix openflow.h compilation with GCC 2.95.

Necessary because older Linux 2.4 releases will only compile with GCC 2.95.

16 years agoRename variables with duplicate names, so as to be less confusing.
Ben Pfaff [Tue, 29 Apr 2008 17:18:45 +0000 (10:18 -0700)]
Rename variables with duplicate names, so as to be less confusing.

Suggestion from Justin.

16 years agoGet rid of union in struct sw_flow, because only one member is ever used any longer.
Ben Pfaff [Tue, 29 Apr 2008 16:52:06 +0000 (09:52 -0700)]
Get rid of union in struct sw_flow, because only one member is ever used any longer.

16 years agoMake dumping large numbers of flows possible.
Ben Pfaff [Tue, 29 Apr 2008 01:16:05 +0000 (18:16 -0700)]
Make dumping large numbers of flows possible.

This changes the kernel switch implementation to use the kernel Netlink
"dump" interface to allow flow stats that don't fit in the socket buffer
to be dumped gradually as the caller drains the socket buffer.

One of the changes here is a bug fix for nla_unreserve.  Because Netlink
attributes' lengths are rounded up to a multiple of 4 bytes, reducing
the length of the payload by N bytes doesn't necessarily reduce the
length of the skb by N bytes.  Instead, we need to know the original
length and final length of the attribute.  This means that using 'len'
as a difference in bytes doesn't really make sense, so this changes
'len' to be the new length of the attribute payload and renames the
function to nla_shrink to (IMO) better reflect what it is now doing.

Since we have to release the RCU read lock between calls to the dump
function, we need table iterators that persist across RCU epochs.  One
way to do this would be to add new "iterator_save" and "iterator_restore"
functions, but this seemed like overkill since there would then be a
total of 5 iterator functions that have only one user (flow stats dumping).
Instead, this patch refactors table iteration into a single "iterate"
function that takes a callback.  This simplifies the table iteration code
significantly.

This change also modifies dpctl to understand the new format of flow
stats.

16 years agoBUG #6
Justin Pettit [Mon, 28 Apr 2008 21:33:02 +0000 (14:33 -0700)]
BUG #6

Fix problem with "dpctl monitor" not working.

** Fix by Ben. **

16 years agoAdd missing NLM_F flags constants (oops).
Ben Pfaff [Mon, 28 Apr 2008 21:16:57 +0000 (14:16 -0700)]
Add missing NLM_F flags constants (oops).

16 years agoEnable the netlink library to dump more verbose debug output.
Ben Pfaff [Tue, 22 Apr 2008 18:08:12 +0000 (11:08 -0700)]
Enable the netlink library to dump more verbose debug output.

16 years agoMake nl_sock_sendv properly implement 'wait' option.
Ben Pfaff [Mon, 21 Apr 2008 17:36:49 +0000 (10:36 -0700)]
Make nl_sock_sendv properly implement 'wait' option.

16 years agoFix typo in comment.
Ben Pfaff [Fri, 18 Apr 2008 21:49:45 +0000 (14:49 -0700)]
Fix typo in comment.

16 years agoClean-up related to supporting priorities...mostly suggestions from Ben.
Justin Pettit [Sat, 26 Apr 2008 21:27:32 +0000 (14:27 -0700)]
Clean-up related to supporting priorities...mostly suggestions from Ben.

16 years agoBUG #5
Justin Pettit [Sat, 26 Apr 2008 00:28:50 +0000 (17:28 -0700)]
BUG #5

Fixes crash when a non-existent command is given to dpctl.

16 years agoPrint the configuration of the switch in addition to the features when "dpctl show...
Justin Pettit [Fri, 25 Apr 2008 22:18:08 +0000 (15:18 -0700)]
Print the configuration of the switch in addition to the features when "dpctl show" is run.

16 years agoAdd support for deleting flow entries with "del-flows" command in "dpctl".
Justin Pettit [Fri, 25 Apr 2008 21:21:51 +0000 (14:21 -0700)]
Add support for deleting flow entries with "del-flows" command in "dpctl".

16 years ago- Add support for flow entry priorities.
Justin Pettit [Fri, 25 Apr 2008 21:00:15 +0000 (14:00 -0700)]
- Add support for flow entry priorities.
- Fix "flow-add" action for dpctl.

16 years agoFix problem where the add_flow command is reading an unitialized array.
Justin Pettit [Tue, 22 Apr 2008 06:49:17 +0000 (23:49 -0700)]
Fix problem where the add_flow command is reading an unitialized array.

16 years agoImprove list traversal macros.
Ben Pfaff [Sat, 26 Apr 2008 01:28:03 +0000 (18:28 -0700)]
Improve list traversal macros.

Make LIST_FOR_EACH[_SAFE] variable take logically correct value upon loop termination.

Also, add regression tests for linked list routines, to ensure that this
change does not break code.

Also, add new macro LIST_FOR_EACH_REVERSE.

16 years agoAdd missing header to Makefile.am.
Ben Pfaff [Sat, 26 Apr 2008 16:10:41 +0000 (09:10 -0700)]
Add missing header to Makefile.am.

16 years agoDrop stray debug messages.
Ben Pfaff [Fri, 25 Apr 2008 02:07:54 +0000 (19:07 -0700)]
Drop stray debug messages.

16 years agoGet rid of build dependency on netlink-related headers from Linux 2.6.
Ben Pfaff [Thu, 24 Apr 2008 23:29:53 +0000 (16:29 -0700)]
Get rid of build dependency on netlink-related headers from Linux 2.6.

This fixes userspace program build problems on top of systems with
Linux 2.4 headers.

16 years agoFix problem in sending netlink messages on non-32-bit platforms.
root [Thu, 24 Apr 2008 18:37:54 +0000 (11:37 -0700)]
Fix problem in sending netlink messages on non-32-bit platforms.

** Fix provided by Ben. **

16 years agoCHECKSUM_COMPLETE and CHECKSUM_PARTIAL were added Linux 2.6.19, so update the compati...
root [Wed, 23 Apr 2008 22:48:56 +0000 (15:48 -0700)]
CHECKSUM_COMPLETE and CHECKSUM_PARTIAL were added Linux 2.6.19, so update the compatiblity layer to reflect this.

16 years agoTolerate ENOBUFS from kernel netlink code in second call to recvmsg.
root [Wed, 23 Apr 2008 22:20:58 +0000 (15:20 -0700)]
Tolerate ENOBUFS from kernel netlink code in second call to recvmsg.

The Linux kernel returns ENOBUFS to userspace code to indicate that
a netlink message that the kernel wanted to send could not be due to
a lack of buffer space.  We checked for this and dealt with it in
one recvmsg call but not in another.  This change tolerates it in
both places.

Should fix a problem encountered on the OF6k under "hping3 --flood".

** This fix was done by Ben. **

16 years agoSupport NETLINK_ADD_MEMBERSHIP even when compiled with old kernel headers.
Ben Pfaff [Wed, 23 Apr 2008 21:25:27 +0000 (14:25 -0700)]
Support NETLINK_ADD_MEMBERSHIP even when compiled with old kernel headers.

Commit 0a9024a2d7, "Changes based on feedback from GigaFin," added support
for compiling on a system that lacked up-to-date Linux kernel headers, by
dropping support for a feature only in newer kernels on such a system.
But the code already supported such a system properly; only the lack of
a macro definition kept it from compiling.  So define the macro ourselves
instead of disabling the feature.

To elaborate, there are two issues here.

The first is kernel support for NETLINK_ADD_MEMBERSHIP.  Older
kernels don't support this.  But NETLINK_ADD_MEMBERSHIP was added
at the same time as support for more than 32 netlink multicast
groups.  Netlink multicast groups numbered less than 32 can be
subscribed using a different mechanism, and in fact we do that
for such groups.  Thus, attempting to use NETLINK_ADD_MEMBERSHIP
on an older kernel basically can't happen, and if it did it would
be a bug in the OpenFlow kernel module for telling userspace to
subscribe to a multicast group that cannot exist on that kernel.

The second is the kernel headers that the userspace programs are
compiled with.  Without the change quoted below, the userspace
programs will silently fail if they are compiled with 2.4.x
headers and then run on a 2.6.x kernel and given a multicast
group numbered above 32, because they will not even try to
subscribe to that group.  With the change, the userspace programs
will work properly when run on 2.4.x or 2.6.x kernels regardless
of the multicast group number and regardless of whether the
headers they were compiled against were from 2.4.x or 2.6.x.

16 years agoHandle memory allocation failure in dp_output_control().
Ben Pfaff [Wed, 23 Apr 2008 19:24:32 +0000 (12:24 -0700)]
Handle memory allocation failure in dp_output_control().

Possible fix for bug observed on OF6k.

16 years agoMark functions not meant to be exported as static.
Ben Pfaff [Wed, 23 Apr 2008 00:48:22 +0000 (17:48 -0700)]
Mark functions not meant to be exported as static.

16 years agoAdd priority field to flow_mod...code to support this forthcoming.
Justin Pettit [Tue, 22 Apr 2008 01:13:42 +0000 (18:13 -0700)]
Add priority field to flow_mod...code to support this forthcoming.

16 years agoFix tab/space issue.
Justin Pettit [Tue, 22 Apr 2008 00:59:44 +0000 (17:59 -0700)]
Fix tab/space issue.

16 years agoBUG #4.
Justin Pettit [Tue, 22 Apr 2008 00:56:12 +0000 (17:56 -0700)]
BUG #4.

Don't use kmalloc with GFP_KERNEL within an rcu_read_lock().