From b3dcb73cc58a7ee089cfaec623818142196e1172 Mon Sep 17 00:00:00 2001 From: Pravin B Shelar Date: Mon, 26 Aug 2013 23:53:17 -0700 Subject: [PATCH] datapath: Cleanup netlink compat code. Patch removes genl, netlink, rtnl compat code and dpif-linux fallback-id compat code. Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross --- datapath/compat.h | 8 - datapath/datapath.c | 12 +- datapath/dp_notify.c | 2 +- datapath/linux/compat/genetlink-openvswitch.c | 132 ---------------- datapath/linux/compat/include/linux/netlink.h | 16 -- .../linux/compat/include/linux/rtnetlink.h | 43 ----- datapath/linux/compat/include/net/genetlink.h | 149 +----------------- datapath/linux/compat/include/net/netlink.h | 113 ------------- debian/copyright.in | 1 - include/openvswitch/automake.mk | 1 - include/openvswitch/datapath-compat.h | 45 ------ lib/dpif-linux.c | 4 +- lib/netlink-socket.c | 11 +- lib/netlink-socket.h | 3 +- 14 files changed, 13 insertions(+), 527 deletions(-) delete mode 100644 include/openvswitch/datapath-compat.h diff --git a/datapath/compat.h b/datapath/compat.h index c786b9739..2873f0a8c 100644 --- a/datapath/compat.h +++ b/datapath/compat.h @@ -58,14 +58,6 @@ static inline void skb_clear_rxhash(struct sk_buff *skb) #endif } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) -#define GENL_SOCK(net) (genl_sock) -#define SET_NETNSOK -#else -#define GENL_SOCK(net) ((net)->genl_sock) -#define SET_NETNSOK .netnsok = true, -#endif - #ifdef HAVE_PARALLEL_OPS #define SET_PARALLEL_OPS .parallel_ops = true, #else diff --git a/datapath/datapath.c b/datapath/datapath.c index 70c939193..2063f5cea 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -272,7 +272,7 @@ static struct genl_family dp_packet_genl_family = { .name = OVS_PACKET_FAMILY, .version = OVS_PACKET_VERSION, .maxattr = OVS_PACKET_ATTR_MAX, - SET_NETNSOK + .netnsok = true, SET_PARALLEL_OPS }; @@ -1003,7 +1003,7 @@ static struct genl_family dp_flow_genl_family = { .name = OVS_FLOW_FAMILY, .version = OVS_FLOW_VERSION, .maxattr = OVS_FLOW_ATTR_MAX, - SET_NETNSOK + .netnsok = true, SET_PARALLEL_OPS }; @@ -1387,7 +1387,7 @@ static int ovs_flow_cmd_new_or_set(struct sk_buff *skb, struct genl_info *info) if (!IS_ERR(reply)) ovs_notify(reply, info, &ovs_dp_flow_multicast_group); else - netlink_set_err(GENL_SOCK(sock_net(skb->sk)), 0, + netlink_set_err(sock_net(skb->sk)->genl_sock, 0, ovs_dp_flow_multicast_group.id, PTR_ERR(reply)); return 0; @@ -1583,7 +1583,7 @@ static struct genl_family dp_datapath_genl_family = { .name = OVS_DATAPATH_FAMILY, .version = OVS_DATAPATH_VERSION, .maxattr = OVS_DP_ATTR_MAX, - SET_NETNSOK + .netnsok = true, SET_PARALLEL_OPS }; @@ -1850,7 +1850,7 @@ static int ovs_dp_cmd_set(struct sk_buff *skb, struct genl_info *info) info->snd_seq, OVS_DP_CMD_NEW); if (IS_ERR(reply)) { err = PTR_ERR(reply); - netlink_set_err(GENL_SOCK(sock_net(skb->sk)), 0, + netlink_set_err(sock_net(skb->sk)->genl_sock, 0, ovs_dp_datapath_multicast_group.id, err); err = 0; goto unlock; @@ -1963,7 +1963,7 @@ static struct genl_family dp_vport_genl_family = { .name = OVS_VPORT_FAMILY, .version = OVS_VPORT_VERSION, .maxattr = OVS_VPORT_ATTR_MAX, - SET_NETNSOK + .netnsok = true, SET_PARALLEL_OPS }; diff --git a/datapath/dp_notify.c b/datapath/dp_notify.c index d5308933f..847f6116f 100644 --- a/datapath/dp_notify.c +++ b/datapath/dp_notify.c @@ -35,7 +35,7 @@ static void dp_detach_port_notify(struct vport *vport) OVS_VPORT_CMD_DEL); ovs_dp_detach_port(vport); if (IS_ERR(notify)) { - netlink_set_err(GENL_SOCK(ovs_dp_get_net(dp)), 0, + netlink_set_err(ovs_dp_get_net(dp)->genl_sock, 0, ovs_dp_vport_multicast_group.id, PTR_ERR(notify)); return; diff --git a/datapath/linux/compat/genetlink-openvswitch.c b/datapath/linux/compat/genetlink-openvswitch.c index 810223b3d..359f916dc 100644 --- a/datapath/linux/compat/genetlink-openvswitch.c +++ b/datapath/linux/compat/genetlink-openvswitch.c @@ -1,138 +1,13 @@ #include #include -#define GENL_FIRST_MCGROUP 16 -#define GENL_LAST_MCGROUP 31 - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) -#include -#include - -#include "openvswitch/datapath-compat.h" - -static DEFINE_MUTEX(mc_group_mutex); - -int genl_register_mc_group(struct genl_family *family, - struct genl_multicast_group *grp) -{ - static int next_group = GENL_FIRST_MCGROUP; - - grp->family = family; - - if (!strcmp(grp->name, OVS_VPORT_MCGROUP)) { - grp->id = OVS_VPORT_MCGROUP_FALLBACK_ID; - return 0; - } - - mutex_lock(&mc_group_mutex); - grp->id = next_group; - - if (++next_group > GENL_LAST_MCGROUP) - next_group = GENL_FIRST_MCGROUP; - mutex_unlock(&mc_group_mutex); - - return 0; -} -#endif /* kernel < 2.6.23 */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31) -/** - * genl_register_family_with_ops - register a generic netlink family - * @family: generic netlink family - * @ops: operations to be registered - * @n_ops: number of elements to register - * - * Registers the specified family and operations from the specified table. - * Only one family may be registered with the same family name or identifier. - * - * The family id may equal GENL_ID_GENERATE causing an unique id to - * be automatically generated and assigned. - * - * Either a doit or dumpit callback must be specified for every registered - * operation or the function will fail. Only one operation structure per - * command identifier may be registered. - * - * See include/net/genetlink.h for more documenation on the operations - * structure. - * - * This is equivalent to calling genl_register_family() followed by - * genl_register_ops() for every operation entry in the table taking - * care to unregister the family on error path. - * - * Return 0 on success or a negative error code. - */ -int genl_register_family_with_ops(struct genl_family *family, - struct genl_ops *ops, size_t n_ops) -{ - int err, i; - - err = genl_register_family(family); - if (err) - return err; - - for (i = 0; i < n_ops; ++i, ++ops) { - err = genl_register_ops(family, ops); - if (err) - goto err_out; - } - return 0; -err_out: - genl_unregister_family(family); - return err; -} -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -/** - * nlmsg_notify - send a notification netlink message - * @sk: netlink socket to use - * @skb: notification message - * @portid: destination netlink portid for reports or 0 - * @group: destination multicast group or 0 - * @report: 1 to report back, 0 to disable - * @flags: allocation flags - */ -int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid, - unsigned int group, int report, gfp_t flags) -{ - int err = 0; - - if (group) { - int exclude_portid = 0; - - if (report) { - atomic_inc(&skb->users); - exclude_portid = portid; - } - - /* errors reported via destination sk->sk_err, but propagate - * delivery errors if NETLINK_BROADCAST_ERROR flag is set */ - err = nlmsg_multicast(sk, skb, exclude_portid, group, flags); - } - - if (report) { - int err2; - - err2 = nlmsg_unicast(sk, skb, portid); - if (!err || err == -ESRCH) - err = err2; - } - - return err; -} -#endif - /* This is analogous to rtnl_notify() but uses genl_sock instead of rtnl. * * This is not (yet) in any upstream kernel. */ void genl_notify(struct sk_buff *skb, struct net *net, u32 portid, u32 group, struct nlmsghdr *nlh, gfp_t flags) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) struct sock *sk = net->genl_sock; -#else - struct sock *sk = genl_sock; -#endif int report = 0; if (nlh) @@ -140,10 +15,3 @@ void genl_notify(struct sk_buff *skb, struct net *net, u32 portid, u32 group, nlmsg_notify(sk, skb, portid, group, report, flags); } - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) -/* This function wasn't exported before 2.6.30. Lose! */ -void netlink_set_err(struct sock *ssk, u32 portid, u32 group, int code) -{ -} -#endif diff --git a/datapath/linux/compat/include/linux/netlink.h b/datapath/linux/compat/include/linux/netlink.h index 44a20738b..a64de4ff8 100644 --- a/datapath/linux/compat/include/linux/netlink.h +++ b/datapath/linux/compat/include/linux/netlink.h @@ -11,25 +11,9 @@ #endif #include -#include #ifndef NLMSG_DEFAULT_SIZE #define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN) #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -#define nlmsg_new(s, f) nlmsg_new_proper((s), (f)) -static inline struct sk_buff *nlmsg_new_proper(int size, gfp_t flags) -{ - return alloc_skb(size, flags); -} -#endif /* linux kernel < 2.6.19 */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) -static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb) -{ - return (struct nlmsghdr *)skb->data; -} -#endif - #endif diff --git a/datapath/linux/compat/include/linux/rtnetlink.h b/datapath/linux/compat/include/linux/rtnetlink.h index 151f823fd..a1b689c32 100644 --- a/datapath/linux/compat/include/linux/rtnetlink.h +++ b/datapath/linux/compat/include/linux/rtnetlink.h @@ -3,49 +3,6 @@ #include_next -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -static inline void rtnl_notify(struct sk_buff *skb, u32 portid, u32 group, - struct nlmsghdr *nlh, gfp_t flags) -{ - BUG_ON(nlh != NULL); /* not implemented */ - if (group) { - /* errors reported via destination sk->sk_err */ - nlmsg_multicast(rtnl, skb, 0, group, flags); - } -} - -static inline void rtnl_set_sk_err(u32 group, int error) -{ - netlink_set_err(rtnl, 0, group, error); -} -#endif - -/* No 'net' parameter in these versions. */ -#define rtnl_notify(skb, net, portid, group, nlh, flags) \ - ((void) rtnl_notify(skb, portid, group, nlh, flags)) -#define rtnl_set_sk_err(net, group, error) \ - (rtnl_set_sk_err(group, error)) -#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) -/* Make the return type effectively 'void' to match Linux 2.6.30+. */ -#define rtnl_notify(skb, net, portid, group, nlh, flags) \ - ((void) rtnl_notify(skb, net, portid, group, nlh, flags)) -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) -static inline int rtnl_is_locked(void) -{ - if (unlikely(rtnl_trylock())) { - rtnl_unlock(); - return 0; - } - - return 1; -} - -#endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) #ifdef CONFIG_PROVE_LOCKING static inline int lockdep_rtnl_is_held(void) diff --git a/datapath/linux/compat/include/net/genetlink.h b/datapath/linux/compat/include/net/genetlink.h index c17459b7a..91be1685f 100644 --- a/datapath/linux/compat/include/net/genetlink.h +++ b/datapath/linux/compat/include/net/genetlink.h @@ -4,6 +4,7 @@ #include #include #include +#include_next /* * 15e473046cb6e5d18a4d0057e61d76315230382b renames pid to portid @@ -16,154 +17,6 @@ #define portid pid #endif -/* Very special super-nasty workaround here: - * - * Before 2.6.19, nlmsg_multicast() lacked a 'flags' parameter. We work - * around that in our replacement, so that nlmsg_multicast - * is a macro that expands to rpl_nlmsg_multicast, which in turn has the - * 'flags' parameter. - * - * However, also before 2.6.19, contains an inline definition - * of genlmsg_multicast() that, of course, calls it without the 'flags' - * parameter. This causes a build failure. - * - * This works around the problem by temporarily renaming both nlmsg_multicast - * and genlmsg_multicast with a "busted_" prefix. (Nothing actually defines - * busted_nlmsg_multicast(), so if anything actually tries to call it, then - * we'll get a link error.) - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -#undef nlmsg_multicast -#define nlmsg_multicast busted_nlmsg_multicast -#define genlmsg_multicast busted_genlmsg_multicast -extern int busted_nlmsg_multicast(struct sock *sk, struct sk_buff *skb, - u32 portid, unsigned int group); -#endif /* linux kernel < v2.6.19 */ - -#include_next - -/* Drop the "busted_" prefix described above. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -#undef nlmsg_multicast -#undef genlmsg_multicast -#define nlmsg_multicast rpl_nlmsg_multicast -#endif /* linux kernel < v2.6.19 */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) - -#include - -/** - * struct genl_multicast_group - generic netlink multicast group - * @name: name of the multicast group, names are per-family - * @id: multicast group ID, assigned by the core, to use with - * genlmsg_multicast(). - * @list: list entry for linking - * @family: pointer to family, need not be set before registering - */ -struct genl_multicast_group { - struct genl_family *family; /* private */ - struct list_head list; /* private */ - char name[GENL_NAMSIZ]; - u32 id; -}; - -int genl_register_mc_group(struct genl_family *family, - struct genl_multicast_group *grp); -#endif /* linux kernel < 2.6.23 */ - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -/** - * genlmsg_msg_size - length of genetlink message not including padding - * @payload: length of message payload - */ -static inline int genlmsg_msg_size(int payload) -{ - return GENL_HDRLEN + payload; -} - -/** - * genlmsg_total_size - length of genetlink message including padding - * @payload: length of message payload - */ -static inline int genlmsg_total_size(int payload) -{ - return NLMSG_ALIGN(genlmsg_msg_size(payload)); -} - -#define genlmsg_multicast(s, p, g, f) \ - genlmsg_multicast_flags((s), (p), (g), (f)) - -static inline int genlmsg_multicast_flags(struct sk_buff *skb, u32 portid, - unsigned int group, gfp_t flags) -{ - int err; - - NETLINK_CB(skb).dst_group = group; - - err = netlink_broadcast(genl_sock, skb, portid, group, flags); - if (err > 0) - err = 0; - - return err; -} -#endif /* linux kernel < 2.6.19 */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - -#define genlmsg_put(skb, p, seq, fam, flg, c) \ - genlmsg_put((skb), (p), (seq), (fam)->id, (fam)->hdrsize, \ - (flg), (c), (fam)->version) - -/** - * genlmsg_put_reply - Add generic netlink header to a reply message - * @skb: socket buffer holding the message - * @info: receiver info - * @family: generic netlink family - * @flags: netlink message flags - * @cmd: generic netlink command - * - * Returns pointer to user specific header - */ -static inline void *genlmsg_put_reply(struct sk_buff *skb, - struct genl_info *info, struct genl_family *family, - int flags, u8 cmd) -{ - return genlmsg_put(skb, info->snd_portid, info->snd_seq, family, - flags, cmd); -} - -/** - * genlmsg_reply - reply to a request - * @skb: netlink message to be sent back - * @info: receiver information - */ -static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info) -{ - return genlmsg_unicast(skb, info->snd_portid); -} - -/** - * genlmsg_new - Allocate a new generic netlink message - * @payload: size of the message payload - * @flags: the type of memory to allocate. - */ -static inline struct sk_buff *genlmsg_new(size_t payload, gfp_t flags) -{ - return nlmsg_new(genlmsg_total_size(payload), flags); -} -#endif /* linux kernel < 2.6.20 */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31) -int genl_register_family_with_ops(struct genl_family *family, - struct genl_ops *ops, size_t n_ops); -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -#define genl_notify(skb, net, portid, group, nlh, flags) \ - genl_notify(skb, portid, group, nlh, flags) -#endif extern void genl_notify(struct sk_buff *skb, struct net *net, u32 portid, u32 group, struct nlmsghdr *nlh, gfp_t flags); diff --git a/datapath/linux/compat/include/net/netlink.h b/datapath/linux/compat/include/net/netlink.h index 308cd69b4..a6dc5845b 100644 --- a/datapath/linux/compat/include/net/netlink.h +++ b/datapath/linux/compat/include/net/netlink.h @@ -4,31 +4,6 @@ #include #include_next -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) -/* Before v2.6.29, a NLA_NESTED attribute, if it was present, was not allowed - * to be empty. However, OVS depends on the ability to accept empty - * attributes. For example, a present but empty OVS_FLOW_ATTR_ACTIONS on - * OVS_FLOW_CMD_SET replaces the existing set of actions by an empty "drop" - * action, whereas a missing OVS_FLOW_ATTR_ACTIONS leaves the existing - * actions, if any, unchanged. - * - * NLA_NESTED is different from NLA_UNSPEC in only two ways: - * - * - If the size of the nested attributes is zero, no further size checks - * are performed. - * - * - If the size of the nested attributes is not zero and no length - * parameter is specified the minimum size of nested attributes is - * NLA_HDRLEN. - * - * nla_parse_nested() validates that there is at least enough space for - * NLA_HDRLEN, so neither of these conditions are important, and we might - * as well use NLA_UNSPEC with old kernels. - */ -#undef NLA_NESTED -#define NLA_NESTED NLA_UNSPEC -#endif - #ifndef HAVE_NLA_GET_BE16 /** * nla_get_be16 - return payload of __be16 attribute @@ -40,36 +15,6 @@ static inline __be16 nla_get_be16(const struct nlattr *nla) } #endif /* !HAVE_NLA_GET_BE16 */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -/** - * nla_get_be32 - return payload of __be32 attribute - * @nla: __be32 netlink attribute - */ -static inline __be32 nla_get_be32(const struct nlattr *nla) -{ - return *(__be32 *) nla_data(nla); -} -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) -/* These functions' nlattr source arguments weren't "const" before 2.6.29, so - * cast their arguments to the non-"const" versions. Using macros for this - * isn't exactly a brilliant idea, but it seems less error-prone than copying - * the definitions of all umpteen functions. */ -#define nla_get_u64(nla) (nla_get_u64) ((struct nlattr *) (nla)) -#define nla_get_u32(nla) (nla_get_u32) ((struct nlattr *) (nla)) -#define nla_get_u16(nla) (nla_get_u16) ((struct nlattr *) (nla)) -#define nla_get_u8(nla) (nla_get_u8) ((struct nlattr *) (nla)) -/* nla_get_be64 is handled separately below. */ -#define nla_get_be32(nla) (nla_get_be32) ((struct nlattr *) (nla)) -#define nla_get_be16(nla) (nla_get_be16) ((struct nlattr *) (nla)) -#define nla_get_be8(nla) (nla_get_be8) ((struct nlattr *) (nla)) -#define nla_get_flag(nla) (nla_get_flag) ((struct nlattr *) (nla)) -#define nla_get_msecs(nla) (nla_get_msecs)((struct nlattr *) (nla)) -#define nla_memcpy(dst, src, count) \ - (nla_memcpy)(dst, (struct nlattr *)(src), count) -#endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) /* This function was introduced in 2.6.31, but initially it performed an * unaligned access, so we replace it up to 2.6.34 where it was fixed. */ @@ -106,26 +51,6 @@ static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -/** - * nla_type - attribute type - * @nla: netlink attribute - */ -static inline int nla_type(const struct nlattr *nla) -{ - return nla->nla_type & NLA_TYPE_MASK; -} -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) -#define nla_parse_nested(tb, maxtype, nla, policy) \ - nla_parse_nested(tb, maxtype, (struct nlattr *)(nla), \ - (struct nla_policy *)(policy)) -#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) -#define nla_parse_nested(tb, maxtype, nla, policy) \ - nla_parse_nested(tb, maxtype, (struct nlattr *)(nla), policy) -#endif - #ifndef nla_for_each_nested #define nla_for_each_nested(pos, nla, rem) \ nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem) @@ -138,42 +63,4 @@ static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -/** - * nlmsg_report - need to report back to application? - * @nlh: netlink message header - * - * Returns 1 if a report back to the application is requested. - */ -static inline int nlmsg_report(const struct nlmsghdr *nlh) -{ - return !!(nlh->nlmsg_flags & NLM_F_ECHO); -} - -extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, - u32 portid, unsigned int group, int report, - gfp_t flags); -#endif /* linux kernel < 2.6.19 */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -/* Before 2.6.19 the 'flags' parameter was missing, so replace it. We have to - * #include first because the 2.6.18 version of that header - * has an inline call to nlmsg_multicast() without, of course, any 'flags' - * argument. */ -#define nlmsg_multicast rpl_nlmsg_multicast -static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb, - u32 portid, unsigned int group, gfp_t flags) -{ - int err; - - NETLINK_CB(skb).dst_group = group; - - err = netlink_broadcast(sk, skb, portid, group, flags); - if (err > 0) - err = 0; - - return err; -} -#endif /* linux kernel < 2.6.19 */ - #endif /* net/netlink.h */ diff --git a/debian/copyright.in b/debian/copyright.in index 3bcf3326f..c6631d5e2 100644 --- a/debian/copyright.in +++ b/debian/copyright.in @@ -76,7 +76,6 @@ License: GNU General Public License version 2 and the Apache License Version 2.0. include/linux/openvswitch.h - include/openvswitch/datapath-compat.h On Debian systems, the complete text of the GNU General Public License version 2 can be found in `/usr/share/common-licenses/GPL-2'. diff --git a/include/openvswitch/automake.mk b/include/openvswitch/automake.mk index 88d9529e2..d651c16d4 100644 --- a/include/openvswitch/automake.mk +++ b/include/openvswitch/automake.mk @@ -1,4 +1,3 @@ noinst_HEADERS += \ - include/openvswitch/datapath-compat.h \ include/openvswitch/types.h diff --git a/include/openvswitch/datapath-compat.h b/include/openvswitch/datapath-compat.h deleted file mode 100644 index 338b4224c..000000000 --- a/include/openvswitch/datapath-compat.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2011 Nicira, Inc. - * - * This file is offered under your choice of two licenses: Apache 2.0 or GNU - * GPL 2.0 or later. The permission statements for each of these licenses is - * given below. You may license your modifications to this file under either - * of these licenses or both. If you wish to license your modifications under - * only one of these licenses, delete the permission text for the other - * license. - * - * ---------------------------------------------------------------------- - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ---------------------------------------------------------------------- - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * ---------------------------------------------------------------------- - */ - -#ifndef OPENVSWITCH_DATAPATH_COMPAT_H -#define OPENVSWITCH_DATAPATH_COMPAT_H 1 - -#define OVS_VPORT_MCGROUP_FALLBACK_ID 33 - -#endif /* openvswitch/datapath-compat.h */ diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c index ca5f496d0..e2300d6c2 100644 --- a/lib/dpif-linux.c +++ b/lib/dpif-linux.c @@ -46,7 +46,6 @@ #include "netlink.h" #include "odp-util.h" #include "ofpbuf.h" -#include "openvswitch/datapath-compat.h" #include "packets.h" #include "poll-loop.h" #include "random.h" @@ -1566,8 +1565,7 @@ dpif_linux_init(void) } if (!error) { error = nl_lookup_genl_mcgroup(OVS_VPORT_FAMILY, OVS_VPORT_MCGROUP, - &ovs_vport_mcgroup, - OVS_VPORT_MCGROUP_FALLBACK_ID); + &ovs_vport_mcgroup); } ovsthread_once_done(&once); diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c index 9562d38e5..23c05c5e8 100644 --- a/lib/netlink-socket.c +++ b/lib/netlink-socket.c @@ -925,12 +925,10 @@ do_lookup_genl_family(const char *name, struct nlattr **attrs, /* Finds the multicast group called 'group_name' in genl family 'family_name'. * When successful, writes its result to 'multicast_group' and returns 0. * Otherwise, clears 'multicast_group' and returns a positive error code. - * - * Some kernels do not support looking up a multicast group with this function. - * In this case, 'multicast_group' will be populated with 'fallback'. */ + */ int nl_lookup_genl_mcgroup(const char *family_name, const char *group_name, - unsigned int *multicast_group, unsigned int fallback) + unsigned int *multicast_group) { struct nlattr *family_attrs[ARRAY_SIZE(family_policy)]; const struct nlattr *mc; @@ -945,10 +943,7 @@ nl_lookup_genl_mcgroup(const char *family_name, const char *group_name, } if (!family_attrs[CTRL_ATTR_MCAST_GROUPS]) { - *multicast_group = fallback; - VLOG_WARN("%s-%s: has no multicast group, using fallback %d", - family_name, group_name, *multicast_group); - error = 0; + error = EPROTO; goto exit; } diff --git a/lib/netlink-socket.h b/lib/netlink-socket.h index 986b5740f..18db417b0 100644 --- a/lib/netlink-socket.h +++ b/lib/netlink-socket.h @@ -111,7 +111,6 @@ int nl_dump_done(struct nl_dump *); /* Miscellaneous */ int nl_lookup_genl_family(const char *name, int *number); int nl_lookup_genl_mcgroup(const char *family_name, const char *group_name, - unsigned int *multicast_group, - unsigned int fallback); + unsigned int *multicast_group); #endif /* netlink-socket.h */ -- 2.43.0