Older kernels do not advertise the multicast groups of families when requested by userspace. As a workaround, this patch hardcodes the multicast group ID of the ovs_vport family on these kernels. Userspace will be able to fall back to this hardcoded value if the standard mechanism is unavailable.
Signed-off-by: Ethan Jackson <et...@nicira.com> --- How about something like this? I haven't actually tested this version yet. Ethan --- datapath/linux/compat/genetlink.inc | 10 ++++++- include/openvswitch/datapath-compat.h | 45 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletions(-) create mode 100644 include/openvswitch/datapath-compat.h diff --git a/datapath/linux/compat/genetlink.inc b/datapath/linux/compat/genetlink.inc index d381e4f..afbb2fd 100644 --- a/datapath/linux/compat/genetlink.inc +++ b/datapath/linux/compat/genetlink.inc @@ -6,6 +6,8 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) #include <linux/mutex.h> +#include "openvswitch/datapath-compat.h" + static DEFINE_MUTEX(mc_group_mutex); int genl_register_mc_group(struct genl_family *family, @@ -13,9 +15,15 @@ int genl_register_mc_group(struct genl_family *family, { 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; - grp->family = family; if (++next_group > GENL_LAST_MCGROUP) next_group = GENL_FIRST_MCGROUP; diff --git a/include/openvswitch/datapath-compat.h b/include/openvswitch/datapath-compat.h new file mode 100644 index 0000000..888c311 --- /dev/null +++ b/include/openvswitch/datapath-compat.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2011 Nicira Networks. + * + * 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 214 + +#endif /* openvswitch/datapath-compat.h */ -- 1.7.6.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev