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