Justin Pettit [Tue, 30 Dec 2008 06:53:08 +0000 (22:53 -0800)]
First cut at bridge compatibility for vswitchd.
This set of changes allows the bridge ioctls to be used for adding and
removing datapaths and interfaces. To enable, one must insmod the
new "brcompat_mod.ko" kernel module. Then, vswitchd is run with the
"--brcompat" flag. See the man page for vswitchd for more details.
Ben Pfaff [Mon, 29 Dec 2008 22:29:26 +0000 (14:29 -0800)]
vswitchd: Fix svec_diff().
The logic bugs here were causing bridge.c to do too much work adding and
deleting interfaces unnecessarily and perhaps in some circumstances getting
the set of interfaces wrong entirely.
Ben Pfaff [Mon, 29 Dec 2008 21:26:19 +0000 (13:26 -0800)]
Make ds_cstr() always null-terminate the string.
Most of the time the string in "struct ds" is
null-terminated, but there seem to be a few corner cases
where it is not. Make ds_cstr() always put in the null
terminator, for safety.
Ben Pfaff [Sat, 27 Dec 2008 23:36:49 +0000 (15:36 -0800)]
Factor out common parts of manpages.
There was a lot of duplication in the sources for the
manpages, because many of the programs have common options.
This factors out some of the duplication into include
files, using the man ".so" directive. It also uses the
".ds" directive to define strings that should be
customized for each program's manpage.
Ben Pfaff [Sat, 27 Dec 2008 05:26:46 +0000 (21:26 -0800)]
vswitchd: Actually tag flows that go out bonded devices.
The change that introduced rebalancing for bonded devices
set up the infrastructure for revalidating flows that go
out bonded devices, but neglected to actually tag those
flows. This fixes the problem.
Ben Pfaff [Thu, 18 Dec 2008 22:00:23 +0000 (14:00 -0800)]
Add support for VLAN tags to the MAC learning library.
vswitchd needs to keep separate per-VLAN MAC learning tables, so this adds
a VLAN tag to each MAC learning table entry. The existing users of the
MAC learning table don't care about VLANs, so they always pass in a VLAN
of 0.
There is a very good chance that vswitchd will need additional features in
its MAC learning table that don't fit well into the existing library. In
that case this commit will probably be reverted and a separate MAC learning
implementation added in the vswitch directory.
Ben Pfaff [Wed, 17 Dec 2008 00:57:40 +0000 (16:57 -0800)]
Add new "fd" vconn, which takes a file descriptor number as argument.
This requires introducing the concept of a "reconnectable" vconn. A vconn
is reconnectable if, when it is closed, it is possible to try to reconnect
to it using the name that was originally used. This is the case for all
existing vconn types, but it is not true for fd vconns, because closing a
fd vconn closes the specified file descriptor, and thus attempting to
reopen it will get an EBADF error.
An rconn is not reliable if it is connected to a vconn that is not
reconnectable.
Ben Pfaff [Wed, 17 Dec 2008 00:19:36 +0000 (16:19 -0800)]
Introduce x2nrealloc() helper function, and use it.
Also fixes a bug in read_cert_file() in vconn-ssl.c: "sizeof *certs"
should have been "sizeof **certs". In fact the sizes will be identical
in all practical cases since both *certs and **certs are pointer types,
so this is not an important fix.
Ben Pfaff [Wed, 17 Dec 2008 00:13:36 +0000 (16:13 -0800)]
Make datapath interface library more flexible.
A single netlink socket can address any kernel datapath, but the datapath
interface library was artificially restricting a dpif to address a single
datapath that was selected at dpif creation time. This commit removes
that restriction.
This is useful for vswitchd, which can create and destroy any number of
datapaths and add and remove ports on them. It's more convenient to use
a single dpif for that instead of many.
Ben Pfaff [Wed, 17 Dec 2008 00:10:31 +0000 (16:10 -0800)]
Move DP_MAX into public header file.
vswitchd wants to know the maximum number of datapaths, so DP_MAX needs to
be exported.
(This is not an ideal situation. Really the kernel should not have an
explicit limit on the number of datapaths, and userspace should be able
to query the current maximum.)
Ben Pfaff [Wed, 17 Dec 2008 00:35:56 +0000 (16:35 -0800)]
Improve formatting of process termination messages in secchan logging.
My expectation was that strsignal() returns the signal's name, e.g.
SIGTERM. It actually returns an English explanation, so that the existing
code would log a message like "terminated by signal Terminated". This
commit changes the message to the more sensible "terminated by signal 15
(Terminated)".
Also, the recently approved POSIX 2008 standardized strsignal() and in
particular says that it may return NULL for unknown signal numbers, so
this commit fixes the behavior on NULL return.
Previously the arguments of rate-limited messages were always evaluated
and passed to vlog_rate_limit(). This commit short-circuits the case
where the vlog levels would prevent any messages from being logged even
without considering rate limiting.
Ben Pfaff [Tue, 2 Dec 2008 16:27:31 +0000 (08:27 -0800)]
Update prerequisite Autoconf version to 2.60 (from 2.59).
We use the MKDIR_P variable that only Autoconf 2.60 and
later supports, but we were only requiring Autoconf 2.59
or later. This fixes the problem.
Also, we were not explicitly invoking AC_PROG_MKDIR_P from
configure.ac, even though we were using $(MKDIR_P). Some
other macro must have been internally invoking
AC_PROG_MKDIR_P, but it's not good to depend on that, so
this commit adds an explicit call to it.
Justin Pettit [Mon, 1 Dec 2008 22:34:23 +0000 (14:34 -0800)]
Add support for listing and deleting entries based on an output port.
To support this, an "out_port" field has been added to the "ofp_flow_mod",
"ofp_flow_stats_request", and "ofp_aggregate_stats_request" messages. If an
"out_port" contains a value other than "OFPP_NONE", it introduces a constraint
when matching. This constraint is that the rule must contain an output action
directed at that port. Other constraints such as ofp_match structs and
priorities are still used; this is purely an *additional* constraint. Note
that to get previous behavior, though, "out_port" must be set to "OFPP_NONE",
since "0" is a valid port id. This only applies to the delete and
delete_strict flow mod commands; the field is ignored by add, modify, and
modify_strict.
Ben Pfaff [Thu, 27 Nov 2008 00:25:55 +0000 (16:25 -0800)]
Free txbuf, rxbuf in vconn-ssl and vconn-stream destructors.
This bug was causing secchan to leak a little bit of memory on almost every
connection close. This is most visible when openflow-monitor is running,
because openflow-monitor connects to secchan once per second.
Ben Pfaff [Fri, 21 Nov 2008 21:05:37 +0000 (13:05 -0800)]
Maintain separate async and sync connections to nl:0 in secchan.
When a network link is flooded with traffic, secchan's OpenFlow socket
queue becomes congested with traffic. This leaves no room for replies
to OpenFlow requests relayed to that socket by secchan.
This commit modifies secchan to use separate sockets for asynchronous
traffic and for OpenFlow requests/replies, which should avoid the problem.
Ben Pfaff [Thu, 13 Nov 2008 19:29:20 +0000 (11:29 -0800)]
Fix double-free: NF_HOOK sometimes frees the sk_buff passed in.
NF_HOOK is supposed to *always* consume the sk_buff passed in, either
internally or through the okfn argument. We assumed that it never
consumed its sk_buff, which was OK in the case where it called okfn,
since our okfn (snat_pre_route_finish) never freed its sk_buff, but
not when one of the netfilter hooks dropped or stole the packet, because
then we'd assume that it still existed and free it a second time.
The other users of NF_HOOK in this file, in snat_skb() and
snat_skb_finish(), do not need to be fixed because they always pass a
copy of their sk_buff argument to NF_HOOK and expect it to be freed.
Ben Pfaff [Tue, 11 Nov 2008 02:26:25 +0000 (18:26 -0800)]
Don't oops in dp_output_control() for skbs with null ->dev.
This shouldn't ordinarily happen, since normal packets are received from
a real device, but some packets can be spontaneously generated within
the switch and thus have null ->dev. (Possibly that is itself a bug
that we should track down; not sure.)