aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-09-28 17:15:45 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:53:30 -0400
commit7c8d4cb4198d199e65a6ced8c81f71e3ac3f4cfc (patch)
treef931048ba1e765b8a6189cd8d16d20e514f1fc44
parent169e36742572934f5d846cfa5f9d76e72d505db4 (diff)
[NETFILTER]: nfnetlink: make subsystem and callbacks const
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/netfilter/nfnetlink.h10
-rw-r--r--net/netfilter/nf_conntrack_netlink.c8
-rw-r--r--net/netfilter/nfnetlink.c18
-rw-r--r--net/netfilter/nfnetlink_log.c4
-rw-r--r--net/netfilter/nfnetlink_queue.c4
5 files changed, 22 insertions, 22 deletions
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 0f9311df1559..e32418bcc661 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -118,9 +118,9 @@ struct nfnl_callback
118struct nfnetlink_subsystem 118struct nfnetlink_subsystem
119{ 119{
120 const char *name; 120 const char *name;
121 __u8 subsys_id; /* nfnetlink subsystem ID */ 121 __u8 subsys_id; /* nfnetlink subsystem ID */
122 __u8 cb_count; /* number of callbacks */ 122 __u8 cb_count; /* number of callbacks */
123 struct nfnl_callback *cb; /* callback for individual types */ 123 const struct nfnl_callback *cb; /* callback for individual types */
124}; 124};
125 125
126extern void __nfa_fill(struct sk_buff *skb, int attrtype, 126extern void __nfa_fill(struct sk_buff *skb, int attrtype,
@@ -129,8 +129,8 @@ extern void __nfa_fill(struct sk_buff *skb, int attrtype,
129({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \ 129({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \
130 __nfa_fill(skb, attrtype, attrlen, data); }) 130 __nfa_fill(skb, attrtype, attrlen, data); })
131 131
132extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n); 132extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
133extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n); 133extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
134 134
135extern void nfattr_parse(struct nfattr *tb[], int maxattr, 135extern void nfattr_parse(struct nfattr *tb[], int maxattr,
136 struct nfattr *nfa, int len); 136 struct nfattr *nfa, int len);
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 2863e72b4091..5080045fdc74 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1548,7 +1548,7 @@ static struct notifier_block ctnl_notifier_exp = {
1548}; 1548};
1549#endif 1549#endif
1550 1550
1551static struct nfnl_callback ctnl_cb[IPCTNL_MSG_MAX] = { 1551static const struct nfnl_callback ctnl_cb[IPCTNL_MSG_MAX] = {
1552 [IPCTNL_MSG_CT_NEW] = { .call = ctnetlink_new_conntrack, 1552 [IPCTNL_MSG_CT_NEW] = { .call = ctnetlink_new_conntrack,
1553 .attr_count = CTA_MAX, }, 1553 .attr_count = CTA_MAX, },
1554 [IPCTNL_MSG_CT_GET] = { .call = ctnetlink_get_conntrack, 1554 [IPCTNL_MSG_CT_GET] = { .call = ctnetlink_get_conntrack,
@@ -1559,7 +1559,7 @@ static struct nfnl_callback ctnl_cb[IPCTNL_MSG_MAX] = {
1559 .attr_count = CTA_MAX, }, 1559 .attr_count = CTA_MAX, },
1560}; 1560};
1561 1561
1562static struct nfnl_callback ctnl_exp_cb[IPCTNL_MSG_EXP_MAX] = { 1562static const struct nfnl_callback ctnl_exp_cb[IPCTNL_MSG_EXP_MAX] = {
1563 [IPCTNL_MSG_EXP_GET] = { .call = ctnetlink_get_expect, 1563 [IPCTNL_MSG_EXP_GET] = { .call = ctnetlink_get_expect,
1564 .attr_count = CTA_EXPECT_MAX, }, 1564 .attr_count = CTA_EXPECT_MAX, },
1565 [IPCTNL_MSG_EXP_NEW] = { .call = ctnetlink_new_expect, 1565 [IPCTNL_MSG_EXP_NEW] = { .call = ctnetlink_new_expect,
@@ -1568,14 +1568,14 @@ static struct nfnl_callback ctnl_exp_cb[IPCTNL_MSG_EXP_MAX] = {
1568 .attr_count = CTA_EXPECT_MAX, }, 1568 .attr_count = CTA_EXPECT_MAX, },
1569}; 1569};
1570 1570
1571static struct nfnetlink_subsystem ctnl_subsys = { 1571static const struct nfnetlink_subsystem ctnl_subsys = {
1572 .name = "conntrack", 1572 .name = "conntrack",
1573 .subsys_id = NFNL_SUBSYS_CTNETLINK, 1573 .subsys_id = NFNL_SUBSYS_CTNETLINK,
1574 .cb_count = IPCTNL_MSG_MAX, 1574 .cb_count = IPCTNL_MSG_MAX,
1575 .cb = ctnl_cb, 1575 .cb = ctnl_cb,
1576}; 1576};
1577 1577
1578static struct nfnetlink_subsystem ctnl_exp_subsys = { 1578static const struct nfnetlink_subsystem ctnl_exp_subsys = {
1579 .name = "conntrack_expect", 1579 .name = "conntrack_expect",
1580 .subsys_id = NFNL_SUBSYS_CTNETLINK_EXP, 1580 .subsys_id = NFNL_SUBSYS_CTNETLINK_EXP,
1581 .cb_count = IPCTNL_MSG_EXP_MAX, 1581 .cb_count = IPCTNL_MSG_EXP_MAX,
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 4aa56e7ff156..032224c1409f 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -41,7 +41,7 @@ MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_NETFILTER);
41static char __initdata nfversion[] = "0.30"; 41static char __initdata nfversion[] = "0.30";
42 42
43static struct sock *nfnl = NULL; 43static struct sock *nfnl = NULL;
44static struct nfnetlink_subsystem *subsys_table[NFNL_SUBSYS_COUNT]; 44static const struct nfnetlink_subsystem *subsys_table[NFNL_SUBSYS_COUNT];
45static DEFINE_MUTEX(nfnl_mutex); 45static DEFINE_MUTEX(nfnl_mutex);
46 46
47static void nfnl_lock(void) 47static void nfnl_lock(void)
@@ -66,7 +66,7 @@ static void nfnl_unlock(void)
66 nfnl->sk_data_ready(nfnl, 0); 66 nfnl->sk_data_ready(nfnl, 0);
67} 67}
68 68
69int nfnetlink_subsys_register(struct nfnetlink_subsystem *n) 69int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n)
70{ 70{
71 nfnl_lock(); 71 nfnl_lock();
72 if (subsys_table[n->subsys_id]) { 72 if (subsys_table[n->subsys_id]) {
@@ -80,7 +80,7 @@ int nfnetlink_subsys_register(struct nfnetlink_subsystem *n)
80} 80}
81EXPORT_SYMBOL_GPL(nfnetlink_subsys_register); 81EXPORT_SYMBOL_GPL(nfnetlink_subsys_register);
82 82
83int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n) 83int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n)
84{ 84{
85 nfnl_lock(); 85 nfnl_lock();
86 subsys_table[n->subsys_id] = NULL; 86 subsys_table[n->subsys_id] = NULL;
@@ -90,7 +90,7 @@ int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n)
90} 90}
91EXPORT_SYMBOL_GPL(nfnetlink_subsys_unregister); 91EXPORT_SYMBOL_GPL(nfnetlink_subsys_unregister);
92 92
93static inline struct nfnetlink_subsystem *nfnetlink_get_subsys(u_int16_t type) 93static inline const struct nfnetlink_subsystem *nfnetlink_get_subsys(u_int16_t type)
94{ 94{
95 u_int8_t subsys_id = NFNL_SUBSYS_ID(type); 95 u_int8_t subsys_id = NFNL_SUBSYS_ID(type);
96 96
@@ -100,8 +100,8 @@ static inline struct nfnetlink_subsystem *nfnetlink_get_subsys(u_int16_t type)
100 return subsys_table[subsys_id]; 100 return subsys_table[subsys_id];
101} 101}
102 102
103static inline struct nfnl_callback * 103static inline const struct nfnl_callback *
104nfnetlink_find_client(u_int16_t type, struct nfnetlink_subsystem *ss) 104nfnetlink_find_client(u_int16_t type, const struct nfnetlink_subsystem *ss)
105{ 105{
106 u_int8_t cb_id = NFNL_MSG_TYPE(type); 106 u_int8_t cb_id = NFNL_MSG_TYPE(type);
107 107
@@ -147,7 +147,7 @@ EXPORT_SYMBOL_GPL(nfattr_parse);
147 * 147 *
148 */ 148 */
149static int 149static int
150nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys, 150nfnetlink_check_attributes(const struct nfnetlink_subsystem *subsys,
151 struct nlmsghdr *nlh, struct nfattr *cda[]) 151 struct nlmsghdr *nlh, struct nfattr *cda[])
152{ 152{
153 int min_len = NLMSG_SPACE(sizeof(struct nfgenmsg)); 153 int min_len = NLMSG_SPACE(sizeof(struct nfgenmsg));
@@ -197,8 +197,8 @@ EXPORT_SYMBOL_GPL(nfnetlink_unicast);
197/* Process one complete nfnetlink message. */ 197/* Process one complete nfnetlink message. */
198static int nfnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 198static int nfnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
199{ 199{
200 struct nfnl_callback *nc; 200 const struct nfnl_callback *nc;
201 struct nfnetlink_subsystem *ss; 201 const struct nfnetlink_subsystem *ss;
202 int type, err; 202 int type, err;
203 203
204 if (security_netlink_recv(skb, CAP_NET_ADMIN)) 204 if (security_netlink_recv(skb, CAP_NET_ADMIN))
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 332e0f7f6f9e..c3aa8918035f 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -883,14 +883,14 @@ out:
883 return ret; 883 return ret;
884} 884}
885 885
886static struct nfnl_callback nfulnl_cb[NFULNL_MSG_MAX] = { 886static const struct nfnl_callback nfulnl_cb[NFULNL_MSG_MAX] = {
887 [NFULNL_MSG_PACKET] = { .call = nfulnl_recv_unsupp, 887 [NFULNL_MSG_PACKET] = { .call = nfulnl_recv_unsupp,
888 .attr_count = NFULA_MAX, }, 888 .attr_count = NFULA_MAX, },
889 [NFULNL_MSG_CONFIG] = { .call = nfulnl_recv_config, 889 [NFULNL_MSG_CONFIG] = { .call = nfulnl_recv_config,
890 .attr_count = NFULA_CFG_MAX, }, 890 .attr_count = NFULA_CFG_MAX, },
891}; 891};
892 892
893static struct nfnetlink_subsystem nfulnl_subsys = { 893static const struct nfnetlink_subsystem nfulnl_subsys = {
894 .name = "log", 894 .name = "log",
895 .subsys_id = NFNL_SUBSYS_ULOG, 895 .subsys_id = NFNL_SUBSYS_ULOG,
896 .cb_count = NFULNL_MSG_MAX, 896 .cb_count = NFULNL_MSG_MAX,
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index a813185c766d..bfcc0563bfd4 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -961,7 +961,7 @@ out_put:
961 return ret; 961 return ret;
962} 962}
963 963
964static struct nfnl_callback nfqnl_cb[NFQNL_MSG_MAX] = { 964static const struct nfnl_callback nfqnl_cb[NFQNL_MSG_MAX] = {
965 [NFQNL_MSG_PACKET] = { .call = nfqnl_recv_unsupp, 965 [NFQNL_MSG_PACKET] = { .call = nfqnl_recv_unsupp,
966 .attr_count = NFQA_MAX, }, 966 .attr_count = NFQA_MAX, },
967 [NFQNL_MSG_VERDICT] = { .call = nfqnl_recv_verdict, 967 [NFQNL_MSG_VERDICT] = { .call = nfqnl_recv_verdict,
@@ -970,7 +970,7 @@ static struct nfnl_callback nfqnl_cb[NFQNL_MSG_MAX] = {
970 .attr_count = NFQA_CFG_MAX, }, 970 .attr_count = NFQA_CFG_MAX, },
971}; 971};
972 972
973static struct nfnetlink_subsystem nfqnl_subsys = { 973static const struct nfnetlink_subsystem nfqnl_subsys = {
974 .name = "nf_queue", 974 .name = "nf_queue",
975 .subsys_id = NFNL_SUBSYS_QUEUE, 975 .subsys_id = NFNL_SUBSYS_QUEUE,
976 .cb_count = NFQNL_MSG_MAX, 976 .cb_count = NFQNL_MSG_MAX,