diff options
Diffstat (limited to 'net/ipv6/af_inet6.c')
-rw-r--r-- | net/ipv6/af_inet6.c | 88 |
1 files changed, 39 insertions, 49 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 5cac14a5c778..18cb928c8d92 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -98,6 +98,11 @@ static int inet6_create(struct socket *sock, int protocol) | |||
98 | int try_loading_module = 0; | 98 | int try_loading_module = 0; |
99 | int err; | 99 | int err; |
100 | 100 | ||
101 | if (sock->type != SOCK_RAW && | ||
102 | sock->type != SOCK_DGRAM && | ||
103 | !inet_ehash_secret) | ||
104 | build_ehash_secret(); | ||
105 | |||
101 | /* Look for the requested type/protocol pair. */ | 106 | /* Look for the requested type/protocol pair. */ |
102 | answer = NULL; | 107 | answer = NULL; |
103 | lookup_protocol: | 108 | lookup_protocol: |
@@ -349,6 +354,8 @@ out: | |||
349 | return err; | 354 | return err; |
350 | } | 355 | } |
351 | 356 | ||
357 | EXPORT_SYMBOL(inet6_bind); | ||
358 | |||
352 | int inet6_release(struct socket *sock) | 359 | int inet6_release(struct socket *sock) |
353 | { | 360 | { |
354 | struct sock *sk = sock->sk; | 361 | struct sock *sk = sock->sk; |
@@ -365,6 +372,8 @@ int inet6_release(struct socket *sock) | |||
365 | return inet_release(sock); | 372 | return inet_release(sock); |
366 | } | 373 | } |
367 | 374 | ||
375 | EXPORT_SYMBOL(inet6_release); | ||
376 | |||
368 | int inet6_destroy_sock(struct sock *sk) | 377 | int inet6_destroy_sock(struct sock *sk) |
369 | { | 378 | { |
370 | struct ipv6_pinfo *np = inet6_sk(sk); | 379 | struct ipv6_pinfo *np = inet6_sk(sk); |
@@ -428,6 +437,8 @@ int inet6_getname(struct socket *sock, struct sockaddr *uaddr, | |||
428 | return(0); | 437 | return(0); |
429 | } | 438 | } |
430 | 439 | ||
440 | EXPORT_SYMBOL(inet6_getname); | ||
441 | |||
431 | int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | 442 | int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) |
432 | { | 443 | { |
433 | struct sock *sk = sock->sk; | 444 | struct sock *sk = sock->sk; |
@@ -437,6 +448,9 @@ int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
437 | case SIOCGSTAMP: | 448 | case SIOCGSTAMP: |
438 | return sock_get_timestamp(sk, (struct timeval __user *)arg); | 449 | return sock_get_timestamp(sk, (struct timeval __user *)arg); |
439 | 450 | ||
451 | case SIOCGSTAMPNS: | ||
452 | return sock_get_timestampns(sk, (struct timespec __user *)arg); | ||
453 | |||
440 | case SIOCADDRT: | 454 | case SIOCADDRT: |
441 | case SIOCDELRT: | 455 | case SIOCDELRT: |
442 | 456 | ||
@@ -457,6 +471,8 @@ int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
457 | return(0); | 471 | return(0); |
458 | } | 472 | } |
459 | 473 | ||
474 | EXPORT_SYMBOL(inet6_ioctl); | ||
475 | |||
460 | const struct proto_ops inet6_stream_ops = { | 476 | const struct proto_ops inet6_stream_ops = { |
461 | .family = PF_INET6, | 477 | .family = PF_INET6, |
462 | .owner = THIS_MODULE, | 478 | .owner = THIS_MODULE, |
@@ -603,6 +619,8 @@ out_illegal: | |||
603 | goto out; | 619 | goto out; |
604 | } | 620 | } |
605 | 621 | ||
622 | EXPORT_SYMBOL(inet6_register_protosw); | ||
623 | |||
606 | void | 624 | void |
607 | inet6_unregister_protosw(struct inet_protosw *p) | 625 | inet6_unregister_protosw(struct inet_protosw *p) |
608 | { | 626 | { |
@@ -619,6 +637,8 @@ inet6_unregister_protosw(struct inet_protosw *p) | |||
619 | } | 637 | } |
620 | } | 638 | } |
621 | 639 | ||
640 | EXPORT_SYMBOL(inet6_unregister_protosw); | ||
641 | |||
622 | int inet6_sk_rebuild_header(struct sock *sk) | 642 | int inet6_sk_rebuild_header(struct sock *sk) |
623 | { | 643 | { |
624 | int err; | 644 | int err; |
@@ -678,7 +698,8 @@ int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb) | |||
678 | if (np->rxopt.all) { | 698 | if (np->rxopt.all) { |
679 | if ((opt->hop && (np->rxopt.bits.hopopts || | 699 | if ((opt->hop && (np->rxopt.bits.hopopts || |
680 | np->rxopt.bits.ohopopts)) || | 700 | np->rxopt.bits.ohopopts)) || |
681 | ((IPV6_FLOWINFO_MASK & *(__be32*)skb->nh.raw) && | 701 | ((IPV6_FLOWINFO_MASK & |
702 | *(__be32 *)skb_network_header(skb)) && | ||
682 | np->rxopt.bits.rxflow) || | 703 | np->rxopt.bits.rxflow) || |
683 | (opt->srcrt && (np->rxopt.bits.srcrt || | 704 | (opt->srcrt && (np->rxopt.bits.srcrt || |
684 | np->rxopt.bits.osrcrt)) || | 705 | np->rxopt.bits.osrcrt)) || |
@@ -691,61 +712,28 @@ int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb) | |||
691 | 712 | ||
692 | EXPORT_SYMBOL_GPL(ipv6_opt_accepted); | 713 | EXPORT_SYMBOL_GPL(ipv6_opt_accepted); |
693 | 714 | ||
694 | int | ||
695 | snmp6_mib_init(void *ptr[2], size_t mibsize, size_t mibalign) | ||
696 | { | ||
697 | if (ptr == NULL) | ||
698 | return -EINVAL; | ||
699 | |||
700 | ptr[0] = __alloc_percpu(mibsize); | ||
701 | if (!ptr[0]) | ||
702 | goto err0; | ||
703 | |||
704 | ptr[1] = __alloc_percpu(mibsize); | ||
705 | if (!ptr[1]) | ||
706 | goto err1; | ||
707 | |||
708 | return 0; | ||
709 | |||
710 | err1: | ||
711 | free_percpu(ptr[0]); | ||
712 | ptr[0] = NULL; | ||
713 | err0: | ||
714 | return -ENOMEM; | ||
715 | } | ||
716 | |||
717 | void | ||
718 | snmp6_mib_free(void *ptr[2]) | ||
719 | { | ||
720 | if (ptr == NULL) | ||
721 | return; | ||
722 | free_percpu(ptr[0]); | ||
723 | free_percpu(ptr[1]); | ||
724 | ptr[0] = ptr[1] = NULL; | ||
725 | } | ||
726 | |||
727 | static int __init init_ipv6_mibs(void) | 715 | static int __init init_ipv6_mibs(void) |
728 | { | 716 | { |
729 | if (snmp6_mib_init((void **)ipv6_statistics, sizeof (struct ipstats_mib), | 717 | if (snmp_mib_init((void **)ipv6_statistics, sizeof (struct ipstats_mib), |
730 | __alignof__(struct ipstats_mib)) < 0) | 718 | __alignof__(struct ipstats_mib)) < 0) |
731 | goto err_ip_mib; | 719 | goto err_ip_mib; |
732 | if (snmp6_mib_init((void **)icmpv6_statistics, sizeof (struct icmpv6_mib), | 720 | if (snmp_mib_init((void **)icmpv6_statistics, sizeof (struct icmpv6_mib), |
733 | __alignof__(struct icmpv6_mib)) < 0) | 721 | __alignof__(struct icmpv6_mib)) < 0) |
734 | goto err_icmp_mib; | 722 | goto err_icmp_mib; |
735 | if (snmp6_mib_init((void **)udp_stats_in6, sizeof (struct udp_mib), | 723 | if (snmp_mib_init((void **)udp_stats_in6, sizeof (struct udp_mib), |
736 | __alignof__(struct udp_mib)) < 0) | 724 | __alignof__(struct udp_mib)) < 0) |
737 | goto err_udp_mib; | 725 | goto err_udp_mib; |
738 | if (snmp6_mib_init((void **)udplite_stats_in6, sizeof (struct udp_mib), | 726 | if (snmp_mib_init((void **)udplite_stats_in6, sizeof (struct udp_mib), |
739 | __alignof__(struct udp_mib)) < 0) | 727 | __alignof__(struct udp_mib)) < 0) |
740 | goto err_udplite_mib; | 728 | goto err_udplite_mib; |
741 | return 0; | 729 | return 0; |
742 | 730 | ||
743 | err_udplite_mib: | 731 | err_udplite_mib: |
744 | snmp6_mib_free((void **)udp_stats_in6); | 732 | snmp_mib_free((void **)udp_stats_in6); |
745 | err_udp_mib: | 733 | err_udp_mib: |
746 | snmp6_mib_free((void **)icmpv6_statistics); | 734 | snmp_mib_free((void **)icmpv6_statistics); |
747 | err_icmp_mib: | 735 | err_icmp_mib: |
748 | snmp6_mib_free((void **)ipv6_statistics); | 736 | snmp_mib_free((void **)ipv6_statistics); |
749 | err_ip_mib: | 737 | err_ip_mib: |
750 | return -ENOMEM; | 738 | return -ENOMEM; |
751 | 739 | ||
@@ -753,10 +741,10 @@ err_ip_mib: | |||
753 | 741 | ||
754 | static void cleanup_ipv6_mibs(void) | 742 | static void cleanup_ipv6_mibs(void) |
755 | { | 743 | { |
756 | snmp6_mib_free((void **)ipv6_statistics); | 744 | snmp_mib_free((void **)ipv6_statistics); |
757 | snmp6_mib_free((void **)icmpv6_statistics); | 745 | snmp_mib_free((void **)icmpv6_statistics); |
758 | snmp6_mib_free((void **)udp_stats_in6); | 746 | snmp_mib_free((void **)udp_stats_in6); |
759 | snmp6_mib_free((void **)udplite_stats_in6); | 747 | snmp_mib_free((void **)udplite_stats_in6); |
760 | } | 748 | } |
761 | 749 | ||
762 | static int __init inet6_init(void) | 750 | static int __init inet6_init(void) |
@@ -929,6 +917,8 @@ static void __exit inet6_exit(void) | |||
929 | { | 917 | { |
930 | /* First of all disallow new sockets creation. */ | 918 | /* First of all disallow new sockets creation. */ |
931 | sock_unregister(PF_INET6); | 919 | sock_unregister(PF_INET6); |
920 | /* Disallow any further netlink messages */ | ||
921 | rtnl_unregister_all(PF_INET6); | ||
932 | 922 | ||
933 | /* Cleanup code parts. */ | 923 | /* Cleanup code parts. */ |
934 | ipv6_packet_cleanup(); | 924 | ipv6_packet_cleanup(); |