2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-23 14:57:06 +00:00
Commit Graph

99 Commits

Author SHA1 Message Date
Ben Pfaff
093e47f487 vswitch: Set datapath_id and ofport in ovsdb.
Now ovs-vswitchd fills in the Interface ofport and Bridge datapath_id
fields when it reconfigures.

The existing Bridge datapath_id and hwaddr columns, which had surprising
meanings, have been banished to a new other_config column.
2009-12-11 17:03:35 -08:00
Ben Pfaff
e073f944f5 vswitchd: Avoid segfault when local port is required but missing.
Connecting to a controller requires the vswitch to have a local port
(typically named the same as the bridge itself).  Before the introduction
of ovsdb ovs-vswitchd simply added the local port itself if it was missing.
This was not properly implemented with the ovsdb transition, and a segfault
resulted.  This commit avoids the segfault, although it should possibly
be improved to also add the local port, as before.

CC: Jeremy Stribling <strib@nicira.com>
2009-12-07 13:34:33 -08:00
Jesse Gross
a740f0de5b gre: Add userspace GRE support.
This implements the userspace portion of GRE on Linux. It communicates
with the kernel module to setup tunnels using either Netlink or ioctls
as appropriate based on the kernel version.

Significant portions of this commit were actually written by
Justin Pettit.
2009-12-07 12:48:08 -08:00
Jesse Gross
e9e2856e08 netflow: Correctly set active timeout value.
This fixes a bug originally introduced in commit 763435 "vswitchd:
Initial conversion to database-based configuration."  The bug
reversed a less than operator when setting the active timeout field.
Also add a warning if the timeout is set to an invalid value.

CC: Glen Gibb <grg@stanford.edu>
2009-12-07 11:10:06 -08:00
Ben Pfaff
fa33d64a57 vswitchd: Avoid segfault when creating a bridge fails.
bridge_create() can return a null pointer if creating the bridge fails, so
check for that and don't dereference it in that case.

Thank to Jeremy Stribling for reporting the problem.
2009-12-03 15:14:56 -08:00
Ben Pfaff
7634353824 vswitchd: Initial conversion to database-based configuration.
This has seen very little testing, so some features are almost certainly
busted.  Port mirroring is not yet converted, so it will definitely not
work.
2009-12-03 11:28:40 -08:00
Ben Pfaff
ba54bf4f65 vswitchd: Remove vestigial spanning tree protocol (STP) support.
ovs-vswitchd has never supported spanning tree protocol, but there was
nevertheless a considerable amount of code that provided a framework for
supporting it.

This commit deletes this code, since we have no plans to introduce STP
support soon.
2009-12-03 10:59:09 -08:00
Ben Pfaff
58fda1dab1 Merge "master" branch into "db". 2009-12-02 11:49:53 -08:00
Ben Pfaff
b36682d8dc vswitchd: Fix build when source and build directory differ. 2009-12-02 11:18:52 -08:00
Justin Pettit
6c88d577e8 netdev: Allow explicit creation of netdev objects
This change adds netdev_create() and netdev_destroy() functions to allow
the creation of network devices through the netdev library.  Previously,
network devices had to already exist or be created on demand through
netdev_open().  This caused problems such as not being able to specify
TAP devices as ports in ovs-vswitchd, which this patch fixes.

This also lays the groundwork for adding GRE and VDE support.
2009-12-01 19:01:01 -08:00
Ben Pfaff
d879a707a3 ovsdb: Add ovsdb IDL compiler to build system.
This first stab at any interface definition language and compiler for OVSDB
will give other developers a chance to look at it and try to integrate it.
The IDL is not actually implemented yet; I am working on that.
2009-11-23 16:07:36 -08:00
Ben Pfaff
efacbce62f dpif: New function dpif_create_and_open().
This function combines what dpif_create() and dpif_open() do.  It allows
us to factor a tiny amount of code out of the vswitch, but more importantly
this function is also useful in the following commit.
2009-11-23 15:58:48 -08:00
Ben Pfaff
d17ee8689b Merge citrix branch into master. 2009-11-18 14:14:29 -08:00
Jesse Gross
f1bd68ab58 bridge: Fix segfault when updating learning table for deleted port.
A function call using in_port was accidentally moved before the check
to see if it is null.  in_port can be null if a port was deleted but
an update is still pending.  This moves the call after the check.

Bug #2313
2009-11-11 17:15:10 -08:00
Jesse Gross
42061b2a5b mirroring: Preserve key for disabling learning.
Don't delete the key for disabling MAC learning on a given VLAN
after a reboot.  Also logs when learning is disabled.
2009-11-11 16:00:05 -08:00
Jesse Gross
e96a4d8035 bridge: Feed flow stats into learning table.
Update the learning table to keep it current with flows actually
going through the datapath.  This ensures that entries do not age
out when they are actively being used.

Feature #2209
2009-11-11 15:58:21 -08:00
Jesse Gross
d65349ea28 Merge citrix branch into master. 2009-11-10 15:12:01 -08:00
Jesse Gross
f2d7fd66cf mirroring: Allow learning to be disabled on a VLAN.
RSPAN does not work properly unless MAC learning for the VLAN is
disabled on all switches between the origin and monitoring point.
This allows learning to be disabled on a given VLAN so vSwitch can
acts as an intermediate switch.

Feature #2136
2009-11-10 13:37:08 -08:00
Jesse Gross
93dfc06772 bridge: Require learning table at all times.
The bridge nominally allowed the MAC learning module to not be enabled
though in reality it was always used.  Tracking active MAC addresses
in the bridge is useful for other reasons besides deciding the output
port - primarily for bonding.  In addition there were several bugs
that would have been triggered had learning actually been disabled since
that code path is never tested.  This makes it explicit that the learning
table should be maintained at all times.
2009-11-09 16:37:01 -08:00
Jesse Gross
8b2a2f4a79 bonding: Ignore updelay if there is no active slave.
If all slaves on a bond are down but some are waiting for an updelay,
enable the slave with the shortest amount of delay remaining.  This
would already occur if all other slaves were disabled at the time the
delay was to begin but not if a delay was already in progress.  This
also immediately sends learning packets out in both situations, which
prevents incoming packets to disabled slaves from being blackholed.

CC: Danny Wannagat <Danny.Wannagat@eu.citrix.com>
2009-11-09 14:32:29 -08:00
Ben Pfaff
2886875a38 Fix incorrect printf format specifiers.
GCC reported these during a 64-bit build.
2009-11-09 10:30:10 -08:00
Ben Pfaff
ec6fde61c8 Add new function xzalloc(n) as a shorthand for xcalloc(1, n). 2009-11-04 14:52:32 -08:00
Jesse Gross
0193b2afce netflow: Implement NetFlow active timeouts.
Provides a NetFlow expiration message at regular intervals if the
key netflow.<br>.active-timeout is set.

Feature #1317
2009-11-03 14:05:17 -08:00
Ben Pfaff
8ca79daaa0 unixctl: Allow passing auxiliary data to unixctl commands.
This will allow users of unixctl to avoid using global variables, leading
to cleaner code.
2009-10-29 15:20:56 -07:00
Jesse Gross
6a07af3678 netflow: Populate NetFlow output interface field.
Previously NetFlow expiration messages always contained 0 as the
output interface index.  This changes that to report the OpenFlow
interface instead.

Feature #1202
2009-10-27 13:19:15 -07:00
Jesse Gross
69d60f9f4e bridge: Allow flows based on ARP opcode to be installed.
Since we can now distinguish between flows with different ARP opcodes
in the kernel, allow these flows to be installed.
2009-10-26 11:32:35 -07:00
Ben Pfaff
3f355f47f8 Merge "citrix" into "master".
This merge took a little bit of care due to two issues:

    - Crossport of "interface-reconfigure" fixes from master back to
      citrix that had happened and needed to be canceled out of the merge.

    - New script "refresh-xs-network-uuids" added on citrix branch that
      needed to be moved from /root/vswitch/scripts to
      /usr/share/vswitch/scripts.
2009-10-22 17:43:28 -07:00
Jesse Gross
2416b8ecea bridge: Eject NORMAL flows without a learning entry from datapath.
When revalidating NORMAL flows we consult the learning table, which
could be empty if a packet hasn't come to userspace in a while or we
just did a bridge flush.  If there is no learning entry then existing
flows will begin flooding packets until a new flow is setup.  The
problem is worse with bonding because we can receive one of the flooded
packets back on a bond slave and learn that port, causing us to send
traffic to the wrong location.
2009-10-22 11:40:04 -07:00
Jesse Gross
5422a9e189 bonding: Balance bond slaves based on ratio.
Previously when deciding whether to migrate a hash between slaves
we would never move it if it would cause more load on the new slave
than the old.  This could lead to a situation where the slaves would
be imbalanced but no migration would occur since it would flip the
load.  This will do the migration if it will decrease the ratio.

Bug NIC-49
2009-10-20 19:26:55 -07:00
Jesse Gross
3a55ef1483 bonding: Drop unicast packets which have a different learned port.
Drop packets received on a bond port if we have learned a different
source port for that MAC.  We were already doing this for multicast
packets but extend the logic to unicast packets as well since the
same situation can occur if the connected switch has not learned the
MAC address and is flooding.  Otherwise vSwitch will learn the bond
port as the source of that MAC.

Bug #2167
2009-10-20 10:52:31 -07:00
Jesse Gross
43aa5f47f1 vlan: Compare vlan tags before implicit tagging when RSPANing.
We check that a packet is not sent out the on the in port on the
same VLAN when performing RSPAN.  However, we were comparing the
vlan tag from a packet after implicit tagging with a tag from
before implicit tagging.  This ensures that we always compare them
before such tagging.
2009-10-09 12:42:31 -07:00
Jesse Gross
97b7b2f410 bonding: Compare ports, not interfaces, for loop checks.
In order to avoid loops we check that the input and output ports
are not equal.  When selecting mirror outputs for RSPAN we were
checking interfaces instead of ports.  This lead to loops when
using RSPAN with bonded ports.

Bug #2118
2009-10-08 13:47:07 -07:00
Justin Pettit
e8b52a913a Merge commit 'origin/citrix' 2009-10-06 11:35:29 -07:00
Ben Pfaff
4d678233e9 Merge "citrix" branch into "master. 2009-10-05 10:29:07 -07:00
Jesse Gross
c6303ea11b bonding: Update the link status on the bond fake interface.
Brings the fake bond interface up and down to match our notion of
whether the bond is currently active.  This solves an issue where
XenCenter would always show the bond as disconnected.

Bug #1703
2009-10-05 10:27:29 -07:00
Ben Pfaff
52df17e745 vswitch: Allow user to set Ethernet address of any internal interface.
Until now the vswitch configuration file has allowed the user to configure
the MAC address on bridge local ports only.  This commit adds the ability
to configure them on any internal interface.

It would be logical to extend this to any bridge port, period, but many
network devices must be brought down before their Ethernet addresses may be
changed.  Bringing a network interface down and then back up can reset a
lot of state, so as we don't actually need the ability to change any bridge
port's MAC address yet this commit does not implement it.

CC: Ian Campbell <Ian.Campbell@citrix.com>
2009-10-02 17:12:31 -07:00
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