return skb;
}
+static struct genl_multicast_group dm_mcgrp = {
+ .name = "events",
+};
+
static void send_dm_alert(struct work_struct *work)
{
struct sk_buff *skb;
skb = reset_per_cpu_data(data);
if (skb)
- genlmsg_multicast(skb, 0, NET_DM_GRP_ALERT, GFP_KERNEL);
+ genlmsg_multicast(skb, 0, dm_mcgrp.id, GFP_KERNEL);
}
/*
return rc;
}
+ rc = genl_register_mc_group(&net_drop_monitor_family, &dm_mcgrp);
+ if (rc) {
+ pr_err("Failed to register drop monitor mcast group\n");
+ goto out_unreg;
+ }
+ WARN_ON(dm_mcgrp.id != NET_DM_GRP_ALERT);
+
rc = register_netdevice_notifier(&dropmon_net_notifier);
if (rc < 0) {
pr_crit("Failed to register netdevice notifier\n");
* To avoid an allocation at boot of just one unsigned long,
* declare it global instead.
* Bit 0 is marked as already used since group 0 is invalid.
+ * Bit 1 is marked as already used since the drop-monitor code
+ * abuses the API and thinks it can statically use group 1.
+ * That group will typically conflict with other groups that
+ * any proper users use.
*/
-static unsigned long mc_group_start = 0x1;
+static unsigned long mc_group_start = 0x3;
static unsigned long *mc_groups = &mc_group_start;
static unsigned long mc_groups_longs = 1;
genl_lock_all();
- /* special-case our own group */
+ /* special-case our own group and hacks */
if (grp == ¬ify_grp)
id = GENL_ID_CTRL;
+ else if (strcmp(family->name, "NET_DM") == 0)
+ id = 1;
else
id = find_first_zero_bit(mc_groups,
mc_groups_longs * BITS_PER_LONG);
rcu_read_unlock();
netlink_table_ungrab();
- clear_bit(grp->id, mc_groups);
+ if (grp->id != 1)
+ clear_bit(grp->id, mc_groups);
list_del(&grp->list);
genl_ctrl_event(CTRL_CMD_DELMCAST_GRP, grp);
grp->id = 0;