2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-17 14:28:02 +00:00
Commit Graph

412 Commits

Author SHA1 Message Date
Ben Pfaff
1619019101 datapath: Style fix. 2009-07-06 09:07:24 -07:00
Ben Pfaff
f1aa2072c8 datapath: Get rid of query operations for single flows. 2009-07-06 09:07:24 -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
2f8c6cfb50 datapath: Remove unnecessary range check from put_actions().
This code checked that the number of actions in a flow query did not
exceed the maximum number of actions that are allowed on a given flow.
But this check is unnecessary, since the code will never copy out any
more actions than actually exist in a flow.  It would be a shame to refuse
a flow query simply on the basis that the caller allocated more memory
than necessary, so eliminate the check.
2009-07-06 09:07:24 -07:00
Ben Pfaff
7793a4aaeb datapath: Fix use-after-free error in datapath destruction.
When we create a datapath we do this:

	1. Create local port.
	2. Call add_dp hook.
	3. Allow userspace to add more ports.

When we deleted a datapath we were doing this:

	1. Call del_dp hook
	2. Delete all the ports.

Unfortunately step 1 destroys dp->ifobj, then dp_del_port on any port other
than the local port in step 2 tries to reference dp->ifobj through a call
to sysfs_remove_link().

This commit fixes the problem by changing datapath deletion to mirror
creation:

	1. Delete all the ports but the local port.
	2. Call dp_del hook.
	3. Delete local port.

Commit 010082639 "datapath: Add sysfs support for all (otherwise supported)
Linux versions" makes this problem obvious on a 2.6.25+ kernel configured
with slab debugging, because on such kernels the ifobj is a pointer to a
slab object that is freed by the del_dp hook function (when brcompat_mod
is loaded).  This bug may be just as present on older kernels, but there
the ifobj is part of struct datapath, not a pointer, and thus it is much
harder to trigger.

Bug #1465.
2009-06-26 14:15:46 -07:00
Ben Pfaff
312b427dab datapath: Remove redundant synchronize_rcu() call.
There is no benefit to synchronizing twice, and it might cost us a lot of
time.
2009-06-26 12:20:19 -07:00
Ben Pfaff
cfe7c1f5e8 datapath: Ignore return value from rtnl_notify().
In Linux 2.6.30, the rtnl_notify() return type was changed from int to
void along with the following commit message:

    This patch also modifies the rtnetlink code to ignore the return
    value of rtnl_notify() in all callers. The function rtnl_notify()
    (before this patch) returned the error of the unicast notification
    which makes rtnl_set_sk_err() reports errors to all listeners. This
    is not of any help since the origin of the change (the socket that
    requested the echoing) notices the ENOBUFS error if the notification
    fails and should resync itself.

Thus there's no point in checking the return value, even in older versions
of the kernel, and so this commit changes our code to ignore it, even
on older kernel versions.  We also update the rtnl_notify() wrapper macros
to make the return type void on older kernel versions.

This has not been tested, just built.

Thanks to Mikio for spurring me to try building with Linux 2.6.29 and
2.6.30.
2009-06-24 14:58:57 -07:00
Ben Pfaff
34e63086ed Merge changes from citrix branch into master. 2009-06-15 16:04:54 -07:00
Ben Pfaff
a14bc59fb8 Update primary code license to Apache 2.0. 2009-06-15 15:11:30 -07:00
Ben Pfaff
806e39cfdf datapath: Add sysfs support for all (otherwise supported) Linux versions.
This turned out to be less trouble than I expected.

This builds successfully against 2.6.18 through 2.6.28.  Justin has lightly
tested it on a 2.6.27 kernel provided by Citrix.
2009-06-12 16:45:01 -07:00
Justin Pettit
b4ebfbeaf1 xenserver: xen 2.6.27 kernel doesn't need skb_checksum_setup defined
The latest XenServer release is based on 2.6.27.  The datapath code
defined "skb_checksum_setup", since it wasn't exported in their 2.6.18
kernels.  This change causes it only to be built if the kernel is
version 2.6.18.
2009-06-12 15:39:59 -07:00
Ben Pfaff
064af42167 Import from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45. 2009-07-08 13:19:16 -07:00