Commit Graph

415 Commits

Author SHA1 Message Date
Ben Pfaff deba43acea Use OpenFlow OUI for Ethernet address of local ports. 2008-08-14 16:10:59 -07:00
Ben Pfaff 3b0470d419 Use proper byte order for dl_type of 802.2, non-SNAP frames. 2008-08-14 11:06:18 -07:00
Justin Pettit 0226bbc742 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.
2008-08-14 00:07:18 -07:00
Ben Pfaff 8a83c00302 Print OpenFlow ref. impl. and protocol versions at secchan startup time.
Bug #83.
2008-08-13 14:37:36 -07:00
Ben Pfaff 91c3455d0d Describe how to build and use Debian packages in INSTALL. 2008-08-13 14:29:33 -07:00
Ben Pfaff 5990f0423c Add missing prerequisite to debian/control. 2008-08-13 14:29:18 -07:00
Ben Pfaff 9bff3b7f01 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.
2008-08-13 11:30:31 -07:00
Ben Pfaff b749bdfaf5 rconn: Use rconn_send() to send echo requests.
There's no point in sending echo requests by hand.
2008-08-13 11:26:26 -07:00
Ben Pfaff cd3ac840dd 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."
2008-08-13 11:21:49 -07:00
Ben Pfaff 69abd4346d Prevent the secchan from dying due to SIGPIPE.
Fix for bug #88.
2008-08-12 16:21:45 -07:00
Ben Pfaff c9b82cb59c 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.
2008-08-12 16:15:42 -07:00
Ben Pfaff 72984bb5e9 Make discovery happen faster.
This reduces the initial delay before sending DHCPDISCOVER from
1...10 seconds to 1...3 seconds.
2008-08-12 16:10:01 -07:00
Ben Pfaff 142f33e898 Implement rate limiting in secchan. 2008-08-12 15:34:47 -07:00
Ben Pfaff 903d0940fb 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.
2008-08-12 15:21:30 -07:00
Ben Pfaff b3b28afb7b Use signal-based timekeeping functions throughout the source base. 2008-08-12 15:21:30 -07:00
Ben Pfaff 3f683b32c8 Initialize the timetracking module in each userspace program.
Also, use time_alarm() instead of the POSIX alarm() function, because
alarm() interferes with time_alarm().
2008-08-12 15:21:30 -07:00
Ben Pfaff a837a38209 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).
2008-08-12 15:21:30 -07:00
Ben Pfaff b67da66b07 Make fatal-signal more willing to share signals with other handlers. 2008-08-12 14:24:22 -07:00
Ben Pfaff 57fb2fe378 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.
2008-08-08 15:39:20 -07:00
Ben Pfaff 483624de9a Fix handling of IP but non-TCP, non-UDP packets in kernel flow_extract().
In particular, ICMP was broken.
2008-08-08 11:43:41 -07:00
Ben Pfaff 37dc29f930 Make vconn_open() consistently set *vconnp to NULL on failure.
Fixes issue #80.
2008-08-07 15:37:44 -07:00
Ben Pfaff 7bee00fad9 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.
2008-08-07 15:19:31 -07:00
Ben Pfaff 1c6aac2d04 Fix formatting of flow matches in ofp-print:
Print a comma after wildcard matches as well as exact matches.
2008-08-07 13:29:10 -07:00
Ben Pfaff 874bb0cbc1 Fix uninitialized struct member in userspace table-linear. 2008-08-07 13:29:10 -07:00
Ben Pfaff 7462f2e8bd Fix bug in clearing unsupported switch flags.
We need to keep the flags we support, not drop them.
2008-08-07 13:29:10 -07:00
Ben Pfaff 5a31afdd0c 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.
2008-08-07 11:46:22 -07:00
Ben Pfaff 8effb451eb Don't allow unsupported flags to be set in the switch. 2008-08-07 10:34:37 -07:00
Ben Pfaff eca2aeb329 Implement OFPC_FRAG_DROP fragment handling policy. 2008-08-07 10:34:37 -07:00
Ben Pfaff 2a6dc4f319 Reduce redundancy in datapath code. 2008-08-07 10:34:37 -07:00
Ben Pfaff 844a4678aa Maintain userspace switch configuration in host byte order.
This makes it easier to work with and makes the code more like the
kernel switch.
2008-08-07 10:23:06 -07:00
Ben Pfaff 6ca5840e48 Fix memory leak when OFPP_TABLE is used for a packet that matches no flow. 2008-08-07 10:23:06 -07:00
Ben Pfaff d7f1e2b535 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.
2008-08-07 10:10:11 -07:00
Justin Pettit 5caaf64f20 Properly track table match counts. 2008-08-06 01:58:15 -07:00
Ben Pfaff ca477c1000 Fix typo in comment. 2008-08-05 10:50:09 -07:00
Ben Pfaff 4c4238cacf Mark functions not used in other source files static. 2008-08-04 14:47:27 -07:00
Ben Pfaff bf13819340 Make it easier for the compiler to optimize IP_IS_FRAGMENT. 2008-08-04 14:46:01 -07:00
Ben Pfaff 35aa1a919a Fix bug in flow_extract() for extracting VLAN from short packet. 2008-08-04 14:46:01 -07:00
Ben Pfaff ef7e8993ff 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.
2008-08-04 14:46:01 -07:00
Ben Pfaff b0a11b7a5a Don't try to extract UDP/TCP port numbers from IP fragments. 2008-08-04 14:45:59 -07:00
Ben Pfaff 0b8dc43d6d Fix typo in comment. 2008-08-04 14:45:17 -07:00
Ben Pfaff 7b30178058 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.
2008-07-30 15:46:38 -07:00
Ben Pfaff 245f96aebc dhcp: Make dhcp_option_to_string() act sensibly with null or empty options.
Also, update ofp-switch-setup to parse the new syntax.
2008-07-30 15:46:38 -07:00
Ben Pfaff aa26396ed5 dhcp: New function dhcp_option_equals(). 2008-07-30 15:46:38 -07:00
Ben Pfaff e3eaf2b79c Clean up secchan code. 2008-07-30 15:46:38 -07:00
Ben Pfaff 2d4b692ecd 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.
2008-07-30 15:46:38 -07:00
Ben Pfaff bb55cf014a Debian: Listen on Unix domain socket for management connections. 2008-07-30 15:46:36 -07:00
Ben Pfaff bab6bdbe58 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.
2008-07-30 15:45:21 -07:00
Ben Pfaff 5680957f84 Move unix socket helper functions into socket-util.
This makes them available for use by the upcoming vconn_unix.
2008-07-30 15:45:05 -07:00
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