Home | History | Annotate | Download | only in linux
      1 #ifndef _IPV6_H
      2 #define _IPV6_H
      3 
      4 #include <linux/types.h>
      5 #include <linux/in6.h>
      6 #include <asm/byteorder.h>
      7 
      8 /* The latest drafts declared increase in minimal mtu up to 1280. */
      9 
     10 #define IPV6_MIN_MTU	1280
     11 
     12 /*
     13  *	Advanced API
     14  *	source interface/address selection, source routing, etc...
     15  *	*under construction*
     16  */
     17 
     18 
     19 struct in6_pktinfo {
     20 	struct in6_addr	ipi6_addr;
     21 	int		ipi6_ifindex;
     22 };
     23 
     24 
     25 struct in6_ifreq {
     26 	struct in6_addr	ifr6_addr;
     27 	__u32		ifr6_prefixlen;
     28 	int		ifr6_ifindex;
     29 };
     30 
     31 #define IPV6_SRCRT_STRICT	0x01	/* Deprecated; will be removed */
     32 #define IPV6_SRCRT_TYPE_0	0	/* Deprecated; will be removed */
     33 #define IPV6_SRCRT_TYPE_2	2	/* IPv6 type 2 Routing Header	*/
     34 
     35 /*
     36  *	routing header
     37  */
     38 struct ipv6_rt_hdr {
     39 	__u8		nexthdr;
     40 	__u8		hdrlen;
     41 	__u8		type;
     42 	__u8		segments_left;
     43 
     44 	/*
     45 	 *	type specific data
     46 	 *	variable length field
     47 	 */
     48 };
     49 
     50 
     51 struct ipv6_opt_hdr {
     52 	__u8 		nexthdr;
     53 	__u8 		hdrlen;
     54 	/*
     55 	 * TLV encoded option data follows.
     56 	 */
     57 } __attribute__ ((packed));	/* required for some archs */
     58 
     59 #define ipv6_destopt_hdr ipv6_opt_hdr
     60 #define ipv6_hopopt_hdr  ipv6_opt_hdr
     61 
     62 
     63 /*
     64  *	routing header type 0 (used in cmsghdr struct)
     65  */
     66 
     67 struct rt0_hdr {
     68 	struct ipv6_rt_hdr	rt_hdr;
     69 	__u32			reserved;
     70 	struct in6_addr		addr[0];
     71 
     72 #define rt0_type		rt_hdr.type
     73 };
     74 
     75 /*
     76  *	routing header type 2
     77  */
     78 
     79 struct rt2_hdr {
     80 	struct ipv6_rt_hdr	rt_hdr;
     81 	__u32			reserved;
     82 	struct in6_addr		addr;
     83 
     84 #define rt2_type		rt_hdr.type
     85 };
     86 
     87 /*
     88  *	home address option in destination options header
     89  */
     90 
     91 struct ipv6_destopt_hao {
     92 	__u8			type;
     93 	__u8			length;
     94 	struct in6_addr		addr;
     95 } __attribute__ ((__packed__));
     96 
     97 /*
     98  *	IPv6 fixed header
     99  *
    100  *	BEWARE, it is incorrect. The first 4 bits of flow_lbl
    101  *	are glued to priority now, forming "class".
    102  */
    103 
    104 struct ipv6hdr {
    105 #if defined(__LITTLE_ENDIAN_BITFIELD)
    106 	__u8			priority:4,
    107 				version:4;
    108 #elif defined(__BIG_ENDIAN_BITFIELD)
    109 	__u8			version:4,
    110 				priority:4;
    111 #else
    112 #error	"Please fix <asm/byteorder.h>"
    113 #endif
    114 	__u8			flow_lbl[3];
    115 
    116 	__be16			payload_len;
    117 	__u8			nexthdr;
    118 	__u8			hop_limit;
    119 
    120 	struct	in6_addr	saddr;
    121 	struct	in6_addr	daddr;
    122 };
    123 
    124 
    125 /* index values for the variables in ipv6_devconf */
    126 enum {
    127 	DEVCONF_FORWARDING = 0,
    128 	DEVCONF_HOPLIMIT,
    129 	DEVCONF_MTU6,
    130 	DEVCONF_ACCEPT_RA,
    131 	DEVCONF_ACCEPT_REDIRECTS,
    132 	DEVCONF_AUTOCONF,
    133 	DEVCONF_DAD_TRANSMITS,
    134 	DEVCONF_RTR_SOLICITS,
    135 	DEVCONF_RTR_SOLICIT_INTERVAL,
    136 	DEVCONF_RTR_SOLICIT_DELAY,
    137 	DEVCONF_USE_TEMPADDR,
    138 	DEVCONF_TEMP_VALID_LFT,
    139 	DEVCONF_TEMP_PREFERED_LFT,
    140 	DEVCONF_REGEN_MAX_RETRY,
    141 	DEVCONF_MAX_DESYNC_FACTOR,
    142 	DEVCONF_MAX_ADDRESSES,
    143 	DEVCONF_FORCE_MLD_VERSION,
    144 	DEVCONF_ACCEPT_RA_DEFRTR,
    145 	DEVCONF_ACCEPT_RA_PINFO,
    146 	DEVCONF_ACCEPT_RA_RTR_PREF,
    147 	DEVCONF_RTR_PROBE_INTERVAL,
    148 	DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
    149 	DEVCONF_PROXY_NDP,
    150 	DEVCONF_OPTIMISTIC_DAD,
    151 	DEVCONF_ACCEPT_SOURCE_ROUTE,
    152 	DEVCONF_MC_FORWARDING,
    153 	DEVCONF_DISABLE_IPV6,
    154 	DEVCONF_ACCEPT_DAD,
    155 	DEVCONF_MAX
    156 };
    157 
    158 
    159 #endif /* _IPV6_H */
    160