[NETLINK]: Encapsulate eff_cap usage within security framework.
[deliverable/linux.git] / net / decnet / netfilter / dn_rtmsg.c
index 353fed6888f95eb1e37deca4b4ddbdb0d7401576..8b99bd33540d53fc072278aa6ade21906a541f90 100644 (file)
 #include <linux/netfilter.h>
 #include <linux/spinlock.h>
 #include <linux/netlink.h>
+#include <linux/netfilter_decnet.h>
 
 #include <net/sock.h>
 #include <net/flow.h>
 #include <net/dn.h>
 #include <net/dn_route.h>
 
-#include <linux/netfilter_decnet.h>
-
 static struct sock *dnrmg = NULL;
 
 
@@ -71,10 +70,10 @@ static void dnrmg_send_peer(struct sk_buff *skb)
 
        switch(flags & DN_RT_CNTL_MSK) {
                case DN_RT_PKT_L1RT:
-                       group = DNRMG_L1_NLGRP;
+                       group = DNRNG_NLGRP_L1;
                        break;
                case DN_RT_PKT_L2RT:
-                       group = DNRMG_L2_NLGRP;
+                       group = DNRNG_NLGRP_L2;
                        break;
                default:
                        return;
@@ -108,7 +107,7 @@ static inline void dnrmg_receive_user_skb(struct sk_buff *skb)
        if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
                return;
 
-       if (!cap_raised(NETLINK_CB(skb).eff_cap, CAP_NET_ADMIN))
+       if (security_netlink_recv(skb, CAP_NET_ADMIN))
                RCV_SKB_FAIL(-EPERM);
 
        /* Eventually we might send routing messages too */
@@ -134,12 +133,12 @@ static struct nf_hook_ops dnrmg_ops = {
        .priority       = NF_DN_PRI_DNRTMSG,
 };
 
-static int __init init(void)
+static int __init dn_rtmsg_init(void)
 {
        int rv = 0;
 
-       dnrmg = netlink_kernel_create(NETLINK_DNRTMSG, dnrmg_receive_user_sk,
-                                     THIS_MODULE);
+       dnrmg = netlink_kernel_create(NETLINK_DNRTMSG, DNRNG_NLGRP_MAX,
+                                     dnrmg_receive_user_sk, THIS_MODULE);
        if (dnrmg == NULL) {
                printk(KERN_ERR "dn_rtmsg: Cannot create netlink socket");
                return -ENOMEM;
@@ -153,7 +152,7 @@ static int __init init(void)
        return rv;
 }
 
-static void __exit fini(void)
+static void __exit dn_rtmsg_fini(void)
 {
        nf_unregister_hook(&dnrmg_ops);
        sock_release(dnrmg->sk_socket);
@@ -165,6 +164,6 @@ MODULE_AUTHOR("Steven Whitehouse <steve@chygwyn.com>");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_DNRTMSG);
 
-module_init(init);
-module_exit(fini);
+module_init(dn_rtmsg_init);
+module_exit(dn_rtmsg_fini);
 
This page took 0.025597 seconds and 5 git commands to generate.