Commit Graph
667 Commits
Author SHA1 Message Date
Ben Pfaff 7d73c8bac5 Don't use atomic_t for tracking table flow counts.
Changes to n_flows is already fully serialized by dp_mutex.
2008-07-21 13:59:54 -07:00
Ben Pfaff 53e16ab6f3 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.
2008-07-21 13:59:54 -07:00
Ben Pfaff d50ae013a2 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.
2008-07-21 13:59:12 -07:00
Ben Pfaff 47b8652dbe 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.
2008-07-21 13:59:10 -07:00
Ben Pfaff 988b8ef729 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.
2008-07-21 13:26:37 -07:00
Ben Pfaff 67a603dde8 Make openflow.h SWIG-friendly. 2008-07-21 11:39:39 -07:00
Ben Pfaff b926a8f5e6 Fix build on Linux 2.6.26.
Linux 2.6.26 requires us to additionally include <linux/rculist.h>
to use RCU lists.
2008-07-19 16:14:18 -07:00
Ben Pfaff 295b175a84 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.
2008-07-18 14:16:40 -07:00
Ben Pfaff d4317804f2 Discovery. 2008-07-18 14:16:40 -07:00
Ben Pfaff 6bbe7b98fd Don't truncate flooded packets at the amount sent up by the switch. 2008-07-18 14:16:40 -07:00
Ben Pfaff 1b6df17a65 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.
2008-07-18 14:16:40 -07:00
Ben Pfaff 6d841e9f81 Implement DHCP client. 2008-07-18 14:16:40 -07:00
Ben Pfaff d838ee2e03 vconn: Make errors in vconn names non-fatal errors.
This prevents bad vconn names obtained via discovery from killing
the secure channel.
2008-07-18 14:16:40 -07:00
Ben Pfaff d07d22508e 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.
2008-07-18 14:16:40 -07:00
Ben Pfaff 2dc0a37b6b vconn: Add assertions to vconn_send() to check consistency of outgoing messages. 2008-07-18 14:16:40 -07:00
Ben Pfaff 1297ff43df vconn: Add new function vconn_transact() and use it to simplify dpctl.c. 2008-07-18 14:16:38 -07:00
Ben Pfaff 4d90ee6aef vconn: Add utility functions make_openflow() and update_openflow_length().
Use these functions to simplify code that creates and sends
OpenFlow packets.
2008-07-18 14:08:18 -07:00
Ben Pfaff ab6f9e079b 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).
2008-07-18 14:07:03 -07:00
Ben Pfaff c57a8d1089 rconn: Add questionability. 2008-07-18 14:07:03 -07:00
Ben Pfaff b8769714c1 rconn: Rewrite to use explicit state machine. 2008-07-18 14:07:03 -07:00
Ben Pfaff 453084ed49 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.
2008-07-18 14:07:03 -07:00
Ben Pfaff b0533159ba 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.
2008-07-18 14:07:03 -07:00
Ben Pfaff 06aa679e95 rconn: Log when a connection attempt starts.
This makes it easier to see what happened by viewing the log.
2008-07-18 14:07:03 -07:00
Ben Pfaff e334e4e0e7 rconn: Add new max_backoff argument to rconn_new().
This allows the caller more control over reconnection backoff.
2008-07-18 14:07:03 -07:00
Ben Pfaff bc286c00ea netdev: add ability to set IPv4 addresses and add a default gateway. 2008-07-18 14:07:03 -07:00
Ben Pfaff 2afec34627 netdev: Add ability to permanently set device flags. 2008-07-18 13:55:12 -07:00
Ben Pfaff 68798b7c18 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).
2008-07-18 13:43:41 -07:00
Ben Pfaff 24eb1d1546 netdev: Add more functions for manipulating device flags.
These are convenient for use in secchan and elsewhere.
2008-07-18 13:43:41 -07:00
Ben Pfaff 9dc091a35f netdev: New function netdev_drain(). 2008-07-18 13:42:38 -07:00
Ben Pfaff e55d52c988 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.
2008-07-18 13:42:38 -07:00
Ben Pfaff b563a5247c netdev: Do not modify the caller's buffer in netdev_send().
This makes it possible to use a buffer whose contents are stack-allocated.
2008-07-18 13:42:38 -07:00
Ben Pfaff f422511c1a 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.
2008-07-18 13:42:38 -07:00
Ben Pfaff cc57cfe85c packets: New macros for detecting IP fragments. 2008-07-18 13:42:38 -07:00
Ben Pfaff 7470a21307 packets: Move IP checksum functionality into new csum.c, csum.h. 2008-07-18 13:42:38 -07:00
Ben Pfaff 841ae14767 packets: Distinguish max Ethernet length with and without VLAN header. 2008-07-18 13:42:37 -07:00
Ben Pfaff 6231bb85af packets: New IP header macros. 2008-07-18 13:42:37 -07:00
Ben Pfaff 49d9301d46 packets: Make Ethernet broadcast address available as a global object. 2008-07-18 13:42:37 -07:00
Ben Pfaff 0ad4720dc6 buffer: New functions buffer_reserve(), buffer_push(),
buffer_try_pull().
2008-07-18 13:42:37 -07:00
Ben Pfaff 86ad61454e 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.
2008-07-18 13:42:37 -07:00
Ben Pfaff d6ea83302a buffer: Make buffer_pull() return the start of the pulled data.
Some callers find this useful.
2008-07-18 13:42:37 -07:00
Ben Pfaff 47cebfdbef New function xmemdup0(). 2008-07-18 13:42:37 -07:00
Ben Pfaff f10a48ce3a New function ds_clear(). 2008-07-18 13:42:37 -07:00
Ben Pfaff 61e2e15051 New function random_range(). 2008-07-18 13:42:37 -07:00
Ben Pfaff 1e0f761030 New header file timeval.h for time-related functionality. 2008-07-18 13:42:37 -07:00
Ben Pfaff fd90251602 New header file "type-props.h" for testing properties of types. 2008-07-18 13:42:37 -07:00
Ben Pfaff 21185e5db1 Set skb->dev before calling netif_rx().
Fixes null pointer dereference reported by David Erickson
<derickso@stanford.edu>.
2008-07-18 13:42:37 -07:00
Ben Pfaff 86ffdbea9f Fix "make dist". 2008-07-18 13:42:37 -07:00
Ben Pfaff 97d6fcbd4d 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.
2008-07-18 13:24:16 -07:00
Ben Pfaff 792576de01 Log an error when the time is negative at vlog startup. 2008-07-18 13:24:16 -07:00
Ben Pfaff 2bc1162f6f 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.
2008-07-18 13:24:16 -07:00