diff options
Diffstat (limited to 'include/net/ipv6.h')
-rw-r--r-- | include/net/ipv6.h | 271 |
1 files changed, 120 insertions, 151 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index bbf1c8fb8511..2a5f668cd683 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -244,14 +244,15 @@ struct ipv6_fl_socklist { | |||
244 | struct rcu_head rcu; | 244 | struct rcu_head rcu; |
245 | }; | 245 | }; |
246 | 246 | ||
247 | extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label); | 247 | struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label); |
248 | extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space, | 248 | struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space, |
249 | struct ip6_flowlabel * fl, | 249 | struct ip6_flowlabel *fl, |
250 | struct ipv6_txoptions * fopt); | 250 | struct ipv6_txoptions *fopt); |
251 | extern void fl6_free_socklist(struct sock *sk); | 251 | void fl6_free_socklist(struct sock *sk); |
252 | extern int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen); | 252 | int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen); |
253 | extern int ip6_flowlabel_init(void); | 253 | int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq); |
254 | extern void ip6_flowlabel_cleanup(void); | 254 | int ip6_flowlabel_init(void); |
255 | void ip6_flowlabel_cleanup(void); | ||
255 | 256 | ||
256 | static inline void fl6_sock_release(struct ip6_flowlabel *fl) | 257 | static inline void fl6_sock_release(struct ip6_flowlabel *fl) |
257 | { | 258 | { |
@@ -259,7 +260,7 @@ static inline void fl6_sock_release(struct ip6_flowlabel *fl) | |||
259 | atomic_dec(&fl->users); | 260 | atomic_dec(&fl->users); |
260 | } | 261 | } |
261 | 262 | ||
262 | extern void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info); | 263 | void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info); |
263 | 264 | ||
264 | int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, | 265 | int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, |
265 | struct icmp6hdr *thdr, int len); | 266 | struct icmp6hdr *thdr, int len); |
@@ -267,19 +268,21 @@ int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, | |||
267 | struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb, | 268 | struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb, |
268 | struct sock *sk, struct flowi6 *fl6); | 269 | struct sock *sk, struct flowi6 *fl6); |
269 | 270 | ||
270 | extern int ip6_ra_control(struct sock *sk, int sel); | 271 | int ip6_ra_control(struct sock *sk, int sel); |
271 | 272 | ||
272 | extern int ipv6_parse_hopopts(struct sk_buff *skb); | 273 | int ipv6_parse_hopopts(struct sk_buff *skb); |
273 | 274 | ||
274 | extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt); | 275 | struct ipv6_txoptions *ipv6_dup_options(struct sock *sk, |
275 | extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt, | 276 | struct ipv6_txoptions *opt); |
276 | int newtype, | 277 | struct ipv6_txoptions *ipv6_renew_options(struct sock *sk, |
277 | struct ipv6_opt_hdr __user *newopt, | 278 | struct ipv6_txoptions *opt, |
278 | int newoptlen); | 279 | int newtype, |
280 | struct ipv6_opt_hdr __user *newopt, | ||
281 | int newoptlen); | ||
279 | struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, | 282 | struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, |
280 | struct ipv6_txoptions *opt); | 283 | struct ipv6_txoptions *opt); |
281 | 284 | ||
282 | extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb); | 285 | bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb); |
283 | 286 | ||
284 | static inline bool ipv6_accept_ra(struct inet6_dev *idev) | 287 | static inline bool ipv6_accept_ra(struct inet6_dev *idev) |
285 | { | 288 | { |
@@ -306,7 +309,7 @@ static inline int ip6_frag_mem(struct net *net) | |||
306 | #define IPV6_FRAG_LOW_THRESH (3 * 1024*1024) /* 3145728 */ | 309 | #define IPV6_FRAG_LOW_THRESH (3 * 1024*1024) /* 3145728 */ |
307 | #define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */ | 310 | #define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */ |
308 | 311 | ||
309 | extern int __ipv6_addr_type(const struct in6_addr *addr); | 312 | int __ipv6_addr_type(const struct in6_addr *addr); |
310 | static inline int ipv6_addr_type(const struct in6_addr *addr) | 313 | static inline int ipv6_addr_type(const struct in6_addr *addr) |
311 | { | 314 | { |
312 | return __ipv6_addr_type(addr) & 0xffff; | 315 | return __ipv6_addr_type(addr) & 0xffff; |
@@ -537,14 +540,14 @@ static inline u32 ipv6_addr_hash(const struct in6_addr *a) | |||
537 | } | 540 | } |
538 | 541 | ||
539 | /* more secured version of ipv6_addr_hash() */ | 542 | /* more secured version of ipv6_addr_hash() */ |
540 | static inline u32 ipv6_addr_jhash(const struct in6_addr *a) | 543 | static inline u32 __ipv6_addr_jhash(const struct in6_addr *a, const u32 initval) |
541 | { | 544 | { |
542 | u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1]; | 545 | u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1]; |
543 | 546 | ||
544 | return jhash_3words(v, | 547 | return jhash_3words(v, |
545 | (__force u32)a->s6_addr32[2], | 548 | (__force u32)a->s6_addr32[2], |
546 | (__force u32)a->s6_addr32[3], | 549 | (__force u32)a->s6_addr32[3], |
547 | ipv6_hash_secret); | 550 | initval); |
548 | } | 551 | } |
549 | 552 | ||
550 | static inline bool ipv6_addr_loopback(const struct in6_addr *a) | 553 | static inline bool ipv6_addr_loopback(const struct in6_addr *a) |
@@ -656,9 +659,9 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add | |||
656 | return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); | 659 | return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); |
657 | } | 660 | } |
658 | 661 | ||
659 | extern void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); | 662 | void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); |
660 | 663 | ||
661 | extern int ip6_dst_hoplimit(struct dst_entry *dst); | 664 | int ip6_dst_hoplimit(struct dst_entry *dst); |
662 | 665 | ||
663 | /* | 666 | /* |
664 | * Header manipulation | 667 | * Header manipulation |
@@ -682,83 +685,65 @@ static inline __be32 ip6_flowinfo(const struct ipv6hdr *hdr) | |||
682 | * rcv function (called from netdevice level) | 685 | * rcv function (called from netdevice level) |
683 | */ | 686 | */ |
684 | 687 | ||
685 | extern int ipv6_rcv(struct sk_buff *skb, | 688 | int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, |
686 | struct net_device *dev, | 689 | struct packet_type *pt, struct net_device *orig_dev); |
687 | struct packet_type *pt, | ||
688 | struct net_device *orig_dev); | ||
689 | 690 | ||
690 | extern int ip6_rcv_finish(struct sk_buff *skb); | 691 | int ip6_rcv_finish(struct sk_buff *skb); |
691 | 692 | ||
692 | /* | 693 | /* |
693 | * upper-layer output functions | 694 | * upper-layer output functions |
694 | */ | 695 | */ |
695 | extern int ip6_xmit(struct sock *sk, | 696 | int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6, |
696 | struct sk_buff *skb, | 697 | struct ipv6_txoptions *opt, int tclass); |
697 | struct flowi6 *fl6, | 698 | |
698 | struct ipv6_txoptions *opt, | 699 | int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr); |
699 | int tclass); | 700 | |
700 | 701 | int ip6_append_data(struct sock *sk, | |
701 | extern int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr); | 702 | int getfrag(void *from, char *to, int offset, int len, |
702 | 703 | int odd, struct sk_buff *skb), | |
703 | extern int ip6_append_data(struct sock *sk, | 704 | void *from, int length, int transhdrlen, int hlimit, |
704 | int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), | 705 | int tclass, struct ipv6_txoptions *opt, struct flowi6 *fl6, |
705 | void *from, | 706 | struct rt6_info *rt, unsigned int flags, int dontfrag); |
706 | int length, | 707 | |
707 | int transhdrlen, | 708 | int ip6_push_pending_frames(struct sock *sk); |
708 | int hlimit, | 709 | |
709 | int tclass, | 710 | void ip6_flush_pending_frames(struct sock *sk); |
710 | struct ipv6_txoptions *opt, | 711 | |
711 | struct flowi6 *fl6, | 712 | int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi6 *fl6); |
712 | struct rt6_info *rt, | 713 | struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, |
713 | unsigned int flags, | 714 | const struct in6_addr *final_dst, |
714 | int dontfrag); | 715 | bool can_sleep); |
715 | 716 | struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, | |
716 | extern int ip6_push_pending_frames(struct sock *sk); | 717 | const struct in6_addr *final_dst, |
717 | 718 | bool can_sleep); | |
718 | extern void ip6_flush_pending_frames(struct sock *sk); | 719 | struct dst_entry *ip6_blackhole_route(struct net *net, |
719 | 720 | struct dst_entry *orig_dst); | |
720 | extern int ip6_dst_lookup(struct sock *sk, | ||
721 | struct dst_entry **dst, | ||
722 | struct flowi6 *fl6); | ||
723 | extern struct dst_entry * ip6_dst_lookup_flow(struct sock *sk, | ||
724 | struct flowi6 *fl6, | ||
725 | const struct in6_addr *final_dst, | ||
726 | bool can_sleep); | ||
727 | extern struct dst_entry * ip6_sk_dst_lookup_flow(struct sock *sk, | ||
728 | struct flowi6 *fl6, | ||
729 | const struct in6_addr *final_dst, | ||
730 | bool can_sleep); | ||
731 | extern struct dst_entry * ip6_blackhole_route(struct net *net, | ||
732 | struct dst_entry *orig_dst); | ||
733 | 721 | ||
734 | /* | 722 | /* |
735 | * skb processing functions | 723 | * skb processing functions |
736 | */ | 724 | */ |
737 | 725 | ||
738 | extern int ip6_output(struct sk_buff *skb); | 726 | int ip6_output(struct sk_buff *skb); |
739 | extern int ip6_forward(struct sk_buff *skb); | 727 | int ip6_forward(struct sk_buff *skb); |
740 | extern int ip6_input(struct sk_buff *skb); | 728 | int ip6_input(struct sk_buff *skb); |
741 | extern int ip6_mc_input(struct sk_buff *skb); | 729 | int ip6_mc_input(struct sk_buff *skb); |
742 | 730 | ||
743 | extern int __ip6_local_out(struct sk_buff *skb); | 731 | int __ip6_local_out(struct sk_buff *skb); |
744 | extern int ip6_local_out(struct sk_buff *skb); | 732 | int ip6_local_out(struct sk_buff *skb); |
745 | 733 | ||
746 | /* | 734 | /* |
747 | * Extension header (options) processing | 735 | * Extension header (options) processing |
748 | */ | 736 | */ |
749 | 737 | ||
750 | extern void ipv6_push_nfrag_opts(struct sk_buff *skb, | 738 | void ipv6_push_nfrag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt, |
751 | struct ipv6_txoptions *opt, | 739 | u8 *proto, struct in6_addr **daddr_p); |
752 | u8 *proto, | 740 | void ipv6_push_frag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt, |
753 | struct in6_addr **daddr_p); | 741 | u8 *proto); |
754 | extern void ipv6_push_frag_opts(struct sk_buff *skb, | ||
755 | struct ipv6_txoptions *opt, | ||
756 | u8 *proto); | ||
757 | 742 | ||
758 | extern int ipv6_skip_exthdr(const struct sk_buff *, int start, | 743 | int ipv6_skip_exthdr(const struct sk_buff *, int start, u8 *nexthdrp, |
759 | u8 *nexthdrp, __be16 *frag_offp); | 744 | __be16 *frag_offp); |
760 | 745 | ||
761 | extern bool ipv6_ext_hdr(u8 nexthdr); | 746 | bool ipv6_ext_hdr(u8 nexthdr); |
762 | 747 | ||
763 | enum { | 748 | enum { |
764 | IP6_FH_F_FRAG = (1 << 0), | 749 | IP6_FH_F_FRAG = (1 << 0), |
@@ -767,57 +752,44 @@ enum { | |||
767 | }; | 752 | }; |
768 | 753 | ||
769 | /* find specified header and get offset to it */ | 754 | /* find specified header and get offset to it */ |
770 | extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, | 755 | int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, int target, |
771 | int target, unsigned short *fragoff, int *fragflg); | 756 | unsigned short *fragoff, int *fragflg); |
772 | 757 | ||
773 | extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); | 758 | int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); |
774 | 759 | ||
775 | extern struct in6_addr *fl6_update_dst(struct flowi6 *fl6, | 760 | struct in6_addr *fl6_update_dst(struct flowi6 *fl6, |
776 | const struct ipv6_txoptions *opt, | 761 | const struct ipv6_txoptions *opt, |
777 | struct in6_addr *orig); | 762 | struct in6_addr *orig); |
778 | 763 | ||
779 | /* | 764 | /* |
780 | * socket options (ipv6_sockglue.c) | 765 | * socket options (ipv6_sockglue.c) |
781 | */ | 766 | */ |
782 | 767 | ||
783 | extern int ipv6_setsockopt(struct sock *sk, int level, | 768 | int ipv6_setsockopt(struct sock *sk, int level, int optname, |
784 | int optname, | 769 | char __user *optval, unsigned int optlen); |
785 | char __user *optval, | 770 | int ipv6_getsockopt(struct sock *sk, int level, int optname, |
786 | unsigned int optlen); | 771 | char __user *optval, int __user *optlen); |
787 | extern int ipv6_getsockopt(struct sock *sk, int level, | 772 | int compat_ipv6_setsockopt(struct sock *sk, int level, int optname, |
788 | int optname, | 773 | char __user *optval, unsigned int optlen); |
789 | char __user *optval, | 774 | int compat_ipv6_getsockopt(struct sock *sk, int level, int optname, |
790 | int __user *optlen); | 775 | char __user *optval, int __user *optlen); |
791 | extern int compat_ipv6_setsockopt(struct sock *sk, | 776 | |
792 | int level, | 777 | int ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, int addr_len); |
793 | int optname, | 778 | |
794 | char __user *optval, | 779 | int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); |
795 | unsigned int optlen); | 780 | int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len); |
796 | extern int compat_ipv6_getsockopt(struct sock *sk, | 781 | void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, |
797 | int level, | 782 | u32 info, u8 *payload); |
798 | int optname, | 783 | void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info); |
799 | char __user *optval, | 784 | void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu); |
800 | int __user *optlen); | 785 | |
801 | 786 | int inet6_release(struct socket *sock); | |
802 | extern int ip6_datagram_connect(struct sock *sk, | 787 | int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len); |
803 | struct sockaddr *addr, int addr_len); | 788 | int inet6_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, |
804 | 789 | int peer); | |
805 | extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); | 790 | int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); |
806 | extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len); | 791 | |
807 | extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, | 792 | int inet6_hash_connect(struct inet_timewait_death_row *death_row, |
808 | u32 info, u8 *payload); | ||
809 | extern void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info); | ||
810 | extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu); | ||
811 | |||
812 | extern int inet6_release(struct socket *sock); | ||
813 | extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr, | ||
814 | int addr_len); | ||
815 | extern int inet6_getname(struct socket *sock, struct sockaddr *uaddr, | ||
816 | int *uaddr_len, int peer); | ||
817 | extern int inet6_ioctl(struct socket *sock, unsigned int cmd, | ||
818 | unsigned long arg); | ||
819 | |||
820 | extern int inet6_hash_connect(struct inet_timewait_death_row *death_row, | ||
821 | struct sock *sk); | 793 | struct sock *sk); |
822 | 794 | ||
823 | /* | 795 | /* |
@@ -829,30 +801,27 @@ extern const struct proto_ops inet6_dgram_ops; | |||
829 | struct group_source_req; | 801 | struct group_source_req; |
830 | struct group_filter; | 802 | struct group_filter; |
831 | 803 | ||
832 | extern int ip6_mc_source(int add, int omode, struct sock *sk, | 804 | int ip6_mc_source(int add, int omode, struct sock *sk, |
833 | struct group_source_req *pgsr); | 805 | struct group_source_req *pgsr); |
834 | extern int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf); | 806 | int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf); |
835 | extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, | 807 | int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, |
836 | struct group_filter __user *optval, | 808 | struct group_filter __user *optval, int __user *optlen); |
837 | int __user *optlen); | ||
838 | extern unsigned int inet6_hash_frag(__be32 id, const struct in6_addr *saddr, | ||
839 | const struct in6_addr *daddr, u32 rnd); | ||
840 | 809 | ||
841 | #ifdef CONFIG_PROC_FS | 810 | #ifdef CONFIG_PROC_FS |
842 | extern int ac6_proc_init(struct net *net); | 811 | int ac6_proc_init(struct net *net); |
843 | extern void ac6_proc_exit(struct net *net); | 812 | void ac6_proc_exit(struct net *net); |
844 | extern int raw6_proc_init(void); | 813 | int raw6_proc_init(void); |
845 | extern void raw6_proc_exit(void); | 814 | void raw6_proc_exit(void); |
846 | extern int tcp6_proc_init(struct net *net); | 815 | int tcp6_proc_init(struct net *net); |
847 | extern void tcp6_proc_exit(struct net *net); | 816 | void tcp6_proc_exit(struct net *net); |
848 | extern int udp6_proc_init(struct net *net); | 817 | int udp6_proc_init(struct net *net); |
849 | extern void udp6_proc_exit(struct net *net); | 818 | void udp6_proc_exit(struct net *net); |
850 | extern int udplite6_proc_init(void); | 819 | int udplite6_proc_init(void); |
851 | extern void udplite6_proc_exit(void); | 820 | void udplite6_proc_exit(void); |
852 | extern int ipv6_misc_proc_init(void); | 821 | int ipv6_misc_proc_init(void); |
853 | extern void ipv6_misc_proc_exit(void); | 822 | void ipv6_misc_proc_exit(void); |
854 | extern int snmp6_register_dev(struct inet6_dev *idev); | 823 | int snmp6_register_dev(struct inet6_dev *idev); |
855 | extern int snmp6_unregister_dev(struct inet6_dev *idev); | 824 | int snmp6_unregister_dev(struct inet6_dev *idev); |
856 | 825 | ||
857 | #else | 826 | #else |
858 | static inline int ac6_proc_init(struct net *net) { return 0; } | 827 | static inline int ac6_proc_init(struct net *net) { return 0; } |
@@ -865,10 +834,10 @@ static inline int snmp6_unregister_dev(struct inet6_dev *idev) { return 0; } | |||
865 | extern struct ctl_table ipv6_route_table_template[]; | 834 | extern struct ctl_table ipv6_route_table_template[]; |
866 | extern struct ctl_table ipv6_icmp_table_template[]; | 835 | extern struct ctl_table ipv6_icmp_table_template[]; |
867 | 836 | ||
868 | extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net); | 837 | struct ctl_table *ipv6_icmp_sysctl_init(struct net *net); |
869 | extern struct ctl_table *ipv6_route_sysctl_init(struct net *net); | 838 | struct ctl_table *ipv6_route_sysctl_init(struct net *net); |
870 | extern int ipv6_sysctl_register(void); | 839 | int ipv6_sysctl_register(void); |
871 | extern void ipv6_sysctl_unregister(void); | 840 | void ipv6_sysctl_unregister(void); |
872 | #endif | 841 | #endif |
873 | 842 | ||
874 | #endif /* _NET_IPV6_H */ | 843 | #endif /* _NET_IPV6_H */ |