The new GRE implementation provides a complete drop in replacement
for the old Linux based implementation. Therefore, remove the
old implementation and rename "grenew" to "gre".
Allow netdev providers to set get_ifindex and get_features it
null if they would always return EOPNOTSUPP. This is particuarly
useful for virtual devices.
When receiving a change notification from rtnetlink we checked whether
a netdev of that name existed and if so tried to handle it. This also
checks that the type of the device is one handled by netdev-linux.
Add netdev_is_open(), which checks to see if a given netdev is
currently open. It will be used to assist in cleaning up old ports
that are no longer in use.
This commit introduces a new netdev type called "patch". A patch is a
pair of interfaces, in which frames sent through one of the devices
pop out of the other. This is useful for linking together datapaths.
A patch's only argument on creation is "peer", which specifies the other
side of the patch. A patch must be created in pairs, so a second netdev
must be created with the "name" and "peer" values reversed.
The current implementation is built using veth devices. Further, it's
limited to the veth devices which support configuration through sysfs.
This limits the ability to use a "patch" on 2.6.18 kernels using the
veth device we include (read: flavors of XenServer 5.5). In the not too
distant future, the implementation will be modified to use the new
kernel port abstraction introduced by Jesse Gross's forthcoming GRE
work. At that point, patch devices will work on any Linux platform
supported by OVS.
If an error occured while opening a netdev it would decrement the
refcount, even though it was never incremented. Depending on
the timing this could result in either an error message or an
assertion failure. This workaround simply always increments
the refcount before openning a device. A more complete fix
already exists in the netdev overhaul in the 'next' branch.
NIC-59
No conflicts, but lib/dpif.c needed a few changes since struct dpif's
member "class" was renamed to "dpif_class" in master since sflow was
branched off.
We only reconfigure netdevs if the arguments have changed, which
was previously detected based on a hash. This stores and compares
the full argument list to avoid any chance of missing changes due
to collisions.
We previously maintained a list of open devices inside of the
linux netdev. Since the netdev library now maintains this list,
it is better to use that list instead of our own.
Until now, fatal_signal_fork() has simply disabled all the fatal signal
callback hooks. This worked fine, because a daemon process forked only
once and the parent didn't do much before it exited.
But upcoming commits will introduce a --monitor option, which requires
processes to fork multiple times. Sometimes the parent process will fork,
then run for a while, then fork again. It's not good to disable the
hooks in the child process in such a case, because that prevents e.g.
pidfiles from being removed at the child's exit.
So this commit changes the semantics of fatal_signal_fork() to just
clearing out hooks. After hooks are cleared, new hooks can be added and
will be executed on process termination in the usual way.
This commit also introduces a cancellation callback function so that a
canceled hook can free resources.
This builds on earlier work that implemented netdev object refcounting.
However, rather than requiring explicit create and destroy calls,
these operations are now performed automatically based on the referenece
count. This is important because in certain situations it is not
possible to know whether a netdev has already been created. A
workaround existed (which looked fairly similar to this paradigm) but
introduced it's own issues. This simplifies and unifies the API.
Rather than running signal hooks directly from the actual signal
handler, simply record the fact that the signal occured and run
the hook next time around the poll loop. This allows significantly
more freedom as to what can actually be done in the signal hooks.
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.
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.
The comment on netdev_get_features() claimed that all of the passed-in
values were set to 0 on failure, but the implementation didn't live up
to the promise.
CC: Paul Ingram <paul@nicira.com>
This new abstraction layer allows multiple implementations of network
devices in a single running process. This will be useful, for example, to
support network devices that are simulated entirely in the running process
or that communicate with other processes over Unix domain sockets, etc.
The reimplemented tap device support in this commit has not been tested.
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.
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.
Also updates the only user of netdev_find_dev_by_in4().
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.
This new function allows cleanup of code that was using
netdev_nodev_get_flags() or ad-hoc methods to detect whether a network
device with the given name exists.
netdev_open() can always be used in place of netdev_open_tap(). The
former is going to be generalized to support pluggable network device
types, so it makes sense to use it everywhere.
Until now, netdev_get_in4() and netdev_nodev_get_in4() have returned a
bool that represents success or failure. This commit changes the return
value to an int that can indicate what kind of error occurred, which is
both more consistent with the rest of the netdev interfaces and more
meaningful, and updates all callers to the new interface.
(Currently netdev_get_in4() won't ever return an error, but other future
implementations might.)
To make the netdev code more portable, it needs to support returning error
codes from functions that don't have them. This commit changes
netdev_get_mtu() to return an error code and updates its caller.
(Currently netdev_get_mtu() won't ever return an error, but other future
implementations might.)
To make the netdev code more portable, it needs to support returning error
codes from functions that don't have them. This commit changes
netdev_get_etheraddr() to return an error code and updates all of its
callers.
(Currently netdev_get_etheraddr() won't ever return an error, but other
future implementations might.)
In some cases we need to be able to locate a device by its IPv4 address.
There doesn't seem to be an easy way to do this on Linux, so we iterate
through all devices until it's found. The caller can provide a hint as
to the device, so subsequent checks can be quicker.
This checkin also adds nodev versions of functions to lookup ARP entries
and the IPv4 address of a device.
The dpif and netdev code has had various ways to check for changes to
dpifs and netdevs over the course of Open vSwitch development. All of
these have been thus far fairly specific to the Linux implementation. This
commit is the start of a more general API for watching for such changes.
The dpif-related parts seem fairly mature and so they are documented,
the netdev parts will probably need to change somewhat and so they are
not documented yet.