diff options
Diffstat (limited to 'net')
154 files changed, 1577 insertions, 1073 deletions
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 697ac55e29dc..7b1eb9a4fc96 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -1819,6 +1819,22 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1819 | return rc; | 1819 | return rc; |
1820 | } | 1820 | } |
1821 | 1821 | ||
1822 | |||
1823 | #ifdef CONFIG_COMPAT | ||
1824 | static int atalk_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | ||
1825 | { | ||
1826 | /* | ||
1827 | * All Appletalk ioctls except SIOCATALKDIFADDR are standard. And | ||
1828 | * SIOCATALKDIFADDR is handled by upper layer as well, so there is | ||
1829 | * nothing to do. Eventually SIOCATALKDIFADDR should be moved | ||
1830 | * here so there is no generic SIOCPROTOPRIVATE translation in the | ||
1831 | * system. | ||
1832 | */ | ||
1833 | return -ENOIOCTLCMD; | ||
1834 | } | ||
1835 | #endif | ||
1836 | |||
1837 | |||
1822 | static struct net_proto_family atalk_family_ops = { | 1838 | static struct net_proto_family atalk_family_ops = { |
1823 | .family = PF_APPLETALK, | 1839 | .family = PF_APPLETALK, |
1824 | .create = atalk_create, | 1840 | .create = atalk_create, |
@@ -1836,6 +1852,9 @@ static const struct proto_ops SOCKOPS_WRAPPED(atalk_dgram_ops) = { | |||
1836 | .getname = atalk_getname, | 1852 | .getname = atalk_getname, |
1837 | .poll = datagram_poll, | 1853 | .poll = datagram_poll, |
1838 | .ioctl = atalk_ioctl, | 1854 | .ioctl = atalk_ioctl, |
1855 | #ifdef CONFIG_COMPAT | ||
1856 | .compat_ioctl = atalk_compat_ioctl, | ||
1857 | #endif | ||
1839 | .listen = sock_no_listen, | 1858 | .listen = sock_no_listen, |
1840 | .shutdown = sock_no_shutdown, | 1859 | .shutdown = sock_no_shutdown, |
1841 | .setsockopt = sock_no_setsockopt, | 1860 | .setsockopt = sock_no_setsockopt, |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 9106354c781e..a49a6975092d 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -73,23 +73,23 @@ DEFINE_RWLOCK(hci_cb_list_lock); | |||
73 | struct hci_proto *hci_proto[HCI_MAX_PROTO]; | 73 | struct hci_proto *hci_proto[HCI_MAX_PROTO]; |
74 | 74 | ||
75 | /* HCI notifiers list */ | 75 | /* HCI notifiers list */ |
76 | static struct notifier_block *hci_notifier; | 76 | static ATOMIC_NOTIFIER_HEAD(hci_notifier); |
77 | 77 | ||
78 | /* ---- HCI notifications ---- */ | 78 | /* ---- HCI notifications ---- */ |
79 | 79 | ||
80 | int hci_register_notifier(struct notifier_block *nb) | 80 | int hci_register_notifier(struct notifier_block *nb) |
81 | { | 81 | { |
82 | return notifier_chain_register(&hci_notifier, nb); | 82 | return atomic_notifier_chain_register(&hci_notifier, nb); |
83 | } | 83 | } |
84 | 84 | ||
85 | int hci_unregister_notifier(struct notifier_block *nb) | 85 | int hci_unregister_notifier(struct notifier_block *nb) |
86 | { | 86 | { |
87 | return notifier_chain_unregister(&hci_notifier, nb); | 87 | return atomic_notifier_chain_unregister(&hci_notifier, nb); |
88 | } | 88 | } |
89 | 89 | ||
90 | static void hci_notify(struct hci_dev *hdev, int event) | 90 | static void hci_notify(struct hci_dev *hdev, int event) |
91 | { | 91 | { |
92 | notifier_call_chain(&hci_notifier, event, hdev); | 92 | atomic_notifier_call_chain(&hci_notifier, event, hdev); |
93 | } | 93 | } |
94 | 94 | ||
95 | /* ---- HCI requests ---- */ | 95 | /* ---- HCI requests ---- */ |
diff --git a/net/bridge/netfilter/ebt_802_3.c b/net/bridge/netfilter/ebt_802_3.c index 468ebdf4bc1c..d42f63f5e9f8 100644 --- a/net/bridge/netfilter/ebt_802_3.c +++ b/net/bridge/netfilter/ebt_802_3.c | |||
@@ -58,16 +58,16 @@ static struct ebt_match filter_802_3 = | |||
58 | .me = THIS_MODULE, | 58 | .me = THIS_MODULE, |
59 | }; | 59 | }; |
60 | 60 | ||
61 | static int __init init(void) | 61 | static int __init ebt_802_3_init(void) |
62 | { | 62 | { |
63 | return ebt_register_match(&filter_802_3); | 63 | return ebt_register_match(&filter_802_3); |
64 | } | 64 | } |
65 | 65 | ||
66 | static void __exit fini(void) | 66 | static void __exit ebt_802_3_fini(void) |
67 | { | 67 | { |
68 | ebt_unregister_match(&filter_802_3); | 68 | ebt_unregister_match(&filter_802_3); |
69 | } | 69 | } |
70 | 70 | ||
71 | module_init(init); | 71 | module_init(ebt_802_3_init); |
72 | module_exit(fini); | 72 | module_exit(ebt_802_3_fini); |
73 | MODULE_LICENSE("GPL"); | 73 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c index 5a1f5e3bff15..a614485828af 100644 --- a/net/bridge/netfilter/ebt_among.c +++ b/net/bridge/netfilter/ebt_among.c | |||
@@ -213,16 +213,16 @@ static struct ebt_match filter_among = { | |||
213 | .me = THIS_MODULE, | 213 | .me = THIS_MODULE, |
214 | }; | 214 | }; |
215 | 215 | ||
216 | static int __init init(void) | 216 | static int __init ebt_among_init(void) |
217 | { | 217 | { |
218 | return ebt_register_match(&filter_among); | 218 | return ebt_register_match(&filter_among); |
219 | } | 219 | } |
220 | 220 | ||
221 | static void __exit fini(void) | 221 | static void __exit ebt_among_fini(void) |
222 | { | 222 | { |
223 | ebt_unregister_match(&filter_among); | 223 | ebt_unregister_match(&filter_among); |
224 | } | 224 | } |
225 | 225 | ||
226 | module_init(init); | 226 | module_init(ebt_among_init); |
227 | module_exit(fini); | 227 | module_exit(ebt_among_fini); |
228 | MODULE_LICENSE("GPL"); | 228 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebt_arp.c b/net/bridge/netfilter/ebt_arp.c index b94c48cb6e4b..a6c81d9f73b8 100644 --- a/net/bridge/netfilter/ebt_arp.c +++ b/net/bridge/netfilter/ebt_arp.c | |||
@@ -125,16 +125,16 @@ static struct ebt_match filter_arp = | |||
125 | .me = THIS_MODULE, | 125 | .me = THIS_MODULE, |
126 | }; | 126 | }; |
127 | 127 | ||
128 | static int __init init(void) | 128 | static int __init ebt_arp_init(void) |
129 | { | 129 | { |
130 | return ebt_register_match(&filter_arp); | 130 | return ebt_register_match(&filter_arp); |
131 | } | 131 | } |
132 | 132 | ||
133 | static void __exit fini(void) | 133 | static void __exit ebt_arp_fini(void) |
134 | { | 134 | { |
135 | ebt_unregister_match(&filter_arp); | 135 | ebt_unregister_match(&filter_arp); |
136 | } | 136 | } |
137 | 137 | ||
138 | module_init(init); | 138 | module_init(ebt_arp_init); |
139 | module_exit(fini); | 139 | module_exit(ebt_arp_fini); |
140 | MODULE_LICENSE("GPL"); | 140 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebt_arpreply.c b/net/bridge/netfilter/ebt_arpreply.c index b934de90f7c5..d19fc4b328dc 100644 --- a/net/bridge/netfilter/ebt_arpreply.c +++ b/net/bridge/netfilter/ebt_arpreply.c | |||
@@ -82,16 +82,16 @@ static struct ebt_target reply_target = | |||
82 | .me = THIS_MODULE, | 82 | .me = THIS_MODULE, |
83 | }; | 83 | }; |
84 | 84 | ||
85 | static int __init init(void) | 85 | static int __init ebt_arpreply_init(void) |
86 | { | 86 | { |
87 | return ebt_register_target(&reply_target); | 87 | return ebt_register_target(&reply_target); |
88 | } | 88 | } |
89 | 89 | ||
90 | static void __exit fini(void) | 90 | static void __exit ebt_arpreply_fini(void) |
91 | { | 91 | { |
92 | ebt_unregister_target(&reply_target); | 92 | ebt_unregister_target(&reply_target); |
93 | } | 93 | } |
94 | 94 | ||
95 | module_init(init); | 95 | module_init(ebt_arpreply_init); |
96 | module_exit(fini); | 96 | module_exit(ebt_arpreply_fini); |
97 | MODULE_LICENSE("GPL"); | 97 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebt_dnat.c b/net/bridge/netfilter/ebt_dnat.c index f5463086c7bd..4582659dff0e 100644 --- a/net/bridge/netfilter/ebt_dnat.c +++ b/net/bridge/netfilter/ebt_dnat.c | |||
@@ -61,16 +61,16 @@ static struct ebt_target dnat = | |||
61 | .me = THIS_MODULE, | 61 | .me = THIS_MODULE, |
62 | }; | 62 | }; |
63 | 63 | ||
64 | static int __init init(void) | 64 | static int __init ebt_dnat_init(void) |
65 | { | 65 | { |
66 | return ebt_register_target(&dnat); | 66 | return ebt_register_target(&dnat); |
67 | } | 67 | } |
68 | 68 | ||
69 | static void __exit fini(void) | 69 | static void __exit ebt_dnat_fini(void) |
70 | { | 70 | { |
71 | ebt_unregister_target(&dnat); | 71 | ebt_unregister_target(&dnat); |
72 | } | 72 | } |
73 | 73 | ||
74 | module_init(init); | 74 | module_init(ebt_dnat_init); |
75 | module_exit(fini); | 75 | module_exit(ebt_dnat_fini); |
76 | MODULE_LICENSE("GPL"); | 76 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebt_ip.c b/net/bridge/netfilter/ebt_ip.c index dc5d0b2427cf..65b665ce57b5 100644 --- a/net/bridge/netfilter/ebt_ip.c +++ b/net/bridge/netfilter/ebt_ip.c | |||
@@ -112,16 +112,16 @@ static struct ebt_match filter_ip = | |||
112 | .me = THIS_MODULE, | 112 | .me = THIS_MODULE, |
113 | }; | 113 | }; |
114 | 114 | ||
115 | static int __init init(void) | 115 | static int __init ebt_ip_init(void) |
116 | { | 116 | { |
117 | return ebt_register_match(&filter_ip); | 117 | return ebt_register_match(&filter_ip); |
118 | } | 118 | } |
119 | 119 | ||
120 | static void __exit fini(void) | 120 | static void __exit ebt_ip_fini(void) |
121 | { | 121 | { |
122 | ebt_unregister_match(&filter_ip); | 122 | ebt_unregister_match(&filter_ip); |
123 | } | 123 | } |
124 | 124 | ||
125 | module_init(init); | 125 | module_init(ebt_ip_init); |
126 | module_exit(fini); | 126 | module_exit(ebt_ip_fini); |
127 | MODULE_LICENSE("GPL"); | 127 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebt_limit.c b/net/bridge/netfilter/ebt_limit.c index 637c8844cd5f..d48fa5cb26cf 100644 --- a/net/bridge/netfilter/ebt_limit.c +++ b/net/bridge/netfilter/ebt_limit.c | |||
@@ -98,16 +98,16 @@ static struct ebt_match ebt_limit_reg = | |||
98 | .me = THIS_MODULE, | 98 | .me = THIS_MODULE, |
99 | }; | 99 | }; |
100 | 100 | ||
101 | static int __init init(void) | 101 | static int __init ebt_limit_init(void) |
102 | { | 102 | { |
103 | return ebt_register_match(&ebt_limit_reg); | 103 | return ebt_register_match(&ebt_limit_reg); |
104 | } | 104 | } |
105 | 105 | ||
106 | static void __exit fini(void) | 106 | static void __exit ebt_limit_fini(void) |
107 | { | 107 | { |
108 | ebt_unregister_match(&ebt_limit_reg); | 108 | ebt_unregister_match(&ebt_limit_reg); |
109 | } | 109 | } |
110 | 110 | ||
111 | module_init(init); | 111 | module_init(ebt_limit_init); |
112 | module_exit(fini); | 112 | module_exit(ebt_limit_fini); |
113 | MODULE_LICENSE("GPL"); | 113 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c index 288ff1d4ccc4..d159c92cca84 100644 --- a/net/bridge/netfilter/ebt_log.c +++ b/net/bridge/netfilter/ebt_log.c | |||
@@ -188,7 +188,7 @@ static struct nf_logger ebt_log_logger = { | |||
188 | .me = THIS_MODULE, | 188 | .me = THIS_MODULE, |
189 | }; | 189 | }; |
190 | 190 | ||
191 | static int __init init(void) | 191 | static int __init ebt_log_init(void) |
192 | { | 192 | { |
193 | int ret; | 193 | int ret; |
194 | 194 | ||
@@ -205,12 +205,12 @@ static int __init init(void) | |||
205 | return 0; | 205 | return 0; |
206 | } | 206 | } |
207 | 207 | ||
208 | static void __exit fini(void) | 208 | static void __exit ebt_log_fini(void) |
209 | { | 209 | { |
210 | nf_log_unregister_logger(&ebt_log_logger); | 210 | nf_log_unregister_logger(&ebt_log_logger); |
211 | ebt_unregister_watcher(&log); | 211 | ebt_unregister_watcher(&log); |
212 | } | 212 | } |
213 | 213 | ||
214 | module_init(init); | 214 | module_init(ebt_log_init); |
215 | module_exit(fini); | 215 | module_exit(ebt_log_fini); |
216 | MODULE_LICENSE("GPL"); | 216 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebt_mark.c b/net/bridge/netfilter/ebt_mark.c index c93d35ab95c0..770c0df972a3 100644 --- a/net/bridge/netfilter/ebt_mark.c +++ b/net/bridge/netfilter/ebt_mark.c | |||
@@ -52,16 +52,16 @@ static struct ebt_target mark_target = | |||
52 | .me = THIS_MODULE, | 52 | .me = THIS_MODULE, |
53 | }; | 53 | }; |
54 | 54 | ||
55 | static int __init init(void) | 55 | static int __init ebt_mark_init(void) |
56 | { | 56 | { |
57 | return ebt_register_target(&mark_target); | 57 | return ebt_register_target(&mark_target); |
58 | } | 58 | } |
59 | 59 | ||
60 | static void __exit fini(void) | 60 | static void __exit ebt_mark_fini(void) |
61 | { | 61 | { |
62 | ebt_unregister_target(&mark_target); | 62 | ebt_unregister_target(&mark_target); |
63 | } | 63 | } |
64 | 64 | ||
65 | module_init(init); | 65 | module_init(ebt_mark_init); |
66 | module_exit(fini); | 66 | module_exit(ebt_mark_fini); |
67 | MODULE_LICENSE("GPL"); | 67 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebt_mark_m.c b/net/bridge/netfilter/ebt_mark_m.c index 625102de1495..a6413e4b4982 100644 --- a/net/bridge/netfilter/ebt_mark_m.c +++ b/net/bridge/netfilter/ebt_mark_m.c | |||
@@ -47,16 +47,16 @@ static struct ebt_match filter_mark = | |||
47 | .me = THIS_MODULE, | 47 | .me = THIS_MODULE, |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static int __init init(void) | 50 | static int __init ebt_mark_m_init(void) |
51 | { | 51 | { |
52 | return ebt_register_match(&filter_mark); | 52 | return ebt_register_match(&filter_mark); |
53 | } | 53 | } |
54 | 54 | ||
55 | static void __exit fini(void) | 55 | static void __exit ebt_mark_m_fini(void) |
56 | { | 56 | { |
57 | ebt_unregister_match(&filter_mark); | 57 | ebt_unregister_match(&filter_mark); |
58 | } | 58 | } |
59 | 59 | ||
60 | module_init(init); | 60 | module_init(ebt_mark_m_init); |
61 | module_exit(fini); | 61 | module_exit(ebt_mark_m_fini); |
62 | MODULE_LICENSE("GPL"); | 62 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebt_pkttype.c b/net/bridge/netfilter/ebt_pkttype.c index ecd3b42b19b0..4fffd70e4da7 100644 --- a/net/bridge/netfilter/ebt_pkttype.c +++ b/net/bridge/netfilter/ebt_pkttype.c | |||
@@ -44,16 +44,16 @@ static struct ebt_match filter_pkttype = | |||
44 | .me = THIS_MODULE, | 44 | .me = THIS_MODULE, |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static int __init init(void) | 47 | static int __init ebt_pkttype_init(void) |
48 | { | 48 | { |
49 | return ebt_register_match(&filter_pkttype); | 49 | return ebt_register_match(&filter_pkttype); |
50 | } | 50 | } |
51 | 51 | ||
52 | static void __exit fini(void) | 52 | static void __exit ebt_pkttype_fini(void) |
53 | { | 53 | { |
54 | ebt_unregister_match(&filter_pkttype); | 54 | ebt_unregister_match(&filter_pkttype); |
55 | } | 55 | } |
56 | 56 | ||
57 | module_init(init); | 57 | module_init(ebt_pkttype_init); |
58 | module_exit(fini); | 58 | module_exit(ebt_pkttype_fini); |
59 | MODULE_LICENSE("GPL"); | 59 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebt_redirect.c b/net/bridge/netfilter/ebt_redirect.c index 1538b4386662..9f378eab72d0 100644 --- a/net/bridge/netfilter/ebt_redirect.c +++ b/net/bridge/netfilter/ebt_redirect.c | |||
@@ -66,16 +66,16 @@ static struct ebt_target redirect_target = | |||
66 | .me = THIS_MODULE, | 66 | .me = THIS_MODULE, |
67 | }; | 67 | }; |
68 | 68 | ||
69 | static int __init init(void) | 69 | static int __init ebt_redirect_init(void) |
70 | { | 70 | { |
71 | return ebt_register_target(&redirect_target); | 71 | return ebt_register_target(&redirect_target); |
72 | } | 72 | } |
73 | 73 | ||
74 | static void __exit fini(void) | 74 | static void __exit ebt_redirect_fini(void) |
75 | { | 75 | { |
76 | ebt_unregister_target(&redirect_target); | 76 | ebt_unregister_target(&redirect_target); |
77 | } | 77 | } |
78 | 78 | ||
79 | module_init(init); | 79 | module_init(ebt_redirect_init); |
80 | module_exit(fini); | 80 | module_exit(ebt_redirect_fini); |
81 | MODULE_LICENSE("GPL"); | 81 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebt_snat.c b/net/bridge/netfilter/ebt_snat.c index 1529bdcb9a48..cbb33e24ca8a 100644 --- a/net/bridge/netfilter/ebt_snat.c +++ b/net/bridge/netfilter/ebt_snat.c | |||
@@ -61,16 +61,16 @@ static struct ebt_target snat = | |||
61 | .me = THIS_MODULE, | 61 | .me = THIS_MODULE, |
62 | }; | 62 | }; |
63 | 63 | ||
64 | static int __init init(void) | 64 | static int __init ebt_snat_init(void) |
65 | { | 65 | { |
66 | return ebt_register_target(&snat); | 66 | return ebt_register_target(&snat); |
67 | } | 67 | } |
68 | 68 | ||
69 | static void __exit fini(void) | 69 | static void __exit ebt_snat_fini(void) |
70 | { | 70 | { |
71 | ebt_unregister_target(&snat); | 71 | ebt_unregister_target(&snat); |
72 | } | 72 | } |
73 | 73 | ||
74 | module_init(init); | 74 | module_init(ebt_snat_init); |
75 | module_exit(fini); | 75 | module_exit(ebt_snat_fini); |
76 | MODULE_LICENSE("GPL"); | 76 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebt_stp.c b/net/bridge/netfilter/ebt_stp.c index 0248c67277ee..a0bed82145ed 100644 --- a/net/bridge/netfilter/ebt_stp.c +++ b/net/bridge/netfilter/ebt_stp.c | |||
@@ -180,16 +180,16 @@ static struct ebt_match filter_stp = | |||
180 | .me = THIS_MODULE, | 180 | .me = THIS_MODULE, |
181 | }; | 181 | }; |
182 | 182 | ||
183 | static int __init init(void) | 183 | static int __init ebt_stp_init(void) |
184 | { | 184 | { |
185 | return ebt_register_match(&filter_stp); | 185 | return ebt_register_match(&filter_stp); |
186 | } | 186 | } |
187 | 187 | ||
188 | static void __exit fini(void) | 188 | static void __exit ebt_stp_fini(void) |
189 | { | 189 | { |
190 | ebt_unregister_match(&filter_stp); | 190 | ebt_unregister_match(&filter_stp); |
191 | } | 191 | } |
192 | 192 | ||
193 | module_init(init); | 193 | module_init(ebt_stp_init); |
194 | module_exit(fini); | 194 | module_exit(ebt_stp_fini); |
195 | MODULE_LICENSE("GPL"); | 195 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c index 802baf755ef4..ee5a51761260 100644 --- a/net/bridge/netfilter/ebt_ulog.c +++ b/net/bridge/netfilter/ebt_ulog.c | |||
@@ -281,7 +281,7 @@ static struct nf_logger ebt_ulog_logger = { | |||
281 | .me = THIS_MODULE, | 281 | .me = THIS_MODULE, |
282 | }; | 282 | }; |
283 | 283 | ||
284 | static int __init init(void) | 284 | static int __init ebt_ulog_init(void) |
285 | { | 285 | { |
286 | int i, ret = 0; | 286 | int i, ret = 0; |
287 | 287 | ||
@@ -316,7 +316,7 @@ static int __init init(void) | |||
316 | return ret; | 316 | return ret; |
317 | } | 317 | } |
318 | 318 | ||
319 | static void __exit fini(void) | 319 | static void __exit ebt_ulog_fini(void) |
320 | { | 320 | { |
321 | ebt_ulog_buff_t *ub; | 321 | ebt_ulog_buff_t *ub; |
322 | int i; | 322 | int i; |
@@ -337,8 +337,8 @@ static void __exit fini(void) | |||
337 | sock_release(ebtulognl->sk_socket); | 337 | sock_release(ebtulognl->sk_socket); |
338 | } | 338 | } |
339 | 339 | ||
340 | module_init(init); | 340 | module_init(ebt_ulog_init); |
341 | module_exit(fini); | 341 | module_exit(ebt_ulog_fini); |
342 | MODULE_LICENSE("GPL"); | 342 | MODULE_LICENSE("GPL"); |
343 | MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>"); | 343 | MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>"); |
344 | MODULE_DESCRIPTION("ebtables userspace logging module for bridged Ethernet" | 344 | MODULE_DESCRIPTION("ebtables userspace logging module for bridged Ethernet" |
diff --git a/net/bridge/netfilter/ebt_vlan.c b/net/bridge/netfilter/ebt_vlan.c index db60d734908b..a2b452862b73 100644 --- a/net/bridge/netfilter/ebt_vlan.c +++ b/net/bridge/netfilter/ebt_vlan.c | |||
@@ -178,7 +178,7 @@ static struct ebt_match filter_vlan = { | |||
178 | .me = THIS_MODULE, | 178 | .me = THIS_MODULE, |
179 | }; | 179 | }; |
180 | 180 | ||
181 | static int __init init(void) | 181 | static int __init ebt_vlan_init(void) |
182 | { | 182 | { |
183 | DEBUG_MSG("ebtables 802.1Q extension module v" | 183 | DEBUG_MSG("ebtables 802.1Q extension module v" |
184 | MODULE_VERS "\n"); | 184 | MODULE_VERS "\n"); |
@@ -186,10 +186,10 @@ static int __init init(void) | |||
186 | return ebt_register_match(&filter_vlan); | 186 | return ebt_register_match(&filter_vlan); |
187 | } | 187 | } |
188 | 188 | ||
189 | static void __exit fini(void) | 189 | static void __exit ebt_vlan_fini(void) |
190 | { | 190 | { |
191 | ebt_unregister_match(&filter_vlan); | 191 | ebt_unregister_match(&filter_vlan); |
192 | } | 192 | } |
193 | 193 | ||
194 | module_init(init); | 194 | module_init(ebt_vlan_init); |
195 | module_exit(fini); | 195 | module_exit(ebt_vlan_fini); |
diff --git a/net/bridge/netfilter/ebtable_broute.c b/net/bridge/netfilter/ebtable_broute.c index 1767c94cd3de..9a6e548e148b 100644 --- a/net/bridge/netfilter/ebtable_broute.c +++ b/net/bridge/netfilter/ebtable_broute.c | |||
@@ -62,7 +62,7 @@ static int ebt_broute(struct sk_buff **pskb) | |||
62 | return 0; /* bridge it */ | 62 | return 0; /* bridge it */ |
63 | } | 63 | } |
64 | 64 | ||
65 | static int __init init(void) | 65 | static int __init ebtable_broute_init(void) |
66 | { | 66 | { |
67 | int ret; | 67 | int ret; |
68 | 68 | ||
@@ -74,13 +74,13 @@ static int __init init(void) | |||
74 | return ret; | 74 | return ret; |
75 | } | 75 | } |
76 | 76 | ||
77 | static void __exit fini(void) | 77 | static void __exit ebtable_broute_fini(void) |
78 | { | 78 | { |
79 | br_should_route_hook = NULL; | 79 | br_should_route_hook = NULL; |
80 | synchronize_net(); | 80 | synchronize_net(); |
81 | ebt_unregister_table(&broute_table); | 81 | ebt_unregister_table(&broute_table); |
82 | } | 82 | } |
83 | 83 | ||
84 | module_init(init); | 84 | module_init(ebtable_broute_init); |
85 | module_exit(fini); | 85 | module_exit(ebtable_broute_fini); |
86 | MODULE_LICENSE("GPL"); | 86 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebtable_filter.c b/net/bridge/netfilter/ebtable_filter.c index c18666e0392b..3d5bd44f2395 100644 --- a/net/bridge/netfilter/ebtable_filter.c +++ b/net/bridge/netfilter/ebtable_filter.c | |||
@@ -91,7 +91,7 @@ static struct nf_hook_ops ebt_ops_filter[] = { | |||
91 | }, | 91 | }, |
92 | }; | 92 | }; |
93 | 93 | ||
94 | static int __init init(void) | 94 | static int __init ebtable_filter_init(void) |
95 | { | 95 | { |
96 | int i, j, ret; | 96 | int i, j, ret; |
97 | 97 | ||
@@ -109,7 +109,7 @@ cleanup: | |||
109 | return ret; | 109 | return ret; |
110 | } | 110 | } |
111 | 111 | ||
112 | static void __exit fini(void) | 112 | static void __exit ebtable_filter_fini(void) |
113 | { | 113 | { |
114 | int i; | 114 | int i; |
115 | 115 | ||
@@ -118,6 +118,6 @@ static void __exit fini(void) | |||
118 | ebt_unregister_table(&frame_filter); | 118 | ebt_unregister_table(&frame_filter); |
119 | } | 119 | } |
120 | 120 | ||
121 | module_init(init); | 121 | module_init(ebtable_filter_init); |
122 | module_exit(fini); | 122 | module_exit(ebtable_filter_fini); |
123 | MODULE_LICENSE("GPL"); | 123 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebtable_nat.c b/net/bridge/netfilter/ebtable_nat.c index 828cac2cc4a3..04dd42efda1d 100644 --- a/net/bridge/netfilter/ebtable_nat.c +++ b/net/bridge/netfilter/ebtable_nat.c | |||
@@ -98,7 +98,7 @@ static struct nf_hook_ops ebt_ops_nat[] = { | |||
98 | }, | 98 | }, |
99 | }; | 99 | }; |
100 | 100 | ||
101 | static int __init init(void) | 101 | static int __init ebtable_nat_init(void) |
102 | { | 102 | { |
103 | int i, ret, j; | 103 | int i, ret, j; |
104 | 104 | ||
@@ -116,7 +116,7 @@ cleanup: | |||
116 | return ret; | 116 | return ret; |
117 | } | 117 | } |
118 | 118 | ||
119 | static void __exit fini(void) | 119 | static void __exit ebtable_nat_fini(void) |
120 | { | 120 | { |
121 | int i; | 121 | int i; |
122 | 122 | ||
@@ -125,6 +125,6 @@ static void __exit fini(void) | |||
125 | ebt_unregister_table(&frame_nat); | 125 | ebt_unregister_table(&frame_nat); |
126 | } | 126 | } |
127 | 127 | ||
128 | module_init(init); | 128 | module_init(ebtable_nat_init); |
129 | module_exit(fini); | 129 | module_exit(ebtable_nat_fini); |
130 | MODULE_LICENSE("GPL"); | 130 | MODULE_LICENSE("GPL"); |
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 997953367204..01eae97c53d9 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -1487,7 +1487,7 @@ static struct nf_sockopt_ops ebt_sockopts = | |||
1487 | .get = do_ebt_get_ctl, | 1487 | .get = do_ebt_get_ctl, |
1488 | }; | 1488 | }; |
1489 | 1489 | ||
1490 | static int __init init(void) | 1490 | static int __init ebtables_init(void) |
1491 | { | 1491 | { |
1492 | int ret; | 1492 | int ret; |
1493 | 1493 | ||
@@ -1501,7 +1501,7 @@ static int __init init(void) | |||
1501 | return 0; | 1501 | return 0; |
1502 | } | 1502 | } |
1503 | 1503 | ||
1504 | static void __exit fini(void) | 1504 | static void __exit ebtables_fini(void) |
1505 | { | 1505 | { |
1506 | nf_unregister_sockopt(&ebt_sockopts); | 1506 | nf_unregister_sockopt(&ebt_sockopts); |
1507 | printk(KERN_NOTICE "Ebtables v2.0 unregistered\n"); | 1507 | printk(KERN_NOTICE "Ebtables v2.0 unregistered\n"); |
@@ -1516,6 +1516,6 @@ EXPORT_SYMBOL(ebt_unregister_watcher); | |||
1516 | EXPORT_SYMBOL(ebt_register_target); | 1516 | EXPORT_SYMBOL(ebt_register_target); |
1517 | EXPORT_SYMBOL(ebt_unregister_target); | 1517 | EXPORT_SYMBOL(ebt_unregister_target); |
1518 | EXPORT_SYMBOL(ebt_do_table); | 1518 | EXPORT_SYMBOL(ebt_do_table); |
1519 | module_init(init); | 1519 | module_init(ebtables_init); |
1520 | module_exit(fini); | 1520 | module_exit(ebtables_fini); |
1521 | MODULE_LICENSE("GPL"); | 1521 | MODULE_LICENSE("GPL"); |
diff --git a/net/core/dev.c b/net/core/dev.c index 8e1dc3051222..a3ab11f34153 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -193,7 +193,7 @@ static inline struct hlist_head *dev_index_hash(int ifindex) | |||
193 | * Our notifier list | 193 | * Our notifier list |
194 | */ | 194 | */ |
195 | 195 | ||
196 | static struct notifier_block *netdev_chain; | 196 | static BLOCKING_NOTIFIER_HEAD(netdev_chain); |
197 | 197 | ||
198 | /* | 198 | /* |
199 | * Device drivers call our routines to queue packets here. We empty the | 199 | * Device drivers call our routines to queue packets here. We empty the |
@@ -736,7 +736,8 @@ int dev_change_name(struct net_device *dev, char *newname) | |||
736 | if (!err) { | 736 | if (!err) { |
737 | hlist_del(&dev->name_hlist); | 737 | hlist_del(&dev->name_hlist); |
738 | hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name)); | 738 | hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name)); |
739 | notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev); | 739 | blocking_notifier_call_chain(&netdev_chain, |
740 | NETDEV_CHANGENAME, dev); | ||
740 | } | 741 | } |
741 | 742 | ||
742 | return err; | 743 | return err; |
@@ -750,7 +751,7 @@ int dev_change_name(struct net_device *dev, char *newname) | |||
750 | */ | 751 | */ |
751 | void netdev_features_change(struct net_device *dev) | 752 | void netdev_features_change(struct net_device *dev) |
752 | { | 753 | { |
753 | notifier_call_chain(&netdev_chain, NETDEV_FEAT_CHANGE, dev); | 754 | blocking_notifier_call_chain(&netdev_chain, NETDEV_FEAT_CHANGE, dev); |
754 | } | 755 | } |
755 | EXPORT_SYMBOL(netdev_features_change); | 756 | EXPORT_SYMBOL(netdev_features_change); |
756 | 757 | ||
@@ -765,7 +766,8 @@ EXPORT_SYMBOL(netdev_features_change); | |||
765 | void netdev_state_change(struct net_device *dev) | 766 | void netdev_state_change(struct net_device *dev) |
766 | { | 767 | { |
767 | if (dev->flags & IFF_UP) { | 768 | if (dev->flags & IFF_UP) { |
768 | notifier_call_chain(&netdev_chain, NETDEV_CHANGE, dev); | 769 | blocking_notifier_call_chain(&netdev_chain, |
770 | NETDEV_CHANGE, dev); | ||
769 | rtmsg_ifinfo(RTM_NEWLINK, dev, 0); | 771 | rtmsg_ifinfo(RTM_NEWLINK, dev, 0); |
770 | } | 772 | } |
771 | } | 773 | } |
@@ -862,7 +864,7 @@ int dev_open(struct net_device *dev) | |||
862 | /* | 864 | /* |
863 | * ... and announce new interface. | 865 | * ... and announce new interface. |
864 | */ | 866 | */ |
865 | notifier_call_chain(&netdev_chain, NETDEV_UP, dev); | 867 | blocking_notifier_call_chain(&netdev_chain, NETDEV_UP, dev); |
866 | } | 868 | } |
867 | return ret; | 869 | return ret; |
868 | } | 870 | } |
@@ -885,7 +887,7 @@ int dev_close(struct net_device *dev) | |||
885 | * Tell people we are going down, so that they can | 887 | * Tell people we are going down, so that they can |
886 | * prepare to death, when device is still operating. | 888 | * prepare to death, when device is still operating. |
887 | */ | 889 | */ |
888 | notifier_call_chain(&netdev_chain, NETDEV_GOING_DOWN, dev); | 890 | blocking_notifier_call_chain(&netdev_chain, NETDEV_GOING_DOWN, dev); |
889 | 891 | ||
890 | dev_deactivate(dev); | 892 | dev_deactivate(dev); |
891 | 893 | ||
@@ -922,7 +924,7 @@ int dev_close(struct net_device *dev) | |||
922 | /* | 924 | /* |
923 | * Tell people we are down | 925 | * Tell people we are down |
924 | */ | 926 | */ |
925 | notifier_call_chain(&netdev_chain, NETDEV_DOWN, dev); | 927 | blocking_notifier_call_chain(&netdev_chain, NETDEV_DOWN, dev); |
926 | 928 | ||
927 | return 0; | 929 | return 0; |
928 | } | 930 | } |
@@ -953,7 +955,7 @@ int register_netdevice_notifier(struct notifier_block *nb) | |||
953 | int err; | 955 | int err; |
954 | 956 | ||
955 | rtnl_lock(); | 957 | rtnl_lock(); |
956 | err = notifier_chain_register(&netdev_chain, nb); | 958 | err = blocking_notifier_chain_register(&netdev_chain, nb); |
957 | if (!err) { | 959 | if (!err) { |
958 | for (dev = dev_base; dev; dev = dev->next) { | 960 | for (dev = dev_base; dev; dev = dev->next) { |
959 | nb->notifier_call(nb, NETDEV_REGISTER, dev); | 961 | nb->notifier_call(nb, NETDEV_REGISTER, dev); |
@@ -981,7 +983,7 @@ int unregister_netdevice_notifier(struct notifier_block *nb) | |||
981 | int err; | 983 | int err; |
982 | 984 | ||
983 | rtnl_lock(); | 985 | rtnl_lock(); |
984 | err = notifier_chain_unregister(&netdev_chain, nb); | 986 | err = blocking_notifier_chain_unregister(&netdev_chain, nb); |
985 | rtnl_unlock(); | 987 | rtnl_unlock(); |
986 | return err; | 988 | return err; |
987 | } | 989 | } |
@@ -992,12 +994,12 @@ int unregister_netdevice_notifier(struct notifier_block *nb) | |||
992 | * @v: pointer passed unmodified to notifier function | 994 | * @v: pointer passed unmodified to notifier function |
993 | * | 995 | * |
994 | * Call all network notifier blocks. Parameters and return value | 996 | * Call all network notifier blocks. Parameters and return value |
995 | * are as for notifier_call_chain(). | 997 | * are as for blocking_notifier_call_chain(). |
996 | */ | 998 | */ |
997 | 999 | ||
998 | int call_netdevice_notifiers(unsigned long val, void *v) | 1000 | int call_netdevice_notifiers(unsigned long val, void *v) |
999 | { | 1001 | { |
1000 | return notifier_call_chain(&netdev_chain, val, v); | 1002 | return blocking_notifier_call_chain(&netdev_chain, val, v); |
1001 | } | 1003 | } |
1002 | 1004 | ||
1003 | /* When > 0 there are consumers of rx skb time stamps */ | 1005 | /* When > 0 there are consumers of rx skb time stamps */ |
@@ -2242,7 +2244,8 @@ int dev_change_flags(struct net_device *dev, unsigned flags) | |||
2242 | if (dev->flags & IFF_UP && | 2244 | if (dev->flags & IFF_UP && |
2243 | ((old_flags ^ dev->flags) &~ (IFF_UP | IFF_PROMISC | IFF_ALLMULTI | | 2245 | ((old_flags ^ dev->flags) &~ (IFF_UP | IFF_PROMISC | IFF_ALLMULTI | |
2244 | IFF_VOLATILE))) | 2246 | IFF_VOLATILE))) |
2245 | notifier_call_chain(&netdev_chain, NETDEV_CHANGE, dev); | 2247 | blocking_notifier_call_chain(&netdev_chain, |
2248 | NETDEV_CHANGE, dev); | ||
2246 | 2249 | ||
2247 | if ((flags ^ dev->gflags) & IFF_PROMISC) { | 2250 | if ((flags ^ dev->gflags) & IFF_PROMISC) { |
2248 | int inc = (flags & IFF_PROMISC) ? +1 : -1; | 2251 | int inc = (flags & IFF_PROMISC) ? +1 : -1; |
@@ -2286,8 +2289,8 @@ int dev_set_mtu(struct net_device *dev, int new_mtu) | |||
2286 | else | 2289 | else |
2287 | dev->mtu = new_mtu; | 2290 | dev->mtu = new_mtu; |
2288 | if (!err && dev->flags & IFF_UP) | 2291 | if (!err && dev->flags & IFF_UP) |
2289 | notifier_call_chain(&netdev_chain, | 2292 | blocking_notifier_call_chain(&netdev_chain, |
2290 | NETDEV_CHANGEMTU, dev); | 2293 | NETDEV_CHANGEMTU, dev); |
2291 | return err; | 2294 | return err; |
2292 | } | 2295 | } |
2293 | 2296 | ||
@@ -2303,7 +2306,8 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa) | |||
2303 | return -ENODEV; | 2306 | return -ENODEV; |
2304 | err = dev->set_mac_address(dev, sa); | 2307 | err = dev->set_mac_address(dev, sa); |
2305 | if (!err) | 2308 | if (!err) |
2306 | notifier_call_chain(&netdev_chain, NETDEV_CHANGEADDR, dev); | 2309 | blocking_notifier_call_chain(&netdev_chain, |
2310 | NETDEV_CHANGEADDR, dev); | ||
2307 | return err; | 2311 | return err; |
2308 | } | 2312 | } |
2309 | 2313 | ||
@@ -2359,7 +2363,7 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd) | |||
2359 | return -EINVAL; | 2363 | return -EINVAL; |
2360 | memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data, | 2364 | memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data, |
2361 | min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len)); | 2365 | min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len)); |
2362 | notifier_call_chain(&netdev_chain, | 2366 | blocking_notifier_call_chain(&netdev_chain, |
2363 | NETDEV_CHANGEADDR, dev); | 2367 | NETDEV_CHANGEADDR, dev); |
2364 | return 0; | 2368 | return 0; |
2365 | 2369 | ||
@@ -2813,7 +2817,7 @@ int register_netdevice(struct net_device *dev) | |||
2813 | write_unlock_bh(&dev_base_lock); | 2817 | write_unlock_bh(&dev_base_lock); |
2814 | 2818 | ||
2815 | /* Notify protocols, that a new device appeared. */ | 2819 | /* Notify protocols, that a new device appeared. */ |
2816 | notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev); | 2820 | blocking_notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev); |
2817 | 2821 | ||
2818 | /* Finish registration after unlock */ | 2822 | /* Finish registration after unlock */ |
2819 | net_set_todo(dev); | 2823 | net_set_todo(dev); |
@@ -2892,7 +2896,7 @@ static void netdev_wait_allrefs(struct net_device *dev) | |||
2892 | rtnl_lock(); | 2896 | rtnl_lock(); |
2893 | 2897 | ||
2894 | /* Rebroadcast unregister notification */ | 2898 | /* Rebroadcast unregister notification */ |
2895 | notifier_call_chain(&netdev_chain, | 2899 | blocking_notifier_call_chain(&netdev_chain, |
2896 | NETDEV_UNREGISTER, dev); | 2900 | NETDEV_UNREGISTER, dev); |
2897 | 2901 | ||
2898 | if (test_bit(__LINK_STATE_LINKWATCH_PENDING, | 2902 | if (test_bit(__LINK_STATE_LINKWATCH_PENDING, |
@@ -3148,7 +3152,7 @@ int unregister_netdevice(struct net_device *dev) | |||
3148 | /* Notify protocols, that we are about to destroy | 3152 | /* Notify protocols, that we are about to destroy |
3149 | this device. They should clean all the things. | 3153 | this device. They should clean all the things. |
3150 | */ | 3154 | */ |
3151 | notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev); | 3155 | blocking_notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev); |
3152 | 3156 | ||
3153 | /* | 3157 | /* |
3154 | * Flush the multicast chain | 3158 | * Flush the multicast chain |
diff --git a/net/core/request_sock.c b/net/core/request_sock.c index 98f0fc923f91..1e44eda1fda9 100644 --- a/net/core/request_sock.c +++ b/net/core/request_sock.c | |||
@@ -51,7 +51,7 @@ int reqsk_queue_alloc(struct request_sock_queue *queue, | |||
51 | 51 | ||
52 | get_random_bytes(&lopt->hash_rnd, sizeof(lopt->hash_rnd)); | 52 | get_random_bytes(&lopt->hash_rnd, sizeof(lopt->hash_rnd)); |
53 | rwlock_init(&queue->syn_wait_lock); | 53 | rwlock_init(&queue->syn_wait_lock); |
54 | queue->rskq_accept_head = queue->rskq_accept_head = NULL; | 54 | queue->rskq_accept_head = NULL; |
55 | lopt->nr_table_entries = nr_table_entries; | 55 | lopt->nr_table_entries = nr_table_entries; |
56 | 56 | ||
57 | write_lock_bh(&queue->syn_wait_lock); | 57 | write_lock_bh(&queue->syn_wait_lock); |
diff --git a/net/core/sock.c b/net/core/sock.c index e110b9004147..a96ea7dd0fc1 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -187,6 +187,99 @@ static void sock_disable_timestamp(struct sock *sk) | |||
187 | } | 187 | } |
188 | 188 | ||
189 | 189 | ||
190 | int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | ||
191 | { | ||
192 | int err = 0; | ||
193 | int skb_len; | ||
194 | |||
195 | /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces | ||
196 | number of warnings when compiling with -W --ANK | ||
197 | */ | ||
198 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= | ||
199 | (unsigned)sk->sk_rcvbuf) { | ||
200 | err = -ENOMEM; | ||
201 | goto out; | ||
202 | } | ||
203 | |||
204 | /* It would be deadlock, if sock_queue_rcv_skb is used | ||
205 | with socket lock! We assume that users of this | ||
206 | function are lock free. | ||
207 | */ | ||
208 | err = sk_filter(sk, skb, 1); | ||
209 | if (err) | ||
210 | goto out; | ||
211 | |||
212 | skb->dev = NULL; | ||
213 | skb_set_owner_r(skb, sk); | ||
214 | |||
215 | /* Cache the SKB length before we tack it onto the receive | ||
216 | * queue. Once it is added it no longer belongs to us and | ||
217 | * may be freed by other threads of control pulling packets | ||
218 | * from the queue. | ||
219 | */ | ||
220 | skb_len = skb->len; | ||
221 | |||
222 | skb_queue_tail(&sk->sk_receive_queue, skb); | ||
223 | |||
224 | if (!sock_flag(sk, SOCK_DEAD)) | ||
225 | sk->sk_data_ready(sk, skb_len); | ||
226 | out: | ||
227 | return err; | ||
228 | } | ||
229 | EXPORT_SYMBOL(sock_queue_rcv_skb); | ||
230 | |||
231 | int sk_receive_skb(struct sock *sk, struct sk_buff *skb) | ||
232 | { | ||
233 | int rc = NET_RX_SUCCESS; | ||
234 | |||
235 | if (sk_filter(sk, skb, 0)) | ||
236 | goto discard_and_relse; | ||
237 | |||
238 | skb->dev = NULL; | ||
239 | |||
240 | bh_lock_sock(sk); | ||
241 | if (!sock_owned_by_user(sk)) | ||
242 | rc = sk->sk_backlog_rcv(sk, skb); | ||
243 | else | ||
244 | sk_add_backlog(sk, skb); | ||
245 | bh_unlock_sock(sk); | ||
246 | out: | ||
247 | sock_put(sk); | ||
248 | return rc; | ||
249 | discard_and_relse: | ||
250 | kfree_skb(skb); | ||
251 | goto out; | ||
252 | } | ||
253 | EXPORT_SYMBOL(sk_receive_skb); | ||
254 | |||
255 | struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie) | ||
256 | { | ||
257 | struct dst_entry *dst = sk->sk_dst_cache; | ||
258 | |||
259 | if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) { | ||
260 | sk->sk_dst_cache = NULL; | ||
261 | dst_release(dst); | ||
262 | return NULL; | ||
263 | } | ||
264 | |||
265 | return dst; | ||
266 | } | ||
267 | EXPORT_SYMBOL(__sk_dst_check); | ||
268 | |||
269 | struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie) | ||
270 | { | ||
271 | struct dst_entry *dst = sk_dst_get(sk); | ||
272 | |||
273 | if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) { | ||
274 | sk_dst_reset(sk); | ||
275 | dst_release(dst); | ||
276 | return NULL; | ||
277 | } | ||
278 | |||
279 | return dst; | ||
280 | } | ||
281 | EXPORT_SYMBOL(sk_dst_check); | ||
282 | |||
190 | /* | 283 | /* |
191 | * This is meant for all protocols to use and covers goings on | 284 | * This is meant for all protocols to use and covers goings on |
192 | * at the socket level. Everything here is generic. | 285 | * at the socket level. Everything here is generic. |
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index cc7b9d9255ef..d2ae9893ca17 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -68,7 +68,7 @@ __le16 decnet_address = 0; | |||
68 | 68 | ||
69 | static DEFINE_RWLOCK(dndev_lock); | 69 | static DEFINE_RWLOCK(dndev_lock); |
70 | static struct net_device *decnet_default_device; | 70 | static struct net_device *decnet_default_device; |
71 | static struct notifier_block *dnaddr_chain; | 71 | static BLOCKING_NOTIFIER_HEAD(dnaddr_chain); |
72 | 72 | ||
73 | static struct dn_dev *dn_dev_create(struct net_device *dev, int *err); | 73 | static struct dn_dev *dn_dev_create(struct net_device *dev, int *err); |
74 | static void dn_dev_delete(struct net_device *dev); | 74 | static void dn_dev_delete(struct net_device *dev); |
@@ -446,7 +446,7 @@ static void dn_dev_del_ifa(struct dn_dev *dn_db, struct dn_ifaddr **ifap, int de | |||
446 | } | 446 | } |
447 | 447 | ||
448 | rtmsg_ifa(RTM_DELADDR, ifa1); | 448 | rtmsg_ifa(RTM_DELADDR, ifa1); |
449 | notifier_call_chain(&dnaddr_chain, NETDEV_DOWN, ifa1); | 449 | blocking_notifier_call_chain(&dnaddr_chain, NETDEV_DOWN, ifa1); |
450 | if (destroy) { | 450 | if (destroy) { |
451 | dn_dev_free_ifa(ifa1); | 451 | dn_dev_free_ifa(ifa1); |
452 | 452 | ||
@@ -481,7 +481,7 @@ static int dn_dev_insert_ifa(struct dn_dev *dn_db, struct dn_ifaddr *ifa) | |||
481 | dn_db->ifa_list = ifa; | 481 | dn_db->ifa_list = ifa; |
482 | 482 | ||
483 | rtmsg_ifa(RTM_NEWADDR, ifa); | 483 | rtmsg_ifa(RTM_NEWADDR, ifa); |
484 | notifier_call_chain(&dnaddr_chain, NETDEV_UP, ifa); | 484 | blocking_notifier_call_chain(&dnaddr_chain, NETDEV_UP, ifa); |
485 | 485 | ||
486 | return 0; | 486 | return 0; |
487 | } | 487 | } |
@@ -1285,12 +1285,12 @@ void dn_dev_devices_on(void) | |||
1285 | 1285 | ||
1286 | int register_dnaddr_notifier(struct notifier_block *nb) | 1286 | int register_dnaddr_notifier(struct notifier_block *nb) |
1287 | { | 1287 | { |
1288 | return notifier_chain_register(&dnaddr_chain, nb); | 1288 | return blocking_notifier_chain_register(&dnaddr_chain, nb); |
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | int unregister_dnaddr_notifier(struct notifier_block *nb) | 1291 | int unregister_dnaddr_notifier(struct notifier_block *nb) |
1292 | { | 1292 | { |
1293 | return notifier_chain_unregister(&dnaddr_chain, nb); | 1293 | return blocking_notifier_chain_unregister(&dnaddr_chain, nb); |
1294 | } | 1294 | } |
1295 | 1295 | ||
1296 | #ifdef CONFIG_PROC_FS | 1296 | #ifdef CONFIG_PROC_FS |
diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c index 16a5a31e2126..74133ecd7700 100644 --- a/net/decnet/netfilter/dn_rtmsg.c +++ b/net/decnet/netfilter/dn_rtmsg.c | |||
@@ -133,7 +133,7 @@ static struct nf_hook_ops dnrmg_ops = { | |||
133 | .priority = NF_DN_PRI_DNRTMSG, | 133 | .priority = NF_DN_PRI_DNRTMSG, |
134 | }; | 134 | }; |
135 | 135 | ||
136 | static int __init init(void) | 136 | static int __init dn_rtmsg_init(void) |
137 | { | 137 | { |
138 | int rv = 0; | 138 | int rv = 0; |
139 | 139 | ||
@@ -152,7 +152,7 @@ static int __init init(void) | |||
152 | return rv; | 152 | return rv; |
153 | } | 153 | } |
154 | 154 | ||
155 | static void __exit fini(void) | 155 | static void __exit dn_rtmsg_fini(void) |
156 | { | 156 | { |
157 | nf_unregister_hook(&dnrmg_ops); | 157 | nf_unregister_hook(&dnrmg_ops); |
158 | sock_release(dnrmg->sk_socket); | 158 | sock_release(dnrmg->sk_socket); |
@@ -164,6 +164,6 @@ MODULE_AUTHOR("Steven Whitehouse <steve@chygwyn.com>"); | |||
164 | MODULE_LICENSE("GPL"); | 164 | MODULE_LICENSE("GPL"); |
165 | MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_DNRTMSG); | 165 | MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_DNRTMSG); |
166 | 166 | ||
167 | module_init(init); | 167 | module_init(dn_rtmsg_init); |
168 | module_exit(fini); | 168 | module_exit(dn_rtmsg_fini); |
169 | 169 | ||
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index c792994d7952..868265619dbb 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/spinlock.h> | 42 | #include <linux/spinlock.h> |
43 | #include <linux/rcupdate.h> | 43 | #include <linux/rcupdate.h> |
44 | #include <linux/bitops.h> | 44 | #include <linux/bitops.h> |
45 | #include <linux/mutex.h> | ||
45 | 46 | ||
46 | #include <asm/uaccess.h> | 47 | #include <asm/uaccess.h> |
47 | #include <asm/system.h> | 48 | #include <asm/system.h> |
@@ -49,6 +50,7 @@ | |||
49 | static const struct proto_ops econet_ops; | 50 | static const struct proto_ops econet_ops; |
50 | static struct hlist_head econet_sklist; | 51 | static struct hlist_head econet_sklist; |
51 | static DEFINE_RWLOCK(econet_lock); | 52 | static DEFINE_RWLOCK(econet_lock); |
53 | static DEFINE_MUTEX(econet_mutex); | ||
52 | 54 | ||
53 | /* Since there are only 256 possible network numbers (or fewer, depends | 55 | /* Since there are only 256 possible network numbers (or fewer, depends |
54 | how you count) it makes sense to use a simple lookup table. */ | 56 | how you count) it makes sense to use a simple lookup table. */ |
@@ -124,6 +126,8 @@ static int econet_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
124 | 126 | ||
125 | msg->msg_namelen = sizeof(struct sockaddr_ec); | 127 | msg->msg_namelen = sizeof(struct sockaddr_ec); |
126 | 128 | ||
129 | mutex_lock(&econet_mutex); | ||
130 | |||
127 | /* | 131 | /* |
128 | * Call the generic datagram receiver. This handles all sorts | 132 | * Call the generic datagram receiver. This handles all sorts |
129 | * of horrible races and re-entrancy so we can forget about it | 133 | * of horrible races and re-entrancy so we can forget about it |
@@ -174,6 +178,7 @@ static int econet_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
174 | out_free: | 178 | out_free: |
175 | skb_free_datagram(sk, skb); | 179 | skb_free_datagram(sk, skb); |
176 | out: | 180 | out: |
181 | mutex_unlock(&econet_mutex); | ||
177 | return err; | 182 | return err; |
178 | } | 183 | } |
179 | 184 | ||
@@ -184,8 +189,8 @@ out: | |||
184 | static int econet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | 189 | static int econet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
185 | { | 190 | { |
186 | struct sockaddr_ec *sec = (struct sockaddr_ec *)uaddr; | 191 | struct sockaddr_ec *sec = (struct sockaddr_ec *)uaddr; |
187 | struct sock *sk=sock->sk; | 192 | struct sock *sk; |
188 | struct econet_sock *eo = ec_sk(sk); | 193 | struct econet_sock *eo; |
189 | 194 | ||
190 | /* | 195 | /* |
191 | * Check legality | 196 | * Check legality |
@@ -195,11 +200,18 @@ static int econet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len | |||
195 | sec->sec_family != AF_ECONET) | 200 | sec->sec_family != AF_ECONET) |
196 | return -EINVAL; | 201 | return -EINVAL; |
197 | 202 | ||
203 | mutex_lock(&econet_mutex); | ||
204 | |||
205 | sk = sock->sk; | ||
206 | eo = ec_sk(sk); | ||
207 | |||
198 | eo->cb = sec->cb; | 208 | eo->cb = sec->cb; |
199 | eo->port = sec->port; | 209 | eo->port = sec->port; |
200 | eo->station = sec->addr.station; | 210 | eo->station = sec->addr.station; |
201 | eo->net = sec->addr.net; | 211 | eo->net = sec->addr.net; |
202 | 212 | ||
213 | mutex_unlock(&econet_mutex); | ||
214 | |||
203 | return 0; | 215 | return 0; |
204 | } | 216 | } |
205 | 217 | ||
@@ -284,6 +296,8 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
284 | * Get and verify the address. | 296 | * Get and verify the address. |
285 | */ | 297 | */ |
286 | 298 | ||
299 | mutex_lock(&econet_mutex); | ||
300 | |||
287 | if (saddr == NULL) { | 301 | if (saddr == NULL) { |
288 | struct econet_sock *eo = ec_sk(sk); | 302 | struct econet_sock *eo = ec_sk(sk); |
289 | 303 | ||
@@ -292,8 +306,10 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
292 | port = eo->port; | 306 | port = eo->port; |
293 | cb = eo->cb; | 307 | cb = eo->cb; |
294 | } else { | 308 | } else { |
295 | if (msg->msg_namelen < sizeof(struct sockaddr_ec)) | 309 | if (msg->msg_namelen < sizeof(struct sockaddr_ec)) { |
310 | mutex_unlock(&econet_mutex); | ||
296 | return -EINVAL; | 311 | return -EINVAL; |
312 | } | ||
297 | addr.station = saddr->addr.station; | 313 | addr.station = saddr->addr.station; |
298 | addr.net = saddr->addr.net; | 314 | addr.net = saddr->addr.net; |
299 | port = saddr->port; | 315 | port = saddr->port; |
@@ -304,19 +320,21 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
304 | dev = net2dev_map[addr.net]; | 320 | dev = net2dev_map[addr.net]; |
305 | 321 | ||
306 | /* If not directly reachable, use some default */ | 322 | /* If not directly reachable, use some default */ |
307 | if (dev == NULL) | 323 | if (dev == NULL) { |
308 | { | ||
309 | dev = net2dev_map[0]; | 324 | dev = net2dev_map[0]; |
310 | /* No interfaces at all? */ | 325 | /* No interfaces at all? */ |
311 | if (dev == NULL) | 326 | if (dev == NULL) { |
327 | mutex_unlock(&econet_mutex); | ||
312 | return -ENETDOWN; | 328 | return -ENETDOWN; |
329 | } | ||
313 | } | 330 | } |
314 | 331 | ||
315 | if (len + 15 > dev->mtu) | 332 | if (len + 15 > dev->mtu) { |
333 | mutex_unlock(&econet_mutex); | ||
316 | return -EMSGSIZE; | 334 | return -EMSGSIZE; |
335 | } | ||
317 | 336 | ||
318 | if (dev->type == ARPHRD_ECONET) | 337 | if (dev->type == ARPHRD_ECONET) { |
319 | { | ||
320 | /* Real hardware Econet. We're not worthy etc. */ | 338 | /* Real hardware Econet. We're not worthy etc. */ |
321 | #ifdef CONFIG_ECONET_NATIVE | 339 | #ifdef CONFIG_ECONET_NATIVE |
322 | unsigned short proto = 0; | 340 | unsigned short proto = 0; |
@@ -374,6 +392,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
374 | 392 | ||
375 | dev_queue_xmit(skb); | 393 | dev_queue_xmit(skb); |
376 | dev_put(dev); | 394 | dev_put(dev); |
395 | mutex_unlock(&econet_mutex); | ||
377 | return(len); | 396 | return(len); |
378 | 397 | ||
379 | out_free: | 398 | out_free: |
@@ -384,14 +403,18 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
384 | #else | 403 | #else |
385 | err = -EPROTOTYPE; | 404 | err = -EPROTOTYPE; |
386 | #endif | 405 | #endif |
406 | mutex_unlock(&econet_mutex); | ||
407 | |||
387 | return err; | 408 | return err; |
388 | } | 409 | } |
389 | 410 | ||
390 | #ifdef CONFIG_ECONET_AUNUDP | 411 | #ifdef CONFIG_ECONET_AUNUDP |
391 | /* AUN virtual Econet. */ | 412 | /* AUN virtual Econet. */ |
392 | 413 | ||
393 | if (udpsock == NULL) | 414 | if (udpsock == NULL) { |
415 | mutex_unlock(&econet_mutex); | ||
394 | return -ENETDOWN; /* No socket - can't send */ | 416 | return -ENETDOWN; /* No socket - can't send */ |
417 | } | ||
395 | 418 | ||
396 | /* Make up a UDP datagram and hand it off to some higher intellect. */ | 419 | /* Make up a UDP datagram and hand it off to some higher intellect. */ |
397 | 420 | ||
@@ -438,8 +461,10 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
438 | void __user *base = msg->msg_iov[i].iov_base; | 461 | void __user *base = msg->msg_iov[i].iov_base; |
439 | size_t len = msg->msg_iov[i].iov_len; | 462 | size_t len = msg->msg_iov[i].iov_len; |
440 | /* Check it now since we switch to KERNEL_DS later. */ | 463 | /* Check it now since we switch to KERNEL_DS later. */ |
441 | if (!access_ok(VERIFY_READ, base, len)) | 464 | if (!access_ok(VERIFY_READ, base, len)) { |
465 | mutex_unlock(&econet_mutex); | ||
442 | return -EFAULT; | 466 | return -EFAULT; |
467 | } | ||
443 | iov[i+1].iov_base = base; | 468 | iov[i+1].iov_base = base; |
444 | iov[i+1].iov_len = len; | 469 | iov[i+1].iov_len = len; |
445 | size += len; | 470 | size += len; |
@@ -447,8 +472,11 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
447 | 472 | ||
448 | /* Get a skbuff (no data, just holds our cb information) */ | 473 | /* Get a skbuff (no data, just holds our cb information) */ |
449 | if ((skb = sock_alloc_send_skb(sk, 0, | 474 | if ((skb = sock_alloc_send_skb(sk, 0, |
450 | msg->msg_flags & MSG_DONTWAIT, &err)) == NULL) | 475 | msg->msg_flags & MSG_DONTWAIT, |
476 | &err)) == NULL) { | ||
477 | mutex_unlock(&econet_mutex); | ||
451 | return err; | 478 | return err; |
479 | } | ||
452 | 480 | ||
453 | eb = (struct ec_cb *)&skb->cb; | 481 | eb = (struct ec_cb *)&skb->cb; |
454 | 482 | ||
@@ -475,6 +503,8 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
475 | #else | 503 | #else |
476 | err = -EPROTOTYPE; | 504 | err = -EPROTOTYPE; |
477 | #endif | 505 | #endif |
506 | mutex_unlock(&econet_mutex); | ||
507 | |||
478 | return err; | 508 | return err; |
479 | } | 509 | } |
480 | 510 | ||
@@ -485,18 +515,25 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
485 | static int econet_getname(struct socket *sock, struct sockaddr *uaddr, | 515 | static int econet_getname(struct socket *sock, struct sockaddr *uaddr, |
486 | int *uaddr_len, int peer) | 516 | int *uaddr_len, int peer) |
487 | { | 517 | { |
488 | struct sock *sk = sock->sk; | 518 | struct sock *sk; |
489 | struct econet_sock *eo = ec_sk(sk); | 519 | struct econet_sock *eo; |
490 | struct sockaddr_ec *sec = (struct sockaddr_ec *)uaddr; | 520 | struct sockaddr_ec *sec = (struct sockaddr_ec *)uaddr; |
491 | 521 | ||
492 | if (peer) | 522 | if (peer) |
493 | return -EOPNOTSUPP; | 523 | return -EOPNOTSUPP; |
494 | 524 | ||
525 | mutex_lock(&econet_mutex); | ||
526 | |||
527 | sk = sock->sk; | ||
528 | eo = ec_sk(sk); | ||
529 | |||
495 | sec->sec_family = AF_ECONET; | 530 | sec->sec_family = AF_ECONET; |
496 | sec->port = eo->port; | 531 | sec->port = eo->port; |
497 | sec->addr.station = eo->station; | 532 | sec->addr.station = eo->station; |
498 | sec->addr.net = eo->net; | 533 | sec->addr.net = eo->net; |
499 | 534 | ||
535 | mutex_unlock(&econet_mutex); | ||
536 | |||
500 | *uaddr_len = sizeof(*sec); | 537 | *uaddr_len = sizeof(*sec); |
501 | return 0; | 538 | return 0; |
502 | } | 539 | } |
@@ -522,10 +559,13 @@ static void econet_destroy_timer(unsigned long data) | |||
522 | 559 | ||
523 | static int econet_release(struct socket *sock) | 560 | static int econet_release(struct socket *sock) |
524 | { | 561 | { |
525 | struct sock *sk = sock->sk; | 562 | struct sock *sk; |
526 | 563 | ||
564 | mutex_lock(&econet_mutex); | ||
565 | |||
566 | sk = sock->sk; | ||
527 | if (!sk) | 567 | if (!sk) |
528 | return 0; | 568 | goto out_unlock; |
529 | 569 | ||
530 | econet_remove_socket(&econet_sklist, sk); | 570 | econet_remove_socket(&econet_sklist, sk); |
531 | 571 | ||
@@ -549,10 +589,14 @@ static int econet_release(struct socket *sock) | |||
549 | sk->sk_timer.expires = jiffies + HZ; | 589 | sk->sk_timer.expires = jiffies + HZ; |
550 | sk->sk_timer.function = econet_destroy_timer; | 590 | sk->sk_timer.function = econet_destroy_timer; |
551 | add_timer(&sk->sk_timer); | 591 | add_timer(&sk->sk_timer); |
552 | return 0; | 592 | |
593 | goto out_unlock; | ||
553 | } | 594 | } |
554 | 595 | ||
555 | sk_free(sk); | 596 | sk_free(sk); |
597 | |||
598 | out_unlock: | ||
599 | mutex_unlock(&econet_mutex); | ||
556 | return 0; | 600 | return 0; |
557 | } | 601 | } |
558 | 602 | ||
@@ -608,6 +652,7 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg) | |||
608 | struct ec_device *edev; | 652 | struct ec_device *edev; |
609 | struct net_device *dev; | 653 | struct net_device *dev; |
610 | struct sockaddr_ec *sec; | 654 | struct sockaddr_ec *sec; |
655 | int err; | ||
611 | 656 | ||
612 | /* | 657 | /* |
613 | * Fetch the caller's info block into kernel space | 658 | * Fetch the caller's info block into kernel space |
@@ -621,38 +666,35 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg) | |||
621 | 666 | ||
622 | sec = (struct sockaddr_ec *)&ifr.ifr_addr; | 667 | sec = (struct sockaddr_ec *)&ifr.ifr_addr; |
623 | 668 | ||
624 | switch (cmd) | 669 | mutex_lock(&econet_mutex); |
625 | { | 670 | |
671 | err = 0; | ||
672 | switch (cmd) { | ||
626 | case SIOCSIFADDR: | 673 | case SIOCSIFADDR: |
627 | edev = dev->ec_ptr; | 674 | edev = dev->ec_ptr; |
628 | if (edev == NULL) | 675 | if (edev == NULL) { |
629 | { | ||
630 | /* Magic up a new one. */ | 676 | /* Magic up a new one. */ |
631 | edev = kmalloc(sizeof(struct ec_device), GFP_KERNEL); | 677 | edev = kmalloc(sizeof(struct ec_device), GFP_KERNEL); |
632 | if (edev == NULL) { | 678 | if (edev == NULL) { |
633 | printk("af_ec: memory squeeze.\n"); | 679 | err = -ENOMEM; |
634 | dev_put(dev); | 680 | break; |
635 | return -ENOMEM; | ||
636 | } | 681 | } |
637 | memset(edev, 0, sizeof(struct ec_device)); | 682 | memset(edev, 0, sizeof(struct ec_device)); |
638 | dev->ec_ptr = edev; | 683 | dev->ec_ptr = edev; |
639 | } | 684 | } else |
640 | else | ||
641 | net2dev_map[edev->net] = NULL; | 685 | net2dev_map[edev->net] = NULL; |
642 | edev->station = sec->addr.station; | 686 | edev->station = sec->addr.station; |
643 | edev->net = sec->addr.net; | 687 | edev->net = sec->addr.net; |
644 | net2dev_map[sec->addr.net] = dev; | 688 | net2dev_map[sec->addr.net] = dev; |
645 | if (!net2dev_map[0]) | 689 | if (!net2dev_map[0]) |
646 | net2dev_map[0] = dev; | 690 | net2dev_map[0] = dev; |
647 | dev_put(dev); | 691 | break; |
648 | return 0; | ||
649 | 692 | ||
650 | case SIOCGIFADDR: | 693 | case SIOCGIFADDR: |
651 | edev = dev->ec_ptr; | 694 | edev = dev->ec_ptr; |
652 | if (edev == NULL) | 695 | if (edev == NULL) { |
653 | { | 696 | err = -ENODEV; |
654 | dev_put(dev); | 697 | break; |
655 | return -ENODEV; | ||
656 | } | 698 | } |
657 | memset(sec, 0, sizeof(struct sockaddr_ec)); | 699 | memset(sec, 0, sizeof(struct sockaddr_ec)); |
658 | sec->addr.station = edev->station; | 700 | sec->addr.station = edev->station; |
@@ -660,12 +702,19 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg) | |||
660 | sec->sec_family = AF_ECONET; | 702 | sec->sec_family = AF_ECONET; |
661 | dev_put(dev); | 703 | dev_put(dev); |
662 | if (copy_to_user(arg, &ifr, sizeof(struct ifreq))) | 704 | if (copy_to_user(arg, &ifr, sizeof(struct ifreq))) |
663 | return -EFAULT; | 705 | err = -EFAULT; |
664 | return 0; | 706 | break; |
707 | |||
708 | default: | ||
709 | err = -EINVAL; | ||
710 | break; | ||
665 | } | 711 | } |
666 | 712 | ||
713 | mutex_unlock(&econet_mutex); | ||
714 | |||
667 | dev_put(dev); | 715 | dev_put(dev); |
668 | return -EINVAL; | 716 | |
717 | return err; | ||
669 | } | 718 | } |
670 | 719 | ||
671 | /* | 720 | /* |
@@ -699,7 +748,7 @@ static struct net_proto_family econet_family_ops = { | |||
699 | .owner = THIS_MODULE, | 748 | .owner = THIS_MODULE, |
700 | }; | 749 | }; |
701 | 750 | ||
702 | static const struct proto_ops SOCKOPS_WRAPPED(econet_ops) = { | 751 | static const struct proto_ops econet_ops = { |
703 | .family = PF_ECONET, | 752 | .family = PF_ECONET, |
704 | .owner = THIS_MODULE, | 753 | .owner = THIS_MODULE, |
705 | .release = econet_release, | 754 | .release = econet_release, |
@@ -720,9 +769,6 @@ static const struct proto_ops SOCKOPS_WRAPPED(econet_ops) = { | |||
720 | .sendpage = sock_no_sendpage, | 769 | .sendpage = sock_no_sendpage, |
721 | }; | 770 | }; |
722 | 771 | ||
723 | #include <linux/smp_lock.h> | ||
724 | SOCKOPS_WRAP(econet, PF_ECONET); | ||
725 | |||
726 | #if defined(CONFIG_ECONET_AUNUDP) || defined(CONFIG_ECONET_NATIVE) | 772 | #if defined(CONFIG_ECONET_AUNUDP) || defined(CONFIG_ECONET_NATIVE) |
727 | /* | 773 | /* |
728 | * Find the listening socket, if any, for the given data. | 774 | * Find the listening socket, if any, for the given data. |
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index 011cca7ae02b..e40f75322377 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig | |||
@@ -235,6 +235,7 @@ config IP_PNP_RARP | |||
235 | # bool ' IP: ARP support' CONFIG_IP_PNP_ARP | 235 | # bool ' IP: ARP support' CONFIG_IP_PNP_ARP |
236 | config NET_IPIP | 236 | config NET_IPIP |
237 | tristate "IP: tunneling" | 237 | tristate "IP: tunneling" |
238 | select INET_TUNNEL | ||
238 | ---help--- | 239 | ---help--- |
239 | Tunneling means encapsulating data of one protocol type within | 240 | Tunneling means encapsulating data of one protocol type within |
240 | another protocol and sending it over a channel that understands the | 241 | another protocol and sending it over a channel that understands the |
@@ -395,7 +396,7 @@ config INET_ESP | |||
395 | config INET_IPCOMP | 396 | config INET_IPCOMP |
396 | tristate "IP: IPComp transformation" | 397 | tristate "IP: IPComp transformation" |
397 | select XFRM | 398 | select XFRM |
398 | select INET_TUNNEL | 399 | select INET_XFRM_TUNNEL |
399 | select CRYPTO | 400 | select CRYPTO |
400 | select CRYPTO_DEFLATE | 401 | select CRYPTO_DEFLATE |
401 | ---help--- | 402 | ---help--- |
@@ -404,14 +405,14 @@ config INET_IPCOMP | |||
404 | 405 | ||
405 | If unsure, say Y. | 406 | If unsure, say Y. |
406 | 407 | ||
408 | config INET_XFRM_TUNNEL | ||
409 | tristate | ||
410 | select INET_TUNNEL | ||
411 | default n | ||
412 | |||
407 | config INET_TUNNEL | 413 | config INET_TUNNEL |
408 | tristate "IP: tunnel transformation" | 414 | tristate |
409 | select XFRM | 415 | default n |
410 | ---help--- | ||
411 | Support for generic IP tunnel transformation, which is required by | ||
412 | the IP tunneling module as well as tunnel mode IPComp. | ||
413 | |||
414 | If unsure, say Y. | ||
415 | 416 | ||
416 | config INET_DIAG | 417 | config INET_DIAG |
417 | tristate "INET: socket monitoring interface" | 418 | tristate "INET: socket monitoring interface" |
diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile index 35e5f5999092..9ef50a0b9d2c 100644 --- a/net/ipv4/Makefile +++ b/net/ipv4/Makefile | |||
@@ -22,7 +22,8 @@ obj-$(CONFIG_SYN_COOKIES) += syncookies.o | |||
22 | obj-$(CONFIG_INET_AH) += ah4.o | 22 | obj-$(CONFIG_INET_AH) += ah4.o |
23 | obj-$(CONFIG_INET_ESP) += esp4.o | 23 | obj-$(CONFIG_INET_ESP) += esp4.o |
24 | obj-$(CONFIG_INET_IPCOMP) += ipcomp.o | 24 | obj-$(CONFIG_INET_IPCOMP) += ipcomp.o |
25 | obj-$(CONFIG_INET_TUNNEL) += xfrm4_tunnel.o | 25 | obj-$(CONFIG_INET_XFRM_TUNNEL) += xfrm4_tunnel.o |
26 | obj-$(CONFIG_INET_TUNNEL) += tunnel4.o | ||
26 | obj-$(CONFIG_IP_PNP) += ipconfig.o | 27 | obj-$(CONFIG_IP_PNP) += ipconfig.o |
27 | obj-$(CONFIG_IP_ROUTE_MULTIPATH_RR) += multipath_rr.o | 28 | obj-$(CONFIG_IP_ROUTE_MULTIPATH_RR) += multipath_rr.o |
28 | obj-$(CONFIG_IP_ROUTE_MULTIPATH_RANDOM) += multipath_random.o | 29 | obj-$(CONFIG_IP_ROUTE_MULTIPATH_RANDOM) += multipath_random.o |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 44fdf1413e2c..81c2f7885292 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -81,7 +81,7 @@ static struct ipv4_devconf ipv4_devconf_dflt = { | |||
81 | 81 | ||
82 | static void rtmsg_ifa(int event, struct in_ifaddr *); | 82 | static void rtmsg_ifa(int event, struct in_ifaddr *); |
83 | 83 | ||
84 | static struct notifier_block *inetaddr_chain; | 84 | static BLOCKING_NOTIFIER_HEAD(inetaddr_chain); |
85 | static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, | 85 | static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, |
86 | int destroy); | 86 | int destroy); |
87 | #ifdef CONFIG_SYSCTL | 87 | #ifdef CONFIG_SYSCTL |
@@ -267,7 +267,8 @@ static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, | |||
267 | *ifap1 = ifa->ifa_next; | 267 | *ifap1 = ifa->ifa_next; |
268 | 268 | ||
269 | rtmsg_ifa(RTM_DELADDR, ifa); | 269 | rtmsg_ifa(RTM_DELADDR, ifa); |
270 | notifier_call_chain(&inetaddr_chain, NETDEV_DOWN, ifa); | 270 | blocking_notifier_call_chain(&inetaddr_chain, |
271 | NETDEV_DOWN, ifa); | ||
271 | inet_free_ifa(ifa); | 272 | inet_free_ifa(ifa); |
272 | } else { | 273 | } else { |
273 | promote = ifa; | 274 | promote = ifa; |
@@ -291,7 +292,7 @@ static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, | |||
291 | So that, this order is correct. | 292 | So that, this order is correct. |
292 | */ | 293 | */ |
293 | rtmsg_ifa(RTM_DELADDR, ifa1); | 294 | rtmsg_ifa(RTM_DELADDR, ifa1); |
294 | notifier_call_chain(&inetaddr_chain, NETDEV_DOWN, ifa1); | 295 | blocking_notifier_call_chain(&inetaddr_chain, NETDEV_DOWN, ifa1); |
295 | 296 | ||
296 | if (promote) { | 297 | if (promote) { |
297 | 298 | ||
@@ -303,7 +304,8 @@ static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, | |||
303 | 304 | ||
304 | promote->ifa_flags &= ~IFA_F_SECONDARY; | 305 | promote->ifa_flags &= ~IFA_F_SECONDARY; |
305 | rtmsg_ifa(RTM_NEWADDR, promote); | 306 | rtmsg_ifa(RTM_NEWADDR, promote); |
306 | notifier_call_chain(&inetaddr_chain, NETDEV_UP, promote); | 307 | blocking_notifier_call_chain(&inetaddr_chain, |
308 | NETDEV_UP, promote); | ||
307 | for (ifa = promote->ifa_next; ifa; ifa = ifa->ifa_next) { | 309 | for (ifa = promote->ifa_next; ifa; ifa = ifa->ifa_next) { |
308 | if (ifa1->ifa_mask != ifa->ifa_mask || | 310 | if (ifa1->ifa_mask != ifa->ifa_mask || |
309 | !inet_ifa_match(ifa1->ifa_address, ifa)) | 311 | !inet_ifa_match(ifa1->ifa_address, ifa)) |
@@ -366,7 +368,7 @@ static int inet_insert_ifa(struct in_ifaddr *ifa) | |||
366 | Notifier will trigger FIB update, so that | 368 | Notifier will trigger FIB update, so that |
367 | listeners of netlink will know about new ifaddr */ | 369 | listeners of netlink will know about new ifaddr */ |
368 | rtmsg_ifa(RTM_NEWADDR, ifa); | 370 | rtmsg_ifa(RTM_NEWADDR, ifa); |
369 | notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa); | 371 | blocking_notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa); |
370 | 372 | ||
371 | return 0; | 373 | return 0; |
372 | } | 374 | } |
@@ -938,12 +940,12 @@ u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scop | |||
938 | 940 | ||
939 | int register_inetaddr_notifier(struct notifier_block *nb) | 941 | int register_inetaddr_notifier(struct notifier_block *nb) |
940 | { | 942 | { |
941 | return notifier_chain_register(&inetaddr_chain, nb); | 943 | return blocking_notifier_chain_register(&inetaddr_chain, nb); |
942 | } | 944 | } |
943 | 945 | ||
944 | int unregister_inetaddr_notifier(struct notifier_block *nb) | 946 | int unregister_inetaddr_notifier(struct notifier_block *nb) |
945 | { | 947 | { |
946 | return notifier_chain_unregister(&inetaddr_chain, nb); | 948 | return blocking_notifier_chain_unregister(&inetaddr_chain, nb); |
947 | } | 949 | } |
948 | 950 | ||
949 | /* Rename ifa_labels for a device name change. Make some effort to preserve existing | 951 | /* Rename ifa_labels for a device name change. Make some effort to preserve existing |
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 03d13742a4b8..eef07b0916a3 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -114,7 +114,6 @@ | |||
114 | #include <net/sock.h> | 114 | #include <net/sock.h> |
115 | #include <net/ip.h> | 115 | #include <net/ip.h> |
116 | #include <net/icmp.h> | 116 | #include <net/icmp.h> |
117 | #include <net/protocol.h> | ||
118 | #include <net/ipip.h> | 117 | #include <net/ipip.h> |
119 | #include <net/inet_ecn.h> | 118 | #include <net/inet_ecn.h> |
120 | #include <net/xfrm.h> | 119 | #include <net/xfrm.h> |
@@ -274,7 +273,7 @@ static void ipip_tunnel_uninit(struct net_device *dev) | |||
274 | dev_put(dev); | 273 | dev_put(dev); |
275 | } | 274 | } |
276 | 275 | ||
277 | static void ipip_err(struct sk_buff *skb, u32 info) | 276 | static int ipip_err(struct sk_buff *skb, u32 info) |
278 | { | 277 | { |
279 | #ifndef I_WISH_WORLD_WERE_PERFECT | 278 | #ifndef I_WISH_WORLD_WERE_PERFECT |
280 | 279 | ||
@@ -286,21 +285,22 @@ static void ipip_err(struct sk_buff *skb, u32 info) | |||
286 | int type = skb->h.icmph->type; | 285 | int type = skb->h.icmph->type; |
287 | int code = skb->h.icmph->code; | 286 | int code = skb->h.icmph->code; |
288 | struct ip_tunnel *t; | 287 | struct ip_tunnel *t; |
288 | int err; | ||
289 | 289 | ||
290 | switch (type) { | 290 | switch (type) { |
291 | default: | 291 | default: |
292 | case ICMP_PARAMETERPROB: | 292 | case ICMP_PARAMETERPROB: |
293 | return; | 293 | return 0; |
294 | 294 | ||
295 | case ICMP_DEST_UNREACH: | 295 | case ICMP_DEST_UNREACH: |
296 | switch (code) { | 296 | switch (code) { |
297 | case ICMP_SR_FAILED: | 297 | case ICMP_SR_FAILED: |
298 | case ICMP_PORT_UNREACH: | 298 | case ICMP_PORT_UNREACH: |
299 | /* Impossible event. */ | 299 | /* Impossible event. */ |
300 | return; | 300 | return 0; |
301 | case ICMP_FRAG_NEEDED: | 301 | case ICMP_FRAG_NEEDED: |
302 | /* Soft state for pmtu is maintained by IP core. */ | 302 | /* Soft state for pmtu is maintained by IP core. */ |
303 | return; | 303 | return 0; |
304 | default: | 304 | default: |
305 | /* All others are translated to HOST_UNREACH. | 305 | /* All others are translated to HOST_UNREACH. |
306 | rfc2003 contains "deep thoughts" about NET_UNREACH, | 306 | rfc2003 contains "deep thoughts" about NET_UNREACH, |
@@ -311,14 +311,18 @@ static void ipip_err(struct sk_buff *skb, u32 info) | |||
311 | break; | 311 | break; |
312 | case ICMP_TIME_EXCEEDED: | 312 | case ICMP_TIME_EXCEEDED: |
313 | if (code != ICMP_EXC_TTL) | 313 | if (code != ICMP_EXC_TTL) |
314 | return; | 314 | return 0; |
315 | break; | 315 | break; |
316 | } | 316 | } |
317 | 317 | ||
318 | err = -ENOENT; | ||
319 | |||
318 | read_lock(&ipip_lock); | 320 | read_lock(&ipip_lock); |
319 | t = ipip_tunnel_lookup(iph->daddr, iph->saddr); | 321 | t = ipip_tunnel_lookup(iph->daddr, iph->saddr); |
320 | if (t == NULL || t->parms.iph.daddr == 0) | 322 | if (t == NULL || t->parms.iph.daddr == 0) |
321 | goto out; | 323 | goto out; |
324 | |||
325 | err = 0; | ||
322 | if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) | 326 | if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) |
323 | goto out; | 327 | goto out; |
324 | 328 | ||
@@ -329,7 +333,7 @@ static void ipip_err(struct sk_buff *skb, u32 info) | |||
329 | t->err_time = jiffies; | 333 | t->err_time = jiffies; |
330 | out: | 334 | out: |
331 | read_unlock(&ipip_lock); | 335 | read_unlock(&ipip_lock); |
332 | return; | 336 | return err; |
333 | #else | 337 | #else |
334 | struct iphdr *iph = (struct iphdr*)dp; | 338 | struct iphdr *iph = (struct iphdr*)dp; |
335 | int hlen = iph->ihl<<2; | 339 | int hlen = iph->ihl<<2; |
@@ -344,15 +348,15 @@ out: | |||
344 | struct rtable *rt; | 348 | struct rtable *rt; |
345 | 349 | ||
346 | if (len < hlen + sizeof(struct iphdr)) | 350 | if (len < hlen + sizeof(struct iphdr)) |
347 | return; | 351 | return 0; |
348 | eiph = (struct iphdr*)(dp + hlen); | 352 | eiph = (struct iphdr*)(dp + hlen); |
349 | 353 | ||
350 | switch (type) { | 354 | switch (type) { |
351 | default: | 355 | default: |
352 | return; | 356 | return 0; |
353 | case ICMP_PARAMETERPROB: | 357 | case ICMP_PARAMETERPROB: |
354 | if (skb->h.icmph->un.gateway < hlen) | 358 | if (skb->h.icmph->un.gateway < hlen) |
355 | return; | 359 | return 0; |
356 | 360 | ||
357 | /* So... This guy found something strange INSIDE encapsulated | 361 | /* So... This guy found something strange INSIDE encapsulated |
358 | packet. Well, he is fool, but what can we do ? | 362 | packet. Well, he is fool, but what can we do ? |
@@ -366,16 +370,16 @@ out: | |||
366 | case ICMP_SR_FAILED: | 370 | case ICMP_SR_FAILED: |
367 | case ICMP_PORT_UNREACH: | 371 | case ICMP_PORT_UNREACH: |
368 | /* Impossible event. */ | 372 | /* Impossible event. */ |
369 | return; | 373 | return 0; |
370 | case ICMP_FRAG_NEEDED: | 374 | case ICMP_FRAG_NEEDED: |
371 | /* And it is the only really necessary thing :-) */ | 375 | /* And it is the only really necessary thing :-) */ |
372 | rel_info = ntohs(skb->h.icmph->un.frag.mtu); | 376 | rel_info = ntohs(skb->h.icmph->un.frag.mtu); |
373 | if (rel_info < hlen+68) | 377 | if (rel_info < hlen+68) |
374 | return; | 378 | return 0; |
375 | rel_info -= hlen; | 379 | rel_info -= hlen; |
376 | /* BSD 4.2 MORE DOES NOT EXIST IN NATURE. */ | 380 | /* BSD 4.2 MORE DOES NOT EXIST IN NATURE. */ |
377 | if (rel_info > ntohs(eiph->tot_len)) | 381 | if (rel_info > ntohs(eiph->tot_len)) |
378 | return; | 382 | return 0; |
379 | break; | 383 | break; |
380 | default: | 384 | default: |
381 | /* All others are translated to HOST_UNREACH. | 385 | /* All others are translated to HOST_UNREACH. |
@@ -389,14 +393,14 @@ out: | |||
389 | break; | 393 | break; |
390 | case ICMP_TIME_EXCEEDED: | 394 | case ICMP_TIME_EXCEEDED: |
391 | if (code != ICMP_EXC_TTL) | 395 | if (code != ICMP_EXC_TTL) |
392 | return; | 396 | return 0; |
393 | break; | 397 | break; |
394 | } | 398 | } |
395 | 399 | ||
396 | /* Prepare fake skb to feed it to icmp_send */ | 400 | /* Prepare fake skb to feed it to icmp_send */ |
397 | skb2 = skb_clone(skb, GFP_ATOMIC); | 401 | skb2 = skb_clone(skb, GFP_ATOMIC); |
398 | if (skb2 == NULL) | 402 | if (skb2 == NULL) |
399 | return; | 403 | return 0; |
400 | dst_release(skb2->dst); | 404 | dst_release(skb2->dst); |
401 | skb2->dst = NULL; | 405 | skb2->dst = NULL; |
402 | skb_pull(skb2, skb->data - (u8*)eiph); | 406 | skb_pull(skb2, skb->data - (u8*)eiph); |
@@ -409,7 +413,7 @@ out: | |||
409 | fl.proto = IPPROTO_IPIP; | 413 | fl.proto = IPPROTO_IPIP; |
410 | if (ip_route_output_key(&rt, &key)) { | 414 | if (ip_route_output_key(&rt, &key)) { |
411 | kfree_skb(skb2); | 415 | kfree_skb(skb2); |
412 | return; | 416 | return 0; |
413 | } | 417 | } |
414 | skb2->dev = rt->u.dst.dev; | 418 | skb2->dev = rt->u.dst.dev; |
415 | 419 | ||
@@ -424,14 +428,14 @@ out: | |||
424 | rt->u.dst.dev->type != ARPHRD_TUNNEL) { | 428 | rt->u.dst.dev->type != ARPHRD_TUNNEL) { |
425 | ip_rt_put(rt); | 429 | ip_rt_put(rt); |
426 | kfree_skb(skb2); | 430 | kfree_skb(skb2); |
427 | return; | 431 | return 0; |
428 | } | 432 | } |
429 | } else { | 433 | } else { |
430 | ip_rt_put(rt); | 434 | ip_rt_put(rt); |
431 | if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos, skb2->dev) || | 435 | if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos, skb2->dev) || |
432 | skb2->dst->dev->type != ARPHRD_TUNNEL) { | 436 | skb2->dst->dev->type != ARPHRD_TUNNEL) { |
433 | kfree_skb(skb2); | 437 | kfree_skb(skb2); |
434 | return; | 438 | return 0; |
435 | } | 439 | } |
436 | } | 440 | } |
437 | 441 | ||
@@ -439,7 +443,7 @@ out: | |||
439 | if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) { | 443 | if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) { |
440 | if (rel_info > dst_mtu(skb2->dst)) { | 444 | if (rel_info > dst_mtu(skb2->dst)) { |
441 | kfree_skb(skb2); | 445 | kfree_skb(skb2); |
442 | return; | 446 | return 0; |
443 | } | 447 | } |
444 | skb2->dst->ops->update_pmtu(skb2->dst, rel_info); | 448 | skb2->dst->ops->update_pmtu(skb2->dst, rel_info); |
445 | rel_info = htonl(rel_info); | 449 | rel_info = htonl(rel_info); |
@@ -453,7 +457,7 @@ out: | |||
453 | 457 | ||
454 | icmp_send(skb2, rel_type, rel_code, rel_info); | 458 | icmp_send(skb2, rel_type, rel_code, rel_info); |
455 | kfree_skb(skb2); | 459 | kfree_skb(skb2); |
456 | return; | 460 | return 0; |
457 | #endif | 461 | #endif |
458 | } | 462 | } |
459 | 463 | ||
@@ -855,39 +859,12 @@ static int __init ipip_fb_tunnel_init(struct net_device *dev) | |||
855 | return 0; | 859 | return 0; |
856 | } | 860 | } |
857 | 861 | ||
858 | #ifdef CONFIG_INET_TUNNEL | ||
859 | static struct xfrm_tunnel ipip_handler = { | 862 | static struct xfrm_tunnel ipip_handler = { |
860 | .handler = ipip_rcv, | 863 | .handler = ipip_rcv, |
861 | .err_handler = ipip_err, | 864 | .err_handler = ipip_err, |
865 | .priority = 1, | ||
862 | }; | 866 | }; |
863 | 867 | ||
864 | static inline int ipip_register(void) | ||
865 | { | ||
866 | return xfrm4_tunnel_register(&ipip_handler); | ||
867 | } | ||
868 | |||
869 | static inline int ipip_unregister(void) | ||
870 | { | ||
871 | return xfrm4_tunnel_deregister(&ipip_handler); | ||
872 | } | ||
873 | #else | ||
874 | static struct net_protocol ipip_protocol = { | ||
875 | .handler = ipip_rcv, | ||
876 | .err_handler = ipip_err, | ||
877 | .no_policy = 1, | ||
878 | }; | ||
879 | |||
880 | static inline int ipip_register(void) | ||
881 | { | ||
882 | return inet_add_protocol(&ipip_protocol, IPPROTO_IPIP); | ||
883 | } | ||
884 | |||
885 | static inline int ipip_unregister(void) | ||
886 | { | ||
887 | return inet_del_protocol(&ipip_protocol, IPPROTO_IPIP); | ||
888 | } | ||
889 | #endif | ||
890 | |||
891 | static char banner[] __initdata = | 868 | static char banner[] __initdata = |
892 | KERN_INFO "IPv4 over IPv4 tunneling driver\n"; | 869 | KERN_INFO "IPv4 over IPv4 tunneling driver\n"; |
893 | 870 | ||
@@ -897,7 +874,7 @@ static int __init ipip_init(void) | |||
897 | 874 | ||
898 | printk(banner); | 875 | printk(banner); |
899 | 876 | ||
900 | if (ipip_register() < 0) { | 877 | if (xfrm4_tunnel_register(&ipip_handler)) { |
901 | printk(KERN_INFO "ipip init: can't register tunnel\n"); | 878 | printk(KERN_INFO "ipip init: can't register tunnel\n"); |
902 | return -EAGAIN; | 879 | return -EAGAIN; |
903 | } | 880 | } |
@@ -919,7 +896,7 @@ static int __init ipip_init(void) | |||
919 | err2: | 896 | err2: |
920 | free_netdev(ipip_fb_tunnel_dev); | 897 | free_netdev(ipip_fb_tunnel_dev); |
921 | err1: | 898 | err1: |
922 | ipip_unregister(); | 899 | xfrm4_tunnel_deregister(&ipip_handler); |
923 | goto out; | 900 | goto out; |
924 | } | 901 | } |
925 | 902 | ||
@@ -939,7 +916,7 @@ static void __exit ipip_destroy_tunnels(void) | |||
939 | 916 | ||
940 | static void __exit ipip_fini(void) | 917 | static void __exit ipip_fini(void) |
941 | { | 918 | { |
942 | if (ipip_unregister() < 0) | 919 | if (xfrm4_tunnel_deregister(&ipip_handler)) |
943 | printk(KERN_INFO "ipip close: can't deregister tunnel\n"); | 920 | printk(KERN_INFO "ipip close: can't deregister tunnel\n"); |
944 | 921 | ||
945 | rtnl_lock(); | 922 | rtnl_lock(); |
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c index ed42cdc57cd9..b5ad9ac2fbcc 100644 --- a/net/ipv4/netfilter.c +++ b/net/ipv4/netfilter.c | |||
@@ -167,15 +167,15 @@ static struct nf_queue_rerouter ip_reroute = { | |||
167 | .reroute = queue_reroute, | 167 | .reroute = queue_reroute, |
168 | }; | 168 | }; |
169 | 169 | ||
170 | static int init(void) | 170 | static int ipv4_netfilter_init(void) |
171 | { | 171 | { |
172 | return nf_register_queue_rerouter(PF_INET, &ip_reroute); | 172 | return nf_register_queue_rerouter(PF_INET, &ip_reroute); |
173 | } | 173 | } |
174 | 174 | ||
175 | static void fini(void) | 175 | static void ipv4_netfilter_fini(void) |
176 | { | 176 | { |
177 | nf_unregister_queue_rerouter(PF_INET); | 177 | nf_unregister_queue_rerouter(PF_INET); |
178 | } | 178 | } |
179 | 179 | ||
180 | module_init(init); | 180 | module_init(ipv4_netfilter_init); |
181 | module_exit(fini); | 181 | module_exit(ipv4_netfilter_fini); |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index ff0c594a4198..a44a5d73457d 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -1166,7 +1166,7 @@ static struct nf_sockopt_ops arpt_sockopts = { | |||
1166 | .get = do_arpt_get_ctl, | 1166 | .get = do_arpt_get_ctl, |
1167 | }; | 1167 | }; |
1168 | 1168 | ||
1169 | static int __init init(void) | 1169 | static int __init arp_tables_init(void) |
1170 | { | 1170 | { |
1171 | int ret; | 1171 | int ret; |
1172 | 1172 | ||
@@ -1187,7 +1187,7 @@ static int __init init(void) | |||
1187 | return 0; | 1187 | return 0; |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | static void __exit fini(void) | 1190 | static void __exit arp_tables_fini(void) |
1191 | { | 1191 | { |
1192 | nf_unregister_sockopt(&arpt_sockopts); | 1192 | nf_unregister_sockopt(&arpt_sockopts); |
1193 | xt_proto_fini(NF_ARP); | 1193 | xt_proto_fini(NF_ARP); |
@@ -1197,5 +1197,5 @@ EXPORT_SYMBOL(arpt_register_table); | |||
1197 | EXPORT_SYMBOL(arpt_unregister_table); | 1197 | EXPORT_SYMBOL(arpt_unregister_table); |
1198 | EXPORT_SYMBOL(arpt_do_table); | 1198 | EXPORT_SYMBOL(arpt_do_table); |
1199 | 1199 | ||
1200 | module_init(init); | 1200 | module_init(arp_tables_init); |
1201 | module_exit(fini); | 1201 | module_exit(arp_tables_fini); |
diff --git a/net/ipv4/netfilter/arpt_mangle.c b/net/ipv4/netfilter/arpt_mangle.c index 0f2a95350e26..a58325c1ceb9 100644 --- a/net/ipv4/netfilter/arpt_mangle.c +++ b/net/ipv4/netfilter/arpt_mangle.c | |||
@@ -89,7 +89,7 @@ static struct arpt_target arpt_mangle_reg = { | |||
89 | .me = THIS_MODULE, | 89 | .me = THIS_MODULE, |
90 | }; | 90 | }; |
91 | 91 | ||
92 | static int __init init(void) | 92 | static int __init arpt_mangle_init(void) |
93 | { | 93 | { |
94 | if (arpt_register_target(&arpt_mangle_reg)) | 94 | if (arpt_register_target(&arpt_mangle_reg)) |
95 | return -EINVAL; | 95 | return -EINVAL; |
@@ -97,10 +97,10 @@ static int __init init(void) | |||
97 | return 0; | 97 | return 0; |
98 | } | 98 | } |
99 | 99 | ||
100 | static void __exit fini(void) | 100 | static void __exit arpt_mangle_fini(void) |
101 | { | 101 | { |
102 | arpt_unregister_target(&arpt_mangle_reg); | 102 | arpt_unregister_target(&arpt_mangle_reg); |
103 | } | 103 | } |
104 | 104 | ||
105 | module_init(init); | 105 | module_init(arpt_mangle_init); |
106 | module_exit(fini); | 106 | module_exit(arpt_mangle_fini); |
diff --git a/net/ipv4/netfilter/arptable_filter.c b/net/ipv4/netfilter/arptable_filter.c index f6ab45f48681..d0d379c7df9a 100644 --- a/net/ipv4/netfilter/arptable_filter.c +++ b/net/ipv4/netfilter/arptable_filter.c | |||
@@ -179,7 +179,7 @@ static struct nf_hook_ops arpt_ops[] = { | |||
179 | }, | 179 | }, |
180 | }; | 180 | }; |
181 | 181 | ||
182 | static int __init init(void) | 182 | static int __init arptable_filter_init(void) |
183 | { | 183 | { |
184 | int ret, i; | 184 | int ret, i; |
185 | 185 | ||
@@ -201,7 +201,7 @@ cleanup_hooks: | |||
201 | return ret; | 201 | return ret; |
202 | } | 202 | } |
203 | 203 | ||
204 | static void __exit fini(void) | 204 | static void __exit arptable_filter_fini(void) |
205 | { | 205 | { |
206 | unsigned int i; | 206 | unsigned int i; |
207 | 207 | ||
@@ -211,5 +211,5 @@ static void __exit fini(void) | |||
211 | arpt_unregister_table(&packet_filter); | 211 | arpt_unregister_table(&packet_filter); |
212 | } | 212 | } |
213 | 213 | ||
214 | module_init(init); | 214 | module_init(arptable_filter_init); |
215 | module_exit(fini); | 215 | module_exit(arptable_filter_fini); |
diff --git a/net/ipv4/netfilter/ip_conntrack_amanda.c b/net/ipv4/netfilter/ip_conntrack_amanda.c index 84e4f79b7ffa..a604b1ccfdaa 100644 --- a/net/ipv4/netfilter/ip_conntrack_amanda.c +++ b/net/ipv4/netfilter/ip_conntrack_amanda.c | |||
@@ -153,13 +153,13 @@ static struct ip_conntrack_helper amanda_helper = { | |||
153 | }, | 153 | }, |
154 | }; | 154 | }; |
155 | 155 | ||
156 | static void __exit fini(void) | 156 | static void __exit ip_conntrack_amanda_fini(void) |
157 | { | 157 | { |
158 | ip_conntrack_helper_unregister(&amanda_helper); | 158 | ip_conntrack_helper_unregister(&amanda_helper); |
159 | kfree(amanda_buffer); | 159 | kfree(amanda_buffer); |
160 | } | 160 | } |
161 | 161 | ||
162 | static int __init init(void) | 162 | static int __init ip_conntrack_amanda_init(void) |
163 | { | 163 | { |
164 | int ret; | 164 | int ret; |
165 | 165 | ||
@@ -177,5 +177,5 @@ static int __init init(void) | |||
177 | 177 | ||
178 | } | 178 | } |
179 | 179 | ||
180 | module_init(init); | 180 | module_init(ip_conntrack_amanda_init); |
181 | module_exit(fini); | 181 | module_exit(ip_conntrack_amanda_fini); |
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c index 9e34034729a6..ceaabc18202b 100644 --- a/net/ipv4/netfilter/ip_conntrack_core.c +++ b/net/ipv4/netfilter/ip_conntrack_core.c | |||
@@ -80,8 +80,8 @@ static int ip_conntrack_vmalloc; | |||
80 | static unsigned int ip_conntrack_next_id; | 80 | static unsigned int ip_conntrack_next_id; |
81 | static unsigned int ip_conntrack_expect_next_id; | 81 | static unsigned int ip_conntrack_expect_next_id; |
82 | #ifdef CONFIG_IP_NF_CONNTRACK_EVENTS | 82 | #ifdef CONFIG_IP_NF_CONNTRACK_EVENTS |
83 | struct notifier_block *ip_conntrack_chain; | 83 | ATOMIC_NOTIFIER_HEAD(ip_conntrack_chain); |
84 | struct notifier_block *ip_conntrack_expect_chain; | 84 | ATOMIC_NOTIFIER_HEAD(ip_conntrack_expect_chain); |
85 | 85 | ||
86 | DEFINE_PER_CPU(struct ip_conntrack_ecache, ip_conntrack_ecache); | 86 | DEFINE_PER_CPU(struct ip_conntrack_ecache, ip_conntrack_ecache); |
87 | 87 | ||
@@ -92,7 +92,7 @@ __ip_ct_deliver_cached_events(struct ip_conntrack_ecache *ecache) | |||
92 | { | 92 | { |
93 | DEBUGP("ecache: delivering events for %p\n", ecache->ct); | 93 | DEBUGP("ecache: delivering events for %p\n", ecache->ct); |
94 | if (is_confirmed(ecache->ct) && !is_dying(ecache->ct) && ecache->events) | 94 | if (is_confirmed(ecache->ct) && !is_dying(ecache->ct) && ecache->events) |
95 | notifier_call_chain(&ip_conntrack_chain, ecache->events, | 95 | atomic_notifier_call_chain(&ip_conntrack_chain, ecache->events, |
96 | ecache->ct); | 96 | ecache->ct); |
97 | ecache->events = 0; | 97 | ecache->events = 0; |
98 | ip_conntrack_put(ecache->ct); | 98 | ip_conntrack_put(ecache->ct); |
diff --git a/net/ipv4/netfilter/ip_conntrack_ftp.c b/net/ipv4/netfilter/ip_conntrack_ftp.c index e627e5856172..3e542bf28a9d 100644 --- a/net/ipv4/netfilter/ip_conntrack_ftp.c +++ b/net/ipv4/netfilter/ip_conntrack_ftp.c | |||
@@ -453,7 +453,7 @@ static struct ip_conntrack_helper ftp[MAX_PORTS]; | |||
453 | static char ftp_names[MAX_PORTS][sizeof("ftp-65535")]; | 453 | static char ftp_names[MAX_PORTS][sizeof("ftp-65535")]; |
454 | 454 | ||
455 | /* Not __exit: called from init() */ | 455 | /* Not __exit: called from init() */ |
456 | static void fini(void) | 456 | static void ip_conntrack_ftp_fini(void) |
457 | { | 457 | { |
458 | int i; | 458 | int i; |
459 | for (i = 0; i < ports_c; i++) { | 459 | for (i = 0; i < ports_c; i++) { |
@@ -465,7 +465,7 @@ static void fini(void) | |||
465 | kfree(ftp_buffer); | 465 | kfree(ftp_buffer); |
466 | } | 466 | } |
467 | 467 | ||
468 | static int __init init(void) | 468 | static int __init ip_conntrack_ftp_init(void) |
469 | { | 469 | { |
470 | int i, ret; | 470 | int i, ret; |
471 | char *tmpname; | 471 | char *tmpname; |
@@ -499,12 +499,12 @@ static int __init init(void) | |||
499 | ret = ip_conntrack_helper_register(&ftp[i]); | 499 | ret = ip_conntrack_helper_register(&ftp[i]); |
500 | 500 | ||
501 | if (ret) { | 501 | if (ret) { |
502 | fini(); | 502 | ip_conntrack_ftp_fini(); |
503 | return ret; | 503 | return ret; |
504 | } | 504 | } |
505 | } | 505 | } |
506 | return 0; | 506 | return 0; |
507 | } | 507 | } |
508 | 508 | ||
509 | module_init(init); | 509 | module_init(ip_conntrack_ftp_init); |
510 | module_exit(fini); | 510 | module_exit(ip_conntrack_ftp_fini); |
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c index d716bba798f2..7d3ba4302e9e 100644 --- a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c +++ b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c | |||
@@ -766,7 +766,7 @@ extern void ip_ct_proto_gre_fini(void); | |||
766 | extern int __init ip_ct_proto_gre_init(void); | 766 | extern int __init ip_ct_proto_gre_init(void); |
767 | 767 | ||
768 | /* ip_conntrack_pptp initialization */ | 768 | /* ip_conntrack_pptp initialization */ |
769 | static int __init init(void) | 769 | static int __init ip_conntrack_helper_pptp_init(void) |
770 | { | 770 | { |
771 | int retcode; | 771 | int retcode; |
772 | 772 | ||
@@ -786,15 +786,15 @@ static int __init init(void) | |||
786 | return 0; | 786 | return 0; |
787 | } | 787 | } |
788 | 788 | ||
789 | static void __exit fini(void) | 789 | static void __exit ip_conntrack_helper_pptp_fini(void) |
790 | { | 790 | { |
791 | ip_conntrack_helper_unregister(&pptp); | 791 | ip_conntrack_helper_unregister(&pptp); |
792 | ip_ct_proto_gre_fini(); | 792 | ip_ct_proto_gre_fini(); |
793 | printk("ip_conntrack_pptp version %s unloaded\n", IP_CT_PPTP_VERSION); | 793 | printk("ip_conntrack_pptp version %s unloaded\n", IP_CT_PPTP_VERSION); |
794 | } | 794 | } |
795 | 795 | ||
796 | module_init(init); | 796 | module_init(ip_conntrack_helper_pptp_init); |
797 | module_exit(fini); | 797 | module_exit(ip_conntrack_helper_pptp_fini); |
798 | 798 | ||
799 | EXPORT_SYMBOL(ip_nat_pptp_hook_outbound); | 799 | EXPORT_SYMBOL(ip_nat_pptp_hook_outbound); |
800 | EXPORT_SYMBOL(ip_nat_pptp_hook_inbound); | 800 | EXPORT_SYMBOL(ip_nat_pptp_hook_inbound); |
diff --git a/net/ipv4/netfilter/ip_conntrack_irc.c b/net/ipv4/netfilter/ip_conntrack_irc.c index c51a2cf71b4b..a2ac5ce544b2 100644 --- a/net/ipv4/netfilter/ip_conntrack_irc.c +++ b/net/ipv4/netfilter/ip_conntrack_irc.c | |||
@@ -242,9 +242,9 @@ static int help(struct sk_buff **pskb, | |||
242 | static struct ip_conntrack_helper irc_helpers[MAX_PORTS]; | 242 | static struct ip_conntrack_helper irc_helpers[MAX_PORTS]; |
243 | static char irc_names[MAX_PORTS][sizeof("irc-65535")]; | 243 | static char irc_names[MAX_PORTS][sizeof("irc-65535")]; |
244 | 244 | ||
245 | static void fini(void); | 245 | static void ip_conntrack_irc_fini(void); |
246 | 246 | ||
247 | static int __init init(void) | 247 | static int __init ip_conntrack_irc_init(void) |
248 | { | 248 | { |
249 | int i, ret; | 249 | int i, ret; |
250 | struct ip_conntrack_helper *hlpr; | 250 | struct ip_conntrack_helper *hlpr; |
@@ -288,7 +288,7 @@ static int __init init(void) | |||
288 | if (ret) { | 288 | if (ret) { |
289 | printk("ip_conntrack_irc: ERROR registering port %d\n", | 289 | printk("ip_conntrack_irc: ERROR registering port %d\n", |
290 | ports[i]); | 290 | ports[i]); |
291 | fini(); | 291 | ip_conntrack_irc_fini(); |
292 | return -EBUSY; | 292 | return -EBUSY; |
293 | } | 293 | } |
294 | } | 294 | } |
@@ -297,7 +297,7 @@ static int __init init(void) | |||
297 | 297 | ||
298 | /* This function is intentionally _NOT_ defined as __exit, because | 298 | /* This function is intentionally _NOT_ defined as __exit, because |
299 | * it is needed by the init function */ | 299 | * it is needed by the init function */ |
300 | static void fini(void) | 300 | static void ip_conntrack_irc_fini(void) |
301 | { | 301 | { |
302 | int i; | 302 | int i; |
303 | for (i = 0; i < ports_c; i++) { | 303 | for (i = 0; i < ports_c; i++) { |
@@ -308,5 +308,5 @@ static void fini(void) | |||
308 | kfree(irc_buffer); | 308 | kfree(irc_buffer); |
309 | } | 309 | } |
310 | 310 | ||
311 | module_init(init); | 311 | module_init(ip_conntrack_irc_init); |
312 | module_exit(fini); | 312 | module_exit(ip_conntrack_irc_fini); |
diff --git a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c index 4e68e16a2612..a566a81325b2 100644 --- a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c +++ b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c | |||
@@ -127,16 +127,16 @@ static struct ip_conntrack_helper helper = { | |||
127 | .help = help, | 127 | .help = help, |
128 | }; | 128 | }; |
129 | 129 | ||
130 | static int __init init(void) | 130 | static int __init ip_conntrack_netbios_ns_init(void) |
131 | { | 131 | { |
132 | helper.timeout = timeout; | 132 | helper.timeout = timeout; |
133 | return ip_conntrack_helper_register(&helper); | 133 | return ip_conntrack_helper_register(&helper); |
134 | } | 134 | } |
135 | 135 | ||
136 | static void __exit fini(void) | 136 | static void __exit ip_conntrack_netbios_ns_fini(void) |
137 | { | 137 | { |
138 | ip_conntrack_helper_unregister(&helper); | 138 | ip_conntrack_helper_unregister(&helper); |
139 | } | 139 | } |
140 | 140 | ||
141 | module_init(init); | 141 | module_init(ip_conntrack_netbios_ns_init); |
142 | module_exit(fini); | 142 | module_exit(ip_conntrack_netbios_ns_fini); |
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c index be602e8aeab0..5259abd0fb42 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c | |||
@@ -609,7 +609,7 @@ static ctl_table ip_ct_net_table[] = { | |||
609 | static struct ctl_table_header *ip_ct_sysctl_header; | 609 | static struct ctl_table_header *ip_ct_sysctl_header; |
610 | #endif | 610 | #endif |
611 | 611 | ||
612 | static int __init init(void) | 612 | static int __init ip_conntrack_proto_sctp_init(void) |
613 | { | 613 | { |
614 | int ret; | 614 | int ret; |
615 | 615 | ||
@@ -640,7 +640,7 @@ static int __init init(void) | |||
640 | return ret; | 640 | return ret; |
641 | } | 641 | } |
642 | 642 | ||
643 | static void __exit fini(void) | 643 | static void __exit ip_conntrack_proto_sctp_fini(void) |
644 | { | 644 | { |
645 | ip_conntrack_protocol_unregister(&ip_conntrack_protocol_sctp); | 645 | ip_conntrack_protocol_unregister(&ip_conntrack_protocol_sctp); |
646 | #ifdef CONFIG_SYSCTL | 646 | #ifdef CONFIG_SYSCTL |
@@ -649,8 +649,8 @@ static void __exit fini(void) | |||
649 | DEBUGP("SCTP conntrack module unloaded\n"); | 649 | DEBUGP("SCTP conntrack module unloaded\n"); |
650 | } | 650 | } |
651 | 651 | ||
652 | module_init(init); | 652 | module_init(ip_conntrack_proto_sctp_init); |
653 | module_exit(fini); | 653 | module_exit(ip_conntrack_proto_sctp_fini); |
654 | 654 | ||
655 | MODULE_LICENSE("GPL"); | 655 | MODULE_LICENSE("GPL"); |
656 | MODULE_AUTHOR("Kiran Kumar Immidi"); | 656 | MODULE_AUTHOR("Kiran Kumar Immidi"); |
diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c index 833fcb4be5e7..52076026db36 100644 --- a/net/ipv4/netfilter/ip_conntrack_standalone.c +++ b/net/ipv4/netfilter/ip_conntrack_standalone.c | |||
@@ -929,18 +929,18 @@ void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto) | |||
929 | ip_ct_iterate_cleanup(kill_proto, &proto->proto); | 929 | ip_ct_iterate_cleanup(kill_proto, &proto->proto); |
930 | } | 930 | } |
931 | 931 | ||
932 | static int __init init(void) | 932 | static int __init ip_conntrack_standalone_init(void) |
933 | { | 933 | { |
934 | return init_or_cleanup(1); | 934 | return init_or_cleanup(1); |
935 | } | 935 | } |
936 | 936 | ||
937 | static void __exit fini(void) | 937 | static void __exit ip_conntrack_standalone_fini(void) |
938 | { | 938 | { |
939 | init_or_cleanup(0); | 939 | init_or_cleanup(0); |
940 | } | 940 | } |
941 | 941 | ||
942 | module_init(init); | 942 | module_init(ip_conntrack_standalone_init); |
943 | module_exit(fini); | 943 | module_exit(ip_conntrack_standalone_fini); |
944 | 944 | ||
945 | /* Some modules need us, but don't depend directly on any symbol. | 945 | /* Some modules need us, but don't depend directly on any symbol. |
946 | They should call this. */ | 946 | They should call this. */ |
diff --git a/net/ipv4/netfilter/ip_conntrack_tftp.c b/net/ipv4/netfilter/ip_conntrack_tftp.c index 4ba4463cec28..7e33d3bed5e3 100644 --- a/net/ipv4/netfilter/ip_conntrack_tftp.c +++ b/net/ipv4/netfilter/ip_conntrack_tftp.c | |||
@@ -103,7 +103,7 @@ static int tftp_help(struct sk_buff **pskb, | |||
103 | static struct ip_conntrack_helper tftp[MAX_PORTS]; | 103 | static struct ip_conntrack_helper tftp[MAX_PORTS]; |
104 | static char tftp_names[MAX_PORTS][sizeof("tftp-65535")]; | 104 | static char tftp_names[MAX_PORTS][sizeof("tftp-65535")]; |
105 | 105 | ||
106 | static void fini(void) | 106 | static void ip_conntrack_tftp_fini(void) |
107 | { | 107 | { |
108 | int i; | 108 | int i; |
109 | 109 | ||
@@ -114,7 +114,7 @@ static void fini(void) | |||
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | static int __init init(void) | 117 | static int __init ip_conntrack_tftp_init(void) |
118 | { | 118 | { |
119 | int i, ret; | 119 | int i, ret; |
120 | char *tmpname; | 120 | char *tmpname; |
@@ -148,12 +148,12 @@ static int __init init(void) | |||
148 | if (ret) { | 148 | if (ret) { |
149 | printk("ERROR registering helper for port %d\n", | 149 | printk("ERROR registering helper for port %d\n", |
150 | ports[i]); | 150 | ports[i]); |
151 | fini(); | 151 | ip_conntrack_tftp_fini(); |
152 | return(ret); | 152 | return(ret); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | return(0); | 155 | return(0); |
156 | } | 156 | } |
157 | 157 | ||
158 | module_init(init); | 158 | module_init(ip_conntrack_tftp_init); |
159 | module_exit(fini); | 159 | module_exit(ip_conntrack_tftp_fini); |
diff --git a/net/ipv4/netfilter/ip_nat_amanda.c b/net/ipv4/netfilter/ip_nat_amanda.c index 706c8074f422..3a888715bbf3 100644 --- a/net/ipv4/netfilter/ip_nat_amanda.c +++ b/net/ipv4/netfilter/ip_nat_amanda.c | |||
@@ -68,19 +68,19 @@ static unsigned int help(struct sk_buff **pskb, | |||
68 | return ret; | 68 | return ret; |
69 | } | 69 | } |
70 | 70 | ||
71 | static void __exit fini(void) | 71 | static void __exit ip_nat_amanda_fini(void) |
72 | { | 72 | { |
73 | ip_nat_amanda_hook = NULL; | 73 | ip_nat_amanda_hook = NULL; |
74 | /* Make sure noone calls it, meanwhile. */ | 74 | /* Make sure noone calls it, meanwhile. */ |
75 | synchronize_net(); | 75 | synchronize_net(); |
76 | } | 76 | } |
77 | 77 | ||
78 | static int __init init(void) | 78 | static int __init ip_nat_amanda_init(void) |
79 | { | 79 | { |
80 | BUG_ON(ip_nat_amanda_hook); | 80 | BUG_ON(ip_nat_amanda_hook); |
81 | ip_nat_amanda_hook = help; | 81 | ip_nat_amanda_hook = help; |
82 | return 0; | 82 | return 0; |
83 | } | 83 | } |
84 | 84 | ||
85 | module_init(init); | 85 | module_init(ip_nat_amanda_init); |
86 | module_exit(fini); | 86 | module_exit(ip_nat_amanda_fini); |
diff --git a/net/ipv4/netfilter/ip_nat_ftp.c b/net/ipv4/netfilter/ip_nat_ftp.c index b8daab3c64af..3328fc5c5f50 100644 --- a/net/ipv4/netfilter/ip_nat_ftp.c +++ b/net/ipv4/netfilter/ip_nat_ftp.c | |||
@@ -154,14 +154,14 @@ static unsigned int ip_nat_ftp(struct sk_buff **pskb, | |||
154 | return NF_ACCEPT; | 154 | return NF_ACCEPT; |
155 | } | 155 | } |
156 | 156 | ||
157 | static void __exit fini(void) | 157 | static void __exit ip_nat_ftp_fini(void) |
158 | { | 158 | { |
159 | ip_nat_ftp_hook = NULL; | 159 | ip_nat_ftp_hook = NULL; |
160 | /* Make sure noone calls it, meanwhile. */ | 160 | /* Make sure noone calls it, meanwhile. */ |
161 | synchronize_net(); | 161 | synchronize_net(); |
162 | } | 162 | } |
163 | 163 | ||
164 | static int __init init(void) | 164 | static int __init ip_nat_ftp_init(void) |
165 | { | 165 | { |
166 | BUG_ON(ip_nat_ftp_hook); | 166 | BUG_ON(ip_nat_ftp_hook); |
167 | ip_nat_ftp_hook = ip_nat_ftp; | 167 | ip_nat_ftp_hook = ip_nat_ftp; |
@@ -177,5 +177,5 @@ static int warn_set(const char *val, struct kernel_param *kp) | |||
177 | } | 177 | } |
178 | module_param_call(ports, warn_set, NULL, NULL, 0); | 178 | module_param_call(ports, warn_set, NULL, NULL, 0); |
179 | 179 | ||
180 | module_init(init); | 180 | module_init(ip_nat_ftp_init); |
181 | module_exit(fini); | 181 | module_exit(ip_nat_ftp_fini); |
diff --git a/net/ipv4/netfilter/ip_nat_helper_pptp.c b/net/ipv4/netfilter/ip_nat_helper_pptp.c index b9c016c063b8..f3977726ff09 100644 --- a/net/ipv4/netfilter/ip_nat_helper_pptp.c +++ b/net/ipv4/netfilter/ip_nat_helper_pptp.c | |||
@@ -370,7 +370,7 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
370 | extern int __init ip_nat_proto_gre_init(void); | 370 | extern int __init ip_nat_proto_gre_init(void); |
371 | extern void __exit ip_nat_proto_gre_fini(void); | 371 | extern void __exit ip_nat_proto_gre_fini(void); |
372 | 372 | ||
373 | static int __init init(void) | 373 | static int __init ip_nat_helper_pptp_init(void) |
374 | { | 374 | { |
375 | int ret; | 375 | int ret; |
376 | 376 | ||
@@ -396,7 +396,7 @@ static int __init init(void) | |||
396 | return 0; | 396 | return 0; |
397 | } | 397 | } |
398 | 398 | ||
399 | static void __exit fini(void) | 399 | static void __exit ip_nat_helper_pptp_fini(void) |
400 | { | 400 | { |
401 | DEBUGP("cleanup_module\n" ); | 401 | DEBUGP("cleanup_module\n" ); |
402 | 402 | ||
@@ -412,5 +412,5 @@ static void __exit fini(void) | |||
412 | printk("ip_nat_pptp version %s unloaded\n", IP_NAT_PPTP_VERSION); | 412 | printk("ip_nat_pptp version %s unloaded\n", IP_NAT_PPTP_VERSION); |
413 | } | 413 | } |
414 | 414 | ||
415 | module_init(init); | 415 | module_init(ip_nat_helper_pptp_init); |
416 | module_exit(fini); | 416 | module_exit(ip_nat_helper_pptp_fini); |
diff --git a/net/ipv4/netfilter/ip_nat_irc.c b/net/ipv4/netfilter/ip_nat_irc.c index 461c833eaca1..a767123e082c 100644 --- a/net/ipv4/netfilter/ip_nat_irc.c +++ b/net/ipv4/netfilter/ip_nat_irc.c | |||
@@ -96,14 +96,14 @@ static unsigned int help(struct sk_buff **pskb, | |||
96 | return ret; | 96 | return ret; |
97 | } | 97 | } |
98 | 98 | ||
99 | static void __exit fini(void) | 99 | static void __exit ip_nat_irc_fini(void) |
100 | { | 100 | { |
101 | ip_nat_irc_hook = NULL; | 101 | ip_nat_irc_hook = NULL; |
102 | /* Make sure noone calls it, meanwhile. */ | 102 | /* Make sure noone calls it, meanwhile. */ |
103 | synchronize_net(); | 103 | synchronize_net(); |
104 | } | 104 | } |
105 | 105 | ||
106 | static int __init init(void) | 106 | static int __init ip_nat_irc_init(void) |
107 | { | 107 | { |
108 | BUG_ON(ip_nat_irc_hook); | 108 | BUG_ON(ip_nat_irc_hook); |
109 | ip_nat_irc_hook = help; | 109 | ip_nat_irc_hook = help; |
@@ -119,5 +119,5 @@ static int warn_set(const char *val, struct kernel_param *kp) | |||
119 | } | 119 | } |
120 | module_param_call(ports, warn_set, NULL, NULL, 0); | 120 | module_param_call(ports, warn_set, NULL, NULL, 0); |
121 | 121 | ||
122 | module_init(init); | 122 | module_init(ip_nat_irc_init); |
123 | module_exit(fini); | 123 | module_exit(ip_nat_irc_fini); |
diff --git a/net/ipv4/netfilter/ip_nat_snmp_basic.c b/net/ipv4/netfilter/ip_nat_snmp_basic.c index f029da2a60ee..c62253845538 100644 --- a/net/ipv4/netfilter/ip_nat_snmp_basic.c +++ b/net/ipv4/netfilter/ip_nat_snmp_basic.c | |||
@@ -1324,7 +1324,7 @@ static struct ip_conntrack_helper snmp_trap_helper = { | |||
1324 | * | 1324 | * |
1325 | *****************************************************************************/ | 1325 | *****************************************************************************/ |
1326 | 1326 | ||
1327 | static int __init init(void) | 1327 | static int __init ip_nat_snmp_basic_init(void) |
1328 | { | 1328 | { |
1329 | int ret = 0; | 1329 | int ret = 0; |
1330 | 1330 | ||
@@ -1339,13 +1339,13 @@ static int __init init(void) | |||
1339 | return ret; | 1339 | return ret; |
1340 | } | 1340 | } |
1341 | 1341 | ||
1342 | static void __exit fini(void) | 1342 | static void __exit ip_nat_snmp_basic_fini(void) |
1343 | { | 1343 | { |
1344 | ip_conntrack_helper_unregister(&snmp_helper); | 1344 | ip_conntrack_helper_unregister(&snmp_helper); |
1345 | ip_conntrack_helper_unregister(&snmp_trap_helper); | 1345 | ip_conntrack_helper_unregister(&snmp_trap_helper); |
1346 | } | 1346 | } |
1347 | 1347 | ||
1348 | module_init(init); | 1348 | module_init(ip_nat_snmp_basic_init); |
1349 | module_exit(fini); | 1349 | module_exit(ip_nat_snmp_basic_fini); |
1350 | 1350 | ||
1351 | module_param(debug, bool, 0600); | 1351 | module_param(debug, bool, 0600); |
diff --git a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c index 380aef3d7865..3505b0de2e04 100644 --- a/net/ipv4/netfilter/ip_nat_standalone.c +++ b/net/ipv4/netfilter/ip_nat_standalone.c | |||
@@ -425,17 +425,17 @@ static int init_or_cleanup(int init) | |||
425 | return ret; | 425 | return ret; |
426 | } | 426 | } |
427 | 427 | ||
428 | static int __init init(void) | 428 | static int __init ip_nat_standalone_init(void) |
429 | { | 429 | { |
430 | return init_or_cleanup(1); | 430 | return init_or_cleanup(1); |
431 | } | 431 | } |
432 | 432 | ||
433 | static void __exit fini(void) | 433 | static void __exit ip_nat_standalone_fini(void) |
434 | { | 434 | { |
435 | init_or_cleanup(0); | 435 | init_or_cleanup(0); |
436 | } | 436 | } |
437 | 437 | ||
438 | module_init(init); | 438 | module_init(ip_nat_standalone_init); |
439 | module_exit(fini); | 439 | module_exit(ip_nat_standalone_fini); |
440 | 440 | ||
441 | MODULE_LICENSE("GPL"); | 441 | MODULE_LICENSE("GPL"); |
diff --git a/net/ipv4/netfilter/ip_nat_tftp.c b/net/ipv4/netfilter/ip_nat_tftp.c index 43c3bd7c118e..94a78015451c 100644 --- a/net/ipv4/netfilter/ip_nat_tftp.c +++ b/net/ipv4/netfilter/ip_nat_tftp.c | |||
@@ -53,19 +53,19 @@ static unsigned int help(struct sk_buff **pskb, | |||
53 | return NF_ACCEPT; | 53 | return NF_ACCEPT; |
54 | } | 54 | } |
55 | 55 | ||
56 | static void __exit fini(void) | 56 | static void __exit ip_nat_tftp_fini(void) |
57 | { | 57 | { |
58 | ip_nat_tftp_hook = NULL; | 58 | ip_nat_tftp_hook = NULL; |
59 | /* Make sure noone calls it, meanwhile. */ | 59 | /* Make sure noone calls it, meanwhile. */ |
60 | synchronize_net(); | 60 | synchronize_net(); |
61 | } | 61 | } |
62 | 62 | ||
63 | static int __init init(void) | 63 | static int __init ip_nat_tftp_init(void) |
64 | { | 64 | { |
65 | BUG_ON(ip_nat_tftp_hook); | 65 | BUG_ON(ip_nat_tftp_hook); |
66 | ip_nat_tftp_hook = help; | 66 | ip_nat_tftp_hook = help; |
67 | return 0; | 67 | return 0; |
68 | } | 68 | } |
69 | 69 | ||
70 | module_init(init); | 70 | module_init(ip_nat_tftp_init); |
71 | module_exit(fini); | 71 | module_exit(ip_nat_tftp_fini); |
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index 1655866c55b9..896a244f8f91 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
@@ -717,13 +717,13 @@ cleanup_netlink_notifier: | |||
717 | return status; | 717 | return status; |
718 | } | 718 | } |
719 | 719 | ||
720 | static int __init init(void) | 720 | static int __init ip_queue_init(void) |
721 | { | 721 | { |
722 | 722 | ||
723 | return init_or_cleanup(1); | 723 | return init_or_cleanup(1); |
724 | } | 724 | } |
725 | 725 | ||
726 | static void __exit fini(void) | 726 | static void __exit ip_queue_fini(void) |
727 | { | 727 | { |
728 | init_or_cleanup(0); | 728 | init_or_cleanup(0); |
729 | } | 729 | } |
@@ -732,5 +732,5 @@ MODULE_DESCRIPTION("IPv4 packet queue handler"); | |||
732 | MODULE_AUTHOR("James Morris <jmorris@intercode.com.au>"); | 732 | MODULE_AUTHOR("James Morris <jmorris@intercode.com.au>"); |
733 | MODULE_LICENSE("GPL"); | 733 | MODULE_LICENSE("GPL"); |
734 | 734 | ||
735 | module_init(init); | 735 | module_init(ip_queue_init); |
736 | module_exit(fini); | 736 | module_exit(ip_queue_fini); |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index a7b194c4d79d..460fd905fad0 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -1364,7 +1364,7 @@ static struct ipt_match icmp_matchstruct = { | |||
1364 | .checkentry = icmp_checkentry, | 1364 | .checkentry = icmp_checkentry, |
1365 | }; | 1365 | }; |
1366 | 1366 | ||
1367 | static int __init init(void) | 1367 | static int __init ip_tables_init(void) |
1368 | { | 1368 | { |
1369 | int ret; | 1369 | int ret; |
1370 | 1370 | ||
@@ -1386,7 +1386,7 @@ static int __init init(void) | |||
1386 | return 0; | 1386 | return 0; |
1387 | } | 1387 | } |
1388 | 1388 | ||
1389 | static void __exit fini(void) | 1389 | static void __exit ip_tables_fini(void) |
1390 | { | 1390 | { |
1391 | nf_unregister_sockopt(&ipt_sockopts); | 1391 | nf_unregister_sockopt(&ipt_sockopts); |
1392 | 1392 | ||
@@ -1400,5 +1400,5 @@ static void __exit fini(void) | |||
1400 | EXPORT_SYMBOL(ipt_register_table); | 1400 | EXPORT_SYMBOL(ipt_register_table); |
1401 | EXPORT_SYMBOL(ipt_unregister_table); | 1401 | EXPORT_SYMBOL(ipt_unregister_table); |
1402 | EXPORT_SYMBOL(ipt_do_table); | 1402 | EXPORT_SYMBOL(ipt_do_table); |
1403 | module_init(init); | 1403 | module_init(ip_tables_init); |
1404 | module_exit(fini); | 1404 | module_exit(ip_tables_fini); |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 61e11edcd6af..e4768a31718b 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -770,15 +770,15 @@ cleanup_none: | |||
770 | return -EINVAL; | 770 | return -EINVAL; |
771 | } | 771 | } |
772 | 772 | ||
773 | static int __init init(void) | 773 | static int __init ipt_clusterip_init(void) |
774 | { | 774 | { |
775 | return init_or_cleanup(0); | 775 | return init_or_cleanup(0); |
776 | } | 776 | } |
777 | 777 | ||
778 | static void __exit fini(void) | 778 | static void __exit ipt_clusterip_fini(void) |
779 | { | 779 | { |
780 | init_or_cleanup(1); | 780 | init_or_cleanup(1); |
781 | } | 781 | } |
782 | 782 | ||
783 | module_init(init); | 783 | module_init(ipt_clusterip_init); |
784 | module_exit(fini); | 784 | module_exit(ipt_clusterip_fini); |
diff --git a/net/ipv4/netfilter/ipt_DSCP.c b/net/ipv4/netfilter/ipt_DSCP.c index cfb0b90e598a..c8e971288dfe 100644 --- a/net/ipv4/netfilter/ipt_DSCP.c +++ b/net/ipv4/netfilter/ipt_DSCP.c | |||
@@ -82,15 +82,15 @@ static struct ipt_target ipt_dscp_reg = { | |||
82 | .me = THIS_MODULE, | 82 | .me = THIS_MODULE, |
83 | }; | 83 | }; |
84 | 84 | ||
85 | static int __init init(void) | 85 | static int __init ipt_dscp_init(void) |
86 | { | 86 | { |
87 | return ipt_register_target(&ipt_dscp_reg); | 87 | return ipt_register_target(&ipt_dscp_reg); |
88 | } | 88 | } |
89 | 89 | ||
90 | static void __exit fini(void) | 90 | static void __exit ipt_dscp_fini(void) |
91 | { | 91 | { |
92 | ipt_unregister_target(&ipt_dscp_reg); | 92 | ipt_unregister_target(&ipt_dscp_reg); |
93 | } | 93 | } |
94 | 94 | ||
95 | module_init(init); | 95 | module_init(ipt_dscp_init); |
96 | module_exit(fini); | 96 | module_exit(ipt_dscp_fini); |
diff --git a/net/ipv4/netfilter/ipt_ECN.c b/net/ipv4/netfilter/ipt_ECN.c index b9b80f90c84e..4adf5c9d34f5 100644 --- a/net/ipv4/netfilter/ipt_ECN.c +++ b/net/ipv4/netfilter/ipt_ECN.c | |||
@@ -151,15 +151,15 @@ static struct ipt_target ipt_ecn_reg = { | |||
151 | .me = THIS_MODULE, | 151 | .me = THIS_MODULE, |
152 | }; | 152 | }; |
153 | 153 | ||
154 | static int __init init(void) | 154 | static int __init ipt_ecn_init(void) |
155 | { | 155 | { |
156 | return ipt_register_target(&ipt_ecn_reg); | 156 | return ipt_register_target(&ipt_ecn_reg); |
157 | } | 157 | } |
158 | 158 | ||
159 | static void __exit fini(void) | 159 | static void __exit ipt_ecn_fini(void) |
160 | { | 160 | { |
161 | ipt_unregister_target(&ipt_ecn_reg); | 161 | ipt_unregister_target(&ipt_ecn_reg); |
162 | } | 162 | } |
163 | 163 | ||
164 | module_init(init); | 164 | module_init(ipt_ecn_init); |
165 | module_exit(fini); | 165 | module_exit(ipt_ecn_fini); |
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c index 750d3221b280..39fd4c2a2386 100644 --- a/net/ipv4/netfilter/ipt_LOG.c +++ b/net/ipv4/netfilter/ipt_LOG.c | |||
@@ -471,7 +471,7 @@ static struct nf_logger ipt_log_logger ={ | |||
471 | .me = THIS_MODULE, | 471 | .me = THIS_MODULE, |
472 | }; | 472 | }; |
473 | 473 | ||
474 | static int __init init(void) | 474 | static int __init ipt_log_init(void) |
475 | { | 475 | { |
476 | if (ipt_register_target(&ipt_log_reg)) | 476 | if (ipt_register_target(&ipt_log_reg)) |
477 | return -EINVAL; | 477 | return -EINVAL; |
@@ -485,11 +485,11 @@ static int __init init(void) | |||
485 | return 0; | 485 | return 0; |
486 | } | 486 | } |
487 | 487 | ||
488 | static void __exit fini(void) | 488 | static void __exit ipt_log_fini(void) |
489 | { | 489 | { |
490 | nf_log_unregister_logger(&ipt_log_logger); | 490 | nf_log_unregister_logger(&ipt_log_logger); |
491 | ipt_unregister_target(&ipt_log_reg); | 491 | ipt_unregister_target(&ipt_log_reg); |
492 | } | 492 | } |
493 | 493 | ||
494 | module_init(init); | 494 | module_init(ipt_log_init); |
495 | module_exit(fini); | 495 | module_exit(ipt_log_fini); |
diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c index e0c321c3bae5..8b3e7f99b861 100644 --- a/net/ipv4/netfilter/ipt_MASQUERADE.c +++ b/net/ipv4/netfilter/ipt_MASQUERADE.c | |||
@@ -175,7 +175,7 @@ static struct ipt_target masquerade = { | |||
175 | .me = THIS_MODULE, | 175 | .me = THIS_MODULE, |
176 | }; | 176 | }; |
177 | 177 | ||
178 | static int __init init(void) | 178 | static int __init ipt_masquerade_init(void) |
179 | { | 179 | { |
180 | int ret; | 180 | int ret; |
181 | 181 | ||
@@ -191,12 +191,12 @@ static int __init init(void) | |||
191 | return ret; | 191 | return ret; |
192 | } | 192 | } |
193 | 193 | ||
194 | static void __exit fini(void) | 194 | static void __exit ipt_masquerade_fini(void) |
195 | { | 195 | { |
196 | ipt_unregister_target(&masquerade); | 196 | ipt_unregister_target(&masquerade); |
197 | unregister_netdevice_notifier(&masq_dev_notifier); | 197 | unregister_netdevice_notifier(&masq_dev_notifier); |
198 | unregister_inetaddr_notifier(&masq_inet_notifier); | 198 | unregister_inetaddr_notifier(&masq_inet_notifier); |
199 | } | 199 | } |
200 | 200 | ||
201 | module_init(init); | 201 | module_init(ipt_masquerade_init); |
202 | module_exit(fini); | 202 | module_exit(ipt_masquerade_fini); |
diff --git a/net/ipv4/netfilter/ipt_NETMAP.c b/net/ipv4/netfilter/ipt_NETMAP.c index fba181c2a426..2fcf1075b027 100644 --- a/net/ipv4/netfilter/ipt_NETMAP.c +++ b/net/ipv4/netfilter/ipt_NETMAP.c | |||
@@ -98,15 +98,15 @@ static struct ipt_target target_module = { | |||
98 | .me = THIS_MODULE | 98 | .me = THIS_MODULE |
99 | }; | 99 | }; |
100 | 100 | ||
101 | static int __init init(void) | 101 | static int __init ipt_netmap_init(void) |
102 | { | 102 | { |
103 | return ipt_register_target(&target_module); | 103 | return ipt_register_target(&target_module); |
104 | } | 104 | } |
105 | 105 | ||
106 | static void __exit fini(void) | 106 | static void __exit ipt_netmap_fini(void) |
107 | { | 107 | { |
108 | ipt_unregister_target(&target_module); | 108 | ipt_unregister_target(&target_module); |
109 | } | 109 | } |
110 | 110 | ||
111 | module_init(init); | 111 | module_init(ipt_netmap_init); |
112 | module_exit(fini); | 112 | module_exit(ipt_netmap_fini); |
diff --git a/net/ipv4/netfilter/ipt_REDIRECT.c b/net/ipv4/netfilter/ipt_REDIRECT.c index be3da7c4b871..f290463232de 100644 --- a/net/ipv4/netfilter/ipt_REDIRECT.c +++ b/net/ipv4/netfilter/ipt_REDIRECT.c | |||
@@ -112,15 +112,15 @@ static struct ipt_target redirect_reg = { | |||
112 | .me = THIS_MODULE, | 112 | .me = THIS_MODULE, |
113 | }; | 113 | }; |
114 | 114 | ||
115 | static int __init init(void) | 115 | static int __init ipt_redirect_init(void) |
116 | { | 116 | { |
117 | return ipt_register_target(&redirect_reg); | 117 | return ipt_register_target(&redirect_reg); |
118 | } | 118 | } |
119 | 119 | ||
120 | static void __exit fini(void) | 120 | static void __exit ipt_redirect_fini(void) |
121 | { | 121 | { |
122 | ipt_unregister_target(&redirect_reg); | 122 | ipt_unregister_target(&redirect_reg); |
123 | } | 123 | } |
124 | 124 | ||
125 | module_init(init); | 125 | module_init(ipt_redirect_init); |
126 | module_exit(fini); | 126 | module_exit(ipt_redirect_fini); |
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c index 9d3b3579f27c..4269a5440d43 100644 --- a/net/ipv4/netfilter/ipt_REJECT.c +++ b/net/ipv4/netfilter/ipt_REJECT.c | |||
@@ -313,15 +313,15 @@ static struct ipt_target ipt_reject_reg = { | |||
313 | .me = THIS_MODULE, | 313 | .me = THIS_MODULE, |
314 | }; | 314 | }; |
315 | 315 | ||
316 | static int __init init(void) | 316 | static int __init ipt_reject_init(void) |
317 | { | 317 | { |
318 | return ipt_register_target(&ipt_reject_reg); | 318 | return ipt_register_target(&ipt_reject_reg); |
319 | } | 319 | } |
320 | 320 | ||
321 | static void __exit fini(void) | 321 | static void __exit ipt_reject_fini(void) |
322 | { | 322 | { |
323 | ipt_unregister_target(&ipt_reject_reg); | 323 | ipt_unregister_target(&ipt_reject_reg); |
324 | } | 324 | } |
325 | 325 | ||
326 | module_init(init); | 326 | module_init(ipt_reject_init); |
327 | module_exit(fini); | 327 | module_exit(ipt_reject_fini); |
diff --git a/net/ipv4/netfilter/ipt_SAME.c b/net/ipv4/netfilter/ipt_SAME.c index 7e2ebc9d945e..7169b09b5a67 100644 --- a/net/ipv4/netfilter/ipt_SAME.c +++ b/net/ipv4/netfilter/ipt_SAME.c | |||
@@ -189,16 +189,16 @@ static struct ipt_target same_reg = { | |||
189 | .me = THIS_MODULE, | 189 | .me = THIS_MODULE, |
190 | }; | 190 | }; |
191 | 191 | ||
192 | static int __init init(void) | 192 | static int __init ipt_same_init(void) |
193 | { | 193 | { |
194 | return ipt_register_target(&same_reg); | 194 | return ipt_register_target(&same_reg); |
195 | } | 195 | } |
196 | 196 | ||
197 | static void __exit fini(void) | 197 | static void __exit ipt_same_fini(void) |
198 | { | 198 | { |
199 | ipt_unregister_target(&same_reg); | 199 | ipt_unregister_target(&same_reg); |
200 | } | 200 | } |
201 | 201 | ||
202 | module_init(init); | 202 | module_init(ipt_same_init); |
203 | module_exit(fini); | 203 | module_exit(ipt_same_fini); |
204 | 204 | ||
diff --git a/net/ipv4/netfilter/ipt_TCPMSS.c b/net/ipv4/netfilter/ipt_TCPMSS.c index c4fc50ec2ddb..ef2fe5b3f0d8 100644 --- a/net/ipv4/netfilter/ipt_TCPMSS.c +++ b/net/ipv4/netfilter/ipt_TCPMSS.c | |||
@@ -243,15 +243,15 @@ static struct ipt_target ipt_tcpmss_reg = { | |||
243 | .me = THIS_MODULE, | 243 | .me = THIS_MODULE, |
244 | }; | 244 | }; |
245 | 245 | ||
246 | static int __init init(void) | 246 | static int __init ipt_tcpmss_init(void) |
247 | { | 247 | { |
248 | return ipt_register_target(&ipt_tcpmss_reg); | 248 | return ipt_register_target(&ipt_tcpmss_reg); |
249 | } | 249 | } |
250 | 250 | ||
251 | static void __exit fini(void) | 251 | static void __exit ipt_tcpmss_fini(void) |
252 | { | 252 | { |
253 | ipt_unregister_target(&ipt_tcpmss_reg); | 253 | ipt_unregister_target(&ipt_tcpmss_reg); |
254 | } | 254 | } |
255 | 255 | ||
256 | module_init(init); | 256 | module_init(ipt_tcpmss_init); |
257 | module_exit(fini); | 257 | module_exit(ipt_tcpmss_fini); |
diff --git a/net/ipv4/netfilter/ipt_TOS.c b/net/ipv4/netfilter/ipt_TOS.c index 9aa7817657f0..1c7a5ca399b3 100644 --- a/net/ipv4/netfilter/ipt_TOS.c +++ b/net/ipv4/netfilter/ipt_TOS.c | |||
@@ -81,15 +81,15 @@ static struct ipt_target ipt_tos_reg = { | |||
81 | .me = THIS_MODULE, | 81 | .me = THIS_MODULE, |
82 | }; | 82 | }; |
83 | 83 | ||
84 | static int __init init(void) | 84 | static int __init ipt_tos_init(void) |
85 | { | 85 | { |
86 | return ipt_register_target(&ipt_tos_reg); | 86 | return ipt_register_target(&ipt_tos_reg); |
87 | } | 87 | } |
88 | 88 | ||
89 | static void __exit fini(void) | 89 | static void __exit ipt_tos_fini(void) |
90 | { | 90 | { |
91 | ipt_unregister_target(&ipt_tos_reg); | 91 | ipt_unregister_target(&ipt_tos_reg); |
92 | } | 92 | } |
93 | 93 | ||
94 | module_init(init); | 94 | module_init(ipt_tos_init); |
95 | module_exit(fini); | 95 | module_exit(ipt_tos_fini); |
diff --git a/net/ipv4/netfilter/ipt_TTL.c b/net/ipv4/netfilter/ipt_TTL.c index 5009a003d578..f48892ae0be5 100644 --- a/net/ipv4/netfilter/ipt_TTL.c +++ b/net/ipv4/netfilter/ipt_TTL.c | |||
@@ -94,15 +94,15 @@ static struct ipt_target ipt_TTL = { | |||
94 | .me = THIS_MODULE, | 94 | .me = THIS_MODULE, |
95 | }; | 95 | }; |
96 | 96 | ||
97 | static int __init init(void) | 97 | static int __init ipt_ttl_init(void) |
98 | { | 98 | { |
99 | return ipt_register_target(&ipt_TTL); | 99 | return ipt_register_target(&ipt_TTL); |
100 | } | 100 | } |
101 | 101 | ||
102 | static void __exit fini(void) | 102 | static void __exit ipt_ttl_fini(void) |
103 | { | 103 | { |
104 | ipt_unregister_target(&ipt_TTL); | 104 | ipt_unregister_target(&ipt_TTL); |
105 | } | 105 | } |
106 | 106 | ||
107 | module_init(init); | 107 | module_init(ipt_ttl_init); |
108 | module_exit(fini); | 108 | module_exit(ipt_ttl_fini); |
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c index a82a32ed0e2f..c84cc03389d8 100644 --- a/net/ipv4/netfilter/ipt_ULOG.c +++ b/net/ipv4/netfilter/ipt_ULOG.c | |||
@@ -374,7 +374,7 @@ static struct nf_logger ipt_ulog_logger = { | |||
374 | .me = THIS_MODULE, | 374 | .me = THIS_MODULE, |
375 | }; | 375 | }; |
376 | 376 | ||
377 | static int __init init(void) | 377 | static int __init ipt_ulog_init(void) |
378 | { | 378 | { |
379 | int i; | 379 | int i; |
380 | 380 | ||
@@ -407,7 +407,7 @@ static int __init init(void) | |||
407 | return 0; | 407 | return 0; |
408 | } | 408 | } |
409 | 409 | ||
410 | static void __exit fini(void) | 410 | static void __exit ipt_ulog_fini(void) |
411 | { | 411 | { |
412 | ulog_buff_t *ub; | 412 | ulog_buff_t *ub; |
413 | int i; | 413 | int i; |
@@ -435,5 +435,5 @@ static void __exit fini(void) | |||
435 | 435 | ||
436 | } | 436 | } |
437 | 437 | ||
438 | module_init(init); | 438 | module_init(ipt_ulog_init); |
439 | module_exit(fini); | 439 | module_exit(ipt_ulog_fini); |
diff --git a/net/ipv4/netfilter/ipt_addrtype.c b/net/ipv4/netfilter/ipt_addrtype.c index 5fdf85d0efcf..893dae210b04 100644 --- a/net/ipv4/netfilter/ipt_addrtype.c +++ b/net/ipv4/netfilter/ipt_addrtype.c | |||
@@ -51,15 +51,15 @@ static struct ipt_match addrtype_match = { | |||
51 | .me = THIS_MODULE | 51 | .me = THIS_MODULE |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static int __init init(void) | 54 | static int __init ipt_addrtype_init(void) |
55 | { | 55 | { |
56 | return ipt_register_match(&addrtype_match); | 56 | return ipt_register_match(&addrtype_match); |
57 | } | 57 | } |
58 | 58 | ||
59 | static void __exit fini(void) | 59 | static void __exit ipt_addrtype_fini(void) |
60 | { | 60 | { |
61 | ipt_unregister_match(&addrtype_match); | 61 | ipt_unregister_match(&addrtype_match); |
62 | } | 62 | } |
63 | 63 | ||
64 | module_init(init); | 64 | module_init(ipt_addrtype_init); |
65 | module_exit(fini); | 65 | module_exit(ipt_addrtype_fini); |
diff --git a/net/ipv4/netfilter/ipt_ah.c b/net/ipv4/netfilter/ipt_ah.c index 35a21fb1f8e0..2927135873d7 100644 --- a/net/ipv4/netfilter/ipt_ah.c +++ b/net/ipv4/netfilter/ipt_ah.c | |||
@@ -96,15 +96,15 @@ static struct ipt_match ah_match = { | |||
96 | .me = THIS_MODULE, | 96 | .me = THIS_MODULE, |
97 | }; | 97 | }; |
98 | 98 | ||
99 | static int __init init(void) | 99 | static int __init ipt_ah_init(void) |
100 | { | 100 | { |
101 | return ipt_register_match(&ah_match); | 101 | return ipt_register_match(&ah_match); |
102 | } | 102 | } |
103 | 103 | ||
104 | static void __exit cleanup(void) | 104 | static void __exit ipt_ah_fini(void) |
105 | { | 105 | { |
106 | ipt_unregister_match(&ah_match); | 106 | ipt_unregister_match(&ah_match); |
107 | } | 107 | } |
108 | 108 | ||
109 | module_init(init); | 109 | module_init(ipt_ah_init); |
110 | module_exit(cleanup); | 110 | module_exit(ipt_ah_fini); |
diff --git a/net/ipv4/netfilter/ipt_dscp.c b/net/ipv4/netfilter/ipt_dscp.c index 11963c385dea..47177591aeb6 100644 --- a/net/ipv4/netfilter/ipt_dscp.c +++ b/net/ipv4/netfilter/ipt_dscp.c | |||
@@ -39,16 +39,16 @@ static struct ipt_match dscp_match = { | |||
39 | .me = THIS_MODULE, | 39 | .me = THIS_MODULE, |
40 | }; | 40 | }; |
41 | 41 | ||
42 | static int __init init(void) | 42 | static int __init ipt_dscp_init(void) |
43 | { | 43 | { |
44 | return ipt_register_match(&dscp_match); | 44 | return ipt_register_match(&dscp_match); |
45 | } | 45 | } |
46 | 46 | ||
47 | static void __exit fini(void) | 47 | static void __exit ipt_dscp_fini(void) |
48 | { | 48 | { |
49 | ipt_unregister_match(&dscp_match); | 49 | ipt_unregister_match(&dscp_match); |
50 | 50 | ||
51 | } | 51 | } |
52 | 52 | ||
53 | module_init(init); | 53 | module_init(ipt_dscp_init); |
54 | module_exit(fini); | 54 | module_exit(ipt_dscp_fini); |
diff --git a/net/ipv4/netfilter/ipt_ecn.c b/net/ipv4/netfilter/ipt_ecn.c index d7e29f6a38d8..b28250414933 100644 --- a/net/ipv4/netfilter/ipt_ecn.c +++ b/net/ipv4/netfilter/ipt_ecn.c | |||
@@ -118,15 +118,15 @@ static struct ipt_match ecn_match = { | |||
118 | .me = THIS_MODULE, | 118 | .me = THIS_MODULE, |
119 | }; | 119 | }; |
120 | 120 | ||
121 | static int __init init(void) | 121 | static int __init ipt_ecn_init(void) |
122 | { | 122 | { |
123 | return ipt_register_match(&ecn_match); | 123 | return ipt_register_match(&ecn_match); |
124 | } | 124 | } |
125 | 125 | ||
126 | static void __exit fini(void) | 126 | static void __exit ipt_ecn_fini(void) |
127 | { | 127 | { |
128 | ipt_unregister_match(&ecn_match); | 128 | ipt_unregister_match(&ecn_match); |
129 | } | 129 | } |
130 | 130 | ||
131 | module_init(init); | 131 | module_init(ipt_ecn_init); |
132 | module_exit(fini); | 132 | module_exit(ipt_ecn_fini); |
diff --git a/net/ipv4/netfilter/ipt_esp.c b/net/ipv4/netfilter/ipt_esp.c index af0d5ec79cb5..3840b417a3c5 100644 --- a/net/ipv4/netfilter/ipt_esp.c +++ b/net/ipv4/netfilter/ipt_esp.c | |||
@@ -97,15 +97,15 @@ static struct ipt_match esp_match = { | |||
97 | .me = THIS_MODULE, | 97 | .me = THIS_MODULE, |
98 | }; | 98 | }; |
99 | 99 | ||
100 | static int __init init(void) | 100 | static int __init ipt_esp_init(void) |
101 | { | 101 | { |
102 | return ipt_register_match(&esp_match); | 102 | return ipt_register_match(&esp_match); |
103 | } | 103 | } |
104 | 104 | ||
105 | static void __exit cleanup(void) | 105 | static void __exit ipt_esp_fini(void) |
106 | { | 106 | { |
107 | ipt_unregister_match(&esp_match); | 107 | ipt_unregister_match(&esp_match); |
108 | } | 108 | } |
109 | 109 | ||
110 | module_init(init); | 110 | module_init(ipt_esp_init); |
111 | module_exit(cleanup); | 111 | module_exit(ipt_esp_fini); |
diff --git a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c index ba5e23505e88..7c6836c4646e 100644 --- a/net/ipv4/netfilter/ipt_hashlimit.c +++ b/net/ipv4/netfilter/ipt_hashlimit.c | |||
@@ -719,15 +719,15 @@ cleanup_nothing: | |||
719 | 719 | ||
720 | } | 720 | } |
721 | 721 | ||
722 | static int __init init(void) | 722 | static int __init ipt_hashlimit_init(void) |
723 | { | 723 | { |
724 | return init_or_fini(0); | 724 | return init_or_fini(0); |
725 | } | 725 | } |
726 | 726 | ||
727 | static void __exit fini(void) | 727 | static void __exit ipt_hashlimit_fini(void) |
728 | { | 728 | { |
729 | init_or_fini(1); | 729 | init_or_fini(1); |
730 | } | 730 | } |
731 | 731 | ||
732 | module_init(init); | 732 | module_init(ipt_hashlimit_init); |
733 | module_exit(fini); | 733 | module_exit(ipt_hashlimit_fini); |
diff --git a/net/ipv4/netfilter/ipt_iprange.c b/net/ipv4/netfilter/ipt_iprange.c index ae70112f5e06..5202edd8d333 100644 --- a/net/ipv4/netfilter/ipt_iprange.c +++ b/net/ipv4/netfilter/ipt_iprange.c | |||
@@ -71,15 +71,15 @@ static struct ipt_match iprange_match = { | |||
71 | .me = THIS_MODULE | 71 | .me = THIS_MODULE |
72 | }; | 72 | }; |
73 | 73 | ||
74 | static int __init init(void) | 74 | static int __init ipt_iprange_init(void) |
75 | { | 75 | { |
76 | return ipt_register_match(&iprange_match); | 76 | return ipt_register_match(&iprange_match); |
77 | } | 77 | } |
78 | 78 | ||
79 | static void __exit fini(void) | 79 | static void __exit ipt_iprange_fini(void) |
80 | { | 80 | { |
81 | ipt_unregister_match(&iprange_match); | 81 | ipt_unregister_match(&iprange_match); |
82 | } | 82 | } |
83 | 83 | ||
84 | module_init(init); | 84 | module_init(ipt_iprange_init); |
85 | module_exit(fini); | 85 | module_exit(ipt_iprange_fini); |
diff --git a/net/ipv4/netfilter/ipt_multiport.c b/net/ipv4/netfilter/ipt_multiport.c index bd07f7c53872..ac95d8390bcc 100644 --- a/net/ipv4/netfilter/ipt_multiport.c +++ b/net/ipv4/netfilter/ipt_multiport.c | |||
@@ -171,7 +171,7 @@ static struct ipt_match multiport_match_v1 = { | |||
171 | .me = THIS_MODULE, | 171 | .me = THIS_MODULE, |
172 | }; | 172 | }; |
173 | 173 | ||
174 | static int __init init(void) | 174 | static int __init ipt_multiport_init(void) |
175 | { | 175 | { |
176 | int err; | 176 | int err; |
177 | 177 | ||
@@ -185,11 +185,11 @@ static int __init init(void) | |||
185 | return err; | 185 | return err; |
186 | } | 186 | } |
187 | 187 | ||
188 | static void __exit fini(void) | 188 | static void __exit ipt_multiport_fini(void) |
189 | { | 189 | { |
190 | ipt_unregister_match(&multiport_match); | 190 | ipt_unregister_match(&multiport_match); |
191 | ipt_unregister_match(&multiport_match_v1); | 191 | ipt_unregister_match(&multiport_match_v1); |
192 | } | 192 | } |
193 | 193 | ||
194 | module_init(init); | 194 | module_init(ipt_multiport_init); |
195 | module_exit(fini); | 195 | module_exit(ipt_multiport_fini); |
diff --git a/net/ipv4/netfilter/ipt_owner.c b/net/ipv4/netfilter/ipt_owner.c index 3900428771f3..5ac6ac023b5e 100644 --- a/net/ipv4/netfilter/ipt_owner.c +++ b/net/ipv4/netfilter/ipt_owner.c | |||
@@ -78,15 +78,15 @@ static struct ipt_match owner_match = { | |||
78 | .me = THIS_MODULE, | 78 | .me = THIS_MODULE, |
79 | }; | 79 | }; |
80 | 80 | ||
81 | static int __init init(void) | 81 | static int __init ipt_owner_init(void) |
82 | { | 82 | { |
83 | return ipt_register_match(&owner_match); | 83 | return ipt_register_match(&owner_match); |
84 | } | 84 | } |
85 | 85 | ||
86 | static void __exit fini(void) | 86 | static void __exit ipt_owner_fini(void) |
87 | { | 87 | { |
88 | ipt_unregister_match(&owner_match); | 88 | ipt_unregister_match(&owner_match); |
89 | } | 89 | } |
90 | 90 | ||
91 | module_init(init); | 91 | module_init(ipt_owner_init); |
92 | module_exit(fini); | 92 | module_exit(ipt_owner_fini); |
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c index 06792ead1da4..143843285702 100644 --- a/net/ipv4/netfilter/ipt_recent.c +++ b/net/ipv4/netfilter/ipt_recent.c | |||
@@ -962,7 +962,7 @@ static struct ipt_match recent_match = { | |||
962 | }; | 962 | }; |
963 | 963 | ||
964 | /* Kernel module initialization. */ | 964 | /* Kernel module initialization. */ |
965 | static int __init init(void) | 965 | static int __init ipt_recent_init(void) |
966 | { | 966 | { |
967 | int err, count; | 967 | int err, count; |
968 | 968 | ||
@@ -995,7 +995,7 @@ static int __init init(void) | |||
995 | } | 995 | } |
996 | 996 | ||
997 | /* Kernel module destruction. */ | 997 | /* Kernel module destruction. */ |
998 | static void __exit fini(void) | 998 | static void __exit ipt_recent_fini(void) |
999 | { | 999 | { |
1000 | ipt_unregister_match(&recent_match); | 1000 | ipt_unregister_match(&recent_match); |
1001 | 1001 | ||
@@ -1003,5 +1003,5 @@ static void __exit fini(void) | |||
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | /* Register our module with the kernel. */ | 1005 | /* Register our module with the kernel. */ |
1006 | module_init(init); | 1006 | module_init(ipt_recent_init); |
1007 | module_exit(fini); | 1007 | module_exit(ipt_recent_fini); |
diff --git a/net/ipv4/netfilter/ipt_tos.c b/net/ipv4/netfilter/ipt_tos.c index e404e92ddd01..5549c39c7851 100644 --- a/net/ipv4/netfilter/ipt_tos.c +++ b/net/ipv4/netfilter/ipt_tos.c | |||
@@ -39,15 +39,15 @@ static struct ipt_match tos_match = { | |||
39 | .me = THIS_MODULE, | 39 | .me = THIS_MODULE, |
40 | }; | 40 | }; |
41 | 41 | ||
42 | static int __init init(void) | 42 | static int __init ipt_multiport_init(void) |
43 | { | 43 | { |
44 | return ipt_register_match(&tos_match); | 44 | return ipt_register_match(&tos_match); |
45 | } | 45 | } |
46 | 46 | ||
47 | static void __exit fini(void) | 47 | static void __exit ipt_multiport_fini(void) |
48 | { | 48 | { |
49 | ipt_unregister_match(&tos_match); | 49 | ipt_unregister_match(&tos_match); |
50 | } | 50 | } |
51 | 51 | ||
52 | module_init(init); | 52 | module_init(ipt_multiport_init); |
53 | module_exit(fini); | 53 | module_exit(ipt_multiport_fini); |
diff --git a/net/ipv4/netfilter/ipt_ttl.c b/net/ipv4/netfilter/ipt_ttl.c index ae7ce4d8d90e..a5243bdb87d7 100644 --- a/net/ipv4/netfilter/ipt_ttl.c +++ b/net/ipv4/netfilter/ipt_ttl.c | |||
@@ -55,16 +55,16 @@ static struct ipt_match ttl_match = { | |||
55 | .me = THIS_MODULE, | 55 | .me = THIS_MODULE, |
56 | }; | 56 | }; |
57 | 57 | ||
58 | static int __init init(void) | 58 | static int __init ipt_ttl_init(void) |
59 | { | 59 | { |
60 | return ipt_register_match(&ttl_match); | 60 | return ipt_register_match(&ttl_match); |
61 | } | 61 | } |
62 | 62 | ||
63 | static void __exit fini(void) | 63 | static void __exit ipt_ttl_fini(void) |
64 | { | 64 | { |
65 | ipt_unregister_match(&ttl_match); | 65 | ipt_unregister_match(&ttl_match); |
66 | 66 | ||
67 | } | 67 | } |
68 | 68 | ||
69 | module_init(init); | 69 | module_init(ipt_ttl_init); |
70 | module_exit(fini); | 70 | module_exit(ipt_ttl_fini); |
diff --git a/net/ipv4/netfilter/iptable_filter.c b/net/ipv4/netfilter/iptable_filter.c index 212a3079085b..3d80aefe9cfa 100644 --- a/net/ipv4/netfilter/iptable_filter.c +++ b/net/ipv4/netfilter/iptable_filter.c | |||
@@ -139,7 +139,7 @@ static struct nf_hook_ops ipt_ops[] = { | |||
139 | static int forward = NF_ACCEPT; | 139 | static int forward = NF_ACCEPT; |
140 | module_param(forward, bool, 0000); | 140 | module_param(forward, bool, 0000); |
141 | 141 | ||
142 | static int __init init(void) | 142 | static int __init iptable_filter_init(void) |
143 | { | 143 | { |
144 | int ret; | 144 | int ret; |
145 | 145 | ||
@@ -181,7 +181,7 @@ static int __init init(void) | |||
181 | return ret; | 181 | return ret; |
182 | } | 182 | } |
183 | 183 | ||
184 | static void __exit fini(void) | 184 | static void __exit iptable_filter_fini(void) |
185 | { | 185 | { |
186 | unsigned int i; | 186 | unsigned int i; |
187 | 187 | ||
@@ -191,5 +191,5 @@ static void __exit fini(void) | |||
191 | ipt_unregister_table(&packet_filter); | 191 | ipt_unregister_table(&packet_filter); |
192 | } | 192 | } |
193 | 193 | ||
194 | module_init(init); | 194 | module_init(iptable_filter_init); |
195 | module_exit(fini); | 195 | module_exit(iptable_filter_fini); |
diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c index 3212a5cc4b6b..412fc96cc896 100644 --- a/net/ipv4/netfilter/iptable_mangle.c +++ b/net/ipv4/netfilter/iptable_mangle.c | |||
@@ -201,7 +201,7 @@ static struct nf_hook_ops ipt_ops[] = { | |||
201 | }, | 201 | }, |
202 | }; | 202 | }; |
203 | 203 | ||
204 | static int __init init(void) | 204 | static int __init iptable_mangle_init(void) |
205 | { | 205 | { |
206 | int ret; | 206 | int ret; |
207 | 207 | ||
@@ -247,7 +247,7 @@ static int __init init(void) | |||
247 | return ret; | 247 | return ret; |
248 | } | 248 | } |
249 | 249 | ||
250 | static void __exit fini(void) | 250 | static void __exit iptable_mangle_fini(void) |
251 | { | 251 | { |
252 | unsigned int i; | 252 | unsigned int i; |
253 | 253 | ||
@@ -257,5 +257,5 @@ static void __exit fini(void) | |||
257 | ipt_unregister_table(&packet_mangler); | 257 | ipt_unregister_table(&packet_mangler); |
258 | } | 258 | } |
259 | 259 | ||
260 | module_init(init); | 260 | module_init(iptable_mangle_init); |
261 | module_exit(fini); | 261 | module_exit(iptable_mangle_fini); |
diff --git a/net/ipv4/netfilter/iptable_raw.c b/net/ipv4/netfilter/iptable_raw.c index fdb9e9c81e81..03cc79a6160a 100644 --- a/net/ipv4/netfilter/iptable_raw.c +++ b/net/ipv4/netfilter/iptable_raw.c | |||
@@ -116,7 +116,7 @@ static struct nf_hook_ops ipt_ops[] = { | |||
116 | }, | 116 | }, |
117 | }; | 117 | }; |
118 | 118 | ||
119 | static int __init init(void) | 119 | static int __init iptable_raw_init(void) |
120 | { | 120 | { |
121 | int ret; | 121 | int ret; |
122 | 122 | ||
@@ -144,7 +144,7 @@ static int __init init(void) | |||
144 | return ret; | 144 | return ret; |
145 | } | 145 | } |
146 | 146 | ||
147 | static void __exit fini(void) | 147 | static void __exit iptable_raw_fini(void) |
148 | { | 148 | { |
149 | unsigned int i; | 149 | unsigned int i; |
150 | 150 | ||
@@ -154,6 +154,6 @@ static void __exit fini(void) | |||
154 | ipt_unregister_table(&packet_raw); | 154 | ipt_unregister_table(&packet_raw); |
155 | } | 155 | } |
156 | 156 | ||
157 | module_init(init); | 157 | module_init(iptable_raw_init); |
158 | module_exit(fini); | 158 | module_exit(iptable_raw_fini); |
159 | MODULE_LICENSE("GPL"); | 159 | MODULE_LICENSE("GPL"); |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index c8abc9d859b9..4afbc699d3ba 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
@@ -571,18 +571,18 @@ static int init_or_cleanup(int init) | |||
571 | MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET)); | 571 | MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET)); |
572 | MODULE_LICENSE("GPL"); | 572 | MODULE_LICENSE("GPL"); |
573 | 573 | ||
574 | static int __init init(void) | 574 | static int __init nf_conntrack_l3proto_ipv4_init(void) |
575 | { | 575 | { |
576 | need_conntrack(); | 576 | need_conntrack(); |
577 | return init_or_cleanup(1); | 577 | return init_or_cleanup(1); |
578 | } | 578 | } |
579 | 579 | ||
580 | static void __exit fini(void) | 580 | static void __exit nf_conntrack_l3proto_ipv4_fini(void) |
581 | { | 581 | { |
582 | init_or_cleanup(0); | 582 | init_or_cleanup(0); |
583 | } | 583 | } |
584 | 584 | ||
585 | module_init(init); | 585 | module_init(nf_conntrack_l3proto_ipv4_init); |
586 | module_exit(fini); | 586 | module_exit(nf_conntrack_l3proto_ipv4_fini); |
587 | 587 | ||
588 | EXPORT_SYMBOL(nf_ct_ipv4_gather_frags); | 588 | EXPORT_SYMBOL(nf_ct_ipv4_gather_frags); |
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index e688c687d62d..91c2f41c7f58 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c | |||
@@ -223,7 +223,7 @@ void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 rtt, u32 in_flight, | |||
223 | 223 | ||
224 | /* In dangerous area, increase slowly. */ | 224 | /* In dangerous area, increase slowly. */ |
225 | else if (sysctl_tcp_abc) { | 225 | else if (sysctl_tcp_abc) { |
226 | /* RFC3465: Apppriate Byte Count | 226 | /* RFC3465: Appropriate Byte Count |
227 | * increase once for each full cwnd acked | 227 | * increase once for each full cwnd acked |
228 | */ | 228 | */ |
229 | if (tp->bytes_acked >= tp->snd_cwnd*tp->mss_cache) { | 229 | if (tp->bytes_acked >= tp->snd_cwnd*tp->mss_cache) { |
diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c new file mode 100644 index 000000000000..0d7d386dac22 --- /dev/null +++ b/net/ipv4/tunnel4.c | |||
@@ -0,0 +1,113 @@ | |||
1 | /* tunnel4.c: Generic IP tunnel transformer. | ||
2 | * | ||
3 | * Copyright (C) 2003 David S. Miller (davem@redhat.com) | ||
4 | */ | ||
5 | |||
6 | #include <linux/init.h> | ||
7 | #include <linux/module.h> | ||
8 | #include <linux/mutex.h> | ||
9 | #include <linux/netdevice.h> | ||
10 | #include <linux/skbuff.h> | ||
11 | #include <net/protocol.h> | ||
12 | #include <net/xfrm.h> | ||
13 | |||
14 | static struct xfrm_tunnel *tunnel4_handlers; | ||
15 | static DEFINE_MUTEX(tunnel4_mutex); | ||
16 | |||
17 | int xfrm4_tunnel_register(struct xfrm_tunnel *handler) | ||
18 | { | ||
19 | struct xfrm_tunnel **pprev; | ||
20 | int ret = -EEXIST; | ||
21 | int priority = handler->priority; | ||
22 | |||
23 | mutex_lock(&tunnel4_mutex); | ||
24 | |||
25 | for (pprev = &tunnel4_handlers; *pprev; pprev = &(*pprev)->next) { | ||
26 | if ((*pprev)->priority > priority) | ||
27 | break; | ||
28 | if ((*pprev)->priority == priority) | ||
29 | goto err; | ||
30 | } | ||
31 | |||
32 | handler->next = *pprev; | ||
33 | *pprev = handler; | ||
34 | |||
35 | ret = 0; | ||
36 | |||
37 | err: | ||
38 | mutex_unlock(&tunnel4_mutex); | ||
39 | |||
40 | return ret; | ||
41 | } | ||
42 | |||
43 | EXPORT_SYMBOL(xfrm4_tunnel_register); | ||
44 | |||
45 | int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler) | ||
46 | { | ||
47 | struct xfrm_tunnel **pprev; | ||
48 | int ret = -ENOENT; | ||
49 | |||
50 | mutex_lock(&tunnel4_mutex); | ||
51 | |||
52 | for (pprev = &tunnel4_handlers; *pprev; pprev = &(*pprev)->next) { | ||
53 | if (*pprev == handler) { | ||
54 | *pprev = handler->next; | ||
55 | ret = 0; | ||
56 | break; | ||
57 | } | ||
58 | } | ||
59 | |||
60 | mutex_unlock(&tunnel4_mutex); | ||
61 | |||
62 | synchronize_net(); | ||
63 | |||
64 | return ret; | ||
65 | } | ||
66 | |||
67 | EXPORT_SYMBOL(xfrm4_tunnel_deregister); | ||
68 | |||
69 | static int tunnel4_rcv(struct sk_buff *skb) | ||
70 | { | ||
71 | struct xfrm_tunnel *handler; | ||
72 | |||
73 | for (handler = tunnel4_handlers; handler; handler = handler->next) | ||
74 | if (!handler->handler(skb)) | ||
75 | return 0; | ||
76 | |||
77 | kfree_skb(skb); | ||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | static void tunnel4_err(struct sk_buff *skb, u32 info) | ||
82 | { | ||
83 | struct xfrm_tunnel *handler; | ||
84 | |||
85 | for (handler = tunnel4_handlers; handler; handler = handler->next) | ||
86 | if (!handler->err_handler(skb, info)) | ||
87 | break; | ||
88 | } | ||
89 | |||
90 | static struct net_protocol tunnel4_protocol = { | ||
91 | .handler = tunnel4_rcv, | ||
92 | .err_handler = tunnel4_err, | ||
93 | .no_policy = 1, | ||
94 | }; | ||
95 | |||
96 | static int __init tunnel4_init(void) | ||
97 | { | ||
98 | if (inet_add_protocol(&tunnel4_protocol, IPPROTO_IPIP)) { | ||
99 | printk(KERN_ERR "tunnel4 init: can't add protocol\n"); | ||
100 | return -EAGAIN; | ||
101 | } | ||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | static void __exit tunnel4_fini(void) | ||
106 | { | ||
107 | if (inet_del_protocol(&tunnel4_protocol, IPPROTO_IPIP)) | ||
108 | printk(KERN_ERR "tunnel4 close: can't remove protocol\n"); | ||
109 | } | ||
110 | |||
111 | module_init(tunnel4_init); | ||
112 | module_exit(tunnel4_fini); | ||
113 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c index b08d56b117f8..2d670935c2b5 100644 --- a/net/ipv4/xfrm4_tunnel.c +++ b/net/ipv4/xfrm4_tunnel.c | |||
@@ -26,64 +26,6 @@ static int ipip_xfrm_rcv(struct xfrm_state *x, struct xfrm_decap_state *decap, s | |||
26 | return 0; | 26 | return 0; |
27 | } | 27 | } |
28 | 28 | ||
29 | static struct xfrm_tunnel *ipip_handler; | ||
30 | static DEFINE_MUTEX(xfrm4_tunnel_mutex); | ||
31 | |||
32 | int xfrm4_tunnel_register(struct xfrm_tunnel *handler) | ||
33 | { | ||
34 | int ret; | ||
35 | |||
36 | mutex_lock(&xfrm4_tunnel_mutex); | ||
37 | ret = 0; | ||
38 | if (ipip_handler != NULL) | ||
39 | ret = -EINVAL; | ||
40 | if (!ret) | ||
41 | ipip_handler = handler; | ||
42 | mutex_unlock(&xfrm4_tunnel_mutex); | ||
43 | |||
44 | return ret; | ||
45 | } | ||
46 | |||
47 | EXPORT_SYMBOL(xfrm4_tunnel_register); | ||
48 | |||
49 | int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler) | ||
50 | { | ||
51 | int ret; | ||
52 | |||
53 | mutex_lock(&xfrm4_tunnel_mutex); | ||
54 | ret = 0; | ||
55 | if (ipip_handler != handler) | ||
56 | ret = -EINVAL; | ||
57 | if (!ret) | ||
58 | ipip_handler = NULL; | ||
59 | mutex_unlock(&xfrm4_tunnel_mutex); | ||
60 | |||
61 | synchronize_net(); | ||
62 | |||
63 | return ret; | ||
64 | } | ||
65 | |||
66 | EXPORT_SYMBOL(xfrm4_tunnel_deregister); | ||
67 | |||
68 | static int ipip_rcv(struct sk_buff *skb) | ||
69 | { | ||
70 | struct xfrm_tunnel *handler = ipip_handler; | ||
71 | |||
72 | /* Tunnel devices take precedence. */ | ||
73 | if (handler && handler->handler(skb) == 0) | ||
74 | return 0; | ||
75 | |||
76 | return xfrm4_rcv(skb); | ||
77 | } | ||
78 | |||
79 | static void ipip_err(struct sk_buff *skb, u32 info) | ||
80 | { | ||
81 | struct xfrm_tunnel *handler = ipip_handler; | ||
82 | |||
83 | if (handler) | ||
84 | handler->err_handler(skb, info); | ||
85 | } | ||
86 | |||
87 | static int ipip_init_state(struct xfrm_state *x) | 29 | static int ipip_init_state(struct xfrm_state *x) |
88 | { | 30 | { |
89 | if (!x->props.mode) | 31 | if (!x->props.mode) |
@@ -111,10 +53,15 @@ static struct xfrm_type ipip_type = { | |||
111 | .output = ipip_output | 53 | .output = ipip_output |
112 | }; | 54 | }; |
113 | 55 | ||
114 | static struct net_protocol ipip_protocol = { | 56 | static int xfrm_tunnel_err(struct sk_buff *skb, u32 info) |
115 | .handler = ipip_rcv, | 57 | { |
116 | .err_handler = ipip_err, | 58 | return -ENOENT; |
117 | .no_policy = 1, | 59 | } |
60 | |||
61 | static struct xfrm_tunnel xfrm_tunnel_handler = { | ||
62 | .handler = xfrm4_rcv, | ||
63 | .err_handler = xfrm_tunnel_err, | ||
64 | .priority = 2, | ||
118 | }; | 65 | }; |
119 | 66 | ||
120 | static int __init ipip_init(void) | 67 | static int __init ipip_init(void) |
@@ -123,8 +70,8 @@ static int __init ipip_init(void) | |||
123 | printk(KERN_INFO "ipip init: can't add xfrm type\n"); | 70 | printk(KERN_INFO "ipip init: can't add xfrm type\n"); |
124 | return -EAGAIN; | 71 | return -EAGAIN; |
125 | } | 72 | } |
126 | if (inet_add_protocol(&ipip_protocol, IPPROTO_IPIP) < 0) { | 73 | if (xfrm4_tunnel_register(&xfrm_tunnel_handler)) { |
127 | printk(KERN_INFO "ipip init: can't add protocol\n"); | 74 | printk(KERN_INFO "ipip init: can't add xfrm handler\n"); |
128 | xfrm_unregister_type(&ipip_type, AF_INET); | 75 | xfrm_unregister_type(&ipip_type, AF_INET); |
129 | return -EAGAIN; | 76 | return -EAGAIN; |
130 | } | 77 | } |
@@ -133,8 +80,8 @@ static int __init ipip_init(void) | |||
133 | 80 | ||
134 | static void __exit ipip_fini(void) | 81 | static void __exit ipip_fini(void) |
135 | { | 82 | { |
136 | if (inet_del_protocol(&ipip_protocol, IPPROTO_IPIP) < 0) | 83 | if (xfrm4_tunnel_deregister(&xfrm_tunnel_handler)) |
137 | printk(KERN_INFO "ipip close: can't remove protocol\n"); | 84 | printk(KERN_INFO "ipip close: can't remove xfrm handler\n"); |
138 | if (xfrm_unregister_type(&ipip_type, AF_INET) < 0) | 85 | if (xfrm_unregister_type(&ipip_type, AF_INET) < 0) |
139 | printk(KERN_INFO "ipip close: can't remove xfrm type\n"); | 86 | printk(KERN_INFO "ipip close: can't remove xfrm type\n"); |
140 | } | 87 | } |
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig index e6f83b6a2b76..f8a107ab5592 100644 --- a/net/ipv6/Kconfig +++ b/net/ipv6/Kconfig | |||
@@ -88,7 +88,7 @@ config INET6_IPCOMP | |||
88 | tristate "IPv6: IPComp transformation" | 88 | tristate "IPv6: IPComp transformation" |
89 | depends on IPV6 | 89 | depends on IPV6 |
90 | select XFRM | 90 | select XFRM |
91 | select INET6_TUNNEL | 91 | select INET6_XFRM_TUNNEL |
92 | select CRYPTO | 92 | select CRYPTO |
93 | select CRYPTO_DEFLATE | 93 | select CRYPTO_DEFLATE |
94 | ---help--- | 94 | ---help--- |
@@ -97,19 +97,18 @@ config INET6_IPCOMP | |||
97 | 97 | ||
98 | If unsure, say Y. | 98 | If unsure, say Y. |
99 | 99 | ||
100 | config INET6_XFRM_TUNNEL | ||
101 | tristate | ||
102 | select INET6_TUNNEL | ||
103 | default n | ||
104 | |||
100 | config INET6_TUNNEL | 105 | config INET6_TUNNEL |
101 | tristate "IPv6: tunnel transformation" | 106 | tristate |
102 | depends on IPV6 | 107 | default n |
103 | select XFRM | ||
104 | ---help--- | ||
105 | Support for generic IPv6-in-IPv6 tunnel transformation, which is | ||
106 | required by the IPv6-in-IPv6 tunneling module as well as tunnel mode | ||
107 | IPComp. | ||
108 | |||
109 | If unsure, say Y. | ||
110 | 108 | ||
111 | config IPV6_TUNNEL | 109 | config IPV6_TUNNEL |
112 | tristate "IPv6: IPv6-in-IPv6 tunnel" | 110 | tristate "IPv6: IPv6-in-IPv6 tunnel" |
111 | select INET6_TUNNEL | ||
113 | depends on IPV6 | 112 | depends on IPV6 |
114 | ---help--- | 113 | ---help--- |
115 | Support for IPv6-in-IPv6 tunnels described in RFC 2473. | 114 | Support for IPv6-in-IPv6 tunnels described in RFC 2473. |
diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile index 41877abd22e6..a760b0988fbb 100644 --- a/net/ipv6/Makefile +++ b/net/ipv6/Makefile | |||
@@ -18,7 +18,8 @@ ipv6-objs += $(ipv6-y) | |||
18 | obj-$(CONFIG_INET6_AH) += ah6.o | 18 | obj-$(CONFIG_INET6_AH) += ah6.o |
19 | obj-$(CONFIG_INET6_ESP) += esp6.o | 19 | obj-$(CONFIG_INET6_ESP) += esp6.o |
20 | obj-$(CONFIG_INET6_IPCOMP) += ipcomp6.o | 20 | obj-$(CONFIG_INET6_IPCOMP) += ipcomp6.o |
21 | obj-$(CONFIG_INET6_TUNNEL) += xfrm6_tunnel.o | 21 | obj-$(CONFIG_INET6_XFRM_TUNNEL) += xfrm6_tunnel.o |
22 | obj-$(CONFIG_INET6_TUNNEL) += tunnel6.o | ||
22 | obj-$(CONFIG_NETFILTER) += netfilter/ | 23 | obj-$(CONFIG_NETFILTER) += netfilter/ |
23 | 24 | ||
24 | obj-$(CONFIG_IPV6_TUNNEL) += ip6_tunnel.o | 25 | obj-$(CONFIG_IPV6_TUNNEL) += ip6_tunnel.o |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 01c62a0d3742..445006ee4522 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -143,7 +143,7 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev, | |||
143 | struct prefix_info *pinfo); | 143 | struct prefix_info *pinfo); |
144 | static int ipv6_chk_same_addr(const struct in6_addr *addr, struct net_device *dev); | 144 | static int ipv6_chk_same_addr(const struct in6_addr *addr, struct net_device *dev); |
145 | 145 | ||
146 | static struct notifier_block *inet6addr_chain; | 146 | static ATOMIC_NOTIFIER_HEAD(inet6addr_chain); |
147 | 147 | ||
148 | struct ipv6_devconf ipv6_devconf = { | 148 | struct ipv6_devconf ipv6_devconf = { |
149 | .forwarding = 0, | 149 | .forwarding = 0, |
@@ -593,7 +593,7 @@ out2: | |||
593 | read_unlock_bh(&addrconf_lock); | 593 | read_unlock_bh(&addrconf_lock); |
594 | 594 | ||
595 | if (likely(err == 0)) | 595 | if (likely(err == 0)) |
596 | notifier_call_chain(&inet6addr_chain, NETDEV_UP, ifa); | 596 | atomic_notifier_call_chain(&inet6addr_chain, NETDEV_UP, ifa); |
597 | else { | 597 | else { |
598 | kfree(ifa); | 598 | kfree(ifa); |
599 | ifa = ERR_PTR(err); | 599 | ifa = ERR_PTR(err); |
@@ -688,7 +688,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) | |||
688 | 688 | ||
689 | ipv6_ifa_notify(RTM_DELADDR, ifp); | 689 | ipv6_ifa_notify(RTM_DELADDR, ifp); |
690 | 690 | ||
691 | notifier_call_chain(&inet6addr_chain,NETDEV_DOWN,ifp); | 691 | atomic_notifier_call_chain(&inet6addr_chain, NETDEV_DOWN, ifp); |
692 | 692 | ||
693 | addrconf_del_timer(ifp); | 693 | addrconf_del_timer(ifp); |
694 | 694 | ||
@@ -3767,12 +3767,12 @@ static void addrconf_sysctl_unregister(struct ipv6_devconf *p) | |||
3767 | 3767 | ||
3768 | int register_inet6addr_notifier(struct notifier_block *nb) | 3768 | int register_inet6addr_notifier(struct notifier_block *nb) |
3769 | { | 3769 | { |
3770 | return notifier_chain_register(&inet6addr_chain, nb); | 3770 | return atomic_notifier_chain_register(&inet6addr_chain, nb); |
3771 | } | 3771 | } |
3772 | 3772 | ||
3773 | int unregister_inet6addr_notifier(struct notifier_block *nb) | 3773 | int unregister_inet6addr_notifier(struct notifier_block *nb) |
3774 | { | 3774 | { |
3775 | return notifier_chain_unregister(&inet6addr_chain,nb); | 3775 | return atomic_notifier_chain_unregister(&inet6addr_chain,nb); |
3776 | } | 3776 | } |
3777 | 3777 | ||
3778 | /* | 3778 | /* |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 48597538db3f..ff9040c92556 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -44,7 +44,6 @@ | |||
44 | 44 | ||
45 | #include <net/ip.h> | 45 | #include <net/ip.h> |
46 | #include <net/ipv6.h> | 46 | #include <net/ipv6.h> |
47 | #include <net/protocol.h> | ||
48 | #include <net/ip6_route.h> | 47 | #include <net/ip6_route.h> |
49 | #include <net/addrconf.h> | 48 | #include <net/addrconf.h> |
50 | #include <net/ip6_tunnel.h> | 49 | #include <net/ip6_tunnel.h> |
@@ -391,7 +390,7 @@ parse_tlv_tnl_enc_lim(struct sk_buff *skb, __u8 * raw) | |||
391 | * to the specifications in RFC 2473. | 390 | * to the specifications in RFC 2473. |
392 | **/ | 391 | **/ |
393 | 392 | ||
394 | static void | 393 | static int |
395 | ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | 394 | ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
396 | int type, int code, int offset, __u32 info) | 395 | int type, int code, int offset, __u32 info) |
397 | { | 396 | { |
@@ -402,6 +401,7 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
402 | int rel_code = ICMPV6_ADDR_UNREACH; | 401 | int rel_code = ICMPV6_ADDR_UNREACH; |
403 | __u32 rel_info = 0; | 402 | __u32 rel_info = 0; |
404 | __u16 len; | 403 | __u16 len; |
404 | int err = -ENOENT; | ||
405 | 405 | ||
406 | /* If the packet doesn't contain the original IPv6 header we are | 406 | /* If the packet doesn't contain the original IPv6 header we are |
407 | in trouble since we might need the source address for further | 407 | in trouble since we might need the source address for further |
@@ -411,6 +411,8 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
411 | if ((t = ip6ip6_tnl_lookup(&ipv6h->daddr, &ipv6h->saddr)) == NULL) | 411 | if ((t = ip6ip6_tnl_lookup(&ipv6h->daddr, &ipv6h->saddr)) == NULL) |
412 | goto out; | 412 | goto out; |
413 | 413 | ||
414 | err = 0; | ||
415 | |||
414 | switch (type) { | 416 | switch (type) { |
415 | __u32 teli; | 417 | __u32 teli; |
416 | struct ipv6_tlv_tnl_enc_lim *tel; | 418 | struct ipv6_tlv_tnl_enc_lim *tel; |
@@ -492,6 +494,7 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
492 | } | 494 | } |
493 | out: | 495 | out: |
494 | read_unlock(&ip6ip6_lock); | 496 | read_unlock(&ip6ip6_lock); |
497 | return err; | ||
495 | } | 498 | } |
496 | 499 | ||
497 | static inline void ip6ip6_ecn_decapsulate(struct ipv6hdr *outer_iph, | 500 | static inline void ip6ip6_ecn_decapsulate(struct ipv6hdr *outer_iph, |
@@ -511,9 +514,8 @@ static inline void ip6ip6_ecn_decapsulate(struct ipv6hdr *outer_iph, | |||
511 | **/ | 514 | **/ |
512 | 515 | ||
513 | static int | 516 | static int |
514 | ip6ip6_rcv(struct sk_buff **pskb) | 517 | ip6ip6_rcv(struct sk_buff *skb) |
515 | { | 518 | { |
516 | struct sk_buff *skb = *pskb; | ||
517 | struct ipv6hdr *ipv6h; | 519 | struct ipv6hdr *ipv6h; |
518 | struct ip6_tnl *t; | 520 | struct ip6_tnl *t; |
519 | 521 | ||
@@ -1112,39 +1114,12 @@ ip6ip6_fb_tnl_dev_init(struct net_device *dev) | |||
1112 | return 0; | 1114 | return 0; |
1113 | } | 1115 | } |
1114 | 1116 | ||
1115 | #ifdef CONFIG_INET6_TUNNEL | ||
1116 | static struct xfrm6_tunnel ip6ip6_handler = { | 1117 | static struct xfrm6_tunnel ip6ip6_handler = { |
1117 | .handler = ip6ip6_rcv, | 1118 | .handler = ip6ip6_rcv, |
1118 | .err_handler = ip6ip6_err, | 1119 | .err_handler = ip6ip6_err, |
1120 | .priority = 1, | ||
1119 | }; | 1121 | }; |
1120 | 1122 | ||
1121 | static inline int ip6ip6_register(void) | ||
1122 | { | ||
1123 | return xfrm6_tunnel_register(&ip6ip6_handler); | ||
1124 | } | ||
1125 | |||
1126 | static inline int ip6ip6_unregister(void) | ||
1127 | { | ||
1128 | return xfrm6_tunnel_deregister(&ip6ip6_handler); | ||
1129 | } | ||
1130 | #else | ||
1131 | static struct inet6_protocol xfrm6_tunnel_protocol = { | ||
1132 | .handler = ip6ip6_rcv, | ||
1133 | .err_handler = ip6ip6_err, | ||
1134 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, | ||
1135 | }; | ||
1136 | |||
1137 | static inline int ip6ip6_register(void) | ||
1138 | { | ||
1139 | return inet6_add_protocol(&xfrm6_tunnel_protocol, IPPROTO_IPV6); | ||
1140 | } | ||
1141 | |||
1142 | static inline int ip6ip6_unregister(void) | ||
1143 | { | ||
1144 | return inet6_del_protocol(&xfrm6_tunnel_protocol, IPPROTO_IPV6); | ||
1145 | } | ||
1146 | #endif | ||
1147 | |||
1148 | /** | 1123 | /** |
1149 | * ip6_tunnel_init - register protocol and reserve needed resources | 1124 | * ip6_tunnel_init - register protocol and reserve needed resources |
1150 | * | 1125 | * |
@@ -1155,7 +1130,7 @@ static int __init ip6_tunnel_init(void) | |||
1155 | { | 1130 | { |
1156 | int err; | 1131 | int err; |
1157 | 1132 | ||
1158 | if (ip6ip6_register() < 0) { | 1133 | if (xfrm6_tunnel_register(&ip6ip6_handler)) { |
1159 | printk(KERN_ERR "ip6ip6 init: can't register tunnel\n"); | 1134 | printk(KERN_ERR "ip6ip6 init: can't register tunnel\n"); |
1160 | return -EAGAIN; | 1135 | return -EAGAIN; |
1161 | } | 1136 | } |
@@ -1174,7 +1149,7 @@ static int __init ip6_tunnel_init(void) | |||
1174 | } | 1149 | } |
1175 | return 0; | 1150 | return 0; |
1176 | fail: | 1151 | fail: |
1177 | ip6ip6_unregister(); | 1152 | xfrm6_tunnel_deregister(&ip6ip6_handler); |
1178 | return err; | 1153 | return err; |
1179 | } | 1154 | } |
1180 | 1155 | ||
@@ -1184,7 +1159,7 @@ fail: | |||
1184 | 1159 | ||
1185 | static void __exit ip6_tunnel_cleanup(void) | 1160 | static void __exit ip6_tunnel_cleanup(void) |
1186 | { | 1161 | { |
1187 | if (ip6ip6_unregister() < 0) | 1162 | if (xfrm6_tunnel_deregister(&ip6ip6_handler)) |
1188 | printk(KERN_INFO "ip6ip6 close: can't deregister tunnel\n"); | 1163 | printk(KERN_INFO "ip6ip6 close: can't deregister tunnel\n"); |
1189 | 1164 | ||
1190 | unregister_netdev(ip6ip6_fb_tnl_dev); | 1165 | unregister_netdev(ip6ip6_fb_tnl_dev); |
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index 028b636687ec..d4cfec3f414e 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c | |||
@@ -228,6 +228,9 @@ static struct xfrm_state *ipcomp6_tunnel_create(struct xfrm_state *x) | |||
228 | 228 | ||
229 | t->id.proto = IPPROTO_IPV6; | 229 | t->id.proto = IPPROTO_IPV6; |
230 | t->id.spi = xfrm6_tunnel_alloc_spi((xfrm_address_t *)&x->props.saddr); | 230 | t->id.spi = xfrm6_tunnel_alloc_spi((xfrm_address_t *)&x->props.saddr); |
231 | if (!t->id.spi) | ||
232 | goto error; | ||
233 | |||
231 | memcpy(t->id.daddr.a6, x->id.daddr.a6, sizeof(struct in6_addr)); | 234 | memcpy(t->id.daddr.a6, x->id.daddr.a6, sizeof(struct in6_addr)); |
232 | memcpy(&t->sel, &x->sel, sizeof(t->sel)); | 235 | memcpy(&t->sel, &x->sel, sizeof(t->sel)); |
233 | t->props.family = AF_INET6; | 236 | t->props.family = AF_INET6; |
@@ -243,7 +246,9 @@ out: | |||
243 | return t; | 246 | return t; |
244 | 247 | ||
245 | error: | 248 | error: |
249 | t->km.state = XFRM_STATE_DEAD; | ||
246 | xfrm_state_put(t); | 250 | xfrm_state_put(t); |
251 | t = NULL; | ||
247 | goto out; | 252 | goto out; |
248 | } | 253 | } |
249 | 254 | ||
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index 344eab3b5da8..e81c6a9dab81 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c | |||
@@ -713,13 +713,13 @@ cleanup_netlink_notifier: | |||
713 | return status; | 713 | return status; |
714 | } | 714 | } |
715 | 715 | ||
716 | static int __init init(void) | 716 | static int __init ip6_queue_init(void) |
717 | { | 717 | { |
718 | 718 | ||
719 | return init_or_cleanup(1); | 719 | return init_or_cleanup(1); |
720 | } | 720 | } |
721 | 721 | ||
722 | static void __exit fini(void) | 722 | static void __exit ip6_queue_fini(void) |
723 | { | 723 | { |
724 | init_or_cleanup(0); | 724 | init_or_cleanup(0); |
725 | } | 725 | } |
@@ -727,5 +727,5 @@ static void __exit fini(void) | |||
727 | MODULE_DESCRIPTION("IPv6 packet queue handler"); | 727 | MODULE_DESCRIPTION("IPv6 packet queue handler"); |
728 | MODULE_LICENSE("GPL"); | 728 | MODULE_LICENSE("GPL"); |
729 | 729 | ||
730 | module_init(init); | 730 | module_init(ip6_queue_init); |
731 | module_exit(fini); | 731 | module_exit(ip6_queue_fini); |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index db3c9ae98e95..3ecf2db841f8 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -1406,7 +1406,7 @@ static struct ip6t_match icmp6_matchstruct = { | |||
1406 | .family = AF_INET6, | 1406 | .family = AF_INET6, |
1407 | }; | 1407 | }; |
1408 | 1408 | ||
1409 | static int __init init(void) | 1409 | static int __init ip6_tables_init(void) |
1410 | { | 1410 | { |
1411 | int ret; | 1411 | int ret; |
1412 | 1412 | ||
@@ -1429,7 +1429,7 @@ static int __init init(void) | |||
1429 | return 0; | 1429 | return 0; |
1430 | } | 1430 | } |
1431 | 1431 | ||
1432 | static void __exit fini(void) | 1432 | static void __exit ip6_tables_fini(void) |
1433 | { | 1433 | { |
1434 | nf_unregister_sockopt(&ip6t_sockopts); | 1434 | nf_unregister_sockopt(&ip6t_sockopts); |
1435 | xt_unregister_match(&icmp6_matchstruct); | 1435 | xt_unregister_match(&icmp6_matchstruct); |
@@ -1517,5 +1517,5 @@ EXPORT_SYMBOL(ip6t_do_table); | |||
1517 | EXPORT_SYMBOL(ip6t_ext_hdr); | 1517 | EXPORT_SYMBOL(ip6t_ext_hdr); |
1518 | EXPORT_SYMBOL(ipv6_find_hdr); | 1518 | EXPORT_SYMBOL(ipv6_find_hdr); |
1519 | 1519 | ||
1520 | module_init(init); | 1520 | module_init(ip6_tables_init); |
1521 | module_exit(fini); | 1521 | module_exit(ip6_tables_fini); |
diff --git a/net/ipv6/netfilter/ip6t_HL.c b/net/ipv6/netfilter/ip6t_HL.c index da14c6d86bcc..b8eff8ee69b1 100644 --- a/net/ipv6/netfilter/ip6t_HL.c +++ b/net/ipv6/netfilter/ip6t_HL.c | |||
@@ -93,15 +93,15 @@ static struct ip6t_target ip6t_HL = { | |||
93 | .me = THIS_MODULE | 93 | .me = THIS_MODULE |
94 | }; | 94 | }; |
95 | 95 | ||
96 | static int __init init(void) | 96 | static int __init ip6t_hl_init(void) |
97 | { | 97 | { |
98 | return ip6t_register_target(&ip6t_HL); | 98 | return ip6t_register_target(&ip6t_HL); |
99 | } | 99 | } |
100 | 100 | ||
101 | static void __exit fini(void) | 101 | static void __exit ip6t_hl_fini(void) |
102 | { | 102 | { |
103 | ip6t_unregister_target(&ip6t_HL); | 103 | ip6t_unregister_target(&ip6t_HL); |
104 | } | 104 | } |
105 | 105 | ||
106 | module_init(init); | 106 | module_init(ip6t_hl_init); |
107 | module_exit(fini); | 107 | module_exit(ip6t_hl_fini); |
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c index 07c6bcbe4c5f..a96c0de14b00 100644 --- a/net/ipv6/netfilter/ip6t_LOG.c +++ b/net/ipv6/netfilter/ip6t_LOG.c | |||
@@ -483,7 +483,7 @@ static struct nf_logger ip6t_logger = { | |||
483 | .me = THIS_MODULE, | 483 | .me = THIS_MODULE, |
484 | }; | 484 | }; |
485 | 485 | ||
486 | static int __init init(void) | 486 | static int __init ip6t_log_init(void) |
487 | { | 487 | { |
488 | if (ip6t_register_target(&ip6t_log_reg)) | 488 | if (ip6t_register_target(&ip6t_log_reg)) |
489 | return -EINVAL; | 489 | return -EINVAL; |
@@ -497,11 +497,11 @@ static int __init init(void) | |||
497 | return 0; | 497 | return 0; |
498 | } | 498 | } |
499 | 499 | ||
500 | static void __exit fini(void) | 500 | static void __exit ip6t_log_fini(void) |
501 | { | 501 | { |
502 | nf_log_unregister_logger(&ip6t_logger); | 502 | nf_log_unregister_logger(&ip6t_logger); |
503 | ip6t_unregister_target(&ip6t_log_reg); | 503 | ip6t_unregister_target(&ip6t_log_reg); |
504 | } | 504 | } |
505 | 505 | ||
506 | module_init(init); | 506 | module_init(ip6t_log_init); |
507 | module_exit(fini); | 507 | module_exit(ip6t_log_fini); |
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c index ddfa38575fe2..de1175c27f6d 100644 --- a/net/ipv6/netfilter/ip6t_REJECT.c +++ b/net/ipv6/netfilter/ip6t_REJECT.c | |||
@@ -255,17 +255,17 @@ static struct ip6t_target ip6t_reject_reg = { | |||
255 | .me = THIS_MODULE | 255 | .me = THIS_MODULE |
256 | }; | 256 | }; |
257 | 257 | ||
258 | static int __init init(void) | 258 | static int __init ip6t_reject_init(void) |
259 | { | 259 | { |
260 | if (ip6t_register_target(&ip6t_reject_reg)) | 260 | if (ip6t_register_target(&ip6t_reject_reg)) |
261 | return -EINVAL; | 261 | return -EINVAL; |
262 | return 0; | 262 | return 0; |
263 | } | 263 | } |
264 | 264 | ||
265 | static void __exit fini(void) | 265 | static void __exit ip6t_reject_fini(void) |
266 | { | 266 | { |
267 | ip6t_unregister_target(&ip6t_reject_reg); | 267 | ip6t_unregister_target(&ip6t_reject_reg); |
268 | } | 268 | } |
269 | 269 | ||
270 | module_init(init); | 270 | module_init(ip6t_reject_init); |
271 | module_exit(fini); | 271 | module_exit(ip6t_reject_fini); |
diff --git a/net/ipv6/netfilter/ip6t_ah.c b/net/ipv6/netfilter/ip6t_ah.c index 178f6fb1e53d..2f7bb20c758b 100644 --- a/net/ipv6/netfilter/ip6t_ah.c +++ b/net/ipv6/netfilter/ip6t_ah.c | |||
@@ -122,15 +122,15 @@ static struct ip6t_match ah_match = { | |||
122 | .me = THIS_MODULE, | 122 | .me = THIS_MODULE, |
123 | }; | 123 | }; |
124 | 124 | ||
125 | static int __init init(void) | 125 | static int __init ip6t_ah_init(void) |
126 | { | 126 | { |
127 | return ip6t_register_match(&ah_match); | 127 | return ip6t_register_match(&ah_match); |
128 | } | 128 | } |
129 | 129 | ||
130 | static void __exit cleanup(void) | 130 | static void __exit ip6t_ah_fini(void) |
131 | { | 131 | { |
132 | ip6t_unregister_match(&ah_match); | 132 | ip6t_unregister_match(&ah_match); |
133 | } | 133 | } |
134 | 134 | ||
135 | module_init(init); | 135 | module_init(ip6t_ah_init); |
136 | module_exit(cleanup); | 136 | module_exit(ip6t_ah_fini); |
diff --git a/net/ipv6/netfilter/ip6t_dst.c b/net/ipv6/netfilter/ip6t_dst.c index e97a70226987..9422413d0571 100644 --- a/net/ipv6/netfilter/ip6t_dst.c +++ b/net/ipv6/netfilter/ip6t_dst.c | |||
@@ -206,15 +206,15 @@ static struct ip6t_match opts_match = { | |||
206 | .me = THIS_MODULE, | 206 | .me = THIS_MODULE, |
207 | }; | 207 | }; |
208 | 208 | ||
209 | static int __init init(void) | 209 | static int __init ip6t_dst_init(void) |
210 | { | 210 | { |
211 | return ip6t_register_match(&opts_match); | 211 | return ip6t_register_match(&opts_match); |
212 | } | 212 | } |
213 | 213 | ||
214 | static void __exit cleanup(void) | 214 | static void __exit ip6t_dst_fini(void) |
215 | { | 215 | { |
216 | ip6t_unregister_match(&opts_match); | 216 | ip6t_unregister_match(&opts_match); |
217 | } | 217 | } |
218 | 218 | ||
219 | module_init(init); | 219 | module_init(ip6t_dst_init); |
220 | module_exit(cleanup); | 220 | module_exit(ip6t_dst_fini); |
diff --git a/net/ipv6/netfilter/ip6t_esp.c b/net/ipv6/netfilter/ip6t_esp.c index 540b8bfd5055..36bedad2c6f7 100644 --- a/net/ipv6/netfilter/ip6t_esp.c +++ b/net/ipv6/netfilter/ip6t_esp.c | |||
@@ -101,15 +101,15 @@ static struct ip6t_match esp_match = { | |||
101 | .me = THIS_MODULE, | 101 | .me = THIS_MODULE, |
102 | }; | 102 | }; |
103 | 103 | ||
104 | static int __init init(void) | 104 | static int __init ip6t_esp_init(void) |
105 | { | 105 | { |
106 | return ip6t_register_match(&esp_match); | 106 | return ip6t_register_match(&esp_match); |
107 | } | 107 | } |
108 | 108 | ||
109 | static void __exit cleanup(void) | 109 | static void __exit ip6t_esp_fini(void) |
110 | { | 110 | { |
111 | ip6t_unregister_match(&esp_match); | 111 | ip6t_unregister_match(&esp_match); |
112 | } | 112 | } |
113 | 113 | ||
114 | module_init(init); | 114 | module_init(ip6t_esp_init); |
115 | module_exit(cleanup); | 115 | module_exit(ip6t_esp_fini); |
diff --git a/net/ipv6/netfilter/ip6t_eui64.c b/net/ipv6/netfilter/ip6t_eui64.c index d4b0bad52830..94dbdb8b458d 100644 --- a/net/ipv6/netfilter/ip6t_eui64.c +++ b/net/ipv6/netfilter/ip6t_eui64.c | |||
@@ -70,15 +70,15 @@ static struct ip6t_match eui64_match = { | |||
70 | .me = THIS_MODULE, | 70 | .me = THIS_MODULE, |
71 | }; | 71 | }; |
72 | 72 | ||
73 | static int __init init(void) | 73 | static int __init ip6t_eui64_init(void) |
74 | { | 74 | { |
75 | return ip6t_register_match(&eui64_match); | 75 | return ip6t_register_match(&eui64_match); |
76 | } | 76 | } |
77 | 77 | ||
78 | static void __exit fini(void) | 78 | static void __exit ip6t_eui64_fini(void) |
79 | { | 79 | { |
80 | ip6t_unregister_match(&eui64_match); | 80 | ip6t_unregister_match(&eui64_match); |
81 | } | 81 | } |
82 | 82 | ||
83 | module_init(init); | 83 | module_init(ip6t_eui64_init); |
84 | module_exit(fini); | 84 | module_exit(ip6t_eui64_fini); |
diff --git a/net/ipv6/netfilter/ip6t_frag.c b/net/ipv6/netfilter/ip6t_frag.c index 4c41e14823d5..06768c84bd31 100644 --- a/net/ipv6/netfilter/ip6t_frag.c +++ b/net/ipv6/netfilter/ip6t_frag.c | |||
@@ -139,15 +139,15 @@ static struct ip6t_match frag_match = { | |||
139 | .me = THIS_MODULE, | 139 | .me = THIS_MODULE, |
140 | }; | 140 | }; |
141 | 141 | ||
142 | static int __init init(void) | 142 | static int __init ip6t_frag_init(void) |
143 | { | 143 | { |
144 | return ip6t_register_match(&frag_match); | 144 | return ip6t_register_match(&frag_match); |
145 | } | 145 | } |
146 | 146 | ||
147 | static void __exit cleanup(void) | 147 | static void __exit ip6t_frag_fini(void) |
148 | { | 148 | { |
149 | ip6t_unregister_match(&frag_match); | 149 | ip6t_unregister_match(&frag_match); |
150 | } | 150 | } |
151 | 151 | ||
152 | module_init(init); | 152 | module_init(ip6t_frag_init); |
153 | module_exit(cleanup); | 153 | module_exit(ip6t_frag_fini); |
diff --git a/net/ipv6/netfilter/ip6t_hbh.c b/net/ipv6/netfilter/ip6t_hbh.c index b4a1fdfe6abc..374f1be85c0d 100644 --- a/net/ipv6/netfilter/ip6t_hbh.c +++ b/net/ipv6/netfilter/ip6t_hbh.c | |||
@@ -206,15 +206,15 @@ static struct ip6t_match opts_match = { | |||
206 | .me = THIS_MODULE, | 206 | .me = THIS_MODULE, |
207 | }; | 207 | }; |
208 | 208 | ||
209 | static int __init init(void) | 209 | static int __init ip6t_hbh_init(void) |
210 | { | 210 | { |
211 | return ip6t_register_match(&opts_match); | 211 | return ip6t_register_match(&opts_match); |
212 | } | 212 | } |
213 | 213 | ||
214 | static void __exit cleanup(void) | 214 | static void __exit ip6t_hbh_fini(void) |
215 | { | 215 | { |
216 | ip6t_unregister_match(&opts_match); | 216 | ip6t_unregister_match(&opts_match); |
217 | } | 217 | } |
218 | 218 | ||
219 | module_init(init); | 219 | module_init(ip6t_hbh_init); |
220 | module_exit(cleanup); | 220 | module_exit(ip6t_hbh_fini); |
diff --git a/net/ipv6/netfilter/ip6t_hl.c b/net/ipv6/netfilter/ip6t_hl.c index 374055733b26..44a729e17c48 100644 --- a/net/ipv6/netfilter/ip6t_hl.c +++ b/net/ipv6/netfilter/ip6t_hl.c | |||
@@ -55,16 +55,16 @@ static struct ip6t_match hl_match = { | |||
55 | .me = THIS_MODULE, | 55 | .me = THIS_MODULE, |
56 | }; | 56 | }; |
57 | 57 | ||
58 | static int __init init(void) | 58 | static int __init ip6t_hl_init(void) |
59 | { | 59 | { |
60 | return ip6t_register_match(&hl_match); | 60 | return ip6t_register_match(&hl_match); |
61 | } | 61 | } |
62 | 62 | ||
63 | static void __exit fini(void) | 63 | static void __exit ip6t_hl_fini(void) |
64 | { | 64 | { |
65 | ip6t_unregister_match(&hl_match); | 65 | ip6t_unregister_match(&hl_match); |
66 | 66 | ||
67 | } | 67 | } |
68 | 68 | ||
69 | module_init(init); | 69 | module_init(ip6t_hl_init); |
70 | module_exit(fini); | 70 | module_exit(ip6t_hl_fini); |
diff --git a/net/ipv6/netfilter/ip6t_multiport.c b/net/ipv6/netfilter/ip6t_multiport.c index 752b65d21c72..10c48ba596d6 100644 --- a/net/ipv6/netfilter/ip6t_multiport.c +++ b/net/ipv6/netfilter/ip6t_multiport.c | |||
@@ -111,15 +111,15 @@ static struct ip6t_match multiport_match = { | |||
111 | .me = THIS_MODULE, | 111 | .me = THIS_MODULE, |
112 | }; | 112 | }; |
113 | 113 | ||
114 | static int __init init(void) | 114 | static int __init ip6t_multiport_init(void) |
115 | { | 115 | { |
116 | return ip6t_register_match(&multiport_match); | 116 | return ip6t_register_match(&multiport_match); |
117 | } | 117 | } |
118 | 118 | ||
119 | static void __exit fini(void) | 119 | static void __exit ip6t_multiport_fini(void) |
120 | { | 120 | { |
121 | ip6t_unregister_match(&multiport_match); | 121 | ip6t_unregister_match(&multiport_match); |
122 | } | 122 | } |
123 | 123 | ||
124 | module_init(init); | 124 | module_init(ip6t_multiport_init); |
125 | module_exit(fini); | 125 | module_exit(ip6t_multiport_fini); |
diff --git a/net/ipv6/netfilter/ip6t_owner.c b/net/ipv6/netfilter/ip6t_owner.c index e2cee3bcdef9..5d047990cd44 100644 --- a/net/ipv6/netfilter/ip6t_owner.c +++ b/net/ipv6/netfilter/ip6t_owner.c | |||
@@ -79,15 +79,15 @@ static struct ip6t_match owner_match = { | |||
79 | .me = THIS_MODULE, | 79 | .me = THIS_MODULE, |
80 | }; | 80 | }; |
81 | 81 | ||
82 | static int __init init(void) | 82 | static int __init ip6t_owner_init(void) |
83 | { | 83 | { |
84 | return ip6t_register_match(&owner_match); | 84 | return ip6t_register_match(&owner_match); |
85 | } | 85 | } |
86 | 86 | ||
87 | static void __exit fini(void) | 87 | static void __exit ip6t_owner_fini(void) |
88 | { | 88 | { |
89 | ip6t_unregister_match(&owner_match); | 89 | ip6t_unregister_match(&owner_match); |
90 | } | 90 | } |
91 | 91 | ||
92 | module_init(init); | 92 | module_init(ip6t_owner_init); |
93 | module_exit(fini); | 93 | module_exit(ip6t_owner_fini); |
diff --git a/net/ipv6/netfilter/ip6t_rt.c b/net/ipv6/netfilter/ip6t_rt.c index 4c6b55bb225b..fbb0184a41d8 100644 --- a/net/ipv6/netfilter/ip6t_rt.c +++ b/net/ipv6/netfilter/ip6t_rt.c | |||
@@ -225,15 +225,15 @@ static struct ip6t_match rt_match = { | |||
225 | .me = THIS_MODULE, | 225 | .me = THIS_MODULE, |
226 | }; | 226 | }; |
227 | 227 | ||
228 | static int __init init(void) | 228 | static int __init ip6t_rt_init(void) |
229 | { | 229 | { |
230 | return ip6t_register_match(&rt_match); | 230 | return ip6t_register_match(&rt_match); |
231 | } | 231 | } |
232 | 232 | ||
233 | static void __exit cleanup(void) | 233 | static void __exit ip6t_rt_fini(void) |
234 | { | 234 | { |
235 | ip6t_unregister_match(&rt_match); | 235 | ip6t_unregister_match(&rt_match); |
236 | } | 236 | } |
237 | 237 | ||
238 | module_init(init); | 238 | module_init(ip6t_rt_init); |
239 | module_exit(cleanup); | 239 | module_exit(ip6t_rt_fini); |
diff --git a/net/ipv6/netfilter/ip6table_filter.c b/net/ipv6/netfilter/ip6table_filter.c index ce4a968e1f70..e5e724d9ee60 100644 --- a/net/ipv6/netfilter/ip6table_filter.c +++ b/net/ipv6/netfilter/ip6table_filter.c | |||
@@ -159,7 +159,7 @@ static struct nf_hook_ops ip6t_ops[] = { | |||
159 | static int forward = NF_ACCEPT; | 159 | static int forward = NF_ACCEPT; |
160 | module_param(forward, bool, 0000); | 160 | module_param(forward, bool, 0000); |
161 | 161 | ||
162 | static int __init init(void) | 162 | static int __init ip6table_filter_init(void) |
163 | { | 163 | { |
164 | int ret; | 164 | int ret; |
165 | 165 | ||
@@ -201,7 +201,7 @@ static int __init init(void) | |||
201 | return ret; | 201 | return ret; |
202 | } | 202 | } |
203 | 203 | ||
204 | static void __exit fini(void) | 204 | static void __exit ip6table_filter_fini(void) |
205 | { | 205 | { |
206 | unsigned int i; | 206 | unsigned int i; |
207 | 207 | ||
@@ -211,5 +211,5 @@ static void __exit fini(void) | |||
211 | ip6t_unregister_table(&packet_filter); | 211 | ip6t_unregister_table(&packet_filter); |
212 | } | 212 | } |
213 | 213 | ||
214 | module_init(init); | 214 | module_init(ip6table_filter_init); |
215 | module_exit(fini); | 215 | module_exit(ip6table_filter_fini); |
diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c index 30a4627e000d..e1f0f6ae9841 100644 --- a/net/ipv6/netfilter/ip6table_mangle.c +++ b/net/ipv6/netfilter/ip6table_mangle.c | |||
@@ -228,7 +228,7 @@ static struct nf_hook_ops ip6t_ops[] = { | |||
228 | }, | 228 | }, |
229 | }; | 229 | }; |
230 | 230 | ||
231 | static int __init init(void) | 231 | static int __init ip6table_mangle_init(void) |
232 | { | 232 | { |
233 | int ret; | 233 | int ret; |
234 | 234 | ||
@@ -274,7 +274,7 @@ static int __init init(void) | |||
274 | return ret; | 274 | return ret; |
275 | } | 275 | } |
276 | 276 | ||
277 | static void __exit fini(void) | 277 | static void __exit ip6table_mangle_fini(void) |
278 | { | 278 | { |
279 | unsigned int i; | 279 | unsigned int i; |
280 | 280 | ||
@@ -284,5 +284,5 @@ static void __exit fini(void) | |||
284 | ip6t_unregister_table(&packet_mangler); | 284 | ip6t_unregister_table(&packet_mangler); |
285 | } | 285 | } |
286 | 286 | ||
287 | module_init(init); | 287 | module_init(ip6table_mangle_init); |
288 | module_exit(fini); | 288 | module_exit(ip6table_mangle_fini); |
diff --git a/net/ipv6/netfilter/ip6table_raw.c b/net/ipv6/netfilter/ip6table_raw.c index db28ba3855e2..54d1fffd62ba 100644 --- a/net/ipv6/netfilter/ip6table_raw.c +++ b/net/ipv6/netfilter/ip6table_raw.c | |||
@@ -142,7 +142,7 @@ static struct nf_hook_ops ip6t_ops[] = { | |||
142 | }, | 142 | }, |
143 | }; | 143 | }; |
144 | 144 | ||
145 | static int __init init(void) | 145 | static int __init ip6table_raw_init(void) |
146 | { | 146 | { |
147 | int ret; | 147 | int ret; |
148 | 148 | ||
@@ -170,7 +170,7 @@ static int __init init(void) | |||
170 | return ret; | 170 | return ret; |
171 | } | 171 | } |
172 | 172 | ||
173 | static void __exit fini(void) | 173 | static void __exit ip6table_raw_fini(void) |
174 | { | 174 | { |
175 | unsigned int i; | 175 | unsigned int i; |
176 | 176 | ||
@@ -180,6 +180,6 @@ static void __exit fini(void) | |||
180 | ip6t_unregister_table(&packet_raw); | 180 | ip6t_unregister_table(&packet_raw); |
181 | } | 181 | } |
182 | 182 | ||
183 | module_init(init); | 183 | module_init(ip6table_raw_init); |
184 | module_exit(fini); | 184 | module_exit(ip6table_raw_fini); |
185 | MODULE_LICENSE("GPL"); | 185 | MODULE_LICENSE("GPL"); |
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c index c16f62934bd9..c8b5a96cbb0f 100644 --- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | |||
@@ -588,16 +588,16 @@ MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET6)); | |||
588 | MODULE_LICENSE("GPL"); | 588 | MODULE_LICENSE("GPL"); |
589 | MODULE_AUTHOR("Yasuyuki KOZAKAI @USAGI <yasuyuki.kozakai@toshiba.co.jp>"); | 589 | MODULE_AUTHOR("Yasuyuki KOZAKAI @USAGI <yasuyuki.kozakai@toshiba.co.jp>"); |
590 | 590 | ||
591 | static int __init init(void) | 591 | static int __init nf_conntrack_l3proto_ipv6_init(void) |
592 | { | 592 | { |
593 | need_conntrack(); | 593 | need_conntrack(); |
594 | return init_or_cleanup(1); | 594 | return init_or_cleanup(1); |
595 | } | 595 | } |
596 | 596 | ||
597 | static void __exit fini(void) | 597 | static void __exit nf_conntrack_l3proto_ipv6_fini(void) |
598 | { | 598 | { |
599 | init_or_cleanup(0); | 599 | init_or_cleanup(0); |
600 | } | 600 | } |
601 | 601 | ||
602 | module_init(init); | 602 | module_init(nf_conntrack_l3proto_ipv6_init); |
603 | module_exit(fini); | 603 | module_exit(nf_conntrack_l3proto_ipv6_fini); |
diff --git a/net/ipv6/tunnel6.c b/net/ipv6/tunnel6.c new file mode 100644 index 000000000000..5659b52284bd --- /dev/null +++ b/net/ipv6/tunnel6.c | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * Copyright (C)2003,2004 USAGI/WIDE Project | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | * | ||
18 | * Authors Mitsuru KANDA <mk@linux-ipv6.org> | ||
19 | * YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | ||
20 | */ | ||
21 | |||
22 | #include <linux/init.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/mutex.h> | ||
25 | #include <linux/netdevice.h> | ||
26 | #include <linux/skbuff.h> | ||
27 | #include <net/protocol.h> | ||
28 | #include <net/xfrm.h> | ||
29 | |||
30 | static struct xfrm6_tunnel *tunnel6_handlers; | ||
31 | static DEFINE_MUTEX(tunnel6_mutex); | ||
32 | |||
33 | int xfrm6_tunnel_register(struct xfrm6_tunnel *handler) | ||
34 | { | ||
35 | struct xfrm6_tunnel **pprev; | ||
36 | int ret = -EEXIST; | ||
37 | int priority = handler->priority; | ||
38 | |||
39 | mutex_lock(&tunnel6_mutex); | ||
40 | |||
41 | for (pprev = &tunnel6_handlers; *pprev; pprev = &(*pprev)->next) { | ||
42 | if ((*pprev)->priority > priority) | ||
43 | break; | ||
44 | if ((*pprev)->priority == priority) | ||
45 | goto err; | ||
46 | } | ||
47 | |||
48 | handler->next = *pprev; | ||
49 | *pprev = handler; | ||
50 | |||
51 | ret = 0; | ||
52 | |||
53 | err: | ||
54 | mutex_unlock(&tunnel6_mutex); | ||
55 | |||
56 | return ret; | ||
57 | } | ||
58 | |||
59 | EXPORT_SYMBOL(xfrm6_tunnel_register); | ||
60 | |||
61 | int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler) | ||
62 | { | ||
63 | struct xfrm6_tunnel **pprev; | ||
64 | int ret = -ENOENT; | ||
65 | |||
66 | mutex_lock(&tunnel6_mutex); | ||
67 | |||
68 | for (pprev = &tunnel6_handlers; *pprev; pprev = &(*pprev)->next) { | ||
69 | if (*pprev == handler) { | ||
70 | *pprev = handler->next; | ||
71 | ret = 0; | ||
72 | break; | ||
73 | } | ||
74 | } | ||
75 | |||
76 | mutex_unlock(&tunnel6_mutex); | ||
77 | |||
78 | synchronize_net(); | ||
79 | |||
80 | return ret; | ||
81 | } | ||
82 | |||
83 | EXPORT_SYMBOL(xfrm6_tunnel_deregister); | ||
84 | |||
85 | static int tunnel6_rcv(struct sk_buff **pskb) | ||
86 | { | ||
87 | struct sk_buff *skb = *pskb; | ||
88 | struct xfrm6_tunnel *handler; | ||
89 | |||
90 | for (handler = tunnel6_handlers; handler; handler = handler->next) | ||
91 | if (!handler->handler(skb)) | ||
92 | return 0; | ||
93 | |||
94 | kfree_skb(skb); | ||
95 | return 0; | ||
96 | } | ||
97 | |||
98 | static void tunnel6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | ||
99 | int type, int code, int offset, __u32 info) | ||
100 | { | ||
101 | struct xfrm6_tunnel *handler; | ||
102 | |||
103 | for (handler = tunnel6_handlers; handler; handler = handler->next) | ||
104 | if (!handler->err_handler(skb, opt, type, code, offset, info)) | ||
105 | break; | ||
106 | } | ||
107 | |||
108 | static struct inet6_protocol tunnel6_protocol = { | ||
109 | .handler = tunnel6_rcv, | ||
110 | .err_handler = tunnel6_err, | ||
111 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, | ||
112 | }; | ||
113 | |||
114 | static int __init tunnel6_init(void) | ||
115 | { | ||
116 | if (inet6_add_protocol(&tunnel6_protocol, IPPROTO_IPV6)) { | ||
117 | printk(KERN_ERR "tunnel6 init(): can't add protocol\n"); | ||
118 | return -EAGAIN; | ||
119 | } | ||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | static void __exit tunnel6_fini(void) | ||
124 | { | ||
125 | if (inet6_del_protocol(&tunnel6_protocol, IPPROTO_IPV6)) | ||
126 | printk(KERN_ERR "tunnel6 close: can't remove protocol\n"); | ||
127 | } | ||
128 | |||
129 | module_init(tunnel6_init); | ||
130 | module_exit(tunnel6_fini); | ||
131 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c index 1ca2da68ef69..cccf8b76f046 100644 --- a/net/ipv6/xfrm6_input.c +++ b/net/ipv6/xfrm6_input.c | |||
@@ -28,9 +28,8 @@ static inline void ipip6_ecn_decapsulate(struct sk_buff *skb) | |||
28 | IP6_ECN_set_ce(inner_iph); | 28 | IP6_ECN_set_ce(inner_iph); |
29 | } | 29 | } |
30 | 30 | ||
31 | int xfrm6_rcv_spi(struct sk_buff **pskb, u32 spi) | 31 | int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi) |
32 | { | 32 | { |
33 | struct sk_buff *skb = *pskb; | ||
34 | int err; | 33 | int err; |
35 | u32 seq; | 34 | u32 seq; |
36 | struct sec_decap_state xfrm_vec[XFRM_MAX_DEPTH]; | 35 | struct sec_decap_state xfrm_vec[XFRM_MAX_DEPTH]; |
@@ -159,5 +158,5 @@ EXPORT_SYMBOL(xfrm6_rcv_spi); | |||
159 | 158 | ||
160 | int xfrm6_rcv(struct sk_buff **pskb) | 159 | int xfrm6_rcv(struct sk_buff **pskb) |
161 | { | 160 | { |
162 | return xfrm6_rcv_spi(pskb, 0); | 161 | return xfrm6_rcv_spi(*pskb, 0); |
163 | } | 162 | } |
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index 08f9abbdf1d7..a8f6776c518d 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <net/ip.h> | 28 | #include <net/ip.h> |
29 | #include <net/xfrm.h> | 29 | #include <net/xfrm.h> |
30 | #include <net/ipv6.h> | 30 | #include <net/ipv6.h> |
31 | #include <net/protocol.h> | ||
32 | #include <linux/ipv6.h> | 31 | #include <linux/ipv6.h> |
33 | #include <linux/icmpv6.h> | 32 | #include <linux/icmpv6.h> |
34 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
@@ -357,71 +356,18 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct xfrm_decap_state *dec | |||
357 | return 0; | 356 | return 0; |
358 | } | 357 | } |
359 | 358 | ||
360 | static struct xfrm6_tunnel *xfrm6_tunnel_handler; | 359 | static int xfrm6_tunnel_rcv(struct sk_buff *skb) |
361 | static DEFINE_MUTEX(xfrm6_tunnel_mutex); | ||
362 | |||
363 | int xfrm6_tunnel_register(struct xfrm6_tunnel *handler) | ||
364 | { | 360 | { |
365 | int ret; | ||
366 | |||
367 | mutex_lock(&xfrm6_tunnel_mutex); | ||
368 | ret = 0; | ||
369 | if (xfrm6_tunnel_handler != NULL) | ||
370 | ret = -EINVAL; | ||
371 | if (!ret) | ||
372 | xfrm6_tunnel_handler = handler; | ||
373 | mutex_unlock(&xfrm6_tunnel_mutex); | ||
374 | |||
375 | return ret; | ||
376 | } | ||
377 | |||
378 | EXPORT_SYMBOL(xfrm6_tunnel_register); | ||
379 | |||
380 | int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler) | ||
381 | { | ||
382 | int ret; | ||
383 | |||
384 | mutex_lock(&xfrm6_tunnel_mutex); | ||
385 | ret = 0; | ||
386 | if (xfrm6_tunnel_handler != handler) | ||
387 | ret = -EINVAL; | ||
388 | if (!ret) | ||
389 | xfrm6_tunnel_handler = NULL; | ||
390 | mutex_unlock(&xfrm6_tunnel_mutex); | ||
391 | |||
392 | synchronize_net(); | ||
393 | |||
394 | return ret; | ||
395 | } | ||
396 | |||
397 | EXPORT_SYMBOL(xfrm6_tunnel_deregister); | ||
398 | |||
399 | static int xfrm6_tunnel_rcv(struct sk_buff **pskb) | ||
400 | { | ||
401 | struct sk_buff *skb = *pskb; | ||
402 | struct xfrm6_tunnel *handler = xfrm6_tunnel_handler; | ||
403 | struct ipv6hdr *iph = skb->nh.ipv6h; | 361 | struct ipv6hdr *iph = skb->nh.ipv6h; |
404 | u32 spi; | 362 | u32 spi; |
405 | 363 | ||
406 | /* device-like_ip6ip6_handler() */ | ||
407 | if (handler && handler->handler(pskb) == 0) | ||
408 | return 0; | ||
409 | |||
410 | spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&iph->saddr); | 364 | spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&iph->saddr); |
411 | return xfrm6_rcv_spi(pskb, spi); | 365 | return xfrm6_rcv_spi(skb, spi); |
412 | } | 366 | } |
413 | 367 | ||
414 | static void xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | 368 | static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
415 | int type, int code, int offset, __u32 info) | 369 | int type, int code, int offset, __u32 info) |
416 | { | 370 | { |
417 | struct xfrm6_tunnel *handler = xfrm6_tunnel_handler; | ||
418 | |||
419 | /* call here first for device-like ip6ip6 err handling */ | ||
420 | if (handler) { | ||
421 | handler->err_handler(skb, opt, type, code, offset, info); | ||
422 | return; | ||
423 | } | ||
424 | |||
425 | /* xfrm6_tunnel native err handling */ | 371 | /* xfrm6_tunnel native err handling */ |
426 | switch (type) { | 372 | switch (type) { |
427 | case ICMPV6_DEST_UNREACH: | 373 | case ICMPV6_DEST_UNREACH: |
@@ -462,7 +408,8 @@ static void xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
462 | default: | 408 | default: |
463 | break; | 409 | break; |
464 | } | 410 | } |
465 | return; | 411 | |
412 | return 0; | ||
466 | } | 413 | } |
467 | 414 | ||
468 | static int xfrm6_tunnel_init_state(struct xfrm_state *x) | 415 | static int xfrm6_tunnel_init_state(struct xfrm_state *x) |
@@ -493,10 +440,10 @@ static struct xfrm_type xfrm6_tunnel_type = { | |||
493 | .output = xfrm6_tunnel_output, | 440 | .output = xfrm6_tunnel_output, |
494 | }; | 441 | }; |
495 | 442 | ||
496 | static struct inet6_protocol xfrm6_tunnel_protocol = { | 443 | static struct xfrm6_tunnel xfrm6_tunnel_handler = { |
497 | .handler = xfrm6_tunnel_rcv, | 444 | .handler = xfrm6_tunnel_rcv, |
498 | .err_handler = xfrm6_tunnel_err, | 445 | .err_handler = xfrm6_tunnel_err, |
499 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, | 446 | .priority = 2, |
500 | }; | 447 | }; |
501 | 448 | ||
502 | static int __init xfrm6_tunnel_init(void) | 449 | static int __init xfrm6_tunnel_init(void) |
@@ -508,16 +455,16 @@ static int __init xfrm6_tunnel_init(void) | |||
508 | "xfrm6_tunnel init: can't add xfrm type\n"); | 455 | "xfrm6_tunnel init: can't add xfrm type\n"); |
509 | return -EAGAIN; | 456 | return -EAGAIN; |
510 | } | 457 | } |
511 | if (inet6_add_protocol(&xfrm6_tunnel_protocol, IPPROTO_IPV6) < 0) { | 458 | if (xfrm6_tunnel_register(&xfrm6_tunnel_handler)) { |
512 | X6TPRINTK1(KERN_ERR | 459 | X6TPRINTK1(KERN_ERR |
513 | "xfrm6_tunnel init(): can't add protocol\n"); | 460 | "xfrm6_tunnel init(): can't add handler\n"); |
514 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); | 461 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); |
515 | return -EAGAIN; | 462 | return -EAGAIN; |
516 | } | 463 | } |
517 | if (xfrm6_tunnel_spi_init() < 0) { | 464 | if (xfrm6_tunnel_spi_init() < 0) { |
518 | X6TPRINTK1(KERN_ERR | 465 | X6TPRINTK1(KERN_ERR |
519 | "xfrm6_tunnel init: failed to initialize spi\n"); | 466 | "xfrm6_tunnel init: failed to initialize spi\n"); |
520 | inet6_del_protocol(&xfrm6_tunnel_protocol, IPPROTO_IPV6); | 467 | xfrm6_tunnel_deregister(&xfrm6_tunnel_handler); |
521 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); | 468 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); |
522 | return -EAGAIN; | 469 | return -EAGAIN; |
523 | } | 470 | } |
@@ -529,9 +476,9 @@ static void __exit xfrm6_tunnel_fini(void) | |||
529 | X6TPRINTK3(KERN_DEBUG "%s()\n", __FUNCTION__); | 476 | X6TPRINTK3(KERN_DEBUG "%s()\n", __FUNCTION__); |
530 | 477 | ||
531 | xfrm6_tunnel_spi_fini(); | 478 | xfrm6_tunnel_spi_fini(); |
532 | if (inet6_del_protocol(&xfrm6_tunnel_protocol, IPPROTO_IPV6) < 0) | 479 | if (xfrm6_tunnel_deregister(&xfrm6_tunnel_handler)) |
533 | X6TPRINTK1(KERN_ERR | 480 | X6TPRINTK1(KERN_ERR |
534 | "xfrm6_tunnel close: can't remove protocol\n"); | 481 | "xfrm6_tunnel close: can't remove handler\n"); |
535 | if (xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6) < 0) | 482 | if (xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6) < 0) |
536 | X6TPRINTK1(KERN_ERR | 483 | X6TPRINTK1(KERN_ERR |
537 | "xfrm6_tunnel close: can't remove xfrm type\n"); | 484 | "xfrm6_tunnel close: can't remove xfrm type\n"); |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 0fb513a34d11..2dbf134d5266 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -1892,6 +1892,29 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1892 | return rc; | 1892 | return rc; |
1893 | } | 1893 | } |
1894 | 1894 | ||
1895 | |||
1896 | #ifdef CONFIG_COMPAT | ||
1897 | static int ipx_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | ||
1898 | { | ||
1899 | /* | ||
1900 | * These 4 commands use same structure on 32bit and 64bit. Rest of IPX | ||
1901 | * commands is handled by generic ioctl code. As these commands are | ||
1902 | * SIOCPROTOPRIVATE..SIOCPROTOPRIVATE+3, they cannot be handled by generic | ||
1903 | * code. | ||
1904 | */ | ||
1905 | switch (cmd) { | ||
1906 | case SIOCAIPXITFCRT: | ||
1907 | case SIOCAIPXPRISLT: | ||
1908 | case SIOCIPXCFGDATA: | ||
1909 | case SIOCIPXNCPCONN: | ||
1910 | return ipx_ioctl(sock, cmd, arg); | ||
1911 | default: | ||
1912 | return -ENOIOCTLCMD; | ||
1913 | } | ||
1914 | } | ||
1915 | #endif | ||
1916 | |||
1917 | |||
1895 | /* | 1918 | /* |
1896 | * Socket family declarations | 1919 | * Socket family declarations |
1897 | */ | 1920 | */ |
@@ -1913,6 +1936,9 @@ static const struct proto_ops SOCKOPS_WRAPPED(ipx_dgram_ops) = { | |||
1913 | .getname = ipx_getname, | 1936 | .getname = ipx_getname, |
1914 | .poll = datagram_poll, | 1937 | .poll = datagram_poll, |
1915 | .ioctl = ipx_ioctl, | 1938 | .ioctl = ipx_ioctl, |
1939 | #ifdef CONFIG_COMPAT | ||
1940 | .compat_ioctl = ipx_compat_ioctl, | ||
1941 | #endif | ||
1916 | .listen = sock_no_listen, | 1942 | .listen = sock_no_listen, |
1917 | .shutdown = sock_no_shutdown, /* FIXME: support shutdown */ | 1943 | .shutdown = sock_no_shutdown, /* FIXME: support shutdown */ |
1918 | .setsockopt = ipx_setsockopt, | 1944 | .setsockopt = ipx_setsockopt, |
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 759445648667..2f37c9f35e27 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -1302,7 +1302,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1302 | if (sk->sk_state != TCP_ESTABLISHED) | 1302 | if (sk->sk_state != TCP_ESTABLISHED) |
1303 | return -ENOTCONN; | 1303 | return -ENOTCONN; |
1304 | 1304 | ||
1305 | /* Check that we don't send out to big frames */ | 1305 | /* Check that we don't send out too big frames */ |
1306 | if (len > self->max_data_size) { | 1306 | if (len > self->max_data_size) { |
1307 | IRDA_DEBUG(2, "%s(), Chopping frame from %zd to %d bytes!\n", | 1307 | IRDA_DEBUG(2, "%s(), Chopping frame from %zd to %d bytes!\n", |
1308 | __FUNCTION__, len, self->max_data_size); | 1308 | __FUNCTION__, len, self->max_data_size); |
@@ -1546,7 +1546,7 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock, | |||
1546 | IRDA_ASSERT(self != NULL, return -1;); | 1546 | IRDA_ASSERT(self != NULL, return -1;); |
1547 | 1547 | ||
1548 | /* | 1548 | /* |
1549 | * Check that we don't send out to big frames. This is an unreliable | 1549 | * Check that we don't send out too big frames. This is an unreliable |
1550 | * service, so we have no fragmentation and no coalescence | 1550 | * service, so we have no fragmentation and no coalescence |
1551 | */ | 1551 | */ |
1552 | if (len > self->max_data_size) { | 1552 | if (len > self->max_data_size) { |
@@ -1642,7 +1642,7 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock, | |||
1642 | } | 1642 | } |
1643 | 1643 | ||
1644 | /* | 1644 | /* |
1645 | * Check that we don't send out to big frames. This is an unreliable | 1645 | * Check that we don't send out too big frames. This is an unreliable |
1646 | * service, so we have no fragmentation and no coalescence | 1646 | * service, so we have no fragmentation and no coalescence |
1647 | */ | 1647 | */ |
1648 | if (len > self->max_data_size) { | 1648 | if (len > self->max_data_size) { |
@@ -1830,6 +1830,19 @@ static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1830 | return 0; | 1830 | return 0; |
1831 | } | 1831 | } |
1832 | 1832 | ||
1833 | #ifdef CONFIG_COMPAT | ||
1834 | /* | ||
1835 | * Function irda_ioctl (sock, cmd, arg) | ||
1836 | */ | ||
1837 | static int irda_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | ||
1838 | { | ||
1839 | /* | ||
1840 | * All IRDA's ioctl are standard ones. | ||
1841 | */ | ||
1842 | return -ENOIOCTLCMD; | ||
1843 | } | ||
1844 | #endif | ||
1845 | |||
1833 | /* | 1846 | /* |
1834 | * Function irda_setsockopt (sock, level, optname, optval, optlen) | 1847 | * Function irda_setsockopt (sock, level, optname, optval, optlen) |
1835 | * | 1848 | * |
@@ -2476,6 +2489,9 @@ static const struct proto_ops SOCKOPS_WRAPPED(irda_stream_ops) = { | |||
2476 | .getname = irda_getname, | 2489 | .getname = irda_getname, |
2477 | .poll = irda_poll, | 2490 | .poll = irda_poll, |
2478 | .ioctl = irda_ioctl, | 2491 | .ioctl = irda_ioctl, |
2492 | #ifdef CONFIG_COMPAT | ||
2493 | .compat_ioctl = irda_compat_ioctl, | ||
2494 | #endif | ||
2479 | .listen = irda_listen, | 2495 | .listen = irda_listen, |
2480 | .shutdown = irda_shutdown, | 2496 | .shutdown = irda_shutdown, |
2481 | .setsockopt = irda_setsockopt, | 2497 | .setsockopt = irda_setsockopt, |
@@ -2497,6 +2513,9 @@ static const struct proto_ops SOCKOPS_WRAPPED(irda_seqpacket_ops) = { | |||
2497 | .getname = irda_getname, | 2513 | .getname = irda_getname, |
2498 | .poll = datagram_poll, | 2514 | .poll = datagram_poll, |
2499 | .ioctl = irda_ioctl, | 2515 | .ioctl = irda_ioctl, |
2516 | #ifdef CONFIG_COMPAT | ||
2517 | .compat_ioctl = irda_compat_ioctl, | ||
2518 | #endif | ||
2500 | .listen = irda_listen, | 2519 | .listen = irda_listen, |
2501 | .shutdown = irda_shutdown, | 2520 | .shutdown = irda_shutdown, |
2502 | .setsockopt = irda_setsockopt, | 2521 | .setsockopt = irda_setsockopt, |
@@ -2518,6 +2537,9 @@ static const struct proto_ops SOCKOPS_WRAPPED(irda_dgram_ops) = { | |||
2518 | .getname = irda_getname, | 2537 | .getname = irda_getname, |
2519 | .poll = datagram_poll, | 2538 | .poll = datagram_poll, |
2520 | .ioctl = irda_ioctl, | 2539 | .ioctl = irda_ioctl, |
2540 | #ifdef CONFIG_COMPAT | ||
2541 | .compat_ioctl = irda_compat_ioctl, | ||
2542 | #endif | ||
2521 | .listen = irda_listen, | 2543 | .listen = irda_listen, |
2522 | .shutdown = irda_shutdown, | 2544 | .shutdown = irda_shutdown, |
2523 | .setsockopt = irda_setsockopt, | 2545 | .setsockopt = irda_setsockopt, |
@@ -2540,6 +2562,9 @@ static const struct proto_ops SOCKOPS_WRAPPED(irda_ultra_ops) = { | |||
2540 | .getname = irda_getname, | 2562 | .getname = irda_getname, |
2541 | .poll = datagram_poll, | 2563 | .poll = datagram_poll, |
2542 | .ioctl = irda_ioctl, | 2564 | .ioctl = irda_ioctl, |
2565 | #ifdef CONFIG_COMPAT | ||
2566 | .compat_ioctl = irda_compat_ioctl, | ||
2567 | #endif | ||
2543 | .listen = sock_no_listen, | 2568 | .listen = sock_no_listen, |
2544 | .shutdown = irda_shutdown, | 2569 | .shutdown = irda_shutdown, |
2545 | .setsockopt = irda_setsockopt, | 2570 | .setsockopt = irda_setsockopt, |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 0ae281d9bfc3..56389c83557c 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -90,8 +90,8 @@ static int nf_conntrack_vmalloc; | |||
90 | static unsigned int nf_conntrack_next_id; | 90 | static unsigned int nf_conntrack_next_id; |
91 | static unsigned int nf_conntrack_expect_next_id; | 91 | static unsigned int nf_conntrack_expect_next_id; |
92 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | 92 | #ifdef CONFIG_NF_CONNTRACK_EVENTS |
93 | struct notifier_block *nf_conntrack_chain; | 93 | ATOMIC_NOTIFIER_HEAD(nf_conntrack_chain); |
94 | struct notifier_block *nf_conntrack_expect_chain; | 94 | ATOMIC_NOTIFIER_HEAD(nf_conntrack_expect_chain); |
95 | 95 | ||
96 | DEFINE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache); | 96 | DEFINE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache); |
97 | 97 | ||
@@ -103,7 +103,7 @@ __nf_ct_deliver_cached_events(struct nf_conntrack_ecache *ecache) | |||
103 | DEBUGP("ecache: delivering events for %p\n", ecache->ct); | 103 | DEBUGP("ecache: delivering events for %p\n", ecache->ct); |
104 | if (nf_ct_is_confirmed(ecache->ct) && !nf_ct_is_dying(ecache->ct) | 104 | if (nf_ct_is_confirmed(ecache->ct) && !nf_ct_is_dying(ecache->ct) |
105 | && ecache->events) | 105 | && ecache->events) |
106 | notifier_call_chain(&nf_conntrack_chain, ecache->events, | 106 | atomic_notifier_call_chain(&nf_conntrack_chain, ecache->events, |
107 | ecache->ct); | 107 | ecache->ct); |
108 | 108 | ||
109 | ecache->events = 0; | 109 | ecache->events = 0; |
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c index cd191b0d4ac7..e38a4b5a3089 100644 --- a/net/netfilter/nf_conntrack_ftp.c +++ b/net/netfilter/nf_conntrack_ftp.c | |||
@@ -624,7 +624,7 @@ static struct nf_conntrack_helper ftp[MAX_PORTS][2]; | |||
624 | static char ftp_names[MAX_PORTS][2][sizeof("ftp-65535")]; | 624 | static char ftp_names[MAX_PORTS][2][sizeof("ftp-65535")]; |
625 | 625 | ||
626 | /* don't make this __exit, since it's called from __init ! */ | 626 | /* don't make this __exit, since it's called from __init ! */ |
627 | static void fini(void) | 627 | static void nf_conntrack_ftp_fini(void) |
628 | { | 628 | { |
629 | int i, j; | 629 | int i, j; |
630 | for (i = 0; i < ports_c; i++) { | 630 | for (i = 0; i < ports_c; i++) { |
@@ -642,7 +642,7 @@ static void fini(void) | |||
642 | kfree(ftp_buffer); | 642 | kfree(ftp_buffer); |
643 | } | 643 | } |
644 | 644 | ||
645 | static int __init init(void) | 645 | static int __init nf_conntrack_ftp_init(void) |
646 | { | 646 | { |
647 | int i, j = -1, ret = 0; | 647 | int i, j = -1, ret = 0; |
648 | char *tmpname; | 648 | char *tmpname; |
@@ -683,7 +683,7 @@ static int __init init(void) | |||
683 | printk("nf_ct_ftp: failed to register helper " | 683 | printk("nf_ct_ftp: failed to register helper " |
684 | " for pf: %d port: %d\n", | 684 | " for pf: %d port: %d\n", |
685 | ftp[i][j].tuple.src.l3num, ports[i]); | 685 | ftp[i][j].tuple.src.l3num, ports[i]); |
686 | fini(); | 686 | nf_conntrack_ftp_fini(); |
687 | return ret; | 687 | return ret; |
688 | } | 688 | } |
689 | } | 689 | } |
@@ -692,5 +692,5 @@ static int __init init(void) | |||
692 | return 0; | 692 | return 0; |
693 | } | 693 | } |
694 | 694 | ||
695 | module_init(init); | 695 | module_init(nf_conntrack_ftp_init); |
696 | module_exit(fini); | 696 | module_exit(nf_conntrack_ftp_fini); |
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c index cf798e61e379..9cccc325b687 100644 --- a/net/netfilter/nf_conntrack_proto_sctp.c +++ b/net/netfilter/nf_conntrack_proto_sctp.c | |||
@@ -615,7 +615,7 @@ static ctl_table nf_ct_net_table[] = { | |||
615 | static struct ctl_table_header *nf_ct_sysctl_header; | 615 | static struct ctl_table_header *nf_ct_sysctl_header; |
616 | #endif | 616 | #endif |
617 | 617 | ||
618 | int __init init(void) | 618 | int __init nf_conntrack_proto_sctp_init(void) |
619 | { | 619 | { |
620 | int ret; | 620 | int ret; |
621 | 621 | ||
@@ -652,7 +652,7 @@ int __init init(void) | |||
652 | return ret; | 652 | return ret; |
653 | } | 653 | } |
654 | 654 | ||
655 | void __exit fini(void) | 655 | void __exit nf_conntrack_proto_sctp_fini(void) |
656 | { | 656 | { |
657 | nf_conntrack_protocol_unregister(&nf_conntrack_protocol_sctp6); | 657 | nf_conntrack_protocol_unregister(&nf_conntrack_protocol_sctp6); |
658 | nf_conntrack_protocol_unregister(&nf_conntrack_protocol_sctp4); | 658 | nf_conntrack_protocol_unregister(&nf_conntrack_protocol_sctp4); |
@@ -662,8 +662,8 @@ void __exit fini(void) | |||
662 | DEBUGP("SCTP conntrack module unloaded\n"); | 662 | DEBUGP("SCTP conntrack module unloaded\n"); |
663 | } | 663 | } |
664 | 664 | ||
665 | module_init(init); | 665 | module_init(nf_conntrack_proto_sctp_init); |
666 | module_exit(fini); | 666 | module_exit(nf_conntrack_proto_sctp_fini); |
667 | 667 | ||
668 | MODULE_LICENSE("GPL"); | 668 | MODULE_LICENSE("GPL"); |
669 | MODULE_AUTHOR("Kiran Kumar Immidi"); | 669 | MODULE_AUTHOR("Kiran Kumar Immidi"); |
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index 75577e175b35..c72aa3cd22e4 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -806,18 +806,18 @@ void nf_conntrack_protocol_unregister(struct nf_conntrack_protocol *proto) | |||
806 | nf_ct_iterate_cleanup(kill_proto, proto); | 806 | nf_ct_iterate_cleanup(kill_proto, proto); |
807 | } | 807 | } |
808 | 808 | ||
809 | static int __init init(void) | 809 | static int __init nf_conntrack_standalone_init(void) |
810 | { | 810 | { |
811 | return init_or_cleanup(1); | 811 | return init_or_cleanup(1); |
812 | } | 812 | } |
813 | 813 | ||
814 | static void __exit fini(void) | 814 | static void __exit nf_conntrack_standalone_fini(void) |
815 | { | 815 | { |
816 | init_or_cleanup(0); | 816 | init_or_cleanup(0); |
817 | } | 817 | } |
818 | 818 | ||
819 | module_init(init); | 819 | module_init(nf_conntrack_standalone_init); |
820 | module_exit(fini); | 820 | module_exit(nf_conntrack_standalone_fini); |
821 | 821 | ||
822 | /* Some modules need us, but don't depend directly on any symbol. | 822 | /* Some modules need us, but don't depend directly on any symbol. |
823 | They should call this. */ | 823 | They should call this. */ |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 54cbbaa712dc..3e3f5448bacb 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -1081,13 +1081,13 @@ cleanup_netlink_notifier: | |||
1081 | return status; | 1081 | return status; |
1082 | } | 1082 | } |
1083 | 1083 | ||
1084 | static int __init init(void) | 1084 | static int __init nfnetlink_log_init(void) |
1085 | { | 1085 | { |
1086 | 1086 | ||
1087 | return init_or_cleanup(1); | 1087 | return init_or_cleanup(1); |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | static void __exit fini(void) | 1090 | static void __exit nfnetlink_log_fini(void) |
1091 | { | 1091 | { |
1092 | init_or_cleanup(0); | 1092 | init_or_cleanup(0); |
1093 | } | 1093 | } |
@@ -1097,5 +1097,5 @@ MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); | |||
1097 | MODULE_LICENSE("GPL"); | 1097 | MODULE_LICENSE("GPL"); |
1098 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_ULOG); | 1098 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_ULOG); |
1099 | 1099 | ||
1100 | module_init(init); | 1100 | module_init(nfnetlink_log_init); |
1101 | module_exit(fini); | 1101 | module_exit(nfnetlink_log_fini); |
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index b5701662182e..d0e62f68139f 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -1117,13 +1117,13 @@ cleanup_netlink_notifier: | |||
1117 | return status; | 1117 | return status; |
1118 | } | 1118 | } |
1119 | 1119 | ||
1120 | static int __init init(void) | 1120 | static int __init nfnetlink_queue_init(void) |
1121 | { | 1121 | { |
1122 | 1122 | ||
1123 | return init_or_cleanup(1); | 1123 | return init_or_cleanup(1); |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | static void __exit fini(void) | 1126 | static void __exit nfnetlink_queue_fini(void) |
1127 | { | 1127 | { |
1128 | init_or_cleanup(0); | 1128 | init_or_cleanup(0); |
1129 | } | 1129 | } |
@@ -1133,5 +1133,5 @@ MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); | |||
1133 | MODULE_LICENSE("GPL"); | 1133 | MODULE_LICENSE("GPL"); |
1134 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_QUEUE); | 1134 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_QUEUE); |
1135 | 1135 | ||
1136 | module_init(init); | 1136 | module_init(nfnetlink_queue_init); |
1137 | module_exit(fini); | 1137 | module_exit(nfnetlink_queue_fini); |
diff --git a/net/netfilter/xt_CLASSIFY.c b/net/netfilter/xt_CLASSIFY.c index 3cd2ac90a25b..e54e57730012 100644 --- a/net/netfilter/xt_CLASSIFY.c +++ b/net/netfilter/xt_CLASSIFY.c | |||
@@ -62,7 +62,7 @@ static struct xt_target classify6_reg = { | |||
62 | }; | 62 | }; |
63 | 63 | ||
64 | 64 | ||
65 | static int __init init(void) | 65 | static int __init xt_classify_init(void) |
66 | { | 66 | { |
67 | int ret; | 67 | int ret; |
68 | 68 | ||
@@ -77,11 +77,11 @@ static int __init init(void) | |||
77 | return ret; | 77 | return ret; |
78 | } | 78 | } |
79 | 79 | ||
80 | static void __exit fini(void) | 80 | static void __exit xt_classify_fini(void) |
81 | { | 81 | { |
82 | xt_unregister_target(&classify_reg); | 82 | xt_unregister_target(&classify_reg); |
83 | xt_unregister_target(&classify6_reg); | 83 | xt_unregister_target(&classify6_reg); |
84 | } | 84 | } |
85 | 85 | ||
86 | module_init(init); | 86 | module_init(xt_classify_init); |
87 | module_exit(fini); | 87 | module_exit(xt_classify_fini); |
diff --git a/net/netfilter/xt_CONNMARK.c b/net/netfilter/xt_CONNMARK.c index 35448b8e6883..60c375d36f01 100644 --- a/net/netfilter/xt_CONNMARK.c +++ b/net/netfilter/xt_CONNMARK.c | |||
@@ -115,7 +115,7 @@ static struct xt_target connmark6_reg = { | |||
115 | .me = THIS_MODULE | 115 | .me = THIS_MODULE |
116 | }; | 116 | }; |
117 | 117 | ||
118 | static int __init init(void) | 118 | static int __init xt_connmark_init(void) |
119 | { | 119 | { |
120 | int ret; | 120 | int ret; |
121 | 121 | ||
@@ -132,11 +132,11 @@ static int __init init(void) | |||
132 | return ret; | 132 | return ret; |
133 | } | 133 | } |
134 | 134 | ||
135 | static void __exit fini(void) | 135 | static void __exit xt_connmark_fini(void) |
136 | { | 136 | { |
137 | xt_unregister_target(&connmark_reg); | 137 | xt_unregister_target(&connmark_reg); |
138 | xt_unregister_target(&connmark6_reg); | 138 | xt_unregister_target(&connmark6_reg); |
139 | } | 139 | } |
140 | 140 | ||
141 | module_init(init); | 141 | module_init(xt_connmark_init); |
142 | module_exit(fini); | 142 | module_exit(xt_connmark_fini); |
diff --git a/net/netfilter/xt_MARK.c b/net/netfilter/xt_MARK.c index 73bdd5c80e17..ee9c34edc76c 100644 --- a/net/netfilter/xt_MARK.c +++ b/net/netfilter/xt_MARK.c | |||
@@ -145,7 +145,7 @@ static struct xt_target ip6t_mark_reg_v0 = { | |||
145 | .revision = 0, | 145 | .revision = 0, |
146 | }; | 146 | }; |
147 | 147 | ||
148 | static int __init init(void) | 148 | static int __init xt_mark_init(void) |
149 | { | 149 | { |
150 | int err; | 150 | int err; |
151 | 151 | ||
@@ -166,12 +166,12 @@ static int __init init(void) | |||
166 | return err; | 166 | return err; |
167 | } | 167 | } |
168 | 168 | ||
169 | static void __exit fini(void) | 169 | static void __exit xt_mark_fini(void) |
170 | { | 170 | { |
171 | xt_unregister_target(&ipt_mark_reg_v0); | 171 | xt_unregister_target(&ipt_mark_reg_v0); |
172 | xt_unregister_target(&ipt_mark_reg_v1); | 172 | xt_unregister_target(&ipt_mark_reg_v1); |
173 | xt_unregister_target(&ip6t_mark_reg_v0); | 173 | xt_unregister_target(&ip6t_mark_reg_v0); |
174 | } | 174 | } |
175 | 175 | ||
176 | module_init(init); | 176 | module_init(xt_mark_init); |
177 | module_exit(fini); | 177 | module_exit(xt_mark_fini); |
diff --git a/net/netfilter/xt_NFQUEUE.c b/net/netfilter/xt_NFQUEUE.c index 2873e1c60f68..86ccceb61fdd 100644 --- a/net/netfilter/xt_NFQUEUE.c +++ b/net/netfilter/xt_NFQUEUE.c | |||
@@ -61,7 +61,7 @@ static struct xt_target arpt_NFQ_reg = { | |||
61 | .me = THIS_MODULE, | 61 | .me = THIS_MODULE, |
62 | }; | 62 | }; |
63 | 63 | ||
64 | static int __init init(void) | 64 | static int __init xt_nfqueue_init(void) |
65 | { | 65 | { |
66 | int ret; | 66 | int ret; |
67 | ret = xt_register_target(&ipt_NFQ_reg); | 67 | ret = xt_register_target(&ipt_NFQ_reg); |
@@ -83,12 +83,12 @@ out_ip: | |||
83 | return ret; | 83 | return ret; |
84 | } | 84 | } |
85 | 85 | ||
86 | static void __exit fini(void) | 86 | static void __exit xt_nfqueue_fini(void) |
87 | { | 87 | { |
88 | xt_unregister_target(&arpt_NFQ_reg); | 88 | xt_unregister_target(&arpt_NFQ_reg); |
89 | xt_unregister_target(&ip6t_NFQ_reg); | 89 | xt_unregister_target(&ip6t_NFQ_reg); |
90 | xt_unregister_target(&ipt_NFQ_reg); | 90 | xt_unregister_target(&ipt_NFQ_reg); |
91 | } | 91 | } |
92 | 92 | ||
93 | module_init(init); | 93 | module_init(xt_nfqueue_init); |
94 | module_exit(fini); | 94 | module_exit(xt_nfqueue_fini); |
diff --git a/net/netfilter/xt_NOTRACK.c b/net/netfilter/xt_NOTRACK.c index cf2ebd76fd6f..98f4b5363ce8 100644 --- a/net/netfilter/xt_NOTRACK.c +++ b/net/netfilter/xt_NOTRACK.c | |||
@@ -52,7 +52,7 @@ static struct xt_target notrack6_reg = { | |||
52 | .me = THIS_MODULE, | 52 | .me = THIS_MODULE, |
53 | }; | 53 | }; |
54 | 54 | ||
55 | static int __init init(void) | 55 | static int __init xt_notrack_init(void) |
56 | { | 56 | { |
57 | int ret; | 57 | int ret; |
58 | 58 | ||
@@ -67,11 +67,11 @@ static int __init init(void) | |||
67 | return ret; | 67 | return ret; |
68 | } | 68 | } |
69 | 69 | ||
70 | static void __exit fini(void) | 70 | static void __exit xt_notrack_fini(void) |
71 | { | 71 | { |
72 | xt_unregister_target(¬rack6_reg); | 72 | xt_unregister_target(¬rack6_reg); |
73 | xt_unregister_target(¬rack_reg); | 73 | xt_unregister_target(¬rack_reg); |
74 | } | 74 | } |
75 | 75 | ||
76 | module_init(init); | 76 | module_init(xt_notrack_init); |
77 | module_exit(fini); | 77 | module_exit(xt_notrack_fini); |
diff --git a/net/netfilter/xt_comment.c b/net/netfilter/xt_comment.c index 2637724b498d..197609cb06d7 100644 --- a/net/netfilter/xt_comment.c +++ b/net/netfilter/xt_comment.c | |||
@@ -45,7 +45,7 @@ static struct xt_match comment6_match = { | |||
45 | .me = THIS_MODULE | 45 | .me = THIS_MODULE |
46 | }; | 46 | }; |
47 | 47 | ||
48 | static int __init init(void) | 48 | static int __init xt_comment_init(void) |
49 | { | 49 | { |
50 | int ret; | 50 | int ret; |
51 | 51 | ||
@@ -60,11 +60,11 @@ static int __init init(void) | |||
60 | return ret; | 60 | return ret; |
61 | } | 61 | } |
62 | 62 | ||
63 | static void __exit fini(void) | 63 | static void __exit xt_comment_fini(void) |
64 | { | 64 | { |
65 | xt_unregister_match(&comment_match); | 65 | xt_unregister_match(&comment_match); |
66 | xt_unregister_match(&comment6_match); | 66 | xt_unregister_match(&comment6_match); |
67 | } | 67 | } |
68 | 68 | ||
69 | module_init(init); | 69 | module_init(xt_comment_init); |
70 | module_exit(fini); | 70 | module_exit(xt_comment_fini); |
diff --git a/net/netfilter/xt_connbytes.c b/net/netfilter/xt_connbytes.c index 4985f5ec58ca..1396fe2d07c1 100644 --- a/net/netfilter/xt_connbytes.c +++ b/net/netfilter/xt_connbytes.c | |||
@@ -160,7 +160,7 @@ static struct xt_match connbytes6_match = { | |||
160 | .me = THIS_MODULE | 160 | .me = THIS_MODULE |
161 | }; | 161 | }; |
162 | 162 | ||
163 | static int __init init(void) | 163 | static int __init xt_connbytes_init(void) |
164 | { | 164 | { |
165 | int ret; | 165 | int ret; |
166 | ret = xt_register_match(&connbytes_match); | 166 | ret = xt_register_match(&connbytes_match); |
@@ -173,11 +173,11 @@ static int __init init(void) | |||
173 | return ret; | 173 | return ret; |
174 | } | 174 | } |
175 | 175 | ||
176 | static void __exit fini(void) | 176 | static void __exit xt_connbytes_fini(void) |
177 | { | 177 | { |
178 | xt_unregister_match(&connbytes_match); | 178 | xt_unregister_match(&connbytes_match); |
179 | xt_unregister_match(&connbytes6_match); | 179 | xt_unregister_match(&connbytes6_match); |
180 | } | 180 | } |
181 | 181 | ||
182 | module_init(init); | 182 | module_init(xt_connbytes_init); |
183 | module_exit(fini); | 183 | module_exit(xt_connbytes_fini); |
diff --git a/net/netfilter/xt_connmark.c b/net/netfilter/xt_connmark.c index 7b16f1ee16b4..dc26a27cbcaf 100644 --- a/net/netfilter/xt_connmark.c +++ b/net/netfilter/xt_connmark.c | |||
@@ -102,7 +102,7 @@ static struct xt_match connmark6_match = { | |||
102 | .me = THIS_MODULE | 102 | .me = THIS_MODULE |
103 | }; | 103 | }; |
104 | 104 | ||
105 | static int __init init(void) | 105 | static int __init xt_connmark_init(void) |
106 | { | 106 | { |
107 | int ret; | 107 | int ret; |
108 | 108 | ||
@@ -118,11 +118,11 @@ static int __init init(void) | |||
118 | return ret; | 118 | return ret; |
119 | } | 119 | } |
120 | 120 | ||
121 | static void __exit fini(void) | 121 | static void __exit xt_connmark_fini(void) |
122 | { | 122 | { |
123 | xt_unregister_match(&connmark6_match); | 123 | xt_unregister_match(&connmark6_match); |
124 | xt_unregister_match(&connmark_match); | 124 | xt_unregister_match(&connmark_match); |
125 | } | 125 | } |
126 | 126 | ||
127 | module_init(init); | 127 | module_init(xt_connmark_init); |
128 | module_exit(fini); | 128 | module_exit(xt_connmark_fini); |
diff --git a/net/netfilter/xt_conntrack.c b/net/netfilter/xt_conntrack.c index 65a84809fd30..145489a4c3f2 100644 --- a/net/netfilter/xt_conntrack.c +++ b/net/netfilter/xt_conntrack.c | |||
@@ -239,7 +239,7 @@ static struct xt_match conntrack_match = { | |||
239 | .me = THIS_MODULE, | 239 | .me = THIS_MODULE, |
240 | }; | 240 | }; |
241 | 241 | ||
242 | static int __init init(void) | 242 | static int __init xt_conntrack_init(void) |
243 | { | 243 | { |
244 | int ret; | 244 | int ret; |
245 | need_conntrack(); | 245 | need_conntrack(); |
@@ -248,10 +248,10 @@ static int __init init(void) | |||
248 | return ret; | 248 | return ret; |
249 | } | 249 | } |
250 | 250 | ||
251 | static void __exit fini(void) | 251 | static void __exit xt_conntrack_fini(void) |
252 | { | 252 | { |
253 | xt_unregister_match(&conntrack_match); | 253 | xt_unregister_match(&conntrack_match); |
254 | } | 254 | } |
255 | 255 | ||
256 | module_init(init); | 256 | module_init(xt_conntrack_init); |
257 | module_exit(fini); | 257 | module_exit(xt_conntrack_fini); |
diff --git a/net/netfilter/xt_dccp.c b/net/netfilter/xt_dccp.c index 2f331decd151..dfb10b648e57 100644 --- a/net/netfilter/xt_dccp.c +++ b/net/netfilter/xt_dccp.c | |||
@@ -164,7 +164,7 @@ static struct xt_match dccp6_match = | |||
164 | }; | 164 | }; |
165 | 165 | ||
166 | 166 | ||
167 | static int __init init(void) | 167 | static int __init xt_dccp_init(void) |
168 | { | 168 | { |
169 | int ret; | 169 | int ret; |
170 | 170 | ||
@@ -191,12 +191,12 @@ out_kfree: | |||
191 | return ret; | 191 | return ret; |
192 | } | 192 | } |
193 | 193 | ||
194 | static void __exit fini(void) | 194 | static void __exit xt_dccp_fini(void) |
195 | { | 195 | { |
196 | xt_unregister_match(&dccp6_match); | 196 | xt_unregister_match(&dccp6_match); |
197 | xt_unregister_match(&dccp_match); | 197 | xt_unregister_match(&dccp_match); |
198 | kfree(dccp_optbuf); | 198 | kfree(dccp_optbuf); |
199 | } | 199 | } |
200 | 200 | ||
201 | module_init(init); | 201 | module_init(xt_dccp_init); |
202 | module_exit(fini); | 202 | module_exit(xt_dccp_fini); |
diff --git a/net/netfilter/xt_helper.c b/net/netfilter/xt_helper.c index 101f0005e987..799c2a43e3b9 100644 --- a/net/netfilter/xt_helper.c +++ b/net/netfilter/xt_helper.c | |||
@@ -182,7 +182,7 @@ static struct xt_match helper6_match = { | |||
182 | .me = THIS_MODULE, | 182 | .me = THIS_MODULE, |
183 | }; | 183 | }; |
184 | 184 | ||
185 | static int __init init(void) | 185 | static int __init xt_helper_init(void) |
186 | { | 186 | { |
187 | int ret; | 187 | int ret; |
188 | need_conntrack(); | 188 | need_conntrack(); |
@@ -198,12 +198,12 @@ static int __init init(void) | |||
198 | return ret; | 198 | return ret; |
199 | } | 199 | } |
200 | 200 | ||
201 | static void __exit fini(void) | 201 | static void __exit xt_helper_fini(void) |
202 | { | 202 | { |
203 | xt_unregister_match(&helper_match); | 203 | xt_unregister_match(&helper_match); |
204 | xt_unregister_match(&helper6_match); | 204 | xt_unregister_match(&helper6_match); |
205 | } | 205 | } |
206 | 206 | ||
207 | module_init(init); | 207 | module_init(xt_helper_init); |
208 | module_exit(fini); | 208 | module_exit(xt_helper_fini); |
209 | 209 | ||
diff --git a/net/netfilter/xt_length.c b/net/netfilter/xt_length.c index 38560caef757..109132c9a146 100644 --- a/net/netfilter/xt_length.c +++ b/net/netfilter/xt_length.c | |||
@@ -68,7 +68,7 @@ static struct xt_match length6_match = { | |||
68 | .me = THIS_MODULE, | 68 | .me = THIS_MODULE, |
69 | }; | 69 | }; |
70 | 70 | ||
71 | static int __init init(void) | 71 | static int __init xt_length_init(void) |
72 | { | 72 | { |
73 | int ret; | 73 | int ret; |
74 | ret = xt_register_match(&length_match); | 74 | ret = xt_register_match(&length_match); |
@@ -81,11 +81,11 @@ static int __init init(void) | |||
81 | return ret; | 81 | return ret; |
82 | } | 82 | } |
83 | 83 | ||
84 | static void __exit fini(void) | 84 | static void __exit xt_length_fini(void) |
85 | { | 85 | { |
86 | xt_unregister_match(&length_match); | 86 | xt_unregister_match(&length_match); |
87 | xt_unregister_match(&length6_match); | 87 | xt_unregister_match(&length6_match); |
88 | } | 88 | } |
89 | 89 | ||
90 | module_init(init); | 90 | module_init(xt_length_init); |
91 | module_exit(fini); | 91 | module_exit(xt_length_fini); |
diff --git a/net/netfilter/xt_limit.c b/net/netfilter/xt_limit.c index e91c1a444e77..ce7fdb7e4e07 100644 --- a/net/netfilter/xt_limit.c +++ b/net/netfilter/xt_limit.c | |||
@@ -153,7 +153,7 @@ static struct xt_match limit6_reg = { | |||
153 | .me = THIS_MODULE, | 153 | .me = THIS_MODULE, |
154 | }; | 154 | }; |
155 | 155 | ||
156 | static int __init init(void) | 156 | static int __init xt_limit_init(void) |
157 | { | 157 | { |
158 | int ret; | 158 | int ret; |
159 | 159 | ||
@@ -168,11 +168,11 @@ static int __init init(void) | |||
168 | return ret; | 168 | return ret; |
169 | } | 169 | } |
170 | 170 | ||
171 | static void __exit fini(void) | 171 | static void __exit xt_limit_fini(void) |
172 | { | 172 | { |
173 | xt_unregister_match(&ipt_limit_reg); | 173 | xt_unregister_match(&ipt_limit_reg); |
174 | xt_unregister_match(&limit6_reg); | 174 | xt_unregister_match(&limit6_reg); |
175 | } | 175 | } |
176 | 176 | ||
177 | module_init(init); | 177 | module_init(xt_limit_init); |
178 | module_exit(fini); | 178 | module_exit(xt_limit_fini); |
diff --git a/net/netfilter/xt_mac.c b/net/netfilter/xt_mac.c index f4defa28a6ec..356290ffe386 100644 --- a/net/netfilter/xt_mac.c +++ b/net/netfilter/xt_mac.c | |||
@@ -62,7 +62,7 @@ static struct xt_match mac6_match = { | |||
62 | .me = THIS_MODULE, | 62 | .me = THIS_MODULE, |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static int __init init(void) | 65 | static int __init xt_mac_init(void) |
66 | { | 66 | { |
67 | int ret; | 67 | int ret; |
68 | ret = xt_register_match(&mac_match); | 68 | ret = xt_register_match(&mac_match); |
@@ -76,11 +76,11 @@ static int __init init(void) | |||
76 | return ret; | 76 | return ret; |
77 | } | 77 | } |
78 | 78 | ||
79 | static void __exit fini(void) | 79 | static void __exit xt_mac_fini(void) |
80 | { | 80 | { |
81 | xt_unregister_match(&mac_match); | 81 | xt_unregister_match(&mac_match); |
82 | xt_unregister_match(&mac6_match); | 82 | xt_unregister_match(&mac6_match); |
83 | } | 83 | } |
84 | 84 | ||
85 | module_init(init); | 85 | module_init(xt_mac_init); |
86 | module_exit(fini); | 86 | module_exit(xt_mac_fini); |
diff --git a/net/netfilter/xt_mark.c b/net/netfilter/xt_mark.c index ce0badfeef9a..8b385a34886d 100644 --- a/net/netfilter/xt_mark.c +++ b/net/netfilter/xt_mark.c | |||
@@ -69,7 +69,7 @@ static struct xt_match mark6_match = { | |||
69 | .me = THIS_MODULE, | 69 | .me = THIS_MODULE, |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static int __init init(void) | 72 | static int __init xt_mark_init(void) |
73 | { | 73 | { |
74 | int ret; | 74 | int ret; |
75 | ret = xt_register_match(&mark_match); | 75 | ret = xt_register_match(&mark_match); |
@@ -83,11 +83,11 @@ static int __init init(void) | |||
83 | return ret; | 83 | return ret; |
84 | } | 84 | } |
85 | 85 | ||
86 | static void __exit fini(void) | 86 | static void __exit xt_mark_fini(void) |
87 | { | 87 | { |
88 | xt_unregister_match(&mark_match); | 88 | xt_unregister_match(&mark_match); |
89 | xt_unregister_match(&mark6_match); | 89 | xt_unregister_match(&mark6_match); |
90 | } | 90 | } |
91 | 91 | ||
92 | module_init(init); | 92 | module_init(xt_mark_init); |
93 | module_exit(fini); | 93 | module_exit(xt_mark_fini); |
diff --git a/net/netfilter/xt_physdev.c b/net/netfilter/xt_physdev.c index 089f4f7e8636..5fe4c9df17f5 100644 --- a/net/netfilter/xt_physdev.c +++ b/net/netfilter/xt_physdev.c | |||
@@ -134,7 +134,7 @@ static struct xt_match physdev6_match = { | |||
134 | .me = THIS_MODULE, | 134 | .me = THIS_MODULE, |
135 | }; | 135 | }; |
136 | 136 | ||
137 | static int __init init(void) | 137 | static int __init xt_physdev_init(void) |
138 | { | 138 | { |
139 | int ret; | 139 | int ret; |
140 | 140 | ||
@@ -149,11 +149,11 @@ static int __init init(void) | |||
149 | return ret; | 149 | return ret; |
150 | } | 150 | } |
151 | 151 | ||
152 | static void __exit fini(void) | 152 | static void __exit xt_physdev_fini(void) |
153 | { | 153 | { |
154 | xt_unregister_match(&physdev_match); | 154 | xt_unregister_match(&physdev_match); |
155 | xt_unregister_match(&physdev6_match); | 155 | xt_unregister_match(&physdev6_match); |
156 | } | 156 | } |
157 | 157 | ||
158 | module_init(init); | 158 | module_init(xt_physdev_init); |
159 | module_exit(fini); | 159 | module_exit(xt_physdev_fini); |
diff --git a/net/netfilter/xt_pkttype.c b/net/netfilter/xt_pkttype.c index 8b8bca988ac6..3ac703b5cb8f 100644 --- a/net/netfilter/xt_pkttype.c +++ b/net/netfilter/xt_pkttype.c | |||
@@ -49,7 +49,7 @@ static struct xt_match pkttype6_match = { | |||
49 | .me = THIS_MODULE, | 49 | .me = THIS_MODULE, |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static int __init init(void) | 52 | static int __init xt_pkttype_init(void) |
53 | { | 53 | { |
54 | int ret; | 54 | int ret; |
55 | ret = xt_register_match(&pkttype_match); | 55 | ret = xt_register_match(&pkttype_match); |
@@ -63,11 +63,11 @@ static int __init init(void) | |||
63 | return ret; | 63 | return ret; |
64 | } | 64 | } |
65 | 65 | ||
66 | static void __exit fini(void) | 66 | static void __exit xt_pkttype_fini(void) |
67 | { | 67 | { |
68 | xt_unregister_match(&pkttype_match); | 68 | xt_unregister_match(&pkttype_match); |
69 | xt_unregister_match(&pkttype6_match); | 69 | xt_unregister_match(&pkttype6_match); |
70 | } | 70 | } |
71 | 71 | ||
72 | module_init(init); | 72 | module_init(xt_pkttype_init); |
73 | module_exit(fini); | 73 | module_exit(xt_pkttype_fini); |
diff --git a/net/netfilter/xt_realm.c b/net/netfilter/xt_realm.c index 5e31a4a835bf..a80b7d132b65 100644 --- a/net/netfilter/xt_realm.c +++ b/net/netfilter/xt_realm.c | |||
@@ -49,15 +49,15 @@ static struct xt_match realm_match = { | |||
49 | .me = THIS_MODULE | 49 | .me = THIS_MODULE |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static int __init init(void) | 52 | static int __init xt_realm_init(void) |
53 | { | 53 | { |
54 | return xt_register_match(&realm_match); | 54 | return xt_register_match(&realm_match); |
55 | } | 55 | } |
56 | 56 | ||
57 | static void __exit fini(void) | 57 | static void __exit xt_realm_fini(void) |
58 | { | 58 | { |
59 | xt_unregister_match(&realm_match); | 59 | xt_unregister_match(&realm_match); |
60 | } | 60 | } |
61 | 61 | ||
62 | module_init(init); | 62 | module_init(xt_realm_init); |
63 | module_exit(fini); | 63 | module_exit(xt_realm_fini); |
diff --git a/net/netfilter/xt_sctp.c b/net/netfilter/xt_sctp.c index c6eb24a2fe13..34bd87259a09 100644 --- a/net/netfilter/xt_sctp.c +++ b/net/netfilter/xt_sctp.c | |||
@@ -200,7 +200,7 @@ static struct xt_match sctp6_match = { | |||
200 | .me = THIS_MODULE | 200 | .me = THIS_MODULE |
201 | }; | 201 | }; |
202 | 202 | ||
203 | static int __init init(void) | 203 | static int __init xt_sctp_init(void) |
204 | { | 204 | { |
205 | int ret; | 205 | int ret; |
206 | ret = xt_register_match(&sctp_match); | 206 | ret = xt_register_match(&sctp_match); |
@@ -214,11 +214,11 @@ static int __init init(void) | |||
214 | return ret; | 214 | return ret; |
215 | } | 215 | } |
216 | 216 | ||
217 | static void __exit fini(void) | 217 | static void __exit xt_sctp_fini(void) |
218 | { | 218 | { |
219 | xt_unregister_match(&sctp6_match); | 219 | xt_unregister_match(&sctp6_match); |
220 | xt_unregister_match(&sctp_match); | 220 | xt_unregister_match(&sctp_match); |
221 | } | 221 | } |
222 | 222 | ||
223 | module_init(init); | 223 | module_init(xt_sctp_init); |
224 | module_exit(fini); | 224 | module_exit(xt_sctp_fini); |
diff --git a/net/netfilter/xt_state.c b/net/netfilter/xt_state.c index e6c0be9d94d2..f9e304dc4504 100644 --- a/net/netfilter/xt_state.c +++ b/net/netfilter/xt_state.c | |||
@@ -89,7 +89,7 @@ static struct xt_match state6_match = { | |||
89 | .me = THIS_MODULE, | 89 | .me = THIS_MODULE, |
90 | }; | 90 | }; |
91 | 91 | ||
92 | static int __init init(void) | 92 | static int __init xt_state_init(void) |
93 | { | 93 | { |
94 | int ret; | 94 | int ret; |
95 | 95 | ||
@@ -106,11 +106,11 @@ static int __init init(void) | |||
106 | return ret; | 106 | return ret; |
107 | } | 107 | } |
108 | 108 | ||
109 | static void __exit fini(void) | 109 | static void __exit xt_state_fini(void) |
110 | { | 110 | { |
111 | xt_unregister_match(&state_match); | 111 | xt_unregister_match(&state_match); |
112 | xt_unregister_match(&state6_match); | 112 | xt_unregister_match(&state6_match); |
113 | } | 113 | } |
114 | 114 | ||
115 | module_init(init); | 115 | module_init(xt_state_init); |
116 | module_exit(fini); | 116 | module_exit(xt_state_fini); |
diff --git a/net/netfilter/xt_string.c b/net/netfilter/xt_string.c index 703d80fccacf..79d9ea6964ba 100644 --- a/net/netfilter/xt_string.c +++ b/net/netfilter/xt_string.c | |||
@@ -91,7 +91,7 @@ static struct xt_match string6_match = { | |||
91 | .me = THIS_MODULE | 91 | .me = THIS_MODULE |
92 | }; | 92 | }; |
93 | 93 | ||
94 | static int __init init(void) | 94 | static int __init xt_string_init(void) |
95 | { | 95 | { |
96 | int ret; | 96 | int ret; |
97 | 97 | ||
@@ -105,11 +105,11 @@ static int __init init(void) | |||
105 | return ret; | 105 | return ret; |
106 | } | 106 | } |
107 | 107 | ||
108 | static void __exit fini(void) | 108 | static void __exit xt_string_fini(void) |
109 | { | 109 | { |
110 | xt_unregister_match(&string_match); | 110 | xt_unregister_match(&string_match); |
111 | xt_unregister_match(&string6_match); | 111 | xt_unregister_match(&string6_match); |
112 | } | 112 | } |
113 | 113 | ||
114 | module_init(init); | 114 | module_init(xt_string_init); |
115 | module_exit(fini); | 115 | module_exit(xt_string_fini); |
diff --git a/net/netfilter/xt_tcpmss.c b/net/netfilter/xt_tcpmss.c index 70a8858ae3f1..cf7d335cadcd 100644 --- a/net/netfilter/xt_tcpmss.c +++ b/net/netfilter/xt_tcpmss.c | |||
@@ -112,7 +112,7 @@ static struct xt_match tcpmss6_match = { | |||
112 | }; | 112 | }; |
113 | 113 | ||
114 | 114 | ||
115 | static int __init init(void) | 115 | static int __init xt_tcpmss_init(void) |
116 | { | 116 | { |
117 | int ret; | 117 | int ret; |
118 | ret = xt_register_match(&tcpmss_match); | 118 | ret = xt_register_match(&tcpmss_match); |
@@ -126,11 +126,11 @@ static int __init init(void) | |||
126 | return ret; | 126 | return ret; |
127 | } | 127 | } |
128 | 128 | ||
129 | static void __exit fini(void) | 129 | static void __exit xt_tcpmss_fini(void) |
130 | { | 130 | { |
131 | xt_unregister_match(&tcpmss6_match); | 131 | xt_unregister_match(&tcpmss6_match); |
132 | xt_unregister_match(&tcpmss_match); | 132 | xt_unregister_match(&tcpmss_match); |
133 | } | 133 | } |
134 | 134 | ||
135 | module_init(init); | 135 | module_init(xt_tcpmss_init); |
136 | module_exit(fini); | 136 | module_exit(xt_tcpmss_fini); |
diff --git a/net/netfilter/xt_tcpudp.c b/net/netfilter/xt_tcpudp.c index 14a990eb666a..1b61dac9c873 100644 --- a/net/netfilter/xt_tcpudp.c +++ b/net/netfilter/xt_tcpudp.c | |||
@@ -238,7 +238,7 @@ static struct xt_match udp6_matchstruct = { | |||
238 | .me = THIS_MODULE, | 238 | .me = THIS_MODULE, |
239 | }; | 239 | }; |
240 | 240 | ||
241 | static int __init init(void) | 241 | static int __init xt_tcpudp_init(void) |
242 | { | 242 | { |
243 | int ret; | 243 | int ret; |
244 | ret = xt_register_match(&tcp_matchstruct); | 244 | ret = xt_register_match(&tcp_matchstruct); |
@@ -268,7 +268,7 @@ out_unreg_tcp: | |||
268 | return ret; | 268 | return ret; |
269 | } | 269 | } |
270 | 270 | ||
271 | static void __exit fini(void) | 271 | static void __exit xt_tcpudp_fini(void) |
272 | { | 272 | { |
273 | xt_unregister_match(&udp6_matchstruct); | 273 | xt_unregister_match(&udp6_matchstruct); |
274 | xt_unregister_match(&udp_matchstruct); | 274 | xt_unregister_match(&udp_matchstruct); |
@@ -276,5 +276,5 @@ static void __exit fini(void) | |||
276 | xt_unregister_match(&tcp_matchstruct); | 276 | xt_unregister_match(&tcp_matchstruct); |
277 | } | 277 | } |
278 | 278 | ||
279 | module_init(init); | 279 | module_init(xt_tcpudp_init); |
280 | module_exit(fini); | 280 | module_exit(xt_tcpudp_fini); |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index d00a9034cb5f..2a233ffcf618 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -123,7 +123,7 @@ static void netlink_destroy_callback(struct netlink_callback *cb); | |||
123 | static DEFINE_RWLOCK(nl_table_lock); | 123 | static DEFINE_RWLOCK(nl_table_lock); |
124 | static atomic_t nl_table_users = ATOMIC_INIT(0); | 124 | static atomic_t nl_table_users = ATOMIC_INIT(0); |
125 | 125 | ||
126 | static struct notifier_block *netlink_chain; | 126 | static ATOMIC_NOTIFIER_HEAD(netlink_chain); |
127 | 127 | ||
128 | static u32 netlink_group_mask(u32 group) | 128 | static u32 netlink_group_mask(u32 group) |
129 | { | 129 | { |
@@ -469,7 +469,8 @@ static int netlink_release(struct socket *sock) | |||
469 | .protocol = sk->sk_protocol, | 469 | .protocol = sk->sk_protocol, |
470 | .pid = nlk->pid, | 470 | .pid = nlk->pid, |
471 | }; | 471 | }; |
472 | notifier_call_chain(&netlink_chain, NETLINK_URELEASE, &n); | 472 | atomic_notifier_call_chain(&netlink_chain, |
473 | NETLINK_URELEASE, &n); | ||
473 | } | 474 | } |
474 | 475 | ||
475 | if (nlk->module) | 476 | if (nlk->module) |
@@ -1695,12 +1696,12 @@ static struct file_operations netlink_seq_fops = { | |||
1695 | 1696 | ||
1696 | int netlink_register_notifier(struct notifier_block *nb) | 1697 | int netlink_register_notifier(struct notifier_block *nb) |
1697 | { | 1698 | { |
1698 | return notifier_chain_register(&netlink_chain, nb); | 1699 | return atomic_notifier_chain_register(&netlink_chain, nb); |
1699 | } | 1700 | } |
1700 | 1701 | ||
1701 | int netlink_unregister_notifier(struct notifier_block *nb) | 1702 | int netlink_unregister_notifier(struct notifier_block *nb) |
1702 | { | 1703 | { |
1703 | return notifier_chain_unregister(&netlink_chain, nb); | 1704 | return atomic_notifier_chain_unregister(&netlink_chain, nb); |
1704 | } | 1705 | } |
1705 | 1706 | ||
1706 | static const struct proto_ops netlink_ops = { | 1707 | static const struct proto_ops netlink_ops = { |
diff --git a/net/nonet.c b/net/nonet.c index 1230f0ae832e..92e76640c7cd 100644 --- a/net/nonet.c +++ b/net/nonet.c | |||
@@ -19,7 +19,7 @@ static int sock_no_open(struct inode *irrelevant, struct file *dontcare) | |||
19 | return -ENXIO; | 19 | return -ENXIO; |
20 | } | 20 | } |
21 | 21 | ||
22 | struct file_operations bad_sock_fops = { | 22 | const struct file_operations bad_sock_fops = { |
23 | .owner = THIS_MODULE, | 23 | .owner = THIS_MODULE, |
24 | .open = sock_no_open, | 24 | .open = sock_no_open, |
25 | }; | 25 | }; |
diff --git a/net/socket.c b/net/socket.c index 5211ba270375..fcd77eac0ccf 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -539,7 +539,7 @@ static int sock_no_open(struct inode *irrelevant, struct file *dontcare) | |||
539 | return -ENXIO; | 539 | return -ENXIO; |
540 | } | 540 | } |
541 | 541 | ||
542 | struct file_operations bad_sock_fops = { | 542 | const struct file_operations bad_sock_fops = { |
543 | .owner = THIS_MODULE, | 543 | .owner = THIS_MODULE, |
544 | .open = sock_no_open, | 544 | .open = sock_no_open, |
545 | }; | 545 | }; |
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 23632d84d8d7..4d7eb9e704da 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -78,7 +78,8 @@ struct rsi { | |||
78 | 78 | ||
79 | static struct cache_head *rsi_table[RSI_HASHMAX]; | 79 | static struct cache_head *rsi_table[RSI_HASHMAX]; |
80 | static struct cache_detail rsi_cache; | 80 | static struct cache_detail rsi_cache; |
81 | static struct rsi *rsi_lookup(struct rsi *item, int set); | 81 | static struct rsi *rsi_update(struct rsi *new, struct rsi *old); |
82 | static struct rsi *rsi_lookup(struct rsi *item); | ||
82 | 83 | ||
83 | static void rsi_free(struct rsi *rsii) | 84 | static void rsi_free(struct rsi *rsii) |
84 | { | 85 | { |
@@ -88,13 +89,11 @@ static void rsi_free(struct rsi *rsii) | |||
88 | kfree(rsii->out_token.data); | 89 | kfree(rsii->out_token.data); |
89 | } | 90 | } |
90 | 91 | ||
91 | static void rsi_put(struct cache_head *item, struct cache_detail *cd) | 92 | static void rsi_put(struct kref *ref) |
92 | { | 93 | { |
93 | struct rsi *rsii = container_of(item, struct rsi, h); | 94 | struct rsi *rsii = container_of(ref, struct rsi, h.ref); |
94 | if (cache_put(item, cd)) { | 95 | rsi_free(rsii); |
95 | rsi_free(rsii); | 96 | kfree(rsii); |
96 | kfree(rsii); | ||
97 | } | ||
98 | } | 97 | } |
99 | 98 | ||
100 | static inline int rsi_hash(struct rsi *item) | 99 | static inline int rsi_hash(struct rsi *item) |
@@ -103,8 +102,10 @@ static inline int rsi_hash(struct rsi *item) | |||
103 | ^ hash_mem(item->in_token.data, item->in_token.len, RSI_HASHBITS); | 102 | ^ hash_mem(item->in_token.data, item->in_token.len, RSI_HASHBITS); |
104 | } | 103 | } |
105 | 104 | ||
106 | static inline int rsi_match(struct rsi *item, struct rsi *tmp) | 105 | static int rsi_match(struct cache_head *a, struct cache_head *b) |
107 | { | 106 | { |
107 | struct rsi *item = container_of(a, struct rsi, h); | ||
108 | struct rsi *tmp = container_of(b, struct rsi, h); | ||
108 | return netobj_equal(&item->in_handle, &tmp->in_handle) | 109 | return netobj_equal(&item->in_handle, &tmp->in_handle) |
109 | && netobj_equal(&item->in_token, &tmp->in_token); | 110 | && netobj_equal(&item->in_token, &tmp->in_token); |
110 | } | 111 | } |
@@ -125,8 +126,11 @@ static inline int dup_netobj(struct xdr_netobj *dst, struct xdr_netobj *src) | |||
125 | return dup_to_netobj(dst, src->data, src->len); | 126 | return dup_to_netobj(dst, src->data, src->len); |
126 | } | 127 | } |
127 | 128 | ||
128 | static inline void rsi_init(struct rsi *new, struct rsi *item) | 129 | static void rsi_init(struct cache_head *cnew, struct cache_head *citem) |
129 | { | 130 | { |
131 | struct rsi *new = container_of(cnew, struct rsi, h); | ||
132 | struct rsi *item = container_of(citem, struct rsi, h); | ||
133 | |||
130 | new->out_handle.data = NULL; | 134 | new->out_handle.data = NULL; |
131 | new->out_handle.len = 0; | 135 | new->out_handle.len = 0; |
132 | new->out_token.data = NULL; | 136 | new->out_token.data = NULL; |
@@ -141,8 +145,11 @@ static inline void rsi_init(struct rsi *new, struct rsi *item) | |||
141 | item->in_token.data = NULL; | 145 | item->in_token.data = NULL; |
142 | } | 146 | } |
143 | 147 | ||
144 | static inline void rsi_update(struct rsi *new, struct rsi *item) | 148 | static void update_rsi(struct cache_head *cnew, struct cache_head *citem) |
145 | { | 149 | { |
150 | struct rsi *new = container_of(cnew, struct rsi, h); | ||
151 | struct rsi *item = container_of(citem, struct rsi, h); | ||
152 | |||
146 | BUG_ON(new->out_handle.data || new->out_token.data); | 153 | BUG_ON(new->out_handle.data || new->out_token.data); |
147 | new->out_handle.len = item->out_handle.len; | 154 | new->out_handle.len = item->out_handle.len; |
148 | item->out_handle.len = 0; | 155 | item->out_handle.len = 0; |
@@ -157,6 +164,15 @@ static inline void rsi_update(struct rsi *new, struct rsi *item) | |||
157 | new->minor_status = item->minor_status; | 164 | new->minor_status = item->minor_status; |
158 | } | 165 | } |
159 | 166 | ||
167 | static struct cache_head *rsi_alloc(void) | ||
168 | { | ||
169 | struct rsi *rsii = kmalloc(sizeof(*rsii), GFP_KERNEL); | ||
170 | if (rsii) | ||
171 | return &rsii->h; | ||
172 | else | ||
173 | return NULL; | ||
174 | } | ||
175 | |||
160 | static void rsi_request(struct cache_detail *cd, | 176 | static void rsi_request(struct cache_detail *cd, |
161 | struct cache_head *h, | 177 | struct cache_head *h, |
162 | char **bpp, int *blen) | 178 | char **bpp, int *blen) |
@@ -198,6 +214,10 @@ static int rsi_parse(struct cache_detail *cd, | |||
198 | if (dup_to_netobj(&rsii.in_token, buf, len)) | 214 | if (dup_to_netobj(&rsii.in_token, buf, len)) |
199 | goto out; | 215 | goto out; |
200 | 216 | ||
217 | rsip = rsi_lookup(&rsii); | ||
218 | if (!rsip) | ||
219 | goto out; | ||
220 | |||
201 | rsii.h.flags = 0; | 221 | rsii.h.flags = 0; |
202 | /* expiry */ | 222 | /* expiry */ |
203 | expiry = get_expiry(&mesg); | 223 | expiry = get_expiry(&mesg); |
@@ -240,12 +260,14 @@ static int rsi_parse(struct cache_detail *cd, | |||
240 | goto out; | 260 | goto out; |
241 | } | 261 | } |
242 | rsii.h.expiry_time = expiry; | 262 | rsii.h.expiry_time = expiry; |
243 | rsip = rsi_lookup(&rsii, 1); | 263 | rsip = rsi_update(&rsii, rsip); |
244 | status = 0; | 264 | status = 0; |
245 | out: | 265 | out: |
246 | rsi_free(&rsii); | 266 | rsi_free(&rsii); |
247 | if (rsip) | 267 | if (rsip) |
248 | rsi_put(&rsip->h, &rsi_cache); | 268 | cache_put(&rsip->h, &rsi_cache); |
269 | else | ||
270 | status = -ENOMEM; | ||
249 | return status; | 271 | return status; |
250 | } | 272 | } |
251 | 273 | ||
@@ -257,9 +279,37 @@ static struct cache_detail rsi_cache = { | |||
257 | .cache_put = rsi_put, | 279 | .cache_put = rsi_put, |
258 | .cache_request = rsi_request, | 280 | .cache_request = rsi_request, |
259 | .cache_parse = rsi_parse, | 281 | .cache_parse = rsi_parse, |
282 | .match = rsi_match, | ||
283 | .init = rsi_init, | ||
284 | .update = update_rsi, | ||
285 | .alloc = rsi_alloc, | ||
260 | }; | 286 | }; |
261 | 287 | ||
262 | static DefineSimpleCacheLookup(rsi, 0) | 288 | static struct rsi *rsi_lookup(struct rsi *item) |
289 | { | ||
290 | struct cache_head *ch; | ||
291 | int hash = rsi_hash(item); | ||
292 | |||
293 | ch = sunrpc_cache_lookup(&rsi_cache, &item->h, hash); | ||
294 | if (ch) | ||
295 | return container_of(ch, struct rsi, h); | ||
296 | else | ||
297 | return NULL; | ||
298 | } | ||
299 | |||
300 | static struct rsi *rsi_update(struct rsi *new, struct rsi *old) | ||
301 | { | ||
302 | struct cache_head *ch; | ||
303 | int hash = rsi_hash(new); | ||
304 | |||
305 | ch = sunrpc_cache_update(&rsi_cache, &new->h, | ||
306 | &old->h, hash); | ||
307 | if (ch) | ||
308 | return container_of(ch, struct rsi, h); | ||
309 | else | ||
310 | return NULL; | ||
311 | } | ||
312 | |||
263 | 313 | ||
264 | /* | 314 | /* |
265 | * The rpcsec_context cache is used to store a context that is | 315 | * The rpcsec_context cache is used to store a context that is |
@@ -293,7 +343,8 @@ struct rsc { | |||
293 | 343 | ||
294 | static struct cache_head *rsc_table[RSC_HASHMAX]; | 344 | static struct cache_head *rsc_table[RSC_HASHMAX]; |
295 | static struct cache_detail rsc_cache; | 345 | static struct cache_detail rsc_cache; |
296 | static struct rsc *rsc_lookup(struct rsc *item, int set); | 346 | static struct rsc *rsc_update(struct rsc *new, struct rsc *old); |
347 | static struct rsc *rsc_lookup(struct rsc *item); | ||
297 | 348 | ||
298 | static void rsc_free(struct rsc *rsci) | 349 | static void rsc_free(struct rsc *rsci) |
299 | { | 350 | { |
@@ -304,14 +355,12 @@ static void rsc_free(struct rsc *rsci) | |||
304 | put_group_info(rsci->cred.cr_group_info); | 355 | put_group_info(rsci->cred.cr_group_info); |
305 | } | 356 | } |
306 | 357 | ||
307 | static void rsc_put(struct cache_head *item, struct cache_detail *cd) | 358 | static void rsc_put(struct kref *ref) |
308 | { | 359 | { |
309 | struct rsc *rsci = container_of(item, struct rsc, h); | 360 | struct rsc *rsci = container_of(ref, struct rsc, h.ref); |
310 | 361 | ||
311 | if (cache_put(item, cd)) { | 362 | rsc_free(rsci); |
312 | rsc_free(rsci); | 363 | kfree(rsci); |
313 | kfree(rsci); | ||
314 | } | ||
315 | } | 364 | } |
316 | 365 | ||
317 | static inline int | 366 | static inline int |
@@ -320,15 +369,21 @@ rsc_hash(struct rsc *rsci) | |||
320 | return hash_mem(rsci->handle.data, rsci->handle.len, RSC_HASHBITS); | 369 | return hash_mem(rsci->handle.data, rsci->handle.len, RSC_HASHBITS); |
321 | } | 370 | } |
322 | 371 | ||
323 | static inline int | 372 | static int |
324 | rsc_match(struct rsc *new, struct rsc *tmp) | 373 | rsc_match(struct cache_head *a, struct cache_head *b) |
325 | { | 374 | { |
375 | struct rsc *new = container_of(a, struct rsc, h); | ||
376 | struct rsc *tmp = container_of(b, struct rsc, h); | ||
377 | |||
326 | return netobj_equal(&new->handle, &tmp->handle); | 378 | return netobj_equal(&new->handle, &tmp->handle); |
327 | } | 379 | } |
328 | 380 | ||
329 | static inline void | 381 | static void |
330 | rsc_init(struct rsc *new, struct rsc *tmp) | 382 | rsc_init(struct cache_head *cnew, struct cache_head *ctmp) |
331 | { | 383 | { |
384 | struct rsc *new = container_of(cnew, struct rsc, h); | ||
385 | struct rsc *tmp = container_of(ctmp, struct rsc, h); | ||
386 | |||
332 | new->handle.len = tmp->handle.len; | 387 | new->handle.len = tmp->handle.len; |
333 | tmp->handle.len = 0; | 388 | tmp->handle.len = 0; |
334 | new->handle.data = tmp->handle.data; | 389 | new->handle.data = tmp->handle.data; |
@@ -337,9 +392,12 @@ rsc_init(struct rsc *new, struct rsc *tmp) | |||
337 | new->cred.cr_group_info = NULL; | 392 | new->cred.cr_group_info = NULL; |
338 | } | 393 | } |
339 | 394 | ||
340 | static inline void | 395 | static void |
341 | rsc_update(struct rsc *new, struct rsc *tmp) | 396 | update_rsc(struct cache_head *cnew, struct cache_head *ctmp) |
342 | { | 397 | { |
398 | struct rsc *new = container_of(cnew, struct rsc, h); | ||
399 | struct rsc *tmp = container_of(ctmp, struct rsc, h); | ||
400 | |||
343 | new->mechctx = tmp->mechctx; | 401 | new->mechctx = tmp->mechctx; |
344 | tmp->mechctx = NULL; | 402 | tmp->mechctx = NULL; |
345 | memset(&new->seqdata, 0, sizeof(new->seqdata)); | 403 | memset(&new->seqdata, 0, sizeof(new->seqdata)); |
@@ -348,6 +406,16 @@ rsc_update(struct rsc *new, struct rsc *tmp) | |||
348 | tmp->cred.cr_group_info = NULL; | 406 | tmp->cred.cr_group_info = NULL; |
349 | } | 407 | } |
350 | 408 | ||
409 | static struct cache_head * | ||
410 | rsc_alloc(void) | ||
411 | { | ||
412 | struct rsc *rsci = kmalloc(sizeof(*rsci), GFP_KERNEL); | ||
413 | if (rsci) | ||
414 | return &rsci->h; | ||
415 | else | ||
416 | return NULL; | ||
417 | } | ||
418 | |||
351 | static int rsc_parse(struct cache_detail *cd, | 419 | static int rsc_parse(struct cache_detail *cd, |
352 | char *mesg, int mlen) | 420 | char *mesg, int mlen) |
353 | { | 421 | { |
@@ -373,6 +441,10 @@ static int rsc_parse(struct cache_detail *cd, | |||
373 | if (expiry == 0) | 441 | if (expiry == 0) |
374 | goto out; | 442 | goto out; |
375 | 443 | ||
444 | rscp = rsc_lookup(&rsci); | ||
445 | if (!rscp) | ||
446 | goto out; | ||
447 | |||
376 | /* uid, or NEGATIVE */ | 448 | /* uid, or NEGATIVE */ |
377 | rv = get_int(&mesg, &rsci.cred.cr_uid); | 449 | rv = get_int(&mesg, &rsci.cred.cr_uid); |
378 | if (rv == -EINVAL) | 450 | if (rv == -EINVAL) |
@@ -428,12 +500,14 @@ static int rsc_parse(struct cache_detail *cd, | |||
428 | gss_mech_put(gm); | 500 | gss_mech_put(gm); |
429 | } | 501 | } |
430 | rsci.h.expiry_time = expiry; | 502 | rsci.h.expiry_time = expiry; |
431 | rscp = rsc_lookup(&rsci, 1); | 503 | rscp = rsc_update(&rsci, rscp); |
432 | status = 0; | 504 | status = 0; |
433 | out: | 505 | out: |
434 | rsc_free(&rsci); | 506 | rsc_free(&rsci); |
435 | if (rscp) | 507 | if (rscp) |
436 | rsc_put(&rscp->h, &rsc_cache); | 508 | cache_put(&rscp->h, &rsc_cache); |
509 | else | ||
510 | status = -ENOMEM; | ||
437 | return status; | 511 | return status; |
438 | } | 512 | } |
439 | 513 | ||
@@ -444,9 +518,37 @@ static struct cache_detail rsc_cache = { | |||
444 | .name = "auth.rpcsec.context", | 518 | .name = "auth.rpcsec.context", |
445 | .cache_put = rsc_put, | 519 | .cache_put = rsc_put, |
446 | .cache_parse = rsc_parse, | 520 | .cache_parse = rsc_parse, |
521 | .match = rsc_match, | ||
522 | .init = rsc_init, | ||
523 | .update = update_rsc, | ||
524 | .alloc = rsc_alloc, | ||
447 | }; | 525 | }; |
448 | 526 | ||
449 | static DefineSimpleCacheLookup(rsc, 0); | 527 | static struct rsc *rsc_lookup(struct rsc *item) |
528 | { | ||
529 | struct cache_head *ch; | ||
530 | int hash = rsc_hash(item); | ||
531 | |||
532 | ch = sunrpc_cache_lookup(&rsc_cache, &item->h, hash); | ||
533 | if (ch) | ||
534 | return container_of(ch, struct rsc, h); | ||
535 | else | ||
536 | return NULL; | ||
537 | } | ||
538 | |||
539 | static struct rsc *rsc_update(struct rsc *new, struct rsc *old) | ||
540 | { | ||
541 | struct cache_head *ch; | ||
542 | int hash = rsc_hash(new); | ||
543 | |||
544 | ch = sunrpc_cache_update(&rsc_cache, &new->h, | ||
545 | &old->h, hash); | ||
546 | if (ch) | ||
547 | return container_of(ch, struct rsc, h); | ||
548 | else | ||
549 | return NULL; | ||
550 | } | ||
551 | |||
450 | 552 | ||
451 | static struct rsc * | 553 | static struct rsc * |
452 | gss_svc_searchbyctx(struct xdr_netobj *handle) | 554 | gss_svc_searchbyctx(struct xdr_netobj *handle) |
@@ -457,7 +559,7 @@ gss_svc_searchbyctx(struct xdr_netobj *handle) | |||
457 | memset(&rsci, 0, sizeof(rsci)); | 559 | memset(&rsci, 0, sizeof(rsci)); |
458 | if (dup_to_netobj(&rsci.handle, handle->data, handle->len)) | 560 | if (dup_to_netobj(&rsci.handle, handle->data, handle->len)) |
459 | return NULL; | 561 | return NULL; |
460 | found = rsc_lookup(&rsci, 0); | 562 | found = rsc_lookup(&rsci); |
461 | rsc_free(&rsci); | 563 | rsc_free(&rsci); |
462 | if (!found) | 564 | if (!found) |
463 | return NULL; | 565 | return NULL; |
@@ -645,6 +747,8 @@ find_gss_auth_domain(struct gss_ctx *ctx, u32 svc) | |||
645 | return auth_domain_find(name); | 747 | return auth_domain_find(name); |
646 | } | 748 | } |
647 | 749 | ||
750 | static struct auth_ops svcauthops_gss; | ||
751 | |||
648 | int | 752 | int |
649 | svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name) | 753 | svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name) |
650 | { | 754 | { |
@@ -655,20 +759,18 @@ svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name) | |||
655 | new = kmalloc(sizeof(*new), GFP_KERNEL); | 759 | new = kmalloc(sizeof(*new), GFP_KERNEL); |
656 | if (!new) | 760 | if (!new) |
657 | goto out; | 761 | goto out; |
658 | cache_init(&new->h.h); | 762 | kref_init(&new->h.ref); |
659 | new->h.name = kmalloc(strlen(name) + 1, GFP_KERNEL); | 763 | new->h.name = kmalloc(strlen(name) + 1, GFP_KERNEL); |
660 | if (!new->h.name) | 764 | if (!new->h.name) |
661 | goto out_free_dom; | 765 | goto out_free_dom; |
662 | strcpy(new->h.name, name); | 766 | strcpy(new->h.name, name); |
663 | new->h.flavour = RPC_AUTH_GSS; | 767 | new->h.flavour = &svcauthops_gss; |
664 | new->pseudoflavor = pseudoflavor; | 768 | new->pseudoflavor = pseudoflavor; |
665 | new->h.h.expiry_time = NEVER; | ||
666 | 769 | ||
667 | test = auth_domain_lookup(&new->h, 1); | 770 | test = auth_domain_lookup(name, &new->h); |
668 | if (test == &new->h) { | 771 | if (test != &new->h) { /* XXX Duplicate registration? */ |
669 | BUG_ON(atomic_dec_and_test(&new->h.h.refcnt)); | ||
670 | } else { /* XXX Duplicate registration? */ | ||
671 | auth_domain_put(&new->h); | 772 | auth_domain_put(&new->h); |
773 | /* dangling ref-count... */ | ||
672 | goto out; | 774 | goto out; |
673 | } | 775 | } |
674 | return 0; | 776 | return 0; |
@@ -895,7 +997,7 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
895 | goto drop; | 997 | goto drop; |
896 | } | 998 | } |
897 | 999 | ||
898 | rsip = rsi_lookup(&rsikey, 0); | 1000 | rsip = rsi_lookup(&rsikey); |
899 | rsi_free(&rsikey); | 1001 | rsi_free(&rsikey); |
900 | if (!rsip) { | 1002 | if (!rsip) { |
901 | goto drop; | 1003 | goto drop; |
@@ -970,7 +1072,7 @@ drop: | |||
970 | ret = SVC_DROP; | 1072 | ret = SVC_DROP; |
971 | out: | 1073 | out: |
972 | if (rsci) | 1074 | if (rsci) |
973 | rsc_put(&rsci->h, &rsc_cache); | 1075 | cache_put(&rsci->h, &rsc_cache); |
974 | return ret; | 1076 | return ret; |
975 | } | 1077 | } |
976 | 1078 | ||
@@ -1062,7 +1164,7 @@ out_err: | |||
1062 | put_group_info(rqstp->rq_cred.cr_group_info); | 1164 | put_group_info(rqstp->rq_cred.cr_group_info); |
1063 | rqstp->rq_cred.cr_group_info = NULL; | 1165 | rqstp->rq_cred.cr_group_info = NULL; |
1064 | if (gsd->rsci) | 1166 | if (gsd->rsci) |
1065 | rsc_put(&gsd->rsci->h, &rsc_cache); | 1167 | cache_put(&gsd->rsci->h, &rsc_cache); |
1066 | gsd->rsci = NULL; | 1168 | gsd->rsci = NULL; |
1067 | 1169 | ||
1068 | return stat; | 1170 | return stat; |
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 0acccfeeb284..3ac4193a78ed 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -37,16 +37,138 @@ | |||
37 | static void cache_defer_req(struct cache_req *req, struct cache_head *item); | 37 | static void cache_defer_req(struct cache_req *req, struct cache_head *item); |
38 | static void cache_revisit_request(struct cache_head *item); | 38 | static void cache_revisit_request(struct cache_head *item); |
39 | 39 | ||
40 | void cache_init(struct cache_head *h) | 40 | static void cache_init(struct cache_head *h) |
41 | { | 41 | { |
42 | time_t now = get_seconds(); | 42 | time_t now = get_seconds(); |
43 | h->next = NULL; | 43 | h->next = NULL; |
44 | h->flags = 0; | 44 | h->flags = 0; |
45 | atomic_set(&h->refcnt, 1); | 45 | kref_init(&h->ref); |
46 | h->expiry_time = now + CACHE_NEW_EXPIRY; | 46 | h->expiry_time = now + CACHE_NEW_EXPIRY; |
47 | h->last_refresh = now; | 47 | h->last_refresh = now; |
48 | } | 48 | } |
49 | 49 | ||
50 | struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail, | ||
51 | struct cache_head *key, int hash) | ||
52 | { | ||
53 | struct cache_head **head, **hp; | ||
54 | struct cache_head *new = NULL; | ||
55 | |||
56 | head = &detail->hash_table[hash]; | ||
57 | |||
58 | read_lock(&detail->hash_lock); | ||
59 | |||
60 | for (hp=head; *hp != NULL ; hp = &(*hp)->next) { | ||
61 | struct cache_head *tmp = *hp; | ||
62 | if (detail->match(tmp, key)) { | ||
63 | cache_get(tmp); | ||
64 | read_unlock(&detail->hash_lock); | ||
65 | return tmp; | ||
66 | } | ||
67 | } | ||
68 | read_unlock(&detail->hash_lock); | ||
69 | /* Didn't find anything, insert an empty entry */ | ||
70 | |||
71 | new = detail->alloc(); | ||
72 | if (!new) | ||
73 | return NULL; | ||
74 | cache_init(new); | ||
75 | |||
76 | write_lock(&detail->hash_lock); | ||
77 | |||
78 | /* check if entry appeared while we slept */ | ||
79 | for (hp=head; *hp != NULL ; hp = &(*hp)->next) { | ||
80 | struct cache_head *tmp = *hp; | ||
81 | if (detail->match(tmp, key)) { | ||
82 | cache_get(tmp); | ||
83 | write_unlock(&detail->hash_lock); | ||
84 | cache_put(new, detail); | ||
85 | return tmp; | ||
86 | } | ||
87 | } | ||
88 | detail->init(new, key); | ||
89 | new->next = *head; | ||
90 | *head = new; | ||
91 | detail->entries++; | ||
92 | cache_get(new); | ||
93 | write_unlock(&detail->hash_lock); | ||
94 | |||
95 | return new; | ||
96 | } | ||
97 | EXPORT_SYMBOL(sunrpc_cache_lookup); | ||
98 | |||
99 | |||
100 | static void queue_loose(struct cache_detail *detail, struct cache_head *ch); | ||
101 | |||
102 | static int cache_fresh_locked(struct cache_head *head, time_t expiry) | ||
103 | { | ||
104 | head->expiry_time = expiry; | ||
105 | head->last_refresh = get_seconds(); | ||
106 | return !test_and_set_bit(CACHE_VALID, &head->flags); | ||
107 | } | ||
108 | |||
109 | static void cache_fresh_unlocked(struct cache_head *head, | ||
110 | struct cache_detail *detail, int new) | ||
111 | { | ||
112 | if (new) | ||
113 | cache_revisit_request(head); | ||
114 | if (test_and_clear_bit(CACHE_PENDING, &head->flags)) { | ||
115 | cache_revisit_request(head); | ||
116 | queue_loose(detail, head); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | struct cache_head *sunrpc_cache_update(struct cache_detail *detail, | ||
121 | struct cache_head *new, struct cache_head *old, int hash) | ||
122 | { | ||
123 | /* The 'old' entry is to be replaced by 'new'. | ||
124 | * If 'old' is not VALID, we update it directly, | ||
125 | * otherwise we need to replace it | ||
126 | */ | ||
127 | struct cache_head **head; | ||
128 | struct cache_head *tmp; | ||
129 | int is_new; | ||
130 | |||
131 | if (!test_bit(CACHE_VALID, &old->flags)) { | ||
132 | write_lock(&detail->hash_lock); | ||
133 | if (!test_bit(CACHE_VALID, &old->flags)) { | ||
134 | if (test_bit(CACHE_NEGATIVE, &new->flags)) | ||
135 | set_bit(CACHE_NEGATIVE, &old->flags); | ||
136 | else | ||
137 | detail->update(old, new); | ||
138 | is_new = cache_fresh_locked(old, new->expiry_time); | ||
139 | write_unlock(&detail->hash_lock); | ||
140 | cache_fresh_unlocked(old, detail, is_new); | ||
141 | return old; | ||
142 | } | ||
143 | write_unlock(&detail->hash_lock); | ||
144 | } | ||
145 | /* We need to insert a new entry */ | ||
146 | tmp = detail->alloc(); | ||
147 | if (!tmp) { | ||
148 | cache_put(old, detail); | ||
149 | return NULL; | ||
150 | } | ||
151 | cache_init(tmp); | ||
152 | detail->init(tmp, old); | ||
153 | head = &detail->hash_table[hash]; | ||
154 | |||
155 | write_lock(&detail->hash_lock); | ||
156 | if (test_bit(CACHE_NEGATIVE, &new->flags)) | ||
157 | set_bit(CACHE_NEGATIVE, &tmp->flags); | ||
158 | else | ||
159 | detail->update(tmp, new); | ||
160 | tmp->next = *head; | ||
161 | *head = tmp; | ||
162 | cache_get(tmp); | ||
163 | is_new = cache_fresh_locked(tmp, new->expiry_time); | ||
164 | cache_fresh_locked(old, 0); | ||
165 | write_unlock(&detail->hash_lock); | ||
166 | cache_fresh_unlocked(tmp, detail, is_new); | ||
167 | cache_fresh_unlocked(old, detail, 0); | ||
168 | cache_put(old, detail); | ||
169 | return tmp; | ||
170 | } | ||
171 | EXPORT_SYMBOL(sunrpc_cache_update); | ||
50 | 172 | ||
51 | static int cache_make_upcall(struct cache_detail *detail, struct cache_head *h); | 173 | static int cache_make_upcall(struct cache_detail *detail, struct cache_head *h); |
52 | /* | 174 | /* |
@@ -94,7 +216,8 @@ int cache_check(struct cache_detail *detail, | |||
94 | clear_bit(CACHE_PENDING, &h->flags); | 216 | clear_bit(CACHE_PENDING, &h->flags); |
95 | if (rv == -EAGAIN) { | 217 | if (rv == -EAGAIN) { |
96 | set_bit(CACHE_NEGATIVE, &h->flags); | 218 | set_bit(CACHE_NEGATIVE, &h->flags); |
97 | cache_fresh(detail, h, get_seconds()+CACHE_NEW_EXPIRY); | 219 | cache_fresh_unlocked(h, detail, |
220 | cache_fresh_locked(h, get_seconds()+CACHE_NEW_EXPIRY)); | ||
98 | rv = -ENOENT; | 221 | rv = -ENOENT; |
99 | } | 222 | } |
100 | break; | 223 | break; |
@@ -110,25 +233,11 @@ int cache_check(struct cache_detail *detail, | |||
110 | if (rv == -EAGAIN) | 233 | if (rv == -EAGAIN) |
111 | cache_defer_req(rqstp, h); | 234 | cache_defer_req(rqstp, h); |
112 | 235 | ||
113 | if (rv && h) | 236 | if (rv) |
114 | detail->cache_put(h, detail); | 237 | cache_put(h, detail); |
115 | return rv; | 238 | return rv; |
116 | } | 239 | } |
117 | 240 | ||
118 | static void queue_loose(struct cache_detail *detail, struct cache_head *ch); | ||
119 | |||
120 | void cache_fresh(struct cache_detail *detail, | ||
121 | struct cache_head *head, time_t expiry) | ||
122 | { | ||
123 | |||
124 | head->expiry_time = expiry; | ||
125 | head->last_refresh = get_seconds(); | ||
126 | if (!test_and_set_bit(CACHE_VALID, &head->flags)) | ||
127 | cache_revisit_request(head); | ||
128 | if (test_and_clear_bit(CACHE_PENDING, &head->flags)) | ||
129 | queue_loose(detail, head); | ||
130 | } | ||
131 | |||
132 | /* | 241 | /* |
133 | * caches need to be periodically cleaned. | 242 | * caches need to be periodically cleaned. |
134 | * For this we maintain a list of cache_detail and | 243 | * For this we maintain a list of cache_detail and |
@@ -322,7 +431,7 @@ static int cache_clean(void) | |||
322 | if (test_and_clear_bit(CACHE_PENDING, &ch->flags)) | 431 | if (test_and_clear_bit(CACHE_PENDING, &ch->flags)) |
323 | queue_loose(current_detail, ch); | 432 | queue_loose(current_detail, ch); |
324 | 433 | ||
325 | if (atomic_read(&ch->refcnt) == 1) | 434 | if (atomic_read(&ch->ref.refcount) == 1) |
326 | break; | 435 | break; |
327 | } | 436 | } |
328 | if (ch) { | 437 | if (ch) { |
@@ -337,7 +446,7 @@ static int cache_clean(void) | |||
337 | current_index ++; | 446 | current_index ++; |
338 | spin_unlock(&cache_list_lock); | 447 | spin_unlock(&cache_list_lock); |
339 | if (ch) | 448 | if (ch) |
340 | d->cache_put(ch, d); | 449 | cache_put(ch, d); |
341 | } else | 450 | } else |
342 | spin_unlock(&cache_list_lock); | 451 | spin_unlock(&cache_list_lock); |
343 | 452 | ||
@@ -453,7 +562,7 @@ static void cache_defer_req(struct cache_req *req, struct cache_head *item) | |||
453 | /* there was one too many */ | 562 | /* there was one too many */ |
454 | dreq->revisit(dreq, 1); | 563 | dreq->revisit(dreq, 1); |
455 | } | 564 | } |
456 | if (test_bit(CACHE_VALID, &item->flags)) { | 565 | if (!test_bit(CACHE_PENDING, &item->flags)) { |
457 | /* must have just been validated... */ | 566 | /* must have just been validated... */ |
458 | cache_revisit_request(item); | 567 | cache_revisit_request(item); |
459 | } | 568 | } |
@@ -614,7 +723,7 @@ cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) | |||
614 | !test_bit(CACHE_PENDING, &rq->item->flags)) { | 723 | !test_bit(CACHE_PENDING, &rq->item->flags)) { |
615 | list_del(&rq->q.list); | 724 | list_del(&rq->q.list); |
616 | spin_unlock(&queue_lock); | 725 | spin_unlock(&queue_lock); |
617 | cd->cache_put(rq->item, cd); | 726 | cache_put(rq->item, cd); |
618 | kfree(rq->buf); | 727 | kfree(rq->buf); |
619 | kfree(rq); | 728 | kfree(rq); |
620 | } else | 729 | } else |
@@ -794,10 +903,10 @@ static void queue_loose(struct cache_detail *detail, struct cache_head *ch) | |||
794 | if (cr->item != ch) | 903 | if (cr->item != ch) |
795 | continue; | 904 | continue; |
796 | if (cr->readers != 0) | 905 | if (cr->readers != 0) |
797 | break; | 906 | continue; |
798 | list_del(&cr->q.list); | 907 | list_del(&cr->q.list); |
799 | spin_unlock(&queue_lock); | 908 | spin_unlock(&queue_lock); |
800 | detail->cache_put(cr->item, detail); | 909 | cache_put(cr->item, detail); |
801 | kfree(cr->buf); | 910 | kfree(cr->buf); |
802 | kfree(cr); | 911 | kfree(cr); |
803 | return; | 912 | return; |
@@ -1082,8 +1191,8 @@ static int c_show(struct seq_file *m, void *p) | |||
1082 | return cd->cache_show(m, cd, NULL); | 1191 | return cd->cache_show(m, cd, NULL); |
1083 | 1192 | ||
1084 | ifdebug(CACHE) | 1193 | ifdebug(CACHE) |
1085 | seq_printf(m, "# expiry=%ld refcnt=%d\n", | 1194 | seq_printf(m, "# expiry=%ld refcnt=%d flags=%lx\n", |
1086 | cp->expiry_time, atomic_read(&cp->refcnt)); | 1195 | cp->expiry_time, atomic_read(&cp->ref.refcount), cp->flags); |
1087 | cache_get(cp); | 1196 | cache_get(cp); |
1088 | if (cache_check(cd, cp, NULL)) | 1197 | if (cache_check(cd, cp, NULL)) |
1089 | /* cache_check does a cache_put on failure */ | 1198 | /* cache_check does a cache_put on failure */ |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index aa4158be9900..cc673dd8433f 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -395,7 +395,7 @@ enum { | |||
395 | */ | 395 | */ |
396 | struct rpc_filelist { | 396 | struct rpc_filelist { |
397 | char *name; | 397 | char *name; |
398 | struct file_operations *i_fop; | 398 | const struct file_operations *i_fop; |
399 | int mode; | 399 | int mode; |
400 | }; | 400 | }; |
401 | 401 | ||
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 790941e8af4d..dea529666d69 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c | |||
@@ -225,7 +225,7 @@ EXPORT_SYMBOL(rpc_print_iostats); | |||
225 | * Register/unregister RPC proc files | 225 | * Register/unregister RPC proc files |
226 | */ | 226 | */ |
227 | static inline struct proc_dir_entry * | 227 | static inline struct proc_dir_entry * |
228 | do_register(const char *name, void *data, struct file_operations *fops) | 228 | do_register(const char *name, void *data, const struct file_operations *fops) |
229 | { | 229 | { |
230 | struct proc_dir_entry *ent; | 230 | struct proc_dir_entry *ent; |
231 | 231 | ||
@@ -253,7 +253,7 @@ rpc_proc_unregister(const char *name) | |||
253 | } | 253 | } |
254 | 254 | ||
255 | struct proc_dir_entry * | 255 | struct proc_dir_entry * |
256 | svc_proc_register(struct svc_stat *statp, struct file_operations *fops) | 256 | svc_proc_register(struct svc_stat *statp, const struct file_operations *fops) |
257 | { | 257 | { |
258 | return do_register(statp->program->pg_name, statp, fops); | 258 | return do_register(statp->program->pg_name, statp, fops); |
259 | } | 259 | } |
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c index 9f7373203592..769114f0f886 100644 --- a/net/sunrpc/sunrpc_syms.c +++ b/net/sunrpc/sunrpc_syms.c | |||
@@ -105,8 +105,6 @@ EXPORT_SYMBOL(auth_unix_lookup); | |||
105 | EXPORT_SYMBOL(cache_check); | 105 | EXPORT_SYMBOL(cache_check); |
106 | EXPORT_SYMBOL(cache_flush); | 106 | EXPORT_SYMBOL(cache_flush); |
107 | EXPORT_SYMBOL(cache_purge); | 107 | EXPORT_SYMBOL(cache_purge); |
108 | EXPORT_SYMBOL(cache_fresh); | ||
109 | EXPORT_SYMBOL(cache_init); | ||
110 | EXPORT_SYMBOL(cache_register); | 108 | EXPORT_SYMBOL(cache_register); |
111 | EXPORT_SYMBOL(cache_unregister); | 109 | EXPORT_SYMBOL(cache_unregister); |
112 | EXPORT_SYMBOL(qword_add); | 110 | EXPORT_SYMBOL(qword_add); |
@@ -142,6 +140,7 @@ EXPORT_SYMBOL(nlm_debug); | |||
142 | 140 | ||
143 | extern int register_rpc_pipefs(void); | 141 | extern int register_rpc_pipefs(void); |
144 | extern void unregister_rpc_pipefs(void); | 142 | extern void unregister_rpc_pipefs(void); |
143 | extern struct cache_detail ip_map_cache; | ||
145 | 144 | ||
146 | static int __init | 145 | static int __init |
147 | init_sunrpc(void) | 146 | init_sunrpc(void) |
@@ -158,7 +157,6 @@ init_sunrpc(void) | |||
158 | #ifdef CONFIG_PROC_FS | 157 | #ifdef CONFIG_PROC_FS |
159 | rpc_proc_init(); | 158 | rpc_proc_init(); |
160 | #endif | 159 | #endif |
161 | cache_register(&auth_domain_cache); | ||
162 | cache_register(&ip_map_cache); | 160 | cache_register(&ip_map_cache); |
163 | out: | 161 | out: |
164 | return err; | 162 | return err; |
@@ -169,8 +167,6 @@ cleanup_sunrpc(void) | |||
169 | { | 167 | { |
170 | unregister_rpc_pipefs(); | 168 | unregister_rpc_pipefs(); |
171 | rpc_destroy_mempool(); | 169 | rpc_destroy_mempool(); |
172 | if (cache_unregister(&auth_domain_cache)) | ||
173 | printk(KERN_ERR "sunrpc: failed to unregister auth_domain cache\n"); | ||
174 | if (cache_unregister(&ip_map_cache)) | 170 | if (cache_unregister(&ip_map_cache)) |
175 | printk(KERN_ERR "sunrpc: failed to unregister ip_map cache\n"); | 171 | printk(KERN_ERR "sunrpc: failed to unregister ip_map cache\n"); |
176 | #ifdef RPC_DEBUG | 172 | #ifdef RPC_DEBUG |
diff --git a/net/sunrpc/svcauth.c b/net/sunrpc/svcauth.c index dda4f0c63511..5b28c6176806 100644 --- a/net/sunrpc/svcauth.c +++ b/net/sunrpc/svcauth.c | |||
@@ -106,112 +106,56 @@ svc_auth_unregister(rpc_authflavor_t flavor) | |||
106 | EXPORT_SYMBOL(svc_auth_unregister); | 106 | EXPORT_SYMBOL(svc_auth_unregister); |
107 | 107 | ||
108 | /************************************************** | 108 | /************************************************** |
109 | * cache for domain name to auth_domain | 109 | * 'auth_domains' are stored in a hash table indexed by name. |
110 | * Entries are only added by flavours which will normally | 110 | * When the last reference to an 'auth_domain' is dropped, |
111 | * have a structure that 'inherits' from auth_domain. | 111 | * the object is unhashed and freed. |
112 | * e.g. when an IP -> domainname is given to auth_unix, | 112 | * If auth_domain_lookup fails to find an entry, it will return |
113 | * and the domain name doesn't exist, it will create a | 113 | * it's second argument 'new'. If this is non-null, it will |
114 | * auth_unix_domain and add it to this hash table. | 114 | * have been atomically linked into the table. |
115 | * If it finds the name does exist, but isn't AUTH_UNIX, | ||
116 | * it will complain. | ||
117 | */ | 115 | */ |
118 | 116 | ||
119 | /* | ||
120 | * Auth auth_domain cache is somewhat different to other caches, | ||
121 | * largely because the entries are possibly of different types: | ||
122 | * each auth flavour has it's own type. | ||
123 | * One consequence of this that DefineCacheLookup cannot | ||
124 | * allocate a new structure as it cannot know the size. | ||
125 | * Notice that the "INIT" code fragment is quite different | ||
126 | * from other caches. When auth_domain_lookup might be | ||
127 | * creating a new domain, the new domain is passed in | ||
128 | * complete and it is used as-is rather than being copied into | ||
129 | * another structure. | ||
130 | */ | ||
131 | #define DN_HASHBITS 6 | 117 | #define DN_HASHBITS 6 |
132 | #define DN_HASHMAX (1<<DN_HASHBITS) | 118 | #define DN_HASHMAX (1<<DN_HASHBITS) |
133 | #define DN_HASHMASK (DN_HASHMAX-1) | 119 | #define DN_HASHMASK (DN_HASHMAX-1) |
134 | 120 | ||
135 | static struct cache_head *auth_domain_table[DN_HASHMAX]; | 121 | static struct hlist_head auth_domain_table[DN_HASHMAX]; |
136 | 122 | static spinlock_t auth_domain_lock = SPIN_LOCK_UNLOCKED; | |
137 | static void auth_domain_drop(struct cache_head *item, struct cache_detail *cd) | ||
138 | { | ||
139 | struct auth_domain *dom = container_of(item, struct auth_domain, h); | ||
140 | if (cache_put(item,cd)) | ||
141 | authtab[dom->flavour]->domain_release(dom); | ||
142 | } | ||
143 | |||
144 | |||
145 | struct cache_detail auth_domain_cache = { | ||
146 | .owner = THIS_MODULE, | ||
147 | .hash_size = DN_HASHMAX, | ||
148 | .hash_table = auth_domain_table, | ||
149 | .name = "auth.domain", | ||
150 | .cache_put = auth_domain_drop, | ||
151 | }; | ||
152 | 123 | ||
153 | void auth_domain_put(struct auth_domain *dom) | 124 | void auth_domain_put(struct auth_domain *dom) |
154 | { | 125 | { |
155 | auth_domain_drop(&dom->h, &auth_domain_cache); | 126 | if (atomic_dec_and_lock(&dom->ref.refcount, &auth_domain_lock)) { |
156 | } | 127 | hlist_del(&dom->hash); |
157 | 128 | dom->flavour->domain_release(dom); | |
158 | static inline int auth_domain_hash(struct auth_domain *item) | 129 | } |
159 | { | ||
160 | return hash_str(item->name, DN_HASHBITS); | ||
161 | } | ||
162 | static inline int auth_domain_match(struct auth_domain *tmp, struct auth_domain *item) | ||
163 | { | ||
164 | return strcmp(tmp->name, item->name) == 0; | ||
165 | } | 130 | } |
166 | 131 | ||
167 | struct auth_domain * | 132 | struct auth_domain * |
168 | auth_domain_lookup(struct auth_domain *item, int set) | 133 | auth_domain_lookup(char *name, struct auth_domain *new) |
169 | { | 134 | { |
170 | struct auth_domain *tmp = NULL; | 135 | struct auth_domain *hp; |
171 | struct cache_head **hp, **head; | 136 | struct hlist_head *head; |
172 | head = &auth_domain_cache.hash_table[auth_domain_hash(item)]; | 137 | struct hlist_node *np; |
173 | 138 | ||
174 | if (set) | 139 | head = &auth_domain_table[hash_str(name, DN_HASHBITS)]; |
175 | write_lock(&auth_domain_cache.hash_lock); | 140 | |
176 | else | 141 | spin_lock(&auth_domain_lock); |
177 | read_lock(&auth_domain_cache.hash_lock); | 142 | |
178 | for (hp=head; *hp != NULL; hp = &tmp->h.next) { | 143 | hlist_for_each_entry(hp, np, head, hash) { |
179 | tmp = container_of(*hp, struct auth_domain, h); | 144 | if (strcmp(hp->name, name)==0) { |
180 | if (!auth_domain_match(tmp, item)) | 145 | kref_get(&hp->ref); |
181 | continue; | 146 | spin_unlock(&auth_domain_lock); |
182 | if (!set) { | 147 | return hp; |
183 | cache_get(&tmp->h); | ||
184 | goto out_noset; | ||
185 | } | 148 | } |
186 | *hp = tmp->h.next; | ||
187 | tmp->h.next = NULL; | ||
188 | auth_domain_drop(&tmp->h, &auth_domain_cache); | ||
189 | goto out_set; | ||
190 | } | 149 | } |
191 | /* Didn't find anything */ | 150 | if (new) { |
192 | if (!set) | 151 | hlist_add_head(&new->hash, head); |
193 | goto out_nada; | 152 | kref_get(&new->ref); |
194 | auth_domain_cache.entries++; | 153 | } |
195 | out_set: | 154 | spin_unlock(&auth_domain_lock); |
196 | item->h.next = *head; | 155 | return new; |
197 | *head = &item->h; | ||
198 | cache_get(&item->h); | ||
199 | write_unlock(&auth_domain_cache.hash_lock); | ||
200 | cache_fresh(&auth_domain_cache, &item->h, item->h.expiry_time); | ||
201 | cache_get(&item->h); | ||
202 | return item; | ||
203 | out_nada: | ||
204 | tmp = NULL; | ||
205 | out_noset: | ||
206 | read_unlock(&auth_domain_cache.hash_lock); | ||
207 | return tmp; | ||
208 | } | 156 | } |
209 | 157 | ||
210 | struct auth_domain *auth_domain_find(char *name) | 158 | struct auth_domain *auth_domain_find(char *name) |
211 | { | 159 | { |
212 | struct auth_domain *rv, ad; | 160 | return auth_domain_lookup(name, NULL); |
213 | |||
214 | ad.name = name; | ||
215 | rv = auth_domain_lookup(&ad, 0); | ||
216 | return rv; | ||
217 | } | 161 | } |
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 3e6c694bbad1..7e5707e2d6b6 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
@@ -27,41 +27,35 @@ struct unix_domain { | |||
27 | /* other stuff later */ | 27 | /* other stuff later */ |
28 | }; | 28 | }; |
29 | 29 | ||
30 | extern struct auth_ops svcauth_unix; | ||
31 | |||
30 | struct auth_domain *unix_domain_find(char *name) | 32 | struct auth_domain *unix_domain_find(char *name) |
31 | { | 33 | { |
32 | struct auth_domain *rv, ud; | 34 | struct auth_domain *rv; |
33 | struct unix_domain *new; | 35 | struct unix_domain *new = NULL; |
34 | 36 | ||
35 | ud.name = name; | 37 | rv = auth_domain_lookup(name, NULL); |
36 | 38 | while(1) { | |
37 | rv = auth_domain_lookup(&ud, 0); | 39 | if (rv) { |
38 | 40 | if (new && rv != &new->h) | |
39 | foundit: | 41 | auth_domain_put(&new->h); |
40 | if (rv && rv->flavour != RPC_AUTH_UNIX) { | 42 | |
41 | auth_domain_put(rv); | 43 | if (rv->flavour != &svcauth_unix) { |
42 | return NULL; | 44 | auth_domain_put(rv); |
43 | } | 45 | return NULL; |
44 | if (rv) | 46 | } |
45 | return rv; | 47 | return rv; |
46 | 48 | } | |
47 | new = kmalloc(sizeof(*new), GFP_KERNEL); | 49 | |
48 | if (new == NULL) | 50 | new = kmalloc(sizeof(*new), GFP_KERNEL); |
49 | return NULL; | 51 | if (new == NULL) |
50 | cache_init(&new->h.h); | 52 | return NULL; |
51 | new->h.name = kstrdup(name, GFP_KERNEL); | 53 | kref_init(&new->h.ref); |
52 | new->h.flavour = RPC_AUTH_UNIX; | 54 | new->h.name = kstrdup(name, GFP_KERNEL); |
53 | new->addr_changes = 0; | 55 | new->h.flavour = &svcauth_unix; |
54 | new->h.h.expiry_time = NEVER; | 56 | new->addr_changes = 0; |
55 | 57 | rv = auth_domain_lookup(name, &new->h); | |
56 | rv = auth_domain_lookup(&new->h, 2); | ||
57 | if (rv == &new->h) { | ||
58 | if (atomic_dec_and_test(&new->h.h.refcnt)) BUG(); | ||
59 | } else { | ||
60 | auth_domain_put(&new->h); | ||
61 | goto foundit; | ||
62 | } | 58 | } |
63 | |||
64 | return rv; | ||
65 | } | 59 | } |
66 | 60 | ||
67 | static void svcauth_unix_domain_release(struct auth_domain *dom) | 61 | static void svcauth_unix_domain_release(struct auth_domain *dom) |
@@ -90,15 +84,15 @@ struct ip_map { | |||
90 | }; | 84 | }; |
91 | static struct cache_head *ip_table[IP_HASHMAX]; | 85 | static struct cache_head *ip_table[IP_HASHMAX]; |
92 | 86 | ||
93 | static void ip_map_put(struct cache_head *item, struct cache_detail *cd) | 87 | static void ip_map_put(struct kref *kref) |
94 | { | 88 | { |
89 | struct cache_head *item = container_of(kref, struct cache_head, ref); | ||
95 | struct ip_map *im = container_of(item, struct ip_map,h); | 90 | struct ip_map *im = container_of(item, struct ip_map,h); |
96 | if (cache_put(item, cd)) { | 91 | |
97 | if (test_bit(CACHE_VALID, &item->flags) && | 92 | if (test_bit(CACHE_VALID, &item->flags) && |
98 | !test_bit(CACHE_NEGATIVE, &item->flags)) | 93 | !test_bit(CACHE_NEGATIVE, &item->flags)) |
99 | auth_domain_put(&im->m_client->h); | 94 | auth_domain_put(&im->m_client->h); |
100 | kfree(im); | 95 | kfree(im); |
101 | } | ||
102 | } | 96 | } |
103 | 97 | ||
104 | #if IP_HASHBITS == 8 | 98 | #if IP_HASHBITS == 8 |
@@ -112,28 +106,38 @@ static inline int hash_ip(unsigned long ip) | |||
112 | return (hash ^ (hash>>8)) & 0xff; | 106 | return (hash ^ (hash>>8)) & 0xff; |
113 | } | 107 | } |
114 | #endif | 108 | #endif |
115 | 109 | static int ip_map_match(struct cache_head *corig, struct cache_head *cnew) | |
116 | static inline int ip_map_hash(struct ip_map *item) | ||
117 | { | ||
118 | return hash_str(item->m_class, IP_HASHBITS) ^ | ||
119 | hash_ip((unsigned long)item->m_addr.s_addr); | ||
120 | } | ||
121 | static inline int ip_map_match(struct ip_map *item, struct ip_map *tmp) | ||
122 | { | 110 | { |
123 | return strcmp(tmp->m_class, item->m_class) == 0 | 111 | struct ip_map *orig = container_of(corig, struct ip_map, h); |
124 | && tmp->m_addr.s_addr == item->m_addr.s_addr; | 112 | struct ip_map *new = container_of(cnew, struct ip_map, h); |
113 | return strcmp(orig->m_class, new->m_class) == 0 | ||
114 | && orig->m_addr.s_addr == new->m_addr.s_addr; | ||
125 | } | 115 | } |
126 | static inline void ip_map_init(struct ip_map *new, struct ip_map *item) | 116 | static void ip_map_init(struct cache_head *cnew, struct cache_head *citem) |
127 | { | 117 | { |
118 | struct ip_map *new = container_of(cnew, struct ip_map, h); | ||
119 | struct ip_map *item = container_of(citem, struct ip_map, h); | ||
120 | |||
128 | strcpy(new->m_class, item->m_class); | 121 | strcpy(new->m_class, item->m_class); |
129 | new->m_addr.s_addr = item->m_addr.s_addr; | 122 | new->m_addr.s_addr = item->m_addr.s_addr; |
130 | } | 123 | } |
131 | static inline void ip_map_update(struct ip_map *new, struct ip_map *item) | 124 | static void update(struct cache_head *cnew, struct cache_head *citem) |
132 | { | 125 | { |
133 | cache_get(&item->m_client->h.h); | 126 | struct ip_map *new = container_of(cnew, struct ip_map, h); |
127 | struct ip_map *item = container_of(citem, struct ip_map, h); | ||
128 | |||
129 | kref_get(&item->m_client->h.ref); | ||
134 | new->m_client = item->m_client; | 130 | new->m_client = item->m_client; |
135 | new->m_add_change = item->m_add_change; | 131 | new->m_add_change = item->m_add_change; |
136 | } | 132 | } |
133 | static struct cache_head *ip_map_alloc(void) | ||
134 | { | ||
135 | struct ip_map *i = kmalloc(sizeof(*i), GFP_KERNEL); | ||
136 | if (i) | ||
137 | return &i->h; | ||
138 | else | ||
139 | return NULL; | ||
140 | } | ||
137 | 141 | ||
138 | static void ip_map_request(struct cache_detail *cd, | 142 | static void ip_map_request(struct cache_detail *cd, |
139 | struct cache_head *h, | 143 | struct cache_head *h, |
@@ -154,7 +158,8 @@ static void ip_map_request(struct cache_detail *cd, | |||
154 | (*bpp)[-1] = '\n'; | 158 | (*bpp)[-1] = '\n'; |
155 | } | 159 | } |
156 | 160 | ||
157 | static struct ip_map *ip_map_lookup(struct ip_map *, int); | 161 | static struct ip_map *ip_map_lookup(char *class, struct in_addr addr); |
162 | static int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t expiry); | ||
158 | 163 | ||
159 | static int ip_map_parse(struct cache_detail *cd, | 164 | static int ip_map_parse(struct cache_detail *cd, |
160 | char *mesg, int mlen) | 165 | char *mesg, int mlen) |
@@ -166,7 +171,11 @@ static int ip_map_parse(struct cache_detail *cd, | |||
166 | int len; | 171 | int len; |
167 | int b1,b2,b3,b4; | 172 | int b1,b2,b3,b4; |
168 | char c; | 173 | char c; |
169 | struct ip_map ipm, *ipmp; | 174 | char class[8]; |
175 | struct in_addr addr; | ||
176 | int err; | ||
177 | |||
178 | struct ip_map *ipmp; | ||
170 | struct auth_domain *dom; | 179 | struct auth_domain *dom; |
171 | time_t expiry; | 180 | time_t expiry; |
172 | 181 | ||
@@ -175,7 +184,7 @@ static int ip_map_parse(struct cache_detail *cd, | |||
175 | mesg[mlen-1] = 0; | 184 | mesg[mlen-1] = 0; |
176 | 185 | ||
177 | /* class */ | 186 | /* class */ |
178 | len = qword_get(&mesg, ipm.m_class, sizeof(ipm.m_class)); | 187 | len = qword_get(&mesg, class, sizeof(class)); |
179 | if (len <= 0) return -EINVAL; | 188 | if (len <= 0) return -EINVAL; |
180 | 189 | ||
181 | /* ip address */ | 190 | /* ip address */ |
@@ -200,25 +209,22 @@ static int ip_map_parse(struct cache_detail *cd, | |||
200 | } else | 209 | } else |
201 | dom = NULL; | 210 | dom = NULL; |
202 | 211 | ||
203 | ipm.m_addr.s_addr = | 212 | addr.s_addr = |
204 | htonl((((((b1<<8)|b2)<<8)|b3)<<8)|b4); | 213 | htonl((((((b1<<8)|b2)<<8)|b3)<<8)|b4); |
205 | ipm.h.flags = 0; | 214 | |
206 | if (dom) { | 215 | ipmp = ip_map_lookup(class,addr); |
207 | ipm.m_client = container_of(dom, struct unix_domain, h); | 216 | if (ipmp) { |
208 | ipm.m_add_change = ipm.m_client->addr_changes; | 217 | err = ip_map_update(ipmp, |
218 | container_of(dom, struct unix_domain, h), | ||
219 | expiry); | ||
209 | } else | 220 | } else |
210 | set_bit(CACHE_NEGATIVE, &ipm.h.flags); | 221 | err = -ENOMEM; |
211 | ipm.h.expiry_time = expiry; | ||
212 | 222 | ||
213 | ipmp = ip_map_lookup(&ipm, 1); | ||
214 | if (ipmp) | ||
215 | ip_map_put(&ipmp->h, &ip_map_cache); | ||
216 | if (dom) | 223 | if (dom) |
217 | auth_domain_put(dom); | 224 | auth_domain_put(dom); |
218 | if (!ipmp) | 225 | |
219 | return -ENOMEM; | ||
220 | cache_flush(); | 226 | cache_flush(); |
221 | return 0; | 227 | return err; |
222 | } | 228 | } |
223 | 229 | ||
224 | static int ip_map_show(struct seq_file *m, | 230 | static int ip_map_show(struct seq_file *m, |
@@ -262,32 +268,70 @@ struct cache_detail ip_map_cache = { | |||
262 | .cache_request = ip_map_request, | 268 | .cache_request = ip_map_request, |
263 | .cache_parse = ip_map_parse, | 269 | .cache_parse = ip_map_parse, |
264 | .cache_show = ip_map_show, | 270 | .cache_show = ip_map_show, |
271 | .match = ip_map_match, | ||
272 | .init = ip_map_init, | ||
273 | .update = update, | ||
274 | .alloc = ip_map_alloc, | ||
265 | }; | 275 | }; |
266 | 276 | ||
267 | static DefineSimpleCacheLookup(ip_map, 0) | 277 | static struct ip_map *ip_map_lookup(char *class, struct in_addr addr) |
278 | { | ||
279 | struct ip_map ip; | ||
280 | struct cache_head *ch; | ||
281 | |||
282 | strcpy(ip.m_class, class); | ||
283 | ip.m_addr = addr; | ||
284 | ch = sunrpc_cache_lookup(&ip_map_cache, &ip.h, | ||
285 | hash_str(class, IP_HASHBITS) ^ | ||
286 | hash_ip((unsigned long)addr.s_addr)); | ||
287 | |||
288 | if (ch) | ||
289 | return container_of(ch, struct ip_map, h); | ||
290 | else | ||
291 | return NULL; | ||
292 | } | ||
268 | 293 | ||
294 | static int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t expiry) | ||
295 | { | ||
296 | struct ip_map ip; | ||
297 | struct cache_head *ch; | ||
298 | |||
299 | ip.m_client = udom; | ||
300 | ip.h.flags = 0; | ||
301 | if (!udom) | ||
302 | set_bit(CACHE_NEGATIVE, &ip.h.flags); | ||
303 | else { | ||
304 | ip.m_add_change = udom->addr_changes; | ||
305 | /* if this is from the legacy set_client system call, | ||
306 | * we need m_add_change to be one higher | ||
307 | */ | ||
308 | if (expiry == NEVER) | ||
309 | ip.m_add_change++; | ||
310 | } | ||
311 | ip.h.expiry_time = expiry; | ||
312 | ch = sunrpc_cache_update(&ip_map_cache, | ||
313 | &ip.h, &ipm->h, | ||
314 | hash_str(ipm->m_class, IP_HASHBITS) ^ | ||
315 | hash_ip((unsigned long)ipm->m_addr.s_addr)); | ||
316 | if (!ch) | ||
317 | return -ENOMEM; | ||
318 | cache_put(ch, &ip_map_cache); | ||
319 | return 0; | ||
320 | } | ||
269 | 321 | ||
270 | int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom) | 322 | int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom) |
271 | { | 323 | { |
272 | struct unix_domain *udom; | 324 | struct unix_domain *udom; |
273 | struct ip_map ip, *ipmp; | 325 | struct ip_map *ipmp; |
274 | 326 | ||
275 | if (dom->flavour != RPC_AUTH_UNIX) | 327 | if (dom->flavour != &svcauth_unix) |
276 | return -EINVAL; | 328 | return -EINVAL; |
277 | udom = container_of(dom, struct unix_domain, h); | 329 | udom = container_of(dom, struct unix_domain, h); |
278 | strcpy(ip.m_class, "nfsd"); | 330 | ipmp = ip_map_lookup("nfsd", addr); |
279 | ip.m_addr = addr; | ||
280 | ip.m_client = udom; | ||
281 | ip.m_add_change = udom->addr_changes+1; | ||
282 | ip.h.flags = 0; | ||
283 | ip.h.expiry_time = NEVER; | ||
284 | |||
285 | ipmp = ip_map_lookup(&ip, 1); | ||
286 | 331 | ||
287 | if (ipmp) { | 332 | if (ipmp) |
288 | ip_map_put(&ipmp->h, &ip_map_cache); | 333 | return ip_map_update(ipmp, udom, NEVER); |
289 | return 0; | 334 | else |
290 | } else | ||
291 | return -ENOMEM; | 335 | return -ENOMEM; |
292 | } | 336 | } |
293 | 337 | ||
@@ -295,7 +339,7 @@ int auth_unix_forget_old(struct auth_domain *dom) | |||
295 | { | 339 | { |
296 | struct unix_domain *udom; | 340 | struct unix_domain *udom; |
297 | 341 | ||
298 | if (dom->flavour != RPC_AUTH_UNIX) | 342 | if (dom->flavour != &svcauth_unix) |
299 | return -EINVAL; | 343 | return -EINVAL; |
300 | udom = container_of(dom, struct unix_domain, h); | 344 | udom = container_of(dom, struct unix_domain, h); |
301 | udom->addr_changes++; | 345 | udom->addr_changes++; |
@@ -310,7 +354,7 @@ struct auth_domain *auth_unix_lookup(struct in_addr addr) | |||
310 | strcpy(key.m_class, "nfsd"); | 354 | strcpy(key.m_class, "nfsd"); |
311 | key.m_addr = addr; | 355 | key.m_addr = addr; |
312 | 356 | ||
313 | ipm = ip_map_lookup(&key, 0); | 357 | ipm = ip_map_lookup("nfsd", addr); |
314 | 358 | ||
315 | if (!ipm) | 359 | if (!ipm) |
316 | return NULL; | 360 | return NULL; |
@@ -323,31 +367,28 @@ struct auth_domain *auth_unix_lookup(struct in_addr addr) | |||
323 | rv = NULL; | 367 | rv = NULL; |
324 | } else { | 368 | } else { |
325 | rv = &ipm->m_client->h; | 369 | rv = &ipm->m_client->h; |
326 | cache_get(&rv->h); | 370 | kref_get(&rv->ref); |
327 | } | 371 | } |
328 | ip_map_put(&ipm->h, &ip_map_cache); | 372 | cache_put(&ipm->h, &ip_map_cache); |
329 | return rv; | 373 | return rv; |
330 | } | 374 | } |
331 | 375 | ||
332 | void svcauth_unix_purge(void) | 376 | void svcauth_unix_purge(void) |
333 | { | 377 | { |
334 | cache_purge(&ip_map_cache); | 378 | cache_purge(&ip_map_cache); |
335 | cache_purge(&auth_domain_cache); | ||
336 | } | 379 | } |
337 | 380 | ||
338 | static int | 381 | static int |
339 | svcauth_unix_set_client(struct svc_rqst *rqstp) | 382 | svcauth_unix_set_client(struct svc_rqst *rqstp) |
340 | { | 383 | { |
341 | struct ip_map key, *ipm; | 384 | struct ip_map *ipm; |
342 | 385 | ||
343 | rqstp->rq_client = NULL; | 386 | rqstp->rq_client = NULL; |
344 | if (rqstp->rq_proc == 0) | 387 | if (rqstp->rq_proc == 0) |
345 | return SVC_OK; | 388 | return SVC_OK; |
346 | 389 | ||
347 | strcpy(key.m_class, rqstp->rq_server->sv_program->pg_class); | 390 | ipm = ip_map_lookup(rqstp->rq_server->sv_program->pg_class, |
348 | key.m_addr = rqstp->rq_addr.sin_addr; | 391 | rqstp->rq_addr.sin_addr); |
349 | |||
350 | ipm = ip_map_lookup(&key, 0); | ||
351 | 392 | ||
352 | if (ipm == NULL) | 393 | if (ipm == NULL) |
353 | return SVC_DENIED; | 394 | return SVC_DENIED; |
@@ -361,8 +402,8 @@ svcauth_unix_set_client(struct svc_rqst *rqstp) | |||
361 | return SVC_DENIED; | 402 | return SVC_DENIED; |
362 | case 0: | 403 | case 0: |
363 | rqstp->rq_client = &ipm->m_client->h; | 404 | rqstp->rq_client = &ipm->m_client->h; |
364 | cache_get(&rqstp->rq_client->h); | 405 | kref_get(&rqstp->rq_client->ref); |
365 | ip_map_put(&ipm->h, &ip_map_cache); | 406 | cache_put(&ipm->h, &ip_map_cache); |
366 | break; | 407 | break; |
367 | } | 408 | } |
368 | return SVC_OK; | 409 | return SVC_OK; |