aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-11-19 09:19:32 -0500
committerDavid S. Miller <davem@davemloft.net>2013-11-19 16:39:05 -0500
commite5dcecba015f9774a402ba559b80b16999747e3b (patch)
tree866103a98e1987c6b52a05a41cc0f5cbc1c14add /net/core
parentc53ed7423619b4e8108914a9f31b426dd58ad591 (diff)
drop_monitor/genetlink: use proper genetlink multicast APIs
The drop monitor code is abusing the genetlink API and is statically using the generic netlink multicast group 1, even if that group belongs to somebody else (which it invariably will, since it's not reserved.) Make the drop monitor code use the proper APIs to reserve a group ID, but also reserve the group id 1 in generic netlink code to preserve the userspace API. Since drop monitor can be a module, don't clear the bit for it on unregistration. Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/drop_monitor.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index 0efc5028ba9d..46ee488c0015 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -106,6 +106,10 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data)
106 return skb; 106 return skb;
107} 107}
108 108
109static struct genl_multicast_group dm_mcgrp = {
110 .name = "events",
111};
112
109static void send_dm_alert(struct work_struct *work) 113static void send_dm_alert(struct work_struct *work)
110{ 114{
111 struct sk_buff *skb; 115 struct sk_buff *skb;
@@ -116,7 +120,7 @@ static void send_dm_alert(struct work_struct *work)
116 skb = reset_per_cpu_data(data); 120 skb = reset_per_cpu_data(data);
117 121
118 if (skb) 122 if (skb)
119 genlmsg_multicast(skb, 0, NET_DM_GRP_ALERT, GFP_KERNEL); 123 genlmsg_multicast(skb, 0, dm_mcgrp.id, GFP_KERNEL);
120} 124}
121 125
122/* 126/*
@@ -371,6 +375,13 @@ static int __init init_net_drop_monitor(void)
371 return rc; 375 return rc;
372 } 376 }
373 377
378 rc = genl_register_mc_group(&net_drop_monitor_family, &dm_mcgrp);
379 if (rc) {
380 pr_err("Failed to register drop monitor mcast group\n");
381 goto out_unreg;
382 }
383 WARN_ON(dm_mcgrp.id != NET_DM_GRP_ALERT);
384
374 rc = register_netdevice_notifier(&dropmon_net_notifier); 385 rc = register_netdevice_notifier(&dropmon_net_notifier);
375 if (rc < 0) { 386 if (rc < 0) {
376 pr_crit("Failed to register netdevice notifier\n"); 387 pr_crit("Failed to register netdevice notifier\n");