@@ -529,42 +529,6 @@ static struct net_proto_family inet6_family_ops = {
529529 .owner = THIS_MODULE ,
530530};
531531
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-
568532int inet6_register_protosw (struct inet_protosw * p )
569533{
570534 struct list_head * lh ;
@@ -771,7 +735,6 @@ static int __init inet6_init(void)
771735 __this_module .can_unload = & ipv6_unload ;
772736#endif
773737#endif
774-
775738 err = proto_register (& tcpv6_prot , 1 );
776739 if (err )
777740 goto out ;
@@ -796,14 +759,16 @@ static int __init inet6_init(void)
796759 /* We MUST register RAW sockets before we create the ICMP6,
797760 * IGMP6, or NDISC control sockets.
798761 */
799- inet6_register_protosw (& rawv6_protosw );
762+ err = rawv6_init ();
763+ if (err )
764+ goto out_unregister_raw_proto ;
800765
801766 /* Register the family here so that the init calls below will
802767 * be able to create sockets. (?? is this dangerous ??)
803768 */
804769 err = sock_register (& inet6_family_ops );
805770 if (err )
806- goto out_unregister_raw_proto ;
771+ goto out_sock_register_fail ;
807772
808773 /* Initialise ipv6 mibs */
809774 err = init_ipv6_mibs ();
@@ -871,15 +836,32 @@ static int __init inet6_init(void)
871836 goto ipv6_frag_fail ;
872837
873838 /* Init v6 transport protocols. */
874- udpv6_init ();
875- udplitev6_init ();
876- tcpv6_init () ;
839+ err = udpv6_init ();
840+ if ( err )
841+ goto udpv6_fail ;
877842
878- ipv6_packet_init ();
879- err = 0 ;
843+ err = udplitev6_init ();
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 ;
880854out :
881855 return err ;
882856
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 ();
883865ipv6_frag_fail :
884866 ipv6_exthdrs_exit ();
885867ipv6_exthdrs_fail :
@@ -920,6 +902,8 @@ static int __init inet6_init(void)
920902out_unregister_sock :
921903 sock_unregister (PF_INET6 );
922904 rtnl_unregister_all (PF_INET6 );
905+ out_sock_register_fail :
906+ rawv6_exit ();
923907out_unregister_raw_proto :
924908 proto_unregister (& rawv6_prot );
925909out_unregister_udplite_proto :
@@ -939,6 +923,10 @@ static void __exit inet6_exit(void)
939923 /* Disallow any further netlink messages */
940924 rtnl_unregister_all (PF_INET6 );
941925
926+ udpv6_exit ();
927+ udplitev6_exit ();
928+ tcpv6_exit ();
929+
942930 /* Cleanup code parts. */
943931 ipv6_packet_cleanup ();
944932 ipv6_frag_exit ();
@@ -961,6 +949,7 @@ static void __exit inet6_exit(void)
961949 igmp6_cleanup ();
962950 ndisc_cleanup ();
963951 icmpv6_cleanup ();
952+ rawv6_exit ();
964953#ifdef CONFIG_SYSCTL
965954 ipv6_sysctl_unregister ();
966955#endif
0 commit comments