Commit Graph
667 Commits
Author SHA1 Message Date
Ben Pfaff 6ed1440acc vconn: Use vconn_stream to factor out code from vconn_tcp. 2008-07-30 15:45:04 -07:00
Ben Pfaff 85a2e91f5f vconn: Introduce infrastructure for stream socket-based vconns. 2008-07-30 15:44:22 -07:00
Ben Pfaff b803dfadd1 vconn: Allow vconns to delegate to underlying implementations. 2008-07-30 15:43:57 -07:00
Ben Pfaff 22b8fc08fb Fix typo in comment. 2008-07-30 15:43:10 -07:00
Natasha Gude cef6834a20 IP_ARGS takes address of nw_addr 2008-07-30 14:41:47 -07:00
Justin Pettit 0a3d4ba3a4 Don't allow the learning switch to send packets back out the incoming port.
The learning switch functionality included in OpenFlow will send packets
out the port they arrived on if the learned destination is from that port.
This causes problems when newer switches flood packets for destinations they
don't know and OpenFlow reinjects packets back into the network.  The correct
behavior is to just drop the packet.
2008-07-30 00:22:52 -07:00
Ben Pfaff 5147d00489 rconn: Reconnect reliably when underlying vconn reports error.
When a vconn reports an error, the rconn would not reliably reconnect.
In particular, if the error was reported after the call to rconn_run()
but before rconn_run_wait() was called, then the state's "run" routine
would not set min_timeout properly, leading to a potentially arbitrarily
long wait (depending on what other events were going on in) until the
state's "run" routine was called again.

The fix is to have a separate per-state "timeout" routine to compute
when the state needs to be re-entered.

This commit was tested using the following change to randomly inject
errors:

@@ -554,11 +554,16 @@
 static int
 try_send(struct rconn *rc)
 {
     int retval = 0;
     struct buffer *next = rc->txq.head->next;
-    retval = vconn_send(rc->vconn, rc->txq.head);
+    if (!random_range(1000)) {
+        fprintf(stderr, "injecting ECONNRESET\n");
+        retval = ECONNRESET;
+    } else {
+        retval = vconn_send(rc->vconn, rc->txq.head);
+    }
     if (retval) {
         if (retval != EAGAIN) {
             disconnect(rc, retval);
         }
         return retval;
2008-07-28 17:31:18 -07:00
Justin Pettit 15c94784de Export the "dp_mutex" symbol, since it's needed by the hardware tables. 2008-07-28 16:08:37 -07:00
Ben Pfaff 94f903ab6b Drop unnecessary conditional and incorrect comment.
'controller_relay' is always non-null (but in an earlier revision of
the code that was never pushed to the repository, this was not the case.)
2008-07-28 15:07:24 -07:00
Ben Pfaff f873bed057 Be slightly pickier about going into fail-open mode.
Before, the amount of time disconnected was measured relative to the
last time we connected, that is, the last time connect(2) succeeded.
Thus, if we were connected for a long time, and then disconnected,
we would immediately go into fail-open mode.

This change make the disconnected time relative to the last OpenFlow
message received.  Thus, if we are connected for a long time and
receive plenty of packets, and then disconnect, there will still be
an opportunity to reconnect before failing open.
2008-07-28 07:08:38 -07:00
Ben Pfaff f12a593617 Avert GCC false-positive warning. 2008-07-28 10:11:58 -07:00
Ben Pfaff be25fa83e8 Merge branch 'locking' 2008-07-24 16:07:32 -07:00
Ben Pfaff fcb73d77bf Don't invoke Debconf from openflow-switch postinst.
This was in there because at one time it seemed desirable to configure
from the postinst, but that idea was abandoned.  Now Debconf seems to
be screwing something up somehow, so we might as well not run it at all,
since it wasn't doing anything useful.
2008-07-23 17:21:58 -07:00
Ben Pfaff 50acf79953 vlog: Reduce syslog level of VLL_EMER messages to LOG_ALERT.
The LOG_EMERG log level sprayed these messages across every xterm and
console in the system, which was excessive.
2008-07-23 17:04:24 -07:00
Ben Pfaff 42c89afbde vlog: Send multi-line log messages to syslog() one line at a time.
syslogd swallows new-lines, which makes multi-line messages otherwise
difficult to read.
2008-07-23 17:04:21 -07:00
Ben Pfaff 17778ffd72 Verify OpenFlow version number in vconn_recv(). 2008-07-23 17:04:15 -07:00
Ben Pfaff 9eb21b5b43 Fix kdist_clean target in debian/rules.
This fixes "module-assistant auto-install openflow-datapath" for
bootstrapping from a clean environment.  (Use "m-a -f purge
openflow-datapath" to test that it works starting from an un-clean
environment.)
2008-07-23 16:42:05 -07:00
Ben Pfaff 635f9e6299 Update Debconf templates PO file. 2008-07-23 14:57:22 -07:00
Ben Pfaff 228617736a Don't log messages to the console by default in Debian package. 2008-07-23 14:55:04 -07:00
Ben Pfaff 28318b5fdf Be less picky about precise name of process in init script.
The previous version always printed ERROR because for whatever reason
we were comparing "/usr/sbin/secchan" against "secchan", which of
course failed.
2008-07-23 14:55:04 -07:00
Ben Pfaff d72616d544 Only generate private key and certificate request if ssl enabled.
Generating them unconditionally caused a problem with the init script:
the script required there to be a certificate for the private key if
the private key existed, but we do want to allow TCP-only configurations
and always having a private key prevented that.

Also, give the user advice on how to deal with this problem when it
arises in the init script.
2008-07-23 14:55:04 -07:00
Ben Pfaff 5fed6531b9 Enable secchan, ofp-discover to update /etc/resolv.conf.
This way it becomes possible to more reliably refer to the controller
and the PKI server using hostnames.
2008-07-23 14:30:59 -07:00
Ben Pfaff df3a28bf74 Support controller discovery in Debian packages. 2008-07-23 13:12:23 -07:00
Ben Pfaff a1255475a4 New utility ofp-kill.
Needed for controller discovery in upcoming revision of ofp-switch-setup.
2008-07-23 13:12:23 -07:00
Ben Pfaff a412f49bb0 New function make_pidfile_name().
The upcoming ofp-kill utility wants to use this.
2008-07-23 13:12:23 -07:00
Ben Pfaff 7fbf6abfb0 secchan: Improve logging when rejecting a controller vconn. 2008-07-23 13:12:23 -07:00
Ben Pfaff dae8a4a83c Lock pidfiles with fcntl and create them atomically.
This makes it possible to verify that the program that created the
pidfile is still running.
2008-07-23 13:12:23 -07:00
Ben Pfaff 32c18a40af New program ofp-discover. 2008-07-23 13:12:21 -07:00
Ben Pfaff 85a31d495b 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.
2008-07-23 13:12:17 -07:00
Ben Pfaff 4ffdbd5993 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.
2008-07-23 13:12:17 -07:00
Ben Pfaff 3c82b240bf dhcp: Fix race condition in test-dhcp-client.
dhclient_wait() might also access dhcp state.
2008-07-23 13:12:17 -07:00
Ben Pfaff fcecfa88a9 dhcp: Only print "entering" message if state actually changes. 2008-07-23 13:12:17 -07:00
Ben Pfaff 6fd1cf6b87 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.
2008-07-23 13:12:17 -07:00
Ben Pfaff aa1daeffa5 dhcp: Make output of dhcp_option_to_string() more uniform, to ease parsing.
(The ofp-switch-setup program will want to parse its output.)
2008-07-23 13:12:14 -07:00
Ben Pfaff 9c6191bf82 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.
2008-07-22 14:01:10 -07:00
Ben Pfaff 489d9ca0be 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.
2008-07-22 14:01:01 -07:00
Ben Pfaff b761e41bb2 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.
2008-07-22 14:00:03 -07:00
Ben Pfaff 8f1f1132e5 Make set_pidfile() easier to use. 2008-07-22 13:56:26 -07:00
Ben Pfaff 685ac1fe5a dpctl: Get rid of effectively unused variable. 2008-07-22 13:56:26 -07:00
Ben Pfaff 61df6c4639 Don't include unneeded header file. 2008-07-21 16:30:53 -07:00
Ben Pfaff 88b554881b 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.
2008-07-21 15:45:35 -07:00
Ben Pfaff 4d7977d636 Don't unnecessarily link against -lresolv and -ldl.
Eliminates warnings given by dpkg-shlibdeps when building Debian
packages.
2008-07-21 15:45:35 -07:00
Ben Pfaff 42c25524bf Distribute new rculist.h headers. 2008-07-21 15:41:38 -07:00
Ben Pfaff f730dded18 Move Autoconf's macro definitions into config.h.
This makes "make" output slightly more readable.
2008-07-21 15:05:53 -07:00
Ben Pfaff f24230f9d9 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).
2008-07-21 15:05:53 -07:00
Ben Pfaff 5fc6464527 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.
2008-07-21 15:05:53 -07:00
Ben Pfaff 6e1d7e4254 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.
2008-07-21 15:05:53 -07:00
Ben Pfaff 829de2e8b9 Get rid of now-excessive levels of indirection in hwtable_dummy. 2008-07-21 14:06:36 -07:00
Ben Pfaff fbdb49ffdc Verify that sleeping is allowed in chain contexts where Broadcom will need to. 2008-07-21 13:59:55 -07:00
Ben Pfaff f2232335ab Don't need 'deleted' member of struct flow.
Flow deletion is already fully serialized on dp_mutex.
2008-07-21 13:59:55 -07:00