sliver-openvswitch.git
15 years agoProperly track table match counts.
Justin Pettit [Wed, 6 Aug 2008 08:58:15 +0000 (01:58 -0700)]
Properly track table match counts.

15 years agoFix typo in comment.
Ben Pfaff [Mon, 4 Aug 2008 22:30:19 +0000 (15:30 -0700)]
Fix typo in comment.

15 years agoMark functions not used in other source files static.
Ben Pfaff [Mon, 4 Aug 2008 21:47:27 +0000 (14:47 -0700)]
Mark functions not used in other source files static.

15 years agoMake it easier for the compiler to optimize IP_IS_FRAGMENT.
Ben Pfaff [Mon, 4 Aug 2008 21:21:34 +0000 (14:21 -0700)]
Make it easier for the compiler to optimize IP_IS_FRAGMENT.

15 years agoFix bug in flow_extract() for extracting VLAN from short packet.
Ben Pfaff [Mon, 4 Aug 2008 21:20:26 +0000 (14:20 -0700)]
Fix bug in flow_extract() for extracting VLAN from short packet.

15 years agoDon't accept incomplete TCP headers when extracting flows in kernel.
Ben Pfaff [Mon, 4 Aug 2008 21:18:24 +0000 (14:18 -0700)]
Don't accept incomplete TCP headers when extracting flows in kernel.

This makes the kernel and the userspace implementations of flow
extraction behave the same way regarding headers.

15 years agoDon't try to extract UDP/TCP port numbers from IP fragments.
Ben Pfaff [Mon, 4 Aug 2008 21:45:59 +0000 (14:45 -0700)]
Don't try to extract UDP/TCP port numbers from IP fragments.

15 years agoFix typo in comment.
Ben Pfaff [Mon, 4 Aug 2008 21:18:36 +0000 (14:18 -0700)]
Fix typo in comment.

15 years agodhcp: Make client signal a change if renewing yields different options.
Ben Pfaff [Wed, 30 Jul 2008 22:39:03 +0000 (15:39 -0700)]
dhcp: Make client signal a change if renewing yields different options.

This allows the secchan to connect to a new controller if the DHCP server
starts announcing a new vconn without invalidating old leases.

15 years agodhcp: Make dhcp_option_to_string() act sensibly with null or empty options.
Ben Pfaff [Wed, 30 Jul 2008 22:45:50 +0000 (15:45 -0700)]
dhcp: Make dhcp_option_to_string() act sensibly with null or empty options.

Also, update ofp-switch-setup to parse the new syntax.

15 years agodhcp: New function dhcp_option_equals().
Ben Pfaff [Wed, 30 Jul 2008 22:45:38 +0000 (15:45 -0700)]
dhcp: New function dhcp_option_equals().

15 years agoClean up secchan code.
Ben Pfaff [Wed, 30 Jul 2008 22:00:01 +0000 (15:00 -0700)]
Clean up secchan code.

15 years agonetdev: Let netdev_get_in4(), netdev_get_in6() take null pointer argument.
Ben Pfaff [Wed, 30 Jul 2008 22:45:33 +0000 (15:45 -0700)]
netdev: Let netdev_get_in4(), netdev_get_in6() take null pointer argument.

Some callers want to just test whether the device has an address assigned
and don't care about the particular address, so this simplifies those
callers slightly.

15 years agoDebian: Listen on Unix domain socket for management connections.
Ben Pfaff [Wed, 30 Jul 2008 22:46:36 +0000 (15:46 -0700)]
Debian: Listen on Unix domain socket for management connections.

15 years agovconn: Implement Unix domain socket vconn.
Ben Pfaff [Wed, 30 Jul 2008 22:45:21 +0000 (15:45 -0700)]
vconn: Implement Unix domain socket vconn.

These are useful for local management connections because, unlike TCP
sockets, they are subject to regular file system permissions.

15 years agoMove unix socket helper functions into socket-util.
Ben Pfaff [Tue, 29 Jul 2008 21:38:00 +0000 (14:38 -0700)]
Move unix socket helper functions into socket-util.

This makes them available for use by the upcoming vconn_unix.

15 years agovconn: Use vconn_stream to factor out code from vconn_tcp.
Ben Pfaff [Wed, 30 Jul 2008 22:45:04 +0000 (15:45 -0700)]
vconn: Use vconn_stream to factor out code from vconn_tcp.

15 years agovconn: Introduce infrastructure for stream socket-based vconns.
Ben Pfaff [Wed, 30 Jul 2008 22:44:22 +0000 (15:44 -0700)]
vconn: Introduce infrastructure for stream socket-based vconns.

15 years agovconn: Allow vconns to delegate to underlying implementations.
Ben Pfaff [Wed, 30 Jul 2008 22:43:57 +0000 (15:43 -0700)]
vconn: Allow vconns to delegate to underlying implementations.

15 years agoFix typo in comment.
Ben Pfaff [Tue, 29 Jul 2008 22:03:22 +0000 (15:03 -0700)]
Fix typo in comment.

15 years agoIP_ARGS takes address of nw_addr
Natasha Gude [Wed, 30 Jul 2008 21:41:47 +0000 (14:41 -0700)]
IP_ARGS takes address of nw_addr

15 years agoDon't allow the learning switch to send packets back out the incoming port.
Justin Pettit [Wed, 30 Jul 2008 06:43:58 +0000 (23:43 -0700)]
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.

15 years agorconn: Reconnect reliably when underlying vconn reports error.
Ben Pfaff [Tue, 29 Jul 2008 00:29:26 +0000 (17:29 -0700)]
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;

15 years agoExport the "dp_mutex" symbol, since it's needed by the hardware tables.
Justin Pettit [Mon, 28 Jul 2008 23:08:37 +0000 (16:08 -0700)]
Export the "dp_mutex" symbol, since it's needed by the hardware tables.

15 years agoDrop unnecessary conditional and incorrect comment.
Ben Pfaff [Mon, 28 Jul 2008 22:07:24 +0000 (15:07 -0700)]
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.)

15 years agoBe slightly pickier about going into fail-open mode.
Ben Pfaff [Mon, 28 Jul 2008 14:08:38 +0000 (07:08 -0700)]
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.

15 years agoAvert GCC false-positive warning.
Ben Pfaff [Mon, 28 Jul 2008 17:11:51 +0000 (10:11 -0700)]
Avert GCC false-positive warning.

15 years agoMerge branch 'locking'
Ben Pfaff [Thu, 24 Jul 2008 23:07:32 +0000 (16:07 -0700)]
Merge branch 'locking'

15 years agoDon't invoke Debconf from openflow-switch postinst.
Ben Pfaff [Thu, 24 Jul 2008 00:21:58 +0000 (17:21 -0700)]
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.

15 years agovlog: Reduce syslog level of VLL_EMER messages to LOG_ALERT.
Ben Pfaff [Thu, 24 Jul 2008 00:04:05 +0000 (17:04 -0700)]
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.

15 years agovlog: Send multi-line log messages to syslog() one line at a time.
Ben Pfaff [Thu, 24 Jul 2008 00:04:21 +0000 (17:04 -0700)]
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.

15 years agoVerify OpenFlow version number in vconn_recv().
Ben Pfaff [Thu, 24 Jul 2008 00:03:03 +0000 (17:03 -0700)]
Verify OpenFlow version number in vconn_recv().

15 years agoFix kdist_clean target in debian/rules.
Ben Pfaff [Wed, 23 Jul 2008 23:42:05 +0000 (16:42 -0700)]
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.)

15 years agoUpdate Debconf templates PO file.
Ben Pfaff [Wed, 23 Jul 2008 21:57:22 +0000 (14:57 -0700)]
Update Debconf templates PO file.

15 years agoDon't log messages to the console by default in Debian package.
Ben Pfaff [Wed, 23 Jul 2008 21:47:37 +0000 (14:47 -0700)]
Don't log messages to the console by default in Debian package.

15 years agoBe less picky about precise name of process in init script.
Ben Pfaff [Wed, 23 Jul 2008 21:54:19 +0000 (14:54 -0700)]
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.

15 years agoOnly generate private key and certificate request if ssl enabled.
Ben Pfaff [Wed, 23 Jul 2008 21:53:06 +0000 (14:53 -0700)]
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.

15 years agoEnable secchan, ofp-discover to update /etc/resolv.conf.
Ben Pfaff [Wed, 23 Jul 2008 21:30:59 +0000 (14:30 -0700)]
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.

15 years agoSupport controller discovery in Debian packages.
Ben Pfaff [Wed, 23 Jul 2008 20:11:00 +0000 (13:11 -0700)]
Support controller discovery in Debian packages.

15 years agoNew utility ofp-kill.
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.

15 years agoNew function make_pidfile_name().
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.

15 years agosecchan: Improve logging when rejecting a controller vconn.
Ben Pfaff [Wed, 23 Jul 2008 20:07:40 +0000 (13:07 -0700)]
secchan: Improve logging when rejecting a controller vconn.

15 years agoLock pidfiles with fcntl and create them atomically.
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.

15 years agoNew program ofp-discover.
Ben Pfaff [Tue, 22 Jul 2008 21:44:10 +0000 (14:44 -0700)]
New program ofp-discover.

15 years agoAdd SIGALRM to blockable fatal signals.
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.

15 years agodhcp: Always build test-dhcp-client.
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.

15 years agodhcp: Fix race condition in test-dhcp-client.
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.

15 years agodhcp: Only print "entering" message if state actually changes.
Ben Pfaff [Tue, 22 Jul 2008 20:32:42 +0000 (13:32 -0700)]
dhcp: Only print "entering" message if state actually changes.

15 years agodhcp: Don't attempt to drain netdev if we ran out of packets.
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.

15 years agodhcp: Make output of dhcp_option_to_string() more uniform, to ease parsing.
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.)

15 years agodhcp: Make dhcp_msg_to_string() support a multiline format also.
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.

15 years agodhcp: Break out netdev configuration from DHCP binding.
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.

15 years agodhcp: Be more precise about updating 'changed' flag.
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.

15 years agoMake set_pidfile() easier to use.
Ben Pfaff [Tue, 22 Jul 2008 20:53:20 +0000 (13:53 -0700)]
Make set_pidfile() easier to use.

15 years agodpctl: Get rid of effectively unused variable.
Ben Pfaff [Tue, 22 Jul 2008 20:33:02 +0000 (13:33 -0700)]
dpctl: Get rid of effectively unused variable.

15 years agoDon't include unneeded header file.
Ben Pfaff [Mon, 21 Jul 2008 23:30:53 +0000 (16:30 -0700)]
Don't include unneeded header file.

15 years agoDo the Debian package build in a _debian subdirectory.
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.

15 years agoDon't unnecessarily link against -lresolv and -ldl.
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.

15 years agoDistribute new rculist.h headers.
Ben Pfaff [Mon, 21 Jul 2008 22:41:38 +0000 (15:41 -0700)]
Distribute new rculist.h headers.

15 years agoMove Autoconf's macro definitions into config.h.
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.

15 years agoDrop use of libtool for libraries.
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).

15 years agoDon't explicitly link against libdl.
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.

15 years agoOnly link programs that need it against OpenSSL.
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.

15 years agoGet rid of now-excessive levels of indirection in hwtable_dummy.
Ben Pfaff [Mon, 21 Jul 2008 21:06:36 +0000 (14:06 -0700)]
Get rid of now-excessive levels of indirection in hwtable_dummy.

15 years agoVerify that sleeping is allowed in chain contexts where Broadcom will need to.
Ben Pfaff [Mon, 21 Jul 2008 20:39:26 +0000 (13:39 -0700)]
Verify that sleeping is allowed in chain contexts where Broadcom will need to.

15 years agoDon't need 'deleted' member of struct flow.
Ben Pfaff [Mon, 21 Jul 2008 20:51:54 +0000 (13:51 -0700)]
Don't need 'deleted' member of struct flow.

Flow deletion is already fully serialized on dp_mutex.

15 years agoDon't use atomic_t for tracking table flow counts.
Ben Pfaff [Mon, 21 Jul 2008 20:51:02 +0000 (13:51 -0700)]
Don't use atomic_t for tracking table flow counts.

Changes to n_flows is already fully serialized by dp_mutex.

15 years agoGet rid of unnecessary synchronization in tables.
Ben Pfaff [Mon, 21 Jul 2008 20:54:01 +0000 (13:54 -0700)]
Get rid of unnecessary synchronization in tables.

The table insert and delete functions are already fully serialized
on dp_mutex (and genl_mutex), so there's no need for them to use
additional spinlocks.

15 years agoProperly synchronize dp_dev destruction.
Ben Pfaff [Mon, 21 Jul 2008 18:22:28 +0000 (11:22 -0700)]
Properly synchronize dp_dev destruction.

Before, we didn't really synchronize this at all.  Now, when we want
to destroy the ofX device, we stop the transmit path and wait for
in-progress transmissions to finish.

15 years agoSimplify use of dp_mutex.
Ben Pfaff [Mon, 21 Jul 2008 20:59:10 +0000 (13:59 -0700)]
Simplify use of dp_mutex.

There was little point in taking the dp_mutex farther down in the
code than dp_genl_openflow, since that function is already completely
serialized by genl_rcv across the genl_mutex.  We could get rid of
dp_mutex completely, except that we still need it to serialize timeout.

15 years agoGet rid of useless use of rcu_read_lock.
Ben Pfaff [Mon, 21 Jul 2008 20:26:37 +0000 (13:26 -0700)]
Get rid of useless use of rcu_read_lock.

These code paths are fully protected by the Generic Netlink genl_mutex,
which is taken by genl_rcv() that calls dp_genl_openflow(), so there is
no need for them to take the rcu_read_lock.

15 years agoMake openflow.h SWIG-friendly.
Ben Pfaff [Mon, 21 Jul 2008 18:39:39 +0000 (11:39 -0700)]
Make openflow.h SWIG-friendly.

15 years agoFix build on Linux 2.6.26.
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.

15 years agoUse an IP ID of 0 for transmitted DHCP packets.
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.

15 years agoDiscovery.
Ben Pfaff [Tue, 15 Jul 2008 18:20:05 +0000 (11:20 -0700)]
Discovery.

15 years agoDon't truncate flooded packets at the amount sent up by the switch.
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.

15 years agoMake facility and level optional in -v, --verbose options.
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.

15 years agoImplement DHCP client.
Ben Pfaff [Tue, 8 Jul 2008 00:18:34 +0000 (17:18 -0700)]
Implement DHCP client.

15 years agovconn: Make errors in vconn names non-fatal errors.
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.

15 years agovconn: New function vconn_ssl_is_configured().
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.

15 years agovconn: Add assertions to vconn_send() to check consistency of outgoing messages.
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.

15 years agovconn: Add new function vconn_transact() and use it to simplify dpctl.c.
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.

15 years agovconn: Add utility functions make_openflow() and update_openflow_length().
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.

15 years agoAdd new --max-backoff option to secchan and switch programs.
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).

15 years agorconn: Add questionability.
Ben Pfaff [Mon, 14 Jul 2008 20:32:13 +0000 (13:32 -0700)]
rconn: Add questionability.

15 years agorconn: Rewrite to use explicit state machine.
Ben Pfaff [Mon, 14 Jul 2008 20:43:17 +0000 (13:43 -0700)]
rconn: Rewrite to use explicit state machine.

15 years agorconn: Push detection of send errors into try_send().
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.

15 years agorconn: Time out connection attempts when the backoff deadline passes.
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.

15 years agorconn: Log when a connection attempt starts.
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.

15 years agorconn: Add new max_backoff argument to rconn_new().
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.

15 years agonetdev: add ability to set IPv4 addresses and add a default gateway.
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.

15 years agonetdev: Add ability to permanently set device flags.
Ben Pfaff [Fri, 18 Jul 2008 20:55:12 +0000 (13:55 -0700)]
netdev: Add ability to permanently set device flags.

15 years agonetdev: Use SOCK_RAW instead of SOCK_PACKET.
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).

15 years agonetdev: Add more functions for manipulating device flags.
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.

15 years agonetdev: New function netdev_drain().
Ben Pfaff [Mon, 14 Jul 2008 20:03:27 +0000 (13:03 -0700)]
netdev: New function netdev_drain().

15 years agonetdev: Add argument to netdev_open() to specify Ethernet type to capture.
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.

15 years agonetdev: Do not modify the caller's buffer in netdev_send().
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.

15 years agopackets: Make flow_extract() output a pointer to L7 data also.
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.

15 years agopackets: New macros for detecting IP fragments.
Ben Pfaff [Mon, 14 Jul 2008 20:54:45 +0000 (13:54 -0700)]
packets: New macros for detecting IP fragments.

15 years agopackets: Move IP checksum functionality into new csum.c, csum.h.
Ben Pfaff [Mon, 14 Jul 2008 20:54:38 +0000 (13:54 -0700)]
packets: Move IP checksum functionality into new csum.c, csum.h.