linux-2.6/compat-2.6/include/net/ip.h \
linux-2.6/compat-2.6/include/net/netlink.h \
linux-2.6/compat-2.6/include/net/protocol.h \
- linux-2.6/compat-2.6/include/net/route.h
+ linux-2.6/compat-2.6/include/net/route.h \
+ linux-2.6/compat-2.6/genetlink.inc
both_modules += brcompat
brcompat_sources = \
-#include "net/genetlink.h"
-
-#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
-
/* We fix grp->id to 32 so that it doesn't collide with any of the multicast
* groups selected by openvswitch_mod, which uses groups 16 through 31.
* Collision isn't fatal--multicast listeners should check that the family is
* the one that they want and discard others--but it wastes time and memory to
* receive unwanted messages. */
-int genl_register_mc_group(struct genl_family *family,
- struct genl_multicast_group *grp)
-{
- grp->id = 32;
- grp->family = family;
- return 0;
-}
+#define GENL_FIRST_MCGROUP 32
+#define GENL_LAST_MCGROUP 32
-#endif /* kernel < 2.6.23 */
+#include "genetlink.inc"
-#include "net/genetlink.h"
+#define GENL_FIRST_MCGROUP 16
+#define GENL_LAST_MCGROUP 31
-#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
-
-/* We use multicast groups 16 through 31 to avoid colliding with the multicast
- * group selected by brcompat_mod, which uses groups 32. Collision isn't
- * fatal--multicast listeners should check that the family is the one that they
- * want and discard others--but it wastes time and memory to receive unwanted
- * messages. */
-int genl_register_mc_group(struct genl_family *family,
- struct genl_multicast_group *grp)
-{
- /* This code is called single-threaded. */
- static unsigned int next_id = 0;
- grp->id = next_id++ % 16 + 16;
- grp->family = family;
-
- return 0;
-}
-
-#endif /* kernel < 2.6.23 */
+#include "genetlink.inc"
--- /dev/null
+/* -*- c -*- */
+
+#include <net/genetlink.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+#include <linux/mutex.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;
+
+ mutex_lock(&mc_group_mutex);
+ grp->id = next_group;
+ grp->family = family;
+
+ if (++next_group > GENL_LAST_MCGROUP)
+ next_group = GENL_FIRST_MCGROUP;
+ mutex_unlock(&mc_group_mutex);
+
+ return 0;
+}
+#endif /* kernel < 2.6.23 */
#include <linux/genetlink.h>
-/*----------------------------------------------------------------------------
- * In 2.6.23, registering of multicast groups was added. Our compatability
- * layer just supports registering a single group, since that's all we
- * need.
- */
-
/**
* struct genl_multicast_group - generic netlink multicast group
* @name: name of the multicast group, names are per-family