aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/raw.c
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2007-12-11 05:25:35 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:57:13 -0500
commit7f4e4868f3ce0e946f116c28fa4fe033be5e4ba9 (patch)
tree144add1d4c94a145f7e048a17d91b563f5e6e265 /net/ipv6/raw.c
parent87c3efbfdd1f98af14a1f60ff19f73d9a8d8da98 (diff)
[IPV6]: make the protocol initialization to return an error code
This patchset makes the different protocols to return an error code, so the af_inet6 module can check the initialization was correct or not. The raw6 was taken into account to be consistent with the rest of the protocols, but the registration is at the same place. Because the raw6 has its own init function, the proto and the ops structure can be moved inside the raw6.c file. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/raw.c')
-rw-r--r--net/ipv6/raw.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index b34631e1b015..850b83e430bc 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -1273,3 +1273,55 @@ void raw6_proc_exit(void)
1273 proc_net_remove(&init_net, "raw6"); 1273 proc_net_remove(&init_net, "raw6");
1274} 1274}
1275#endif /* CONFIG_PROC_FS */ 1275#endif /* CONFIG_PROC_FS */
1276
1277/* Same as inet6_dgram_ops, sans udp_poll. */
1278static const struct proto_ops inet6_sockraw_ops = {
1279 .family = PF_INET6,
1280 .owner = THIS_MODULE,
1281 .release = inet6_release,
1282 .bind = inet6_bind,
1283 .connect = inet_dgram_connect, /* ok */
1284 .socketpair = sock_no_socketpair, /* a do nothing */
1285 .accept = sock_no_accept, /* a do nothing */
1286 .getname = inet6_getname,
1287 .poll = datagram_poll, /* ok */
1288 .ioctl = inet6_ioctl, /* must change */
1289 .listen = sock_no_listen, /* ok */
1290 .shutdown = inet_shutdown, /* ok */
1291 .setsockopt = sock_common_setsockopt, /* ok */
1292 .getsockopt = sock_common_getsockopt, /* ok */
1293 .sendmsg = inet_sendmsg, /* ok */
1294 .recvmsg = sock_common_recvmsg, /* ok */
1295 .mmap = sock_no_mmap,
1296 .sendpage = sock_no_sendpage,
1297#ifdef CONFIG_COMPAT
1298 .compat_setsockopt = compat_sock_common_setsockopt,
1299 .compat_getsockopt = compat_sock_common_getsockopt,
1300#endif
1301};
1302
1303static struct inet_protosw rawv6_protosw = {
1304 .type = SOCK_RAW,
1305 .protocol = IPPROTO_IP, /* wild card */
1306 .prot = &rawv6_prot,
1307 .ops = &inet6_sockraw_ops,
1308 .capability = CAP_NET_RAW,
1309 .no_check = UDP_CSUM_DEFAULT,
1310 .flags = INET_PROTOSW_REUSE,
1311};
1312
1313int __init rawv6_init(void)
1314{
1315 int ret;
1316
1317 ret = inet6_register_protosw(&rawv6_protosw);
1318 if (ret)
1319 goto out;
1320out:
1321 return ret;
1322}
1323
1324void __exit rawv6_exit(void)
1325{
1326 inet6_unregister_protosw(&rawv6_protosw);
1327}