Commit Graph
290 Commits
Author SHA1 Message Date
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 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 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 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 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 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 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 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 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 7470a21307 packets: Move IP checksum functionality into new csum.c, csum.h. 2008-07-18 13:42:38 -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 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
Ben Pfaff a92ae5b340 New function netdev_arp_lookup().
The secchan needs to handle ARP requests from the controller itself, so
it has to translate the controller's IP address into a MAC address to
allow it to match those packets on dl_src.  (OpenFlow doesn't allow us
to look into ARP packets and match on the encapsulated IP addresses, so
this is the best we can do.)
2008-07-18 13:23:23 -07:00
Ben Pfaff 4532f9cdfb New function rconn_get_ip(). 2008-07-18 13:23:23 -07:00
Ben Pfaff 809743618e New function vconn_get_ip().
The secchan needs to know the IP address of the peer so that it can
handles ARP requests from the controller by itself.
2008-07-18 13:23:23 -07:00
Ben Pfaff 21bcd54543 Include date and time in vlog messages. 2008-07-16 15:31:38 -07:00
Ben Pfaff d6ef9d8ade Fix typo in comment. 2008-07-03 14:11:03 -07:00