aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ipv6.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/ipv6.h')
-rw-r--r--include/net/ipv6.h271
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
247extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label); 247struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label);
248extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space, 248struct 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);
251extern void fl6_free_socklist(struct sock *sk); 251void fl6_free_socklist(struct sock *sk);
252extern int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen); 252int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen);
253extern int ip6_flowlabel_init(void); 253int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq);
254extern void ip6_flowlabel_cleanup(void); 254int ip6_flowlabel_init(void);
255void ip6_flowlabel_cleanup(void);
255 256
256static inline void fl6_sock_release(struct ip6_flowlabel *fl) 257static 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
262extern void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info); 263void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info);
263 264
264int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, 265int 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,
267struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb, 268struct 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
270extern int ip6_ra_control(struct sock *sk, int sel); 271int ip6_ra_control(struct sock *sk, int sel);
271 272
272extern int ipv6_parse_hopopts(struct sk_buff *skb); 273int ipv6_parse_hopopts(struct sk_buff *skb);
273 274
274extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt); 275struct ipv6_txoptions *ipv6_dup_options(struct sock *sk,
275extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt, 276 struct ipv6_txoptions *opt);
276 int newtype, 277struct 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);
279struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, 282struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
280 struct ipv6_txoptions *opt); 283 struct ipv6_txoptions *opt);
281 284
282extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb); 285bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb);
283 286
284static inline bool ipv6_accept_ra(struct inet6_dev *idev) 287static 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
309extern int __ipv6_addr_type(const struct in6_addr *addr); 312int __ipv6_addr_type(const struct in6_addr *addr);
310static inline int ipv6_addr_type(const struct in6_addr *addr) 313static 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() */
540static inline u32 ipv6_addr_jhash(const struct in6_addr *a) 543static 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
550static inline bool ipv6_addr_loopback(const struct in6_addr *a) 553static 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
659extern void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); 662void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt);
660 663
661extern int ip6_dst_hoplimit(struct dst_entry *dst); 664int 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
685extern int ipv6_rcv(struct sk_buff *skb, 688int 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
690extern int ip6_rcv_finish(struct sk_buff *skb); 691int ip6_rcv_finish(struct sk_buff *skb);
691 692
692/* 693/*
693 * upper-layer output functions 694 * upper-layer output functions
694 */ 695 */
695extern int ip6_xmit(struct sock *sk, 696int 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, 699int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr);
699 int tclass); 700
700 701int ip6_append_data(struct sock *sk,
701extern 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),
703extern 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, 708int ip6_push_pending_frames(struct sock *sk);
708 int hlimit, 709
709 int tclass, 710void ip6_flush_pending_frames(struct sock *sk);
710 struct ipv6_txoptions *opt, 711
711 struct flowi6 *fl6, 712int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi6 *fl6);
712 struct rt6_info *rt, 713struct 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 716struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
716extern int ip6_push_pending_frames(struct sock *sk); 717 const struct in6_addr *final_dst,
717 718 bool can_sleep);
718extern void ip6_flush_pending_frames(struct sock *sk); 719struct dst_entry *ip6_blackhole_route(struct net *net,
719 720 struct dst_entry *orig_dst);
720extern int ip6_dst_lookup(struct sock *sk,
721 struct dst_entry **dst,
722 struct flowi6 *fl6);
723extern 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);
727extern 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);
731extern 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
738extern int ip6_output(struct sk_buff *skb); 726int ip6_output(struct sk_buff *skb);
739extern int ip6_forward(struct sk_buff *skb); 727int ip6_forward(struct sk_buff *skb);
740extern int ip6_input(struct sk_buff *skb); 728int ip6_input(struct sk_buff *skb);
741extern int ip6_mc_input(struct sk_buff *skb); 729int ip6_mc_input(struct sk_buff *skb);
742 730
743extern int __ip6_local_out(struct sk_buff *skb); 731int __ip6_local_out(struct sk_buff *skb);
744extern int ip6_local_out(struct sk_buff *skb); 732int 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
750extern void ipv6_push_nfrag_opts(struct sk_buff *skb, 738void 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, 740void ipv6_push_frag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt,
753 struct in6_addr **daddr_p); 741 u8 *proto);
754extern void ipv6_push_frag_opts(struct sk_buff *skb,
755 struct ipv6_txoptions *opt,
756 u8 *proto);
757 742
758extern int ipv6_skip_exthdr(const struct sk_buff *, int start, 743int ipv6_skip_exthdr(const struct sk_buff *, int start, u8 *nexthdrp,
759 u8 *nexthdrp, __be16 *frag_offp); 744 __be16 *frag_offp);
760 745
761extern bool ipv6_ext_hdr(u8 nexthdr); 746bool ipv6_ext_hdr(u8 nexthdr);
762 747
763enum { 748enum {
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 */
770extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 755int 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
773extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); 758int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
774 759
775extern struct in6_addr *fl6_update_dst(struct flowi6 *fl6, 760struct 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
783extern int ipv6_setsockopt(struct sock *sk, int level, 768int ipv6_setsockopt(struct sock *sk, int level, int optname,
784 int optname, 769 char __user *optval, unsigned int optlen);
785 char __user *optval, 770int ipv6_getsockopt(struct sock *sk, int level, int optname,
786 unsigned int optlen); 771 char __user *optval, int __user *optlen);
787extern int ipv6_getsockopt(struct sock *sk, int level, 772int compat_ipv6_setsockopt(struct sock *sk, int level, int optname,
788 int optname, 773 char __user *optval, unsigned int optlen);
789 char __user *optval, 774int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
790 int __user *optlen); 775 char __user *optval, int __user *optlen);
791extern int compat_ipv6_setsockopt(struct sock *sk, 776
792 int level, 777int ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, int addr_len);
793 int optname, 778
794 char __user *optval, 779int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len);
795 unsigned int optlen); 780int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len);
796extern int compat_ipv6_getsockopt(struct sock *sk, 781void 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, 783void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info);
799 char __user *optval, 784void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu);
800 int __user *optlen); 785
801 786int inet6_release(struct socket *sock);
802extern int ip6_datagram_connect(struct sock *sk, 787int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
803 struct sockaddr *addr, int addr_len); 788int inet6_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len,
804 789 int peer);
805extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); 790int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
806extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len); 791
807extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, 792int inet6_hash_connect(struct inet_timewait_death_row *death_row,
808 u32 info, u8 *payload);
809extern void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info);
810extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu);
811
812extern int inet6_release(struct socket *sock);
813extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr,
814 int addr_len);
815extern int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
816 int *uaddr_len, int peer);
817extern int inet6_ioctl(struct socket *sock, unsigned int cmd,
818 unsigned long arg);
819
820extern 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;
829struct group_source_req; 801struct group_source_req;
830struct group_filter; 802struct group_filter;
831 803
832extern int ip6_mc_source(int add, int omode, struct sock *sk, 804int ip6_mc_source(int add, int omode, struct sock *sk,
833 struct group_source_req *pgsr); 805 struct group_source_req *pgsr);
834extern int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf); 806int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf);
835extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, 807int 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);
838extern 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
842extern int ac6_proc_init(struct net *net); 811int ac6_proc_init(struct net *net);
843extern void ac6_proc_exit(struct net *net); 812void ac6_proc_exit(struct net *net);
844extern int raw6_proc_init(void); 813int raw6_proc_init(void);
845extern void raw6_proc_exit(void); 814void raw6_proc_exit(void);
846extern int tcp6_proc_init(struct net *net); 815int tcp6_proc_init(struct net *net);
847extern void tcp6_proc_exit(struct net *net); 816void tcp6_proc_exit(struct net *net);
848extern int udp6_proc_init(struct net *net); 817int udp6_proc_init(struct net *net);
849extern void udp6_proc_exit(struct net *net); 818void udp6_proc_exit(struct net *net);
850extern int udplite6_proc_init(void); 819int udplite6_proc_init(void);
851extern void udplite6_proc_exit(void); 820void udplite6_proc_exit(void);
852extern int ipv6_misc_proc_init(void); 821int ipv6_misc_proc_init(void);
853extern void ipv6_misc_proc_exit(void); 822void ipv6_misc_proc_exit(void);
854extern int snmp6_register_dev(struct inet6_dev *idev); 823int snmp6_register_dev(struct inet6_dev *idev);
855extern int snmp6_unregister_dev(struct inet6_dev *idev); 824int snmp6_unregister_dev(struct inet6_dev *idev);
856 825
857#else 826#else
858static inline int ac6_proc_init(struct net *net) { return 0; } 827static 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; }
865extern struct ctl_table ipv6_route_table_template[]; 834extern struct ctl_table ipv6_route_table_template[];
866extern struct ctl_table ipv6_icmp_table_template[]; 835extern struct ctl_table ipv6_icmp_table_template[];
867 836
868extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net); 837struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
869extern struct ctl_table *ipv6_route_sysctl_init(struct net *net); 838struct ctl_table *ipv6_route_sysctl_init(struct net *net);
870extern int ipv6_sysctl_register(void); 839int ipv6_sysctl_register(void);
871extern void ipv6_sysctl_unregister(void); 840void ipv6_sysctl_unregister(void);
872#endif 841#endif
873 842
874#endif /* _NET_IPV6_H */ 843#endif /* _NET_IPV6_H */