Commit Graph
290 Commits
Author SHA1 Message Date
Ben Pfaff 18349ee8d6 Fix segfault when SSL_connect or SSL_accept reports an error. 2008-07-01 14:17:41 -07:00
Ben Pfaff bebf175930 Make the secure channel and controller send out keepalives.
It can happen that the secure channel thinks that it is connected
to the controller, but in fact the connection has dropped.  For
example, a switch intermediate between the secure channel and the
controller could have a flow inserted, due to a malfunction, that
causes packets in one direction or the other to be dropped.  When
this happens, the Linux kernel's TCP implementation will continue
retransmitting packets for somewhere between 13 and 30 minutes,
depending on the connection's retransmission timeout (according
to linux/Documentation/networking/ip-sysctl.txt) with the default
Linux settings.

We want to detect the lost connection and re-connect much faster
than that.  We use OpenFlow echo request and reply messages: if
no message is received from the controller for N seconds, we
send out an echo request.  If no reply (actually, any message at
all) is received for an additional N seconds, then we assume
that the connection has been lost, and reconnect.
2008-07-01 11:14:45 -07:00
Ben Pfaff 88df6edbfa Drop "benchmark" netlink message and "benchmark-nl" dpctl command.
The new OFPT_ECHO_REQUEST and OFPT_ECHO_REPLY OpenFlow messages
have the same functionality and are more general (in that they
are not Netlink-specific).
2008-07-01 10:59:04 -07:00
Ben Pfaff 258f32a084 Respond to echo requests in OpenFlow implementations.
Nothing yet sends such requests.  This is preparation for their
use in following commits.
2008-07-01 10:51:50 -07:00
Ben Pfaff 7225d06a78 Add utility functions for generating random numbers, and use where appropriate. 2008-07-01 10:51:47 -07:00
Ben Pfaff c44bef2f6e Fix -v, --verbose options to userspace programs.
Now providing an argument to these options works as documented.
2008-07-01 10:51:47 -07:00
Justin Pettit 34d507b6a6 Improve flow handling in dpctl.
This makes the handling of defining and printing actions more consistent in
dpctl.  The flow portion of the output of "dump-flows" can now be used as the
input of "add-flows".  Flows can be added on the command line with the new
"add-flow" command.
2008-06-30 23:05:14 -07:00
Ben Pfaff 5aca80fab9 Add --max-idle option to secchan and controller. 2008-06-26 09:26:50 -07:00
Justin Pettit cb5f13f1b9 Add printing of all supported action types. 2008-06-24 16:48:55 -07:00
Ben Pfaff fe867d8d71 Add --detach and --pidfile options to daemons. 2008-06-13 13:03:51 -07:00
Ben Pfaff 7b351ea076 Factor learning switch out of controller into library.
This prepares for adding "fail-open" support to the secchan, which
will require the secchan to act as a learning switch.
2008-06-09 10:27:49 -07:00
Ben Pfaff aab48e6fe9 Prevent deadlock in OpenSSL. 2008-06-04 09:37:08 -07:00
Ben Pfaff 3d8bf698e7 Ignore NLMSG_DONE Netlink messages in dpif.
Otherwise the secchan considers the NLMSG_DONE at the end of a stats
dump to be an error and disconnects from the netlink connection.

Thanks to Martin for discovering the problem.
2008-05-28 16:03:36 -07:00
Ben Pfaff c8fda0a552 Fix typo in error message. 2008-05-28 16:01:49 -07:00
Ben Pfaff b2f43905ea Make in-band communication work. 2008-05-28 10:46:54 -07:00
Ben Pfaff 711c48de9d Break MAC learning out of controller into library.
This is preparation for use of MAC learning in the secure channel.
2008-05-28 10:46:54 -07:00
Ben Pfaff 23e054dcb6 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.
2008-05-28 10:46:54 -07:00
Ben Pfaff 6b8436f66b Expose device IP addresses through netdev.
This will be useful for the secure channel later.
2008-05-28 10:46:54 -07:00
Ben Pfaff 735683ac61 Move netdev from switch to lib.
This is in preparation for the secure channel wanting to access
network devices.
2008-05-28 10:46:54 -07:00
Ben Pfaff e5bbe3bcc8 Print actions in ofp_flow_mod messages. 2008-05-28 10:46:54 -07:00
Ben Pfaff 0f81e793e5 Pretty-print port numbers when printing ofp_switch_features messages. 2008-05-28 10:46:54 -07:00
Ben Pfaff cf46e1e8a2 Print special ports by name in ofp_packet_in messages. 2008-05-28 09:58:23 -07:00
Ben Pfaff bdac0887d2 Put newline before packet info in ofp_packet_out pretty-print output. 2008-05-28 09:58:22 -07:00
Ben Pfaff 6c08c24913 Print more special ports by name in ofp-print.c. 2008-05-28 09:58:22 -07:00
Ben Pfaff dbcacca77e 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.
2008-05-28 09:58:22 -07:00
Justin Pettit 3e2fac45e7 Cleanup extraneous printing of spaces when dumping flows. 2008-05-19 17:35:01 -07:00
Justin Pettit 03addaad57 Don't try to use the IP addresses from ARP packets when matching. 2008-05-10 00:45:06 -07:00
Justin Pettit cb8ec3bab8 Fix compiler warning about mismatch with format type. 2008-05-10 00:37:41 -07:00
root f2faa2f778 When printing flow expired messages, we should end the line with "\n" instead of "n". 2008-05-07 18:20:13 -07:00
Justin Pettit befb4cbdc3 Fixed problem where the first line of a stats reply message was not showing up on its own line. 2008-05-07 15:35:53 -07:00
root a6c34acd7a Clean-up some compiler warnings related to printing numbers. 2008-05-05 18:49:10 -07:00
Ben Pfaff bcdd14c2d0 Fix a secure channel memory leak that appears only under high load. 2008-05-05 16:06:56 -07:00
Ben Pfaff f7bf3916ff Implement aggregate flow statistics in kernel and userspace switches. 2008-05-02 16:58:33 -07:00
Ben Pfaff 4f5b4efc54 Send actions as part of flow statistics messages. 2008-05-02 10:58:53 -07:00
Ben Pfaff 2e12784892 Add max_idle field to flow stats messages. 2008-05-02 10:58:52 -07:00
Justin Pettit 917160e384 - Add priority to flow expiration messages.
- Clear contents of "pad" field port status messages.
2008-05-01 17:11:29 -07:00
Ben Pfaff 3b9c97ee01 Implement new statistics format in kernel and userspace switches.
This change really cuts the muster!
2008-05-01 17:04:44 -07:00
Ben Pfaff 1daf19850e Initialize rconn "connected" member.
Found by valgrind.
2008-05-01 17:02:31 -07:00
Ben Pfaff 4c411bcb40 New utility function xmemdup(). 2008-05-01 17:02:31 -07:00
Justin Pettit 66b5c90376 - Add support for OpenFlow error message type.
- Ensure OpenFlow messages fit in 16-bit length field.
2008-04-30 17:38:03 -07:00
Justin Pettit 2f6f9fc086 Fix problem displaying duration when printing flow stats. 2008-04-29 15:55:45 -07:00
Justin Pettit d1d2f3f321 - 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.
2008-04-29 15:00:28 -07:00
Ben Pfaff db74f01873 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.
2008-04-29 10:12:46 -07:00
Ben Pfaff 25c6b13561 Enable the netlink library to dump more verbose debug output. 2008-04-28 13:52:48 -07:00
Ben Pfaff cacf0c4926 Make nl_sock_sendv properly implement 'wait' option. 2008-04-28 13:52:27 -07:00
Justin Pettit bfe3b4df89 - Add support for flow entry priorities.
- Fix "flow-add" action for dpctl.
2008-04-26 14:08:41 -07:00
Ben Pfaff c5f976a78f 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.
2008-04-24 16:29:53 -07:00
root 9d3ea3b581 Fix problem in sending netlink messages on non-32-bit platforms.
** Fix provided by Ben. **
2008-04-24 11:37:54 -07:00
root cdd0a5ba36 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. **
2008-04-23 15:20:58 -07:00
Ben Pfaff 15bf0e0b5d 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.
2008-04-23 14:25:27 -07:00