aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2009-08-25 10:07:58 -0400
committerPatrick McHardy <kaber@trash.net>2009-08-25 10:07:58 -0400
commit3993832464dd4e14a4c926583a11f0fa92c1f0f0 (patch)
treea84cdac586ee63e48f711ad93dec098ad84c1b6c /net
parent3a6c2b419b7768703cfb2cabdb894517c5065e33 (diff)
netfilter: nfnetlink: constify message attributes and headers
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/netfilter/nf_nat_core.c6
-rw-r--r--net/netfilter/nf_conntrack_core.c2
-rw-r--r--net/netfilter/nf_conntrack_netlink.c54
-rw-r--r--net/netfilter/nfnetlink.c2
-rw-r--r--net/netfilter/nfnetlink_log.c6
-rw-r--r--net/netfilter/nfnetlink_queue.c9
-rw-r--r--net/netfilter/xt_osf.c6
7 files changed, 52 insertions, 33 deletions
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index b6ddd5633045..68afc6ecd343 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -620,7 +620,7 @@ static const struct nla_policy nat_nla_policy[CTA_NAT_MAX+1] = {
620}; 620};
621 621
622static int 622static int
623nfnetlink_parse_nat(struct nlattr *nat, 623nfnetlink_parse_nat(const struct nlattr *nat,
624 const struct nf_conn *ct, struct nf_nat_range *range) 624 const struct nf_conn *ct, struct nf_nat_range *range)
625{ 625{
626 struct nlattr *tb[CTA_NAT_MAX+1]; 626 struct nlattr *tb[CTA_NAT_MAX+1];
@@ -656,7 +656,7 @@ nfnetlink_parse_nat(struct nlattr *nat,
656static int 656static int
657nfnetlink_parse_nat_setup(struct nf_conn *ct, 657nfnetlink_parse_nat_setup(struct nf_conn *ct,
658 enum nf_nat_manip_type manip, 658 enum nf_nat_manip_type manip,
659 struct nlattr *attr) 659 const struct nlattr *attr)
660{ 660{
661 struct nf_nat_range range; 661 struct nf_nat_range range;
662 662
@@ -671,7 +671,7 @@ nfnetlink_parse_nat_setup(struct nf_conn *ct,
671static int 671static int
672nfnetlink_parse_nat_setup(struct nf_conn *ct, 672nfnetlink_parse_nat_setup(struct nf_conn *ct,
673 enum nf_nat_manip_type manip, 673 enum nf_nat_manip_type manip,
674 struct nlattr *attr) 674 const struct nlattr *attr)
675{ 675{
676 return -EOPNOTSUPP; 676 return -EOPNOTSUPP;
677} 677}
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index b5869b9574b0..565c3a86423f 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -47,7 +47,7 @@
47 47
48int (*nfnetlink_parse_nat_setup_hook)(struct nf_conn *ct, 48int (*nfnetlink_parse_nat_setup_hook)(struct nf_conn *ct,
49 enum nf_nat_manip_type manip, 49 enum nf_nat_manip_type manip,
50 struct nlattr *attr) __read_mostly; 50 const struct nlattr *attr) __read_mostly;
51EXPORT_SYMBOL_GPL(nfnetlink_parse_nat_setup_hook); 51EXPORT_SYMBOL_GPL(nfnetlink_parse_nat_setup_hook);
52 52
53DEFINE_SPINLOCK(nf_conntrack_lock); 53DEFINE_SPINLOCK(nf_conntrack_lock);
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 49479d194570..59d8064eb522 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -704,7 +704,8 @@ ctnetlink_parse_tuple_proto(struct nlattr *attr,
704} 704}
705 705
706static int 706static int
707ctnetlink_parse_tuple(struct nlattr *cda[], struct nf_conntrack_tuple *tuple, 707ctnetlink_parse_tuple(const struct nlattr * const cda[],
708 struct nf_conntrack_tuple *tuple,
708 enum ctattr_tuple type, u_int8_t l3num) 709 enum ctattr_tuple type, u_int8_t l3num)
709{ 710{
710 struct nlattr *tb[CTA_TUPLE_MAX+1]; 711 struct nlattr *tb[CTA_TUPLE_MAX+1];
@@ -740,7 +741,7 @@ ctnetlink_parse_tuple(struct nlattr *cda[], struct nf_conntrack_tuple *tuple,
740} 741}
741 742
742static inline int 743static inline int
743ctnetlink_parse_help(struct nlattr *attr, char **helper_name) 744ctnetlink_parse_help(const struct nlattr *attr, char **helper_name)
744{ 745{
745 struct nlattr *tb[CTA_HELP_MAX+1]; 746 struct nlattr *tb[CTA_HELP_MAX+1];
746 747
@@ -764,7 +765,8 @@ static const struct nla_policy ct_nla_policy[CTA_MAX+1] = {
764 765
765static int 766static int
766ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, 767ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
767 struct nlmsghdr *nlh, struct nlattr *cda[]) 768 const struct nlmsghdr *nlh,
769 const struct nlattr * const cda[])
768{ 770{
769 struct nf_conntrack_tuple_hash *h; 771 struct nf_conntrack_tuple_hash *h;
770 struct nf_conntrack_tuple tuple; 772 struct nf_conntrack_tuple tuple;
@@ -823,7 +825,8 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
823 825
824static int 826static int
825ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, 827ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
826 struct nlmsghdr *nlh, struct nlattr *cda[]) 828 const struct nlmsghdr *nlh,
829 const struct nlattr * const cda[])
827{ 830{
828 struct nf_conntrack_tuple_hash *h; 831 struct nf_conntrack_tuple_hash *h;
829 struct nf_conntrack_tuple tuple; 832 struct nf_conntrack_tuple tuple;
@@ -884,7 +887,7 @@ out:
884static int 887static int
885ctnetlink_parse_nat_setup(struct nf_conn *ct, 888ctnetlink_parse_nat_setup(struct nf_conn *ct,
886 enum nf_nat_manip_type manip, 889 enum nf_nat_manip_type manip,
887 struct nlattr *attr) 890 const struct nlattr *attr)
888{ 891{
889 typeof(nfnetlink_parse_nat_setup_hook) parse_nat_setup; 892 typeof(nfnetlink_parse_nat_setup_hook) parse_nat_setup;
890 893
@@ -914,7 +917,7 @@ ctnetlink_parse_nat_setup(struct nf_conn *ct,
914#endif 917#endif
915 918
916static int 919static int
917ctnetlink_change_status(struct nf_conn *ct, struct nlattr *cda[]) 920ctnetlink_change_status(struct nf_conn *ct, const struct nlattr * const cda[])
918{ 921{
919 unsigned long d; 922 unsigned long d;
920 unsigned int status = ntohl(nla_get_be32(cda[CTA_STATUS])); 923 unsigned int status = ntohl(nla_get_be32(cda[CTA_STATUS]));
@@ -940,7 +943,7 @@ ctnetlink_change_status(struct nf_conn *ct, struct nlattr *cda[])
940} 943}
941 944
942static int 945static int
943ctnetlink_change_nat(struct nf_conn *ct, struct nlattr *cda[]) 946ctnetlink_change_nat(struct nf_conn *ct, const struct nlattr * const cda[])
944{ 947{
945#ifdef CONFIG_NF_NAT_NEEDED 948#ifdef CONFIG_NF_NAT_NEEDED
946 int ret; 949 int ret;
@@ -966,7 +969,7 @@ ctnetlink_change_nat(struct nf_conn *ct, struct nlattr *cda[])
966} 969}
967 970
968static inline int 971static inline int
969ctnetlink_change_helper(struct nf_conn *ct, struct nlattr *cda[]) 972ctnetlink_change_helper(struct nf_conn *ct, const struct nlattr * const cda[])
970{ 973{
971 struct nf_conntrack_helper *helper; 974 struct nf_conntrack_helper *helper;
972 struct nf_conn_help *help = nfct_help(ct); 975 struct nf_conn_help *help = nfct_help(ct);
@@ -1028,7 +1031,7 @@ ctnetlink_change_helper(struct nf_conn *ct, struct nlattr *cda[])
1028} 1031}
1029 1032
1030static inline int 1033static inline int
1031ctnetlink_change_timeout(struct nf_conn *ct, struct nlattr *cda[]) 1034ctnetlink_change_timeout(struct nf_conn *ct, const struct nlattr * const cda[])
1032{ 1035{
1033 u_int32_t timeout = ntohl(nla_get_be32(cda[CTA_TIMEOUT])); 1036 u_int32_t timeout = ntohl(nla_get_be32(cda[CTA_TIMEOUT]));
1034 1037
@@ -1042,9 +1045,10 @@ ctnetlink_change_timeout(struct nf_conn *ct, struct nlattr *cda[])
1042} 1045}
1043 1046
1044static inline int 1047static inline int
1045ctnetlink_change_protoinfo(struct nf_conn *ct, struct nlattr *cda[]) 1048ctnetlink_change_protoinfo(struct nf_conn *ct, const struct nlattr * const cda[])
1046{ 1049{
1047 struct nlattr *tb[CTA_PROTOINFO_MAX+1], *attr = cda[CTA_PROTOINFO]; 1050 const struct nlattr *attr = cda[CTA_PROTOINFO];
1051 struct nlattr *tb[CTA_PROTOINFO_MAX+1];
1048 struct nf_conntrack_l4proto *l4proto; 1052 struct nf_conntrack_l4proto *l4proto;
1049 int err = 0; 1053 int err = 0;
1050 1054
@@ -1061,7 +1065,7 @@ ctnetlink_change_protoinfo(struct nf_conn *ct, struct nlattr *cda[])
1061 1065
1062#ifdef CONFIG_NF_NAT_NEEDED 1066#ifdef CONFIG_NF_NAT_NEEDED
1063static inline int 1067static inline int
1064change_nat_seq_adj(struct nf_nat_seq *natseq, struct nlattr *attr) 1068change_nat_seq_adj(struct nf_nat_seq *natseq, const struct nlattr * const attr)
1065{ 1069{
1066 struct nlattr *cda[CTA_NAT_SEQ_MAX+1]; 1070 struct nlattr *cda[CTA_NAT_SEQ_MAX+1];
1067 1071
@@ -1089,7 +1093,8 @@ change_nat_seq_adj(struct nf_nat_seq *natseq, struct nlattr *attr)
1089} 1093}
1090 1094
1091static int 1095static int
1092ctnetlink_change_nat_seq_adj(struct nf_conn *ct, struct nlattr *cda[]) 1096ctnetlink_change_nat_seq_adj(struct nf_conn *ct,
1097 const struct nlattr * const cda[])
1093{ 1098{
1094 int ret = 0; 1099 int ret = 0;
1095 struct nf_conn_nat *nat = nfct_nat(ct); 1100 struct nf_conn_nat *nat = nfct_nat(ct);
@@ -1120,7 +1125,8 @@ ctnetlink_change_nat_seq_adj(struct nf_conn *ct, struct nlattr *cda[])
1120#endif 1125#endif
1121 1126
1122static int 1127static int
1123ctnetlink_change_conntrack(struct nf_conn *ct, struct nlattr *cda[]) 1128ctnetlink_change_conntrack(struct nf_conn *ct,
1129 const struct nlattr * const cda[])
1124{ 1130{
1125 int err; 1131 int err;
1126 1132
@@ -1169,7 +1175,7 @@ ctnetlink_change_conntrack(struct nf_conn *ct, struct nlattr *cda[])
1169} 1175}
1170 1176
1171static struct nf_conn * 1177static struct nf_conn *
1172ctnetlink_create_conntrack(struct nlattr *cda[], 1178ctnetlink_create_conntrack(const struct nlattr * const cda[],
1173 struct nf_conntrack_tuple *otuple, 1179 struct nf_conntrack_tuple *otuple,
1174 struct nf_conntrack_tuple *rtuple, 1180 struct nf_conntrack_tuple *rtuple,
1175 u8 u3) 1181 u8 u3)
@@ -1304,7 +1310,8 @@ err1:
1304 1310
1305static int 1311static int
1306ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb, 1312ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1307 struct nlmsghdr *nlh, struct nlattr *cda[]) 1313 const struct nlmsghdr *nlh,
1314 const struct nlattr * const cda[])
1308{ 1315{
1309 struct nf_conntrack_tuple otuple, rtuple; 1316 struct nf_conntrack_tuple otuple, rtuple;
1310 struct nf_conntrack_tuple_hash *h = NULL; 1317 struct nf_conntrack_tuple_hash *h = NULL;
@@ -1629,7 +1636,8 @@ static const struct nla_policy exp_nla_policy[CTA_EXPECT_MAX+1] = {
1629 1636
1630static int 1637static int
1631ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb, 1638ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
1632 struct nlmsghdr *nlh, struct nlattr *cda[]) 1639 const struct nlmsghdr *nlh,
1640 const struct nlattr * const cda[])
1633{ 1641{
1634 struct nf_conntrack_tuple tuple; 1642 struct nf_conntrack_tuple tuple;
1635 struct nf_conntrack_expect *exp; 1643 struct nf_conntrack_expect *exp;
@@ -1689,7 +1697,8 @@ out:
1689 1697
1690static int 1698static int
1691ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb, 1699ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb,
1692 struct nlmsghdr *nlh, struct nlattr *cda[]) 1700 const struct nlmsghdr *nlh,
1701 const struct nlattr * const cda[])
1693{ 1702{
1694 struct nf_conntrack_expect *exp; 1703 struct nf_conntrack_expect *exp;
1695 struct nf_conntrack_tuple tuple; 1704 struct nf_conntrack_tuple tuple;
@@ -1767,13 +1776,15 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb,
1767 return 0; 1776 return 0;
1768} 1777}
1769static int 1778static int
1770ctnetlink_change_expect(struct nf_conntrack_expect *x, struct nlattr *cda[]) 1779ctnetlink_change_expect(struct nf_conntrack_expect *x,
1780 const struct nlattr * const cda[])
1771{ 1781{
1772 return -EOPNOTSUPP; 1782 return -EOPNOTSUPP;
1773} 1783}
1774 1784
1775static int 1785static int
1776ctnetlink_create_expect(struct nlattr *cda[], u_int8_t u3, u32 pid, int report) 1786ctnetlink_create_expect(const struct nlattr * const cda[], u_int8_t u3,
1787 u32 pid, int report)
1777{ 1788{
1778 struct nf_conntrack_tuple tuple, mask, master_tuple; 1789 struct nf_conntrack_tuple tuple, mask, master_tuple;
1779 struct nf_conntrack_tuple_hash *h = NULL; 1790 struct nf_conntrack_tuple_hash *h = NULL;
@@ -1831,7 +1842,8 @@ out:
1831 1842
1832static int 1843static int
1833ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb, 1844ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb,
1834 struct nlmsghdr *nlh, struct nlattr *cda[]) 1845 const struct nlmsghdr *nlh,
1846 const struct nlattr * const cda[])
1835{ 1847{
1836 struct nf_conntrack_tuple tuple; 1848 struct nf_conntrack_tuple tuple;
1837 struct nf_conntrack_expect *exp; 1849 struct nf_conntrack_expect *exp;
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 92761a988375..eedc0c1ac7a4 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -170,7 +170,7 @@ replay:
170 if (err < 0) 170 if (err < 0)
171 return err; 171 return err;
172 172
173 err = nc->call(nfnl, skb, nlh, cda); 173 err = nc->call(nfnl, skb, nlh, (const struct nlattr **)cda);
174 if (err == -EAGAIN) 174 if (err == -EAGAIN)
175 goto replay; 175 goto replay;
176 return err; 176 return err;
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 66a6dd5c519a..f900dc3194af 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -694,7 +694,8 @@ static struct notifier_block nfulnl_rtnl_notifier = {
694 694
695static int 695static int
696nfulnl_recv_unsupp(struct sock *ctnl, struct sk_buff *skb, 696nfulnl_recv_unsupp(struct sock *ctnl, struct sk_buff *skb,
697 struct nlmsghdr *nlh, struct nlattr *nfqa[]) 697 const struct nlmsghdr *nlh,
698 const struct nlattr * const nfqa[])
698{ 699{
699 return -ENOTSUPP; 700 return -ENOTSUPP;
700} 701}
@@ -716,7 +717,8 @@ static const struct nla_policy nfula_cfg_policy[NFULA_CFG_MAX+1] = {
716 717
717static int 718static int
718nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, 719nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
719 struct nlmsghdr *nlh, struct nlattr *nfula[]) 720 const struct nlmsghdr *nlh,
721 const struct nlattr * const nfula[])
720{ 722{
721 struct nfgenmsg *nfmsg = NLMSG_DATA(nlh); 723 struct nfgenmsg *nfmsg = NLMSG_DATA(nlh);
722 u_int16_t group_num = ntohs(nfmsg->res_id); 724 u_int16_t group_num = ntohs(nfmsg->res_id);
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index 71daa0934b6c..7a9dec9fb822 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -608,7 +608,8 @@ static const struct nla_policy nfqa_verdict_policy[NFQA_MAX+1] = {
608 608
609static int 609static int
610nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb, 610nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
611 struct nlmsghdr *nlh, struct nlattr *nfqa[]) 611 const struct nlmsghdr *nlh,
612 const struct nlattr * const nfqa[])
612{ 613{
613 struct nfgenmsg *nfmsg = NLMSG_DATA(nlh); 614 struct nfgenmsg *nfmsg = NLMSG_DATA(nlh);
614 u_int16_t queue_num = ntohs(nfmsg->res_id); 615 u_int16_t queue_num = ntohs(nfmsg->res_id);
@@ -670,7 +671,8 @@ err_out_unlock:
670 671
671static int 672static int
672nfqnl_recv_unsupp(struct sock *ctnl, struct sk_buff *skb, 673nfqnl_recv_unsupp(struct sock *ctnl, struct sk_buff *skb,
673 struct nlmsghdr *nlh, struct nlattr *nfqa[]) 674 const struct nlmsghdr *nlh,
675 const struct nlattr * const nfqa[])
674{ 676{
675 return -ENOTSUPP; 677 return -ENOTSUPP;
676} 678}
@@ -687,7 +689,8 @@ static const struct nf_queue_handler nfqh = {
687 689
688static int 690static int
689nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb, 691nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
690 struct nlmsghdr *nlh, struct nlattr *nfqa[]) 692 const struct nlmsghdr *nlh,
693 const struct nlattr * const nfqa[])
691{ 694{
692 struct nfgenmsg *nfmsg = NLMSG_DATA(nlh); 695 struct nfgenmsg *nfmsg = NLMSG_DATA(nlh);
693 u_int16_t queue_num = ntohs(nfmsg->res_id); 696 u_int16_t queue_num = ntohs(nfmsg->res_id);
diff --git a/net/netfilter/xt_osf.c b/net/netfilter/xt_osf.c
index 0f482e2440b4..63e190504656 100644
--- a/net/netfilter/xt_osf.c
+++ b/net/netfilter/xt_osf.c
@@ -70,7 +70,8 @@ static void xt_osf_finger_free_rcu(struct rcu_head *rcu_head)
70} 70}
71 71
72static int xt_osf_add_callback(struct sock *ctnl, struct sk_buff *skb, 72static int xt_osf_add_callback(struct sock *ctnl, struct sk_buff *skb,
73 struct nlmsghdr *nlh, struct nlattr *osf_attrs[]) 73 const struct nlmsghdr *nlh,
74 const struct nlattr * const osf_attrs[])
74{ 75{
75 struct xt_osf_user_finger *f; 76 struct xt_osf_user_finger *f;
76 struct xt_osf_finger *kf = NULL, *sf; 77 struct xt_osf_finger *kf = NULL, *sf;
@@ -112,7 +113,8 @@ static int xt_osf_add_callback(struct sock *ctnl, struct sk_buff *skb,
112} 113}
113 114
114static int xt_osf_remove_callback(struct sock *ctnl, struct sk_buff *skb, 115static int xt_osf_remove_callback(struct sock *ctnl, struct sk_buff *skb,
115 struct nlmsghdr *nlh, struct nlattr *osf_attrs[]) 116 const struct nlmsghdr *nlh,
117 const struct nlattr * const osf_attrs[])
116{ 118{
117 struct xt_osf_user_finger *f; 119 struct xt_osf_user_finger *f;
118 struct xt_osf_finger *sf; 120 struct xt_osf_finger *sf;