Ben Pfaff [Wed, 23 Jul 2008 20:09:25 +0000 (13:09 -0700)]
New utility ofp-kill.
Needed for controller discovery in upcoming revision of ofp-switch-setup.
Ben Pfaff [Wed, 23 Jul 2008 20:08:31 +0000 (13:08 -0700)]
New function make_pidfile_name().
The upcoming ofp-kill utility wants to use this.
Ben Pfaff [Wed, 23 Jul 2008 20:07:40 +0000 (13:07 -0700)]
secchan: Improve logging when rejecting a controller vconn.
Ben Pfaff [Wed, 23 Jul 2008 20:07:02 +0000 (13:07 -0700)]
Lock pidfiles with fcntl and create them atomically.
This makes it possible to verify that the program that created the
pidfile is still running.
Ben Pfaff [Tue, 22 Jul 2008 21:44:10 +0000 (14:44 -0700)]
New program ofp-discover.
Ben Pfaff [Tue, 22 Jul 2008 20:26:03 +0000 (13:26 -0700)]
Add SIGALRM to blockable fatal signals.
We use SIGALRM to limit runtime of dpctl and ofp-discover. There is no
reason that we should not clean up after it in the same way as any other
catchable signal. In particular, ofp-discover wants to restore network
device flags on timeout.
Ben Pfaff [Tue, 22 Jul 2008 21:01:25 +0000 (14:01 -0700)]
dhcp: Always build test-dhcp-client.
Putting test-dhcp-client in check_PROGRAMS instead of noinst_PROGRAMS
makes it too easy to break test-dhcp-client without noticing it.
Ben Pfaff [Tue, 22 Jul 2008 21:01:17 +0000 (14:01 -0700)]
dhcp: Fix race condition in test-dhcp-client.
dhclient_wait() might also access dhcp state.
Ben Pfaff [Tue, 22 Jul 2008 20:32:42 +0000 (13:32 -0700)]
dhcp: Only print "entering" message if state actually changes.
Ben Pfaff [Tue, 22 Jul 2008 20:16:08 +0000 (13:16 -0700)]
dhcp: Don't attempt to drain netdev if we ran out of packets.
Fixes a theoretical race condition that would have caused more
retransmission than otherwise necessary.
Ben Pfaff [Wed, 23 Jul 2008 20:12:14 +0000 (13:12 -0700)]
dhcp: Make output of dhcp_option_to_string() more uniform, to ease parsing.
(The ofp-switch-setup program will want to parse its output.)
Ben Pfaff [Tue, 22 Jul 2008 21:01:10 +0000 (14:01 -0700)]
dhcp: Make dhcp_msg_to_string() support a multiline format also.
The upcoming ofp-discover program wants to print out the binding
information, and dhcp_msg_to_string() is pretty close to what it
wants. But one-field-per-line is easier for other programs to parse.
Ben Pfaff [Tue, 22 Jul 2008 21:01:01 +0000 (14:01 -0700)]
dhcp: Break out netdev configuration from DHCP binding.
This allows us to have DHCP clients that don't actually bind or unbind
a network device's IP address. This is useful for doing controller
discovery without actually reconfiguring a network device.
Ben Pfaff [Tue, 22 Jul 2008 21:00:03 +0000 (14:00 -0700)]
dhcp: Be more precise about updating 'changed' flag.
There's no need to set changed unconditionally in dhclient_init(), and
it can make extra work for the users of the dhclient, by causing them
to think that something changed when it didn't.
Ben Pfaff [Tue, 22 Jul 2008 20:53:20 +0000 (13:53 -0700)]
Make set_pidfile() easier to use.
Ben Pfaff [Tue, 22 Jul 2008 20:33:02 +0000 (13:33 -0700)]
dpctl: Get rid of effectively unused variable.
Ben Pfaff [Mon, 21 Jul 2008 23:30:53 +0000 (16:30 -0700)]
Don't include unneeded header file.
Ben Pfaff [Mon, 21 Jul 2008 22:44:18 +0000 (15:44 -0700)]
Do the Debian package build in a _debian subdirectory.
This makes it easier to do a Debian build in the same source tree
also being used for other development.
Ben Pfaff [Mon, 21 Jul 2008 22:42:31 +0000 (15:42 -0700)]
Don't unnecessarily link against -lresolv and -ldl.
Eliminates warnings given by dpkg-shlibdeps when building Debian
packages.
Ben Pfaff [Mon, 21 Jul 2008 22:41:38 +0000 (15:41 -0700)]
Distribute new rculist.h headers.
Ben Pfaff [Mon, 21 Jul 2008 22:04:54 +0000 (15:04 -0700)]
Move Autoconf's macro definitions into config.h.
This makes "make" output slightly more readable.
Ben Pfaff [Mon, 21 Jul 2008 21:48:53 +0000 (14:48 -0700)]
Drop use of libtool for libraries.
libtool was needed when NOX was directly linking against libopenflow.
Since it doesn't do that anymore, we can drop its use (and that makes
OpenFlow configure and build slightly faster).
Ben Pfaff [Mon, 21 Jul 2008 21:50:36 +0000 (14:50 -0700)]
Don't explicitly link against libdl.
There is no need to add -ldl explicitly to each program's LDADD, because
the configure test for dladdr does that for us.
Ben Pfaff [Mon, 21 Jul 2008 21:37:21 +0000 (14:37 -0700)]
Only link programs that need it against OpenSSL.
This keeps vlogconf, in particular, from being linked against OpenSSL,
which in turn keeps the Debian package build tools from complaining that
the openflow-common package shouldn't need to depend on OpenSSL but does
because of the spurious library link.
Ben Pfaff [Mon, 21 Jul 2008 18:39:39 +0000 (11:39 -0700)]
Make openflow.h SWIG-friendly.
Ben Pfaff [Sat, 19 Jul 2008 23:14:18 +0000 (16:14 -0700)]
Fix build on Linux 2.6.26.
Linux 2.6.26 requires us to additionally include <linux/rculist.h>
to use RCU lists.
Ben Pfaff [Thu, 17 Jul 2008 18:58:15 +0000 (11:58 -0700)]
Use an IP ID of 0 for transmitted DHCP packets.
We can't guarantee uniqueness of ip_id versus the host's, screwing up
fragment reassembly, so prevent fragmentation and use an all-zeros
ip_id. RFC 791 doesn't say we can do this, but Linux does the same
thing for DF packets, so it must not screw anything up.
Ben Pfaff [Tue, 15 Jul 2008 18:20:05 +0000 (11:20 -0700)]
Discovery.
Ben Pfaff [Mon, 14 Jul 2008 22:27:19 +0000 (15:27 -0700)]
Don't truncate flooded packets at the amount sent up by the switch.
Ben Pfaff [Mon, 14 Jul 2008 21:10:18 +0000 (14:10 -0700)]
Make facility and level optional in -v, --verbose options.
This makes it easier to set a given module to maximum verbosity,
as is often useful for debugging.
Ben Pfaff [Tue, 8 Jul 2008 00:18:34 +0000 (17:18 -0700)]
Implement DHCP client.
Ben Pfaff [Mon, 14 Jul 2008 21:01:06 +0000 (14:01 -0700)]
vconn: Make errors in vconn names non-fatal errors.
This prevents bad vconn names obtained via discovery from killing
the secure channel.
Ben Pfaff [Mon, 14 Jul 2008 20:56:39 +0000 (13:56 -0700)]
vconn: New function vconn_ssl_is_configured().
The secure channel, in discovery mode, wants to enable TCP connections
by default only if SSL has not been configured. This function allows
it to do that.
Ben Pfaff [Mon, 14 Jul 2008 20:53:28 +0000 (13:53 -0700)]
vconn: Add assertions to vconn_send() to check consistency of outgoing messages.
Ben Pfaff [Fri, 18 Jul 2008 21:16:38 +0000 (14:16 -0700)]
vconn: Add new function vconn_transact() and use it to simplify dpctl.c.
Ben Pfaff [Fri, 18 Jul 2008 21:08:18 +0000 (14:08 -0700)]
vconn: Add utility functions make_openflow() and update_openflow_length().
Use these functions to simplify code that creates and sends
OpenFlow packets.
Ben Pfaff [Mon, 14 Jul 2008 20:20:00 +0000 (13:20 -0700)]
Add new --max-backoff option to secchan and switch programs.
One use case is when NOX is running on localhost, in which case waiting
for the full default backoff interval is unnecessary and undesirable.
Also changes default maximum backoff to 15 seconds (from 60).
Ben Pfaff [Mon, 14 Jul 2008 20:32:13 +0000 (13:32 -0700)]
rconn: Add questionability.
Ben Pfaff [Mon, 14 Jul 2008 20:43:17 +0000 (13:43 -0700)]
rconn: Rewrite to use explicit state machine.
Ben Pfaff [Mon, 14 Jul 2008 20:31:56 +0000 (13:31 -0700)]
rconn: Push detection of send errors into try_send().
Thereby, we correct a bug in do_send(), one of the callers of try_send(),
which was not checking the try_send() return value.
Ben Pfaff [Mon, 14 Jul 2008 20:34:14 +0000 (13:34 -0700)]
rconn: Time out connection attempts when the backoff deadline passes.
Otherwise, the TCP/IP implementation is responsible for connection
attempt backoff, but we want to have some control over it ourselves.
In particular we want to initially back off faster and to log a
message upon connection attempt retransmission, to make it easier
to see what has happened from the log.
Ben Pfaff [Mon, 14 Jul 2008 20:31:42 +0000 (13:31 -0700)]
rconn: Log when a connection attempt starts.
This makes it easier to see what happened by viewing the log.
Ben Pfaff [Mon, 14 Jul 2008 20:31:28 +0000 (13:31 -0700)]
rconn: Add new max_backoff argument to rconn_new().
This allows the caller more control over reconnection backoff.
Ben Pfaff [Mon, 14 Jul 2008 20:02:27 +0000 (13:02 -0700)]
netdev: add ability to set IPv4 addresses and add a default gateway.
Ben Pfaff [Fri, 18 Jul 2008 20:55:12 +0000 (13:55 -0700)]
netdev: Add ability to permanently set device flags.
Ben Pfaff [Mon, 14 Jul 2008 20:03:49 +0000 (13:03 -0700)]
netdev: Use SOCK_RAW instead of SOCK_PACKET.
A comment previously claimed this wasn't possible, but it
was wrong (and due to misunderstanding kernel code).
Ben Pfaff [Mon, 14 Jul 2008 20:03:37 +0000 (13:03 -0700)]
netdev: Add more functions for manipulating device flags.
These are convenient for use in secchan and elsewhere.
Ben Pfaff [Mon, 14 Jul 2008 20:03:27 +0000 (13:03 -0700)]
netdev: New function netdev_drain().
Ben Pfaff [Mon, 14 Jul 2008 20:03:19 +0000 (13:03 -0700)]
netdev: Add argument to netdev_open() to specify Ethernet type to capture.
This is needed by the controller, which wants to listen only for
OpenFlow discovery BPDUs on its network devices.
Also, update all existing callers.
Ben Pfaff [Mon, 14 Jul 2008 20:03:09 +0000 (13:03 -0700)]
netdev: Do not modify the caller's buffer in netdev_send().
This makes it possible to use a buffer whose contents are stack-allocated.
Ben Pfaff [Mon, 14 Jul 2008 20:55:22 +0000 (13:55 -0700)]
packets: Make flow_extract() output a pointer to L7 data also.
Useful for the DHCP client, which wants to pick apart UDP packets
and extract the DHCP payload.
Ben Pfaff [Mon, 14 Jul 2008 20:54:45 +0000 (13:54 -0700)]
packets: New macros for detecting IP fragments.
Ben Pfaff [Mon, 14 Jul 2008 20:54:38 +0000 (13:54 -0700)]
packets: Move IP checksum functionality into new csum.c, csum.h.
Ben Pfaff [Mon, 14 Jul 2008 20:54:27 +0000 (13:54 -0700)]
packets: Distinguish max Ethernet length with and without VLAN header.
Ben Pfaff [Mon, 14 Jul 2008 20:54:22 +0000 (13:54 -0700)]
packets: New IP header macros.
Ben Pfaff [Mon, 14 Jul 2008 20:54:13 +0000 (13:54 -0700)]
packets: Make Ethernet broadcast address available as a global object.
Ben Pfaff [Mon, 14 Jul 2008 20:51:46 +0000 (13:51 -0700)]
buffer: New functions buffer_reserve(), buffer_push(),
buffer_try_pull().
Ben Pfaff [Mon, 14 Jul 2008 20:51:37 +0000 (13:51 -0700)]
buffer: Rename buffer_reserve_headroom to buffer_prealloc_headroom.
Similarly for buffer_reserve_tailroom.
The new name better reflects what they do, and make way for a different
use of the term "reserve" in the upcoming buffer_reserve() function.
Ben Pfaff [Mon, 14 Jul 2008 20:51:26 +0000 (13:51 -0700)]
buffer: Make buffer_pull() return the start of the pulled data.
Some callers find this useful.
Ben Pfaff [Thu, 10 Jul 2008 17:45:05 +0000 (10:45 -0700)]
New function xmemdup0().
Ben Pfaff [Thu, 10 Jul 2008 00:22:17 +0000 (17:22 -0700)]
New function ds_clear().
Ben Pfaff [Wed, 9 Jul 2008 01:40:41 +0000 (18:40 -0700)]
New function random_range().
Ben Pfaff [Sat, 12 Jul 2008 00:07:27 +0000 (17:07 -0700)]
New header file timeval.h for time-related functionality.
Ben Pfaff [Sat, 12 Jul 2008 00:07:05 +0000 (17:07 -0700)]
New header file "type-props.h" for testing properties of types.
Ben Pfaff [Tue, 8 Jul 2008 20:46:14 +0000 (13:46 -0700)]
Set skb->dev before calling netif_rx().
Fixes null pointer dereference reported by David Erickson
<derickso@stanford.edu>.
Ben Pfaff [Tue, 15 Jul 2008 18:21:06 +0000 (11:21 -0700)]
Fix "make dist".
Ben Pfaff [Thu, 17 Jul 2008 00:52:41 +0000 (17:52 -0700)]
By default, log to syslog also.
It seems that this should be useful for debugging post-mortems. Also,
this ensures that the "current time is negative" log message appears in
syslog. Otherwise, it won't ever, because we log it before the vlog
client has a chance to configure its log levels.
Ben Pfaff [Thu, 17 Jul 2008 00:50:06 +0000 (17:50 -0700)]
Log an error when the time is negative at vlog startup.
Ben Pfaff [Wed, 16 Jul 2008 18:14:23 +0000 (11:14 -0700)]
Fix behavior when system date is negative.
Previously we set a few timers to expire at a time_t of 0, i.e.
immediately. But if the system date is set incorrectly to a date
before 1970, then these timers will essentially never expire.
Set them to expire at TIME_MIN instead.
Ben Pfaff [Thu, 17 Jul 2008 00:01:03 +0000 (17:01 -0700)]
Answer ARP requests from controller directly in secchan.
With in-band control, it can happen that the controller needs to send
out an ARP request to find out the MAC address of the switch. These
packets are sent as broadcasts, so the secure channel will attempt to
send them back to the controller as ofp_packet_in messages. Of course,
that won't work, because the controller won't be able to respond to
the ofp_packet_in (because it needs the MAC address of the switch to
do so).
This commit makes the secure channel recognize broadcast ARP packets
that originate from the controller and flood them without passing them
back up to the controller.
Ben Pfaff [Wed, 16 Jul 2008 20:22:11 +0000 (13:22 -0700)]
New function eth_addr_is_zero().
Ben Pfaff [Wed, 16 Jul 2008 19:55:18 +0000 (12:55 -0700)]
New function netdev_arp_lookup().
The secchan needs to handle ARP requests from the controller itself, so
it has to translate the controller's IP address into a MAC address to
allow it to match those packets on dl_src. (OpenFlow doesn't allow us
to look into ARP packets and match on the encapsulated IP addresses, so
this is the best we can do.)
Ben Pfaff [Wed, 16 Jul 2008 20:22:30 +0000 (13:22 -0700)]
New function rconn_get_ip().
Ben Pfaff [Wed, 16 Jul 2008 19:51:34 +0000 (12:51 -0700)]
New function vconn_get_ip().
The secchan needs to know the IP address of the peer so that it can
handles ARP requests from the controller by itself.
Ben Pfaff [Thu, 17 Jul 2008 05:51:35 +0000 (22:51 -0700)]
Assert on structure sizes in openflow.h.
This causes the build to fail if structures are not the sizes that we
expect.
Ben Pfaff [Thu, 17 Jul 2008 05:50:39 +0000 (22:50 -0700)]
Adjust OpenFlow to have same structure layout on 32- and 64-bit platforms.
Pointed out by "Brandon Heller" <brandon.heller@gmail.com>.
Ben Pfaff [Wed, 16 Jul 2008 21:38:20 +0000 (14:38 -0700)]
Include date and time in vlog messages.
Ben Pfaff [Thu, 3 Jul 2008 19:06:14 +0000 (12:06 -0700)]
Add "probe" command to dpctl.
Ben Pfaff [Tue, 15 Jul 2008 19:43:59 +0000 (12:43 -0700)]
Prevent switch implementations from complaining about echo-reply messages.
Thanks to Reid Price <reid@nicira.com> for reporting the issue (which
only caused spurious warning messages).
Ben Pfaff [Tue, 8 Jul 2008 18:06:19 +0000 (11:06 -0700)]
Fix typo in comment.
Ben Pfaff [Fri, 23 May 2008 23:23:51 +0000 (16:23 -0700)]
Fix typo in comment.
Ben Pfaff [Tue, 1 Jul 2008 21:17:41 +0000 (14:17 -0700)]
Fix segfault when SSL_connect or SSL_accept reports an error.
Ben Pfaff [Fri, 27 Jun 2008 22:16:30 +0000 (15:16 -0700)]
Announce fail-open mode more aggressively in secchan.
Without this change, the secure channel announces that it is
entering or exiting fail-open mode only when an OpenFlow
message actually arrives from the local datapath. Thus,
when no packets arrive on any switch port, the secchan
never enters fail-open mode. Functionally, this makes no
difference, because there are no packets to switch anyhow
in that case, but it makes the log harder to interpret
since it's unclear whether the controller connection is
actually up.
With this change, the secure channel announcing that it is
entering or exiting fail-open mode is not tied to receiving
a packet on a switch port. Thus, the log is easier to
interpret.
Ben Pfaff [Tue, 1 Jul 2008 18:14:45 +0000 (11:14 -0700)]
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.
Ben Pfaff [Tue, 1 Jul 2008 17:52:34 +0000 (10:52 -0700)]
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).
Ben Pfaff [Tue, 1 Jul 2008 17:50:25 +0000 (10:50 -0700)]
Add "benchmark" command to work like "benchmark-nl" with echo requests.
Suggested by Justin.
Ben Pfaff [Fri, 27 Jun 2008 18:18:40 +0000 (11:18 -0700)]
Add "ping" command to dpctl for testing echo requests.
Also may be useful for latency testing.
Ben Pfaff [Fri, 27 Jun 2008 17:42:31 +0000 (10:42 -0700)]
Respond to echo requests in OpenFlow implementations.
Nothing yet sends such requests. This is preparation for their
use in following commits.
Ben Pfaff [Fri, 27 Jun 2008 17:52:11 +0000 (10:52 -0700)]
Add utility functions for generating random numbers, and use where appropriate.
Ben Pfaff [Fri, 27 Jun 2008 21:16:53 +0000 (14:16 -0700)]
Fix -v, --verbose options to userspace programs.
Now providing an argument to these options works as documented.
Ben Pfaff [Fri, 27 Jun 2008 23:20:27 +0000 (16:20 -0700)]
Fix typo in user message.
Ben Pfaff [Tue, 1 Jul 2008 16:02:59 +0000 (09:02 -0700)]
Fix commit
8bdd107e0 (jiffies linking error) when not running on Red Hat.
From David Erickson <derickso@stanford.edu>.
Justin Pettit [Tue, 1 Jul 2008 06:05:14 +0000 (23:05 -0700)]
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.
Justin Pettit [Mon, 30 Jun 2008 23:00:25 +0000 (16:00 -0700)]
Don't allow adding a flow entry with an output port of OFPP_NONE.
Justin Pettit [Mon, 30 Jun 2008 22:58:44 +0000 (15:58 -0700)]
Don't allow adding a flow entry with an output port of OFPP_NONE.
David Erickson [Mon, 23 Jun 2008 23:22:49 +0000 (16:22 -0700)]
Fixed a linking collision where jiffies have been backported to kernel
2.6.18-53 which is included in CENTOS 5.1.
Ben Pfaff [Thu, 26 Jun 2008 23:21:18 +0000 (16:21 -0700)]
Modified the naming scheme for hardware tables.
Because of historical string munging during the kernel build process
if you named your hardware table hwtable-something, when it was built
the filename would look appropriate, but the actual module info would change
the internal name to be hwtable_something, thus after an insmod with the filename
you could not perform an rmmod with the same filename. As a result
the naming scheme has been changed to hwtable_NAME, NAME being the hardware
the table supports.
Further, include files in the hardware table should be prefixed with the
folder name, e.g. #include "hwtable_NAME/my_header.h".
Based on commits from David Erickson <derickso@stanford.edu>.
Ben Pfaff [Thu, 26 Jun 2008 18:52:36 +0000 (11:52 -0700)]
Don't special-case broadcast packets in in-band mode.
Before, in in-band mode, the secure channel would flood all flows
destined for the broadcast destination when not connected to a
controller. The rationale was that this allowed for ARP replies
to be forwarded to the local port, so that the secure channel
could obtain the Ethernet address of the controller. But this
is a false rationale: ARP replies are unicast to the requester,
not broadcast. (Frames unicast to the local port are always handled
by the secure channel.)
Also, even if it were a correct rationale, it would not help in
at least one case: if the controller's Ethernet address has expired
from the ARP cache, but the secure channel's TCP connection to
the controller is still connected, then the secure channel attempt
to ARP would fail, since the broadcast ARP reply would not be
handled by the secure channel (since the secure channel thought
that it was still connected).
Justin Pettit [Thu, 26 Jun 2008 18:48:31 +0000 (11:48 -0700)]
Fix extraction of flow data from match structure.
This brings the user-space switch in-line with fixes that were previously
made to the kernel one. The main problem was that when wildcards are used
some of the fields that follow should also be wildcarded.
Justin Pettit [Thu, 26 Jun 2008 18:44:30 +0000 (11:44 -0700)]
Fix a couple of problems when modifying VLAN tags.