[NETLINK]: Convert netlink users to use group numbers instead of bitmasks
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
d629b836d1
commit
ac6d439d20
@@ -1111,13 +1111,12 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa)
|
||||
struct sk_buff *skb = alloc_skb(size, GFP_KERNEL);
|
||||
|
||||
if (!skb)
|
||||
netlink_set_err(rtnl, 0, RTMGRP_IPV4_IFADDR, ENOBUFS);
|
||||
netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, ENOBUFS);
|
||||
else if (inet_fill_ifaddr(skb, ifa, current->pid, 0, event, 0) < 0) {
|
||||
kfree_skb(skb);
|
||||
netlink_set_err(rtnl, 0, RTMGRP_IPV4_IFADDR, EINVAL);
|
||||
netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, EINVAL);
|
||||
} else {
|
||||
NETLINK_CB(skb).dst_groups = RTMGRP_IPV4_IFADDR;
|
||||
netlink_broadcast(rtnl, skb, 0, RTMGRP_IPV4_IFADDR, GFP_KERNEL);
|
||||
netlink_broadcast(rtnl, skb, 0, RTNLGRP_IPV4_IFADDR, GFP_KERNEL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -560,7 +560,7 @@ static void nl_fib_input(struct sock *sk, int len)
|
||||
pid = nlh->nlmsg_pid; /*pid of sending process */
|
||||
NETLINK_CB(skb).pid = 0; /* from kernel */
|
||||
NETLINK_CB(skb).dst_pid = pid;
|
||||
NETLINK_CB(skb).dst_groups = 0; /* unicast */
|
||||
NETLINK_CB(skb).dst_group = 0; /* unicast */
|
||||
netlink_unicast(sk, skb, pid, MSG_DONTWAIT);
|
||||
}
|
||||
|
||||
|
@@ -290,10 +290,10 @@ void rtmsg_fib(int event, u32 key, struct fib_alias *fa,
|
||||
kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
NETLINK_CB(skb).dst_groups = RTMGRP_IPV4_ROUTE;
|
||||
NETLINK_CB(skb).dst_group = RTNLGRP_IPV4_ROUTE;
|
||||
if (n->nlmsg_flags&NLM_F_ECHO)
|
||||
atomic_inc(&skb->users);
|
||||
netlink_broadcast(rtnl, skb, pid, RTMGRP_IPV4_ROUTE, GFP_KERNEL);
|
||||
netlink_broadcast(rtnl, skb, pid, RTNLGRP_IPV4_ROUTE, GFP_KERNEL);
|
||||
if (n->nlmsg_flags&NLM_F_ECHO)
|
||||
netlink_unicast(rtnl, skb, pid, MSG_DONTWAIT);
|
||||
}
|
||||
|
@@ -297,7 +297,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
|
||||
struct sk_buff *skb;
|
||||
unsigned int type;
|
||||
unsigned char *b;
|
||||
unsigned int flags = 0, groups;
|
||||
unsigned int flags = 0, group;
|
||||
|
||||
/* ignore our fake conntrack entry */
|
||||
if (ct == &ip_conntrack_untracked)
|
||||
@@ -305,7 +305,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
|
||||
|
||||
if (events & IPCT_DESTROY) {
|
||||
type = IPCTNL_MSG_CT_DELETE;
|
||||
groups = NF_NETLINK_CONNTRACK_DESTROY;
|
||||
group = NFNLGRP_CONNTRACK_DESTROY;
|
||||
goto alloc_skb;
|
||||
}
|
||||
if (events & (IPCT_NEW | IPCT_RELATED)) {
|
||||
@@ -313,7 +313,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
|
||||
flags = NLM_F_CREATE|NLM_F_EXCL;
|
||||
/* dump everything */
|
||||
events = ~0UL;
|
||||
groups = NF_NETLINK_CONNTRACK_NEW;
|
||||
group = NFNLGRP_CONNTRACK_NEW;
|
||||
goto alloc_skb;
|
||||
}
|
||||
if (events & (IPCT_STATUS |
|
||||
@@ -322,7 +322,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
|
||||
IPCT_HELPINFO |
|
||||
IPCT_NATINFO)) {
|
||||
type = IPCTNL_MSG_CT_NEW;
|
||||
groups = NF_NETLINK_CONNTRACK_UPDATE;
|
||||
group = NFNLGRP_CONNTRACK_UPDATE;
|
||||
goto alloc_skb;
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ alloc_skb:
|
||||
goto nfattr_failure;
|
||||
|
||||
nlh->nlmsg_len = skb->tail - b;
|
||||
nfnetlink_send(skb, 0, groups, 0);
|
||||
nfnetlink_send(skb, 0, group, 0);
|
||||
return NOTIFY_DONE;
|
||||
|
||||
nlmsg_failure:
|
||||
@@ -1194,7 +1194,7 @@ static int ctnetlink_expect_event(struct notifier_block *this,
|
||||
|
||||
nlh->nlmsg_len = skb->tail - b;
|
||||
proto = exp->tuple.dst.protonum;
|
||||
nfnetlink_send(skb, 0, NF_NETLINK_CONNTRACK_EXP_NEW, 0);
|
||||
nfnetlink_send(skb, 0, NFNLGRP_CONNTRACK_EXP_NEW, 0);
|
||||
return NOTIFY_DONE;
|
||||
|
||||
nlmsg_failure:
|
||||
|
@@ -116,10 +116,10 @@ static void ulog_send(unsigned int nlgroupnum)
|
||||
if (ub->qlen > 1)
|
||||
ub->lastnlh->nlmsg_type = NLMSG_DONE;
|
||||
|
||||
NETLINK_CB(ub->skb).dst_groups = (1 << nlgroupnum);
|
||||
DEBUGP("ipt_ULOG: throwing %d packets to netlink mask %u\n",
|
||||
ub->qlen, nlgroupnum);
|
||||
netlink_broadcast(nflognl, ub->skb, 0, (1 << nlgroupnum), GFP_ATOMIC);
|
||||
NETLINK_CB(ub->skb).dst_group = nlgroupnum + 1;
|
||||
DEBUGP("ipt_ULOG: throwing %d packets to netlink group %u\n",
|
||||
ub->qlen, nlgroupnum + 1);
|
||||
netlink_broadcast(nflognl, ub->skb, 0, nlgroupnum + 1, GFP_ATOMIC);
|
||||
|
||||
ub->qlen = 0;
|
||||
ub->skb = NULL;
|
||||
|
Reference in New Issue
Block a user