2 * Copyright (c) 2011, 2012 Nicira Networks.
3 * Distributed under the terms of the GNU GPL version 2.
5 * Significant portions of this file may be copied from parts of the Linux
6 * kernel, by Linus Torvalds and others.
12 #include <linux/netlink.h>
14 #ifndef HAVE_NLA_NUL_STRING
15 static inline int CHECK_NUL_STRING(struct nlattr *attr, int maxlen)
27 if (s[len - 1] != '\0')
33 static inline int CHECK_NUL_STRING(struct nlattr *attr, int maxlen)
37 #endif /* !HAVE_NLA_NUL_STRING */
40 * Enforces mutual exclusion with the Linux bridge module, by declaring and
41 * exporting br_should_route_hook. Because the bridge module also exports the
42 * same symbol, the module loader will refuse to load both modules at the same
43 * time (e.g. "bridge: exports duplicate symbol br_should_route_hook (owned by
46 * Before Linux 2.6.36, Open vSwitch cannot safely coexist with the Linux
47 * bridge module, so openvswitch_mod uses this macro in those versions. In
48 * Linux 2.6.36 and later, Open vSwitch can coexist with the bridge module, but
49 * it makes no sense to load both bridge and brcompat_mod, so brcompat_mod uses
50 * this macro in those versions.
52 * The use of "typeof" here avoids the need to track changes in the type of
53 * br_should_route_hook over various kernel versions.
55 #define BRIDGE_MUTUAL_EXCLUSION \
56 typeof(br_should_route_hook) br_should_route_hook; \
57 EXPORT_SYMBOL(br_should_route_hook)