diff options
Diffstat (limited to 'net/ipv6/af_inet6.c')
-rw-r--r-- | net/ipv6/af_inet6.c | 77 |
1 files changed, 33 insertions, 44 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 53b06de696bd..34c20533ba5d 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -529,42 +529,6 @@ static struct net_proto_family inet6_family_ops = { | |||
529 | .owner = THIS_MODULE, | 529 | .owner = THIS_MODULE, |
530 | }; | 530 | }; |
531 | 531 | ||
532 | /* Same as inet6_dgram_ops, sans udp_poll. */ | ||
533 | static const struct proto_ops inet6_sockraw_ops = { | ||
534 | .family = PF_INET6, | ||
535 | .owner = THIS_MODULE, | ||
536 | .release = inet6_release, | ||
537 | .bind = inet6_bind, | ||
538 | .connect = inet_dgram_connect, /* ok */ | ||
539 | .socketpair = sock_no_socketpair, /* a do nothing */ | ||
540 | .accept = sock_no_accept, /* a do nothing */ | ||
541 | .getname = inet6_getname, | ||
542 | .poll = datagram_poll, /* ok */ | ||
543 | .ioctl = inet6_ioctl, /* must change */ | ||
544 | .listen = sock_no_listen, /* ok */ | ||
545 | .shutdown = inet_shutdown, /* ok */ | ||
546 | .setsockopt = sock_common_setsockopt, /* ok */ | ||
547 | .getsockopt = sock_common_getsockopt, /* ok */ | ||
548 | .sendmsg = inet_sendmsg, /* ok */ | ||
549 | .recvmsg = sock_common_recvmsg, /* ok */ | ||
550 | .mmap = sock_no_mmap, | ||
551 | .sendpage = sock_no_sendpage, | ||
552 | #ifdef CONFIG_COMPAT | ||
553 | .compat_setsockopt = compat_sock_common_setsockopt, | ||
554 | .compat_getsockopt = compat_sock_common_getsockopt, | ||
555 | #endif | ||
556 | }; | ||
557 | |||
558 | static struct inet_protosw rawv6_protosw = { | ||
559 | .type = SOCK_RAW, | ||
560 | .protocol = IPPROTO_IP, /* wild card */ | ||
561 | .prot = &rawv6_prot, | ||
562 | .ops = &inet6_sockraw_ops, | ||
563 | .capability = CAP_NET_RAW, | ||
564 | .no_check = UDP_CSUM_DEFAULT, | ||
565 | .flags = INET_PROTOSW_REUSE, | ||
566 | }; | ||
567 | |||
568 | int inet6_register_protosw(struct inet_protosw *p) | 532 | int inet6_register_protosw(struct inet_protosw *p) |
569 | { | 533 | { |
570 | struct list_head *lh; | 534 | struct list_head *lh; |
@@ -771,7 +735,6 @@ static int __init inet6_init(void) | |||
771 | __this_module.can_unload = &ipv6_unload; | 735 | __this_module.can_unload = &ipv6_unload; |
772 | #endif | 736 | #endif |
773 | #endif | 737 | #endif |
774 | |||
775 | err = proto_register(&tcpv6_prot, 1); | 738 | err = proto_register(&tcpv6_prot, 1); |
776 | if (err) | 739 | if (err) |
777 | goto out; | 740 | goto out; |
@@ -796,14 +759,16 @@ static int __init inet6_init(void) | |||
796 | /* We MUST register RAW sockets before we create the ICMP6, | 759 | /* We MUST register RAW sockets before we create the ICMP6, |
797 | * IGMP6, or NDISC control sockets. | 760 | * IGMP6, or NDISC control sockets. |
798 | */ | 761 | */ |
799 | inet6_register_protosw(&rawv6_protosw); | 762 | err = rawv6_init(); |
763 | if (err) | ||
764 | goto out_unregister_raw_proto; | ||
800 | 765 | ||
801 | /* Register the family here so that the init calls below will | 766 | /* Register the family here so that the init calls below will |
802 | * be able to create sockets. (?? is this dangerous ??) | 767 | * be able to create sockets. (?? is this dangerous ??) |
803 | */ | 768 | */ |
804 | err = sock_register(&inet6_family_ops); | 769 | err = sock_register(&inet6_family_ops); |
805 | if (err) | 770 | if (err) |
806 | goto out_unregister_raw_proto; | 771 | goto out_sock_register_fail; |
807 | 772 | ||
808 | /* Initialise ipv6 mibs */ | 773 | /* Initialise ipv6 mibs */ |
809 | err = init_ipv6_mibs(); | 774 | err = init_ipv6_mibs(); |
@@ -871,15 +836,32 @@ static int __init inet6_init(void) | |||
871 | goto ipv6_frag_fail; | 836 | goto ipv6_frag_fail; |
872 | 837 | ||
873 | /* Init v6 transport protocols. */ | 838 | /* Init v6 transport protocols. */ |
874 | udpv6_init(); | 839 | err = udpv6_init(); |
875 | udplitev6_init(); | 840 | if (err) |
876 | tcpv6_init(); | 841 | goto udpv6_fail; |
877 | 842 | ||
878 | ipv6_packet_init(); | 843 | err = udplitev6_init(); |
879 | err = 0; | 844 | if (err) |
845 | goto udplitev6_fail; | ||
846 | |||
847 | err = tcpv6_init(); | ||
848 | if (err) | ||
849 | goto tcpv6_fail; | ||
850 | |||
851 | err = ipv6_packet_init(); | ||
852 | if (err) | ||
853 | goto ipv6_packet_fail; | ||
880 | out: | 854 | out: |
881 | return err; | 855 | return err; |
882 | 856 | ||
857 | ipv6_packet_fail: | ||
858 | tcpv6_exit(); | ||
859 | tcpv6_fail: | ||
860 | udplitev6_exit(); | ||
861 | udplitev6_fail: | ||
862 | udpv6_exit(); | ||
863 | udpv6_fail: | ||
864 | ipv6_frag_exit(); | ||
883 | ipv6_frag_fail: | 865 | ipv6_frag_fail: |
884 | ipv6_exthdrs_exit(); | 866 | ipv6_exthdrs_exit(); |
885 | ipv6_exthdrs_fail: | 867 | ipv6_exthdrs_fail: |
@@ -920,6 +902,8 @@ icmp_fail: | |||
920 | out_unregister_sock: | 902 | out_unregister_sock: |
921 | sock_unregister(PF_INET6); | 903 | sock_unregister(PF_INET6); |
922 | rtnl_unregister_all(PF_INET6); | 904 | rtnl_unregister_all(PF_INET6); |
905 | out_sock_register_fail: | ||
906 | rawv6_exit(); | ||
923 | out_unregister_raw_proto: | 907 | out_unregister_raw_proto: |
924 | proto_unregister(&rawv6_prot); | 908 | proto_unregister(&rawv6_prot); |
925 | out_unregister_udplite_proto: | 909 | out_unregister_udplite_proto: |
@@ -939,6 +923,10 @@ static void __exit inet6_exit(void) | |||
939 | /* Disallow any further netlink messages */ | 923 | /* Disallow any further netlink messages */ |
940 | rtnl_unregister_all(PF_INET6); | 924 | rtnl_unregister_all(PF_INET6); |
941 | 925 | ||
926 | udpv6_exit(); | ||
927 | udplitev6_exit(); | ||
928 | tcpv6_exit(); | ||
929 | |||
942 | /* Cleanup code parts. */ | 930 | /* Cleanup code parts. */ |
943 | ipv6_packet_cleanup(); | 931 | ipv6_packet_cleanup(); |
944 | ipv6_frag_exit(); | 932 | ipv6_frag_exit(); |
@@ -961,6 +949,7 @@ static void __exit inet6_exit(void) | |||
961 | igmp6_cleanup(); | 949 | igmp6_cleanup(); |
962 | ndisc_cleanup(); | 950 | ndisc_cleanup(); |
963 | icmpv6_cleanup(); | 951 | icmpv6_cleanup(); |
952 | rawv6_exit(); | ||
964 | #ifdef CONFIG_SYSCTL | 953 | #ifdef CONFIG_SYSCTL |
965 | ipv6_sysctl_unregister(); | 954 | ipv6_sysctl_unregister(); |
966 | #endif | 955 | #endif |