2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-29 05:18:13 +00:00

663 Commits

Author SHA1 Message Date
Ben Pfaff
557d8e6cbf vswitch: Factor out detection of internal interfaces into a new function.
The following commit needs to use this same logic, so break it out into
a function to avoid redundancy.
2009-10-02 17:12:31 -07:00
Ben Pfaff
576e26d7b4 Merge citrix branch into master. 2009-09-22 10:17:44 -07:00
Ben Pfaff
c77dc7705b vswitchd: Fix memory leak in bridge_reconfigure().
Bug #1817.
2009-09-21 16:10:44 -07:00
Justin Pettit
6643c03b4f vswitch: More accurately identify slave status for compatibility
Ben Pfaff dug through the kernel sources and reported that
bond_miimon_inspect() supports four BOND_LINK_* states:

       * BOND_LINK_UP: carrier detected, updelay has passed.

       * BOND_LINK_FAIL: carrier lost, downdelay in progress.

       * BOND_LINK_DOWN: carrier lost, downdelay has passed.

       * BOND_LINK_BACK: carrier detected, updelay in progress.

And that bond_info_show_slave() only considers BOND_LINK_UP to be "up"
and anything else to be "down".

Thanks for doing this and suggesting a fix, Ben!
2009-09-17 23:04:08 -07:00
Ben Pfaff
d0c9d304ff vswitchd: Fix unimportant memory leak.
Free dpif_names when we're done with it.

This memory leak is not a big deal since bridge_init() is only ever called
once in a given ovs-vswitchd execution.
2009-09-17 14:46:18 -07:00
Ian Campbell
e0644b6125 vswitchd: implement bond/hash unixctl
Our test case automation has a requirement to know which hash value a
given MAC address hashes to, in order to validate that balancing is
happening as expect etc.. Rather than attempt to reimplement the hash
algorithm used by vswitchd in python instead expose an appctl which
returns this information.
2009-09-17 09:29:53 -07:00
Ben Pfaff
b9e8b45a39 Factor out code for composing benign packets.
The bonding code in vswitch sends out gratuitous learning packets that
are supposed to teach switches but not cause anything else to happen on
the network.  Some upcoming code wants to synthesize packets with similar
properties, so factor this code into a new function so that it can be
used in both places.
2009-09-16 15:12:27 -07:00
Justin Pettit
2e8873af89 vswitch: Correctly identify slave status in /proc compatibility layer
In the /proc compatibility layer, the bond member was reported as up
immediately after link recovery, regardless of the updelay.  I believe
the compatibility code was correct if the check had been done with carrier,
but since 'iface->enabled' already does that calculation, we can use it
directly.

Additinally, when a bond slave was enabled or disabled, the bond
compatibility code was not being told to update its state.  This commit
makes that call.

NIC-39
2009-09-14 09:42:21 -07:00
Justin Pettit
39fb08818b Merge commit 'origin/citrix'
Conflicts:
	vswitchd/ovs-vswitchd.8.in
	vswitchd/ovs-vswitchd.conf.5.in
	xenserver/etc_init.d_vswitch
2009-09-12 00:49:30 -07:00
Ben Pfaff
b1040b1701 vswitchd: Fix typo in comment. 2009-09-08 12:54:24 -07:00
Ben Pfaff
f1acd62b54 Merge citrix branch into master. 2009-09-02 10:14:53 -07:00
Ben Pfaff
e0c27cffbc vswitchd: Mirror nothing, not everything, if mirror ports don't exist.
If all of the ports specified as mirror selection criteria actually do not
exist, then until now the bridge would mirror all incoming packets (on
specified VLAN(s), if any).  This matches the behavior that occurs if no
mirror selection ports were specified at all, and so it makes a certain
amount of logical sense.

But it is far more likely that the user simply misspelled a port name, or
specified the name of a port that does not always exist.  In fact we have
seen this behavior in practice when the controller has not caught up to
the switch's current configuration.  So this commit changes the bridge to
instead disable a mirror if ports are specified and none of those ports
exist.

Bug #1904.
2009-08-26 14:03:39 -07:00
Ben Pfaff
274de4d20f vswitchd: Avoid output port explosion with mirrors that output to VLANs.
compose_dsts() was updating the VLAN of packets sent to VLAN mirrors
before it changed the VLAN value, but of course it's the final VLAN value
that actually matters.

Thanks to Reid for his good work tracking this one down.

Bug #1898.
2009-08-26 14:03:39 -07:00
Ben Pfaff
0babc06fb3 vswitchd: Fix bug in Ethernet address selection for bridge.
This bug was introduced in the merge from the citrix branch in commit
8fef8c71 "Merge citrix into master."

Thanks to Reid for characterizing the problem.

Bug #1907.
2009-08-26 12:51:39 -07:00
Justin Pettit
3c71830aef dpif: Address portability issues in dpif-netdev
There were a number of Linux assumptions in dpif-netdev that were not
necessary.  This commit cleans those up to aid portability.
2009-08-25 14:12:01 -07:00
Ben Pfaff
8fef8c7121 Merge citrix into master.
This was a somewhat difficult merge since there was a fair amount of
superficially divergent development on the two branches, especially in the
datapath.

This has been build-tested against XenServer 5.5.0 and XenServer 5.7.0
build 15122.  It has been booted and connected to XenCenter on 5.5.0.

The merge revealed a couple of outstanding bugs, which will be fixed on
citrix and then merged back into master.
2009-08-19 13:03:46 -07:00
Ben Pfaff
35c979bff4 vswitchd: Support creating fake bond device interfaces.
Citrix QA scripts expect that "brctl show" shows a bond interface for each
bond that is added to a bridge.  The only way to do that without modifying
brctl itself is to create an actual network device by that name, so this
commit adds a new bonding configuration key that causes an internal
device by the name of the bond to be created.

This feature is also necessary, but not sufficient, to allow XenCenter to
accurately show the link status and statistics of bridges (bug #1363).

This new configuration key is intentionally undocumented, because I don't
want anyone to use it.

Bug NIC-19.
2009-08-07 15:11:42 -07:00
Justin Pettit
d2a345699f dpif: Only clear 'all_dps' argument in dp_enumerate().
Originally, the function dp_enumerate() initialized the 'all_dps'
argument.  This is inconsistent with most other functions that take an
svec argument, which would only clear the contents.  Further, if someone
were not careful when reusing the svec, it could lead to memory leaks.
With this change, the caller is expected to first call svec_init() on
the argument.
2009-08-07 11:16:06 -07:00
Ben Pfaff
ba09980aaf vswitchd: Fix use of uninitialized variable in bridge_pick_local_hw_addr().
When a port's MAC is explicitly specified in the config file, we did not
initialize 'iface' and therefore later we could dereference a wild pointer.
This commit fixes the problem.
2009-08-06 16:57:06 -07:00
Ben Pfaff
8cc013b20f vswitchd: Fix logged warnings for new internal ports.
Justin reported that adding an internal port to a bridge caused
ovs-vswitchd to log a pair of warnings.  This commit suppresses those
warnings, which were harmless.
2009-08-06 10:33:26 -07:00
Ben Pfaff
b2f17b151d netdev: Make netdev_get_vlan_vid() take a netdev instead of a name.
For consistency, it's best if every netdev function takes a netdev instead
of a device name.  The netdev_nodev_*() functions have always been a bit
ugly.
2009-07-30 16:07:14 -07:00
Ben Pfaff
07c318f404 vswitchd: Avoid netdev_nodev_*() functions.
The netdev_nodev_*() functions have always been a bit of a kluge.  It's
better to keep a network device open than to open it every time that it is
needed.  This commit converts all of the users of these functions to use
the corresponding functions that take a "struct netdev *" instead.
2009-07-30 16:07:14 -07:00
Ben Pfaff
795fe1fba0 vswitchd: Avoid netdev_nodev_set_policing().
The netdev_nodev_*() functions have always been a bit of a kluge.  It's
better to keep a network device open than to open it every time that it is
needed.
2009-07-30 16:07:14 -07:00
Ben Pfaff
96b9b7a9ef vswitchd: Don't keep track of mac in struct iface.
It's easy to get the Ethernet address of the interface from the netdev
code, and so we don't have to keep track of it in the bridge too.
2009-07-30 16:07:14 -07:00
Ben Pfaff
0c6aea3f9b vswitchd: Keep a netdev open for each interface.
This will allow the vswitch to use the netdev functions that take a
netdev parameter instead of the ones that take a device name.
2009-07-30 16:07:14 -07:00
Ben Pfaff
6ae39834ad vswitchd: Factor out iteration over interfaces with deletion.
Two different pieces of code in vswitchd were both iterating over all
the interfaces in a bridge and deleting some of them, then deleting any
ports that ended up with no interfaces because of this.  This commit
factors this operation out into a helper function.
2009-07-30 16:07:14 -07:00
Ben Pfaff
0efaf4b50c netdev: Add 'netdev' parameter to netdev_add_router().
When there is the possibility of multiple classes of netdevs,
netdev_add_router() needs to know which of these to use, so it needs a
"struct netdev *" parameter.
2009-07-30 16:07:14 -07:00
Ben Pfaff
85c74638ed vswitchd: Update /proc/net/bonding when bonded port properties change.
Until now ovs-vswitchd has created the files in /proc/net/bonding, but not
updated them, because there was little need.  But the Citrix QA tests check
that the list of bond hashes in that file is kept up-to-date, so we need
to update them whenever the bond hashes (or other data in the file) change.
This commit does that.

Bug NIC-16.
2009-07-30 09:31:01 -07:00
Ben Pfaff
2aebae8397 vswitchd: Add bond hashes to /proc/net/bonding compatibility layer.
The Citrix QA scripts require the bond hashes and their assigned devices
to be noted in /proc/net/bonding.  We weren't doing that, so this commit
adds them.

Bug NIC-16.
2009-07-30 09:31:01 -07:00
Justin Pettit
4f2cad2c3b vswitchd: Add unixctl command to dump all flows, including hidden ones
Previously, the only way to query the flow table was to run "ovs-ofctl
dump-flows".  This returned most flows, but not those marked hidden by
secchan.  Hidden flows are setup by mechanisms such as in-band control,
since they must not be modified by users of the controller.  However,
when debugging problems on the switch, it is often useful to see what
the flow table is actually doing.  The new "bridge/dump-flows" command
added to ovs-appctl shows all flows being used by the OpenFlow stack.
2009-07-29 17:04:18 -07:00
Ben Pfaff
f9fb1858ef Reduce default probe interval to 5 seconds (and fail-open timeout to 15).
Before now, the default probe interval (the idle time after which an echo
request is sent on an OpenFlow connection) was set to 15 seconds.  The
fail-open timeout is 3 times the probe interval, so this meant that it
took 45 seconds for a switch to fail open.

Users at Nicira have commented that this is too long.  They don't like the
idea that the network will be down for most of a minute before it begins to
recover.  So this commit changes the default probe interval to 5 seconds,
hence the fail-open timeout to 15 seconds.
2009-07-29 11:31:07 -07:00
Ben Pfaff
c9aaa87707 Reduce default maximum connection timeout from 15 seconds to 8 seconds.
Users at Nicira have commented that a maximum reconnection time of 15
seconds, which was the default, is too long.  This commit cuts it to 8
seconds, on the theory that an administrator is willing to wait that long
before deciding that a change that should restore connectivity did not
work.
2009-07-29 11:29:18 -07:00
Ben Pfaff
58b7527ecb xenserver: Honor the MAC address specified in xapi database for bonds.
The xapi database for PIFs specifies the MAC address that should be used
for bonds, but interface-reconfigure didn't honor it and ovs-vswitchd
didn't have a way to configure it anyhow.  This commit fixes both problems.

Bug #1645.
2009-07-29 11:20:43 -07:00
Justin Pettit
a5e54d9b6f Merge commit 'origin/citrix'
Conflicts:

	configure.ac
2009-07-28 22:16:50 -07:00
Ben Pfaff
092bebdc04 vswitchd: Make "fdb/show" output more meaningful port numbers.
The "fdb/show" unixctl command was showing vswitch-internal port indexes,
which cannot be meaningfully interpreted by software outside vswitchd.
Also, they potentially change every time the vswitchd configuration file
changes.  This commit changes it to use a datapath port index instead,
which are both more meaningful and more stable.
2009-07-16 15:15:02 -07:00
Ben Pfaff
3b01baa397 Merge citrix branch into master. 2009-07-16 11:54:37 -07:00
Ben Pfaff
8c4c1387fd vswitchd: New unixctl command "fdb/show" to print the MAC learing table.
To implement "brctl showmacs" for bridge compatibility, brcompatd needs to
be able to extract the MAC learning table from ovs-vswitchd.  This provides
a way, and it may be directly useful to switch administrators also.
2009-07-16 09:17:06 -07:00
Ben Pfaff
eaa7133434 Add macros for parsing MAC addresses from strings. 2009-07-16 09:17:06 -07:00
Ben Pfaff
25ce84b23b vswitchd: Skip updelay on slave when only a single bond slave is up.
If a network device takes a few seconds to detect carrier, as some do, then
when bringing up a network device and then immediately adding that device
to a bridge, the bond code would start out with that slave considered down
and apply the full updelay to it before bringing it up.  With the 31-second
updelay set by XenServer, this is excessive: we end up having no
connectivity at all for 31 seconds even though there is no reason for it.

This commit makes the bond code disregard the updelay when an interface
comes up on a bond that has no enabled interfaces, and updates the
documentation to match.

Part of bug #1566.
2009-07-14 17:04:40 -07:00
Ben Pfaff
17ea75b2a2 vswitchd: Fix log messages when bond slaves are enabled or disabled.
We were printg "enabled" when a slave was disabled and vice versa.

Part of bug #1566.
2009-07-14 17:04:40 -07:00
Ben Pfaff
8cd4882fd5 Rename "secchan" to "ofproto" (library) and "ovs-openflowd" (program).
These names are more meaningful, so we prefer them.
2009-07-08 10:30:42 -07:00
Justin Pettit
fef94d151c vswitchd: Add missing argument to check for update-resolv.conf config 2009-07-06 22:12:53 -07:00
Ben Pfaff
de2047c512 vswitch: Don't pass null pointer to stat().
If no CA certificate is defined then cacert_file is null.  The kernel
kindly tolerates this but we should not do it anyhow.

Found with valgrind.
2009-07-06 16:35:04 -07:00
Ben Pfaff
d3d22744a7 vswitch: Avoid knowledge of details specific to Linux datapaths.
At startup, the vswitch needs to delete datapaths that are not configured
by the administrator.  Until now this was done by knowing the possible
names of Linux datapaths.  This commit cleans up by allowing each
datapath class to enumerate its existing datapaths and their names.
2009-07-06 11:06:36 -07:00
Ben Pfaff
632d136c7b vswitch: Remove restriction on datapath names.
Commit f4b96c92c "vswitch: Disallow bridges named "dpN" or "nl:N"" disabled
naming bridges "dpN" because the vswitchd code made the bad assumption that
the bridge's local port has the same name as the bridge, which was not
true (at the time) for bridges named dpN.  Now that assumption has been
eliminated, so this commit eliminates the restriction too.

This change is also a cleanup in that it eliminates one form of the
vswitch's dependence on specifics of the dpif implementation.
2009-07-06 10:17:54 -07:00
Ben Pfaff
72865317a4 New implementation of userspace datapath, based on the netdev library. 2009-07-06 09:55:06 -07:00
Ben Pfaff
9ee3ae3e0d datapath: Make the datapath responsible for choosing port numbers.
Soon we will allow for multiple datapath implementations.  By allowing
the datapath to choose the port numbers, we possibly simplify some datapath
implementations, and the datapath's clients don't have to guess (or to
check) what port numbers are free, so this seems like a better way to go.
2009-07-06 09:07:24 -07:00
Ben Pfaff
f7ef6533d8 dpif: Remove obsolete support for datapaths whose names begin with "nl:".
The use of "nl:" as a prefix for datapath names has been deprecated for
months.  That should be long enough for users to update their scripts.
2009-07-06 09:07:24 -07:00
Ben Pfaff
c228a3649a dpif: Hide the contents of struct dpif.
This helps prepare for multiple dpif implementations, and ensures that
code outside dpif.c does not depend on its internals.
2009-07-06 09:07:23 -07:00
Ben Pfaff
b29ba12809 dpif: Replace dpif_id() by dpif_name().
dpif_id() is often used in error messages, e.g. "dp%u: screwed up".  But
soon we will be generalizing the concept of a datapath, so it is better
to have a function that returns a full name, e.g. "%s: screwed up".
Accordingly, this commit replaces dpif_id() by a new function dpif_name()
that does so.
2009-07-06 09:07:23 -07:00