openvswitch
16 years agoMake -P or --pidfile keep programs from running if already running.
Ben Pfaff [Thu, 28 Aug 2008 20:17:16 +0000 (13:17 -0700)]
Make -P or --pidfile keep programs from running if already running.

16 years agoFix test for fcntl return value.
Ben Pfaff [Thu, 28 Aug 2008 20:15:32 +0000 (13:15 -0700)]
Fix test for fcntl return value.

POSIX only says that -1 is an error; other return values have unspecified
meanings.

16 years agoMake OpenFlow kernel module print protocol version.
Ben Pfaff [Thu, 24 Jul 2008 00:38:42 +0000 (17:38 -0700)]
Make OpenFlow kernel module print protocol version.

16 years agoAllow multiple -l or --listen options on secchan command line.
Ben Pfaff [Wed, 27 Aug 2008 18:50:11 +0000 (11:50 -0700)]
Allow multiple -l or --listen options on secchan command line.

Bug #149.

16 years agovlog: Apply rate-limiting everywhere it seems warranted.
Ben Pfaff [Tue, 19 Aug 2008 22:18:51 +0000 (15:18 -0700)]
vlog: Apply rate-limiting everywhere it seems warranted.

16 years agovlog: Implement rate-limiting.
Ben Pfaff [Tue, 19 Aug 2008 22:16:57 +0000 (15:16 -0700)]
vlog: Implement rate-limiting.

16 years agovlog: Simplify vlog() by using dynamic-string functions.
Ben Pfaff [Tue, 19 Aug 2008 20:58:59 +0000 (13:58 -0700)]
vlog: Simplify vlog() by using dynamic-string functions.

16 years agoNew functions ds_put_strftime(), ds_chomp().
Ben Pfaff [Tue, 19 Aug 2008 20:57:55 +0000 (13:57 -0700)]
New functions ds_put_strftime(), ds_chomp().

16 years agoNew header for saturating arithmetic.
Ben Pfaff [Tue, 19 Aug 2008 20:57:17 +0000 (13:57 -0700)]
New header for saturating arithmetic.

16 years agoEliminate dpctl dependency on /sbin/ifconfig.
Ben Pfaff [Tue, 19 Aug 2008 20:56:28 +0000 (13:56 -0700)]
Eliminate dpctl dependency on /sbin/ifconfig.

16 years agoAllow multiple ports on dpctl addif and delif commands, for convenience.
Ben Pfaff [Tue, 19 Aug 2008 20:47:17 +0000 (13:47 -0700)]
Allow multiple ports on dpctl addif and delif commands, for convenience.

16 years agoImplement new OpenFlow "switch statistics" feature.
Ben Pfaff [Tue, 26 Aug 2008 18:53:51 +0000 (11:53 -0700)]
Implement new OpenFlow "switch statistics" feature.

This should be useful for reporting the status of a switch on its
front-panel display (for those switches that have one) or in the
controller UI.

16 years agorconn: Add functions for reporting connection statistics.
Ben Pfaff [Tue, 19 Aug 2008 18:17:58 +0000 (11:17 -0700)]
rconn: Add functions for reporting connection statistics.

16 years agoAdd functions for reporting dhcp client statistics.
Ben Pfaff [Tue, 19 Aug 2008 18:17:26 +0000 (11:17 -0700)]
Add functions for reporting dhcp client statistics.

16 years agoChange netdev_get_in4() to re-check the IP address on each call.
Ben Pfaff [Tue, 19 Aug 2008 18:14:52 +0000 (11:14 -0700)]
Change netdev_get_in4() to re-check the IP address on each call.

As part of implementing switch stats, secchan wants to report the
IP address currently configured on an interface.  Caching it for
all time defeats that purpose.

16 years agoNew functions ds_truncate(), ds_last().
Ben Pfaff [Tue, 19 Aug 2008 18:12:59 +0000 (11:12 -0700)]
New functions ds_truncate(), ds_last().

16 years agoNew function ds_put_printable().
Ben Pfaff [Tue, 19 Aug 2008 18:12:45 +0000 (11:12 -0700)]
New function ds_put_printable().

Use the function in dhcp_option_to_string().

16 years agoFix a couple of typos.
Justin Pettit [Fri, 22 Aug 2008 20:21:58 +0000 (13:21 -0700)]
Fix a couple of typos.

16 years agoSend PORT_STATUS messages on port and link changes. Add ability to remotely enable...
Justin Pettit [Fri, 22 Aug 2008 19:47:54 +0000 (12:47 -0700)]
Send PORT_STATUS messages on port and link changes.  Add ability to remotely enable and disable a port through the PORT_MOD message.

16 years agorconn: Fix bug #100, "Inactivity time-out slow under heavy load."
Ben Pfaff [Fri, 22 Aug 2008 17:34:15 +0000 (10:34 -0700)]
rconn: Fix bug #100, "Inactivity time-out slow under heavy load."

The timeout() function returns a duration relative to the time at which the
current state was entered, but rconn_run_wait() was treating it as the
waiting time remaining.

16 years agoUn-learn the port on which a MAC is located after some time.
Ben Pfaff [Mon, 18 Aug 2008 22:01:35 +0000 (15:01 -0700)]
Un-learn the port on which a MAC is located after some time.

Otherwise, we can send frames the wrong port indefinitely, if the device
in question does not itself initiate sending data.

16 years agoRemove unnecessary AC_PROG_LD since OpenFlow no longer uses libtool.
Justin Pettit [Thu, 21 Aug 2008 23:16:33 +0000 (16:16 -0700)]
Remove unnecessary AC_PROG_LD since OpenFlow no longer uses libtool.

16 years agoInitialize the table structures to zero.
Justin Pettit [Wed, 20 Aug 2008 00:06:10 +0000 (17:06 -0700)]
Initialize the table structures to zero.

16 years agoCleanup git-status by not showing some unnecessary files.
Justin Pettit [Tue, 19 Aug 2008 06:48:58 +0000 (23:48 -0700)]
Cleanup git-status by not showing some unnecessary files.

16 years agoFix problem where packets never matched in hash table and flows always added regardle...
Justin Pettit [Tue, 19 Aug 2008 05:23:03 +0000 (22:23 -0700)]
Fix problem where packets never matched in hash table and flows always added regardless of whether they currently exist.

16 years agoLink to the normal OpenFlow lib directory, not this hidden one.
Justin Pettit [Tue, 19 Aug 2008 05:13:36 +0000 (22:13 -0700)]
Link to the normal OpenFlow lib directory, not this hidden one.

16 years agoDon't compare wildcards, nw_src_mask, nw_dst_mask fields in hash table.
Ben Pfaff [Fri, 8 Aug 2008 23:09:15 +0000 (16:09 -0700)]
Don't compare wildcards, nw_src_mask, nw_dst_mask fields in hash table.

They should always compare equal, so there's no point in wasting the
time.

16 years agoAllow and use shorthands such as "ip" or "tcp" for specifying flows.
Ben Pfaff [Fri, 8 Aug 2008 21:03:37 +0000 (14:03 -0700)]
Allow and use shorthands such as "ip" or "tcp" for specifying flows.

16 years agoMake ofp_packet_in() print the flow corresponding to the buffer also.
Ben Pfaff [Fri, 8 Aug 2008 21:05:09 +0000 (14:05 -0700)]
Make ofp_packet_in() print the flow corresponding to the buffer also.

16 years agoImplement subnet mask matching in OpenFlow.
Ben Pfaff [Thu, 7 Aug 2008 05:00:29 +0000 (22:00 -0700)]
Implement subnet mask matching in OpenFlow.

16 years agoUse ETH_ALEN in place of hard-coded 6 in datapath/flow.h.
Ben Pfaff [Mon, 18 Aug 2008 21:20:21 +0000 (14:20 -0700)]
Use ETH_ALEN in place of hard-coded 6 in datapath/flow.h.

16 years agoFix typo in comment.
Ben Pfaff [Wed, 6 Aug 2008 21:12:22 +0000 (14:12 -0700)]
Fix typo in comment.

16 years agoFix dump-flows to be usable by add-flows.
Justin Pettit [Mon, 18 Aug 2008 06:17:07 +0000 (23:17 -0700)]
Fix dump-flows to be usable by add-flows.

Some of the fields when printing a flow are hex, but they don't have a
preceeding "0x".  When one tries to import them, they're treated as decimal
and weird results occur.  Bug 27.

16 years agoUse a consistent naming convention for counts.
Justin Pettit [Mon, 18 Aug 2008 06:15:21 +0000 (23:15 -0700)]
Use a consistent naming convention for counts.

16 years agoAdd stats message that allows querying description of components in OpenFlow.
Justin Pettit [Sat, 16 Aug 2008 16:43:05 +0000 (09:43 -0700)]
Add stats message that allows querying description of components in OpenFlow.

16 years agoAdded new interface statistics.
Justin Pettit [Fri, 15 Aug 2008 06:12:37 +0000 (23:12 -0700)]
Added new interface statistics.

16 years agoMake hwtable_dummy compile again.
Ben Pfaff [Thu, 14 Aug 2008 23:22:00 +0000 (16:22 -0700)]
Make hwtable_dummy compile again.

Bug #109.

16 years agoFix vlogconf EINTR error returns.
Ben Pfaff [Thu, 14 Aug 2008 23:18:46 +0000 (16:18 -0700)]
Fix vlogconf EINTR error returns.

Bug #111.

16 years agoUse OpenFlow OUI for Ethernet address of local ports.
Ben Pfaff [Thu, 14 Aug 2008 23:10:59 +0000 (16:10 -0700)]
Use OpenFlow OUI for Ethernet address of local ports.

16 years agoUse proper byte order for dl_type of 802.2, non-SNAP frames.
Ben Pfaff [Thu, 14 Aug 2008 18:05:50 +0000 (11:05 -0700)]
Use proper byte order for dl_type of 802.2, non-SNAP frames.

16 years agoSwitch to new packet-out format and add OFPP_IN_PORT.
Justin Pettit [Thu, 14 Aug 2008 07:02:14 +0000 (00:02 -0700)]
Switch to new packet-out format and add OFPP_IN_PORT.

The original packet-out format allowed multiple actions to be specified for
buffered packets, but only a destination port for messages including data.
This change makes packet-out more consistent by allowing multiple actions
regardless of how the packet is stored.

This change also disallows sending packets through the incoming port without
explicitly using the OFPP_IN_PORT virtual port.

16 years agoPrint OpenFlow ref. impl. and protocol versions at secchan startup time.
Ben Pfaff [Wed, 13 Aug 2008 21:37:36 +0000 (14:37 -0700)]
Print OpenFlow ref. impl. and protocol versions at secchan startup time.

Bug #83.

16 years agoDescribe how to build and use Debian packages in INSTALL.
Ben Pfaff [Wed, 13 Aug 2008 21:29:33 +0000 (14:29 -0700)]
Describe how to build and use Debian packages in INSTALL.

16 years agoAdd missing prerequisite to debian/control.
Ben Pfaff [Wed, 13 Aug 2008 21:29:18 +0000 (14:29 -0700)]
Add missing prerequisite to debian/control.

16 years agorconn: Wake up immediately if we drain the send queue.
Ben Pfaff [Wed, 13 Aug 2008 18:30:31 +0000 (11:30 -0700)]
rconn: Wake up immediately if we drain the send queue.

It is possible that some task is waiting for space to open up in the
send queue, so we need to give it a chance to run.

16 years agorconn: Use rconn_send() to send echo requests.
Ben Pfaff [Wed, 13 Aug 2008 18:26:26 +0000 (11:26 -0700)]
rconn: Use rconn_send() to send echo requests.

There's no point in sending echo requests by hand.

16 years agorconn: Queue packets for tx only if connected.
Ben Pfaff [Wed, 13 Aug 2008 18:21:49 +0000 (11:21 -0700)]
rconn: Queue packets for tx only if connected.

Until now, the rconn code would queue up packets not just while connected
but also while connecting.  This is not just unnecessary, however, it
actually causes a problem in secchan: if the secchan receives packets
from nl:0 and tries to transmit them, then they will quickly fill up
the rconn's transmit buffer (it uses a 1-packet buffer), which causes
secchan to stop reading packets from nl:0 until the buffer frees up.
That cannot happen until the connection completes.  With in-band control,
however, the connection cannot complete until we receive and process
packet_in messages in our in-band hook.  Thus, we have a deadlock.

Fixes bug #90, "Sometimes secchan has to go into fail-open mode to connect."

16 years agoPrevent the secchan from dying due to SIGPIPE.
Ben Pfaff [Tue, 12 Aug 2008 23:21:45 +0000 (16:21 -0700)]
Prevent the secchan from dying due to SIGPIPE.

Fix for bug #88.

16 years agoReduce default burst limit to rate limit / 4.
Ben Pfaff [Tue, 12 Aug 2008 23:15:42 +0000 (16:15 -0700)]
Reduce default burst limit to rate limit / 4.

With the previous default burst limit of rate limit * 2, we would queue
up 2 seconds worth of packet_in messages.  This is not only much more
than actually needed, it causes an actual problem: the datapath only
retains buffered packets for up to 1 second, by default, so that flow
setups sent in response have no packet to work with.

16 years agoMake discovery happen faster.
Ben Pfaff [Tue, 12 Aug 2008 23:09:31 +0000 (16:09 -0700)]
Make discovery happen faster.

This reduces the initial delay before sending DHCPDISCOVER from
1...10 seconds to 1...3 seconds.

16 years agoImplement rate limiting in secchan.
Ben Pfaff [Tue, 12 Aug 2008 22:34:47 +0000 (15:34 -0700)]
Implement rate limiting in secchan.

16 years agoDrop rconn's responsibility for limiting the tx queue.
Ben Pfaff [Mon, 11 Aug 2008 23:24:24 +0000 (16:24 -0700)]
Drop rconn's responsibility for limiting the tx queue.

Now it helps clients track the number of in-flight messages, but lets the
clients do the limiting themselves.  This will come in handy for packet-in
rate limiting (in an upcoming commit), in which we want to track in-flight
packet-in messages separately from other in-flight messages.

16 years agoUse signal-based timekeeping functions throughout the source base.
Ben Pfaff [Mon, 11 Aug 2008 20:44:29 +0000 (13:44 -0700)]
Use signal-based timekeeping functions throughout the source base.

16 years agoInitialize the timetracking module in each userspace program.
Ben Pfaff [Tue, 12 Aug 2008 20:13:16 +0000 (13:13 -0700)]
Initialize the timetracking module in each userspace program.

Also, use time_alarm() instead of the POSIX alarm() function, because
alarm() interferes with time_alarm().

16 years agoImplement signal-driven time tracking.
Ben Pfaff [Tue, 12 Aug 2008 21:41:48 +0000 (14:41 -0700)]
Implement signal-driven time tracking.

Checking the current time only when a periodic timer expires allows us
to reduce the number of system calls to obtain the current time to 10 per
second (from an arbitrary number) plus one per poll loop.

This fixes poll_block() to properly handle being interrupted.
Otherwise, a timeout longer than the interval between signals will never
complete (because it will restart from the beginning after every
signal).

16 years agoMake fatal-signal more willing to share signals with other handlers.
Ben Pfaff [Tue, 12 Aug 2008 21:24:10 +0000 (14:24 -0700)]
Make fatal-signal more willing to share signals with other handlers.

16 years agoSet up flow to drop packets that come in on their output port.
Ben Pfaff [Fri, 8 Aug 2008 22:39:20 +0000 (15:39 -0700)]
Set up flow to drop packets that come in on their output port.

Commit 0a3d4ba3a, "Don't allow the learning switch to send packets back
out the incoming port," drops packets that come in on their incoming port,
but it does not set up a flow to drop those packets.  If we are connected
to a hub, then this can be very expensive, since we can continue to get
many packets in that flow and have to drop them in secchan one by one.  So
now we set up a flow to drop them for us.

16 years agoFix handling of IP but non-TCP, non-UDP packets in kernel flow_extract().
Ben Pfaff [Fri, 8 Aug 2008 18:43:41 +0000 (11:43 -0700)]
Fix handling of IP but non-TCP, non-UDP packets in kernel flow_extract().

In particular, ICMP was broken.

16 years agoMake vconn_open() consistently set *vconnp to NULL on failure.
Ben Pfaff [Thu, 7 Aug 2008 22:37:44 +0000 (15:37 -0700)]
Make vconn_open() consistently set *vconnp to NULL on failure.

Fixes issue #80.

16 years agoImplement OpenFlow hard timeouts.
Ben Pfaff [Thu, 7 Aug 2008 22:19:31 +0000 (15:19 -0700)]
Implement OpenFlow hard timeouts.

This updates the OpenFlow protocol version and changes the names of
structure members, so any software that uses OpenFlow will need to be
updated to match.

16 years agoFix formatting of flow matches in ofp-print:
Ben Pfaff [Wed, 6 Aug 2008 18:39:51 +0000 (11:39 -0700)]
Fix formatting of flow matches in ofp-print:

Print a comma after wildcard matches as well as exact matches.

16 years agoFix uninitialized struct member in userspace table-linear.
Ben Pfaff [Wed, 6 Aug 2008 18:40:14 +0000 (11:40 -0700)]
Fix uninitialized struct member in userspace table-linear.

16 years agoFix bug in clearing unsupported switch flags.
Ben Pfaff [Thu, 7 Aug 2008 20:19:09 +0000 (13:19 -0700)]
Fix bug in clearing unsupported switch flags.

We need to keep the flags we support, not drop them.

16 years agoDon't call kfree_skb() with interrupts disabled.
Ben Pfaff [Thu, 7 Aug 2008 18:46:22 +0000 (11:46 -0700)]
Don't call kfree_skb() with interrupts disabled.

Freeing an skb that has a destructor may require interrupts to be enabled.
This can happen when netfilter is performing NAT, for example.

Discovered by Murphy McCauley.

16 years agoDon't allow unsupported flags to be set in the switch.
Ben Pfaff [Tue, 5 Aug 2008 20:51:29 +0000 (13:51 -0700)]
Don't allow unsupported flags to be set in the switch.

16 years agoImplement OFPC_FRAG_DROP fragment handling policy.
Ben Pfaff [Mon, 4 Aug 2008 22:34:26 +0000 (15:34 -0700)]
Implement OFPC_FRAG_DROP fragment handling policy.

16 years agoReduce redundancy in datapath code.
Ben Pfaff [Tue, 5 Aug 2008 20:58:12 +0000 (13:58 -0700)]
Reduce redundancy in datapath code.

16 years agoMaintain userspace switch configuration in host byte order.
Ben Pfaff [Tue, 5 Aug 2008 21:13:54 +0000 (14:13 -0700)]
Maintain userspace switch configuration in host byte order.

This makes it easier to work with and makes the code more like the
kernel switch.

16 years agoFix memory leak when OFPP_TABLE is used for a packet that matches no flow.
Ben Pfaff [Tue, 5 Aug 2008 21:35:26 +0000 (14:35 -0700)]
Fix memory leak when OFPP_TABLE is used for a packet that matches no flow.

16 years agoDrop controller-bound traffic that arrives on the controller's port.
Ben Pfaff [Tue, 5 Aug 2008 20:05:56 +0000 (13:05 -0700)]
Drop controller-bound traffic that arrives on the controller's port.

Before, if a hub connected a number of OpenFlow switches and the controller,
then in-band control traffic from one of the OpenFlow switches would be
seen by each of the other switches and forwarded up to the controller as
an ofp_packet_in message.  That message would then be seen by all of the
other OpenFlow switches and also forwarded, and so on in an infinite loop.

This change prevents this situation by keeping secchan from forwarding
ofp_packet_in messages for a packet destined to the controller that
arrives on the port where the controller is located.

This code has at least two weaknesses.  First, if the controller's port
changes, then the flows set up to drop packets will not be deleted.  This
should not be a major problem: if this inadvertently kills a switch's
connection to the controller, then the switch will realize it after it
stops receiving data and re-connect.  Its new connection will have new
flow data and therefore its packets will not be dropped.

Second, the notion of the "controller's port" does not take into account
the possibility of loops in the network topology.  We need spanning tree
protocol for that.

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

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

16 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.

16 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.

16 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.

16 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.

16 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.

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

16 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.

16 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.

16 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().

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

16 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.

16 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.

16 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.

16 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.

16 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.

16 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.

16 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.

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

16 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

16 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.

16 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;

16 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.

16 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.)

16 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.

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

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

16 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.

16 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.