The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/ip/ipv6.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Internet Protocol Version 6
    3  *
    4  * rfc2460 defines the protocol, rfc2461 neighbour discovery, and
    5  * rfc2462 address autoconfiguration.  rfc4443 defines ICMP; was rfc2463.
    6  * rfc4291 defines the address architecture (including prefices), was rfc3513.
    7  * rfc4007 defines the scoped address architecture.
    8  *
    9  * global unicast is anything but unspecified (::), loopback (::1),
   10  * multicast (ff00::/8), and link-local unicast (fe80::/10).
   11  *
   12  * site-local (fec0::/10) is now deprecated, originally by rfc3879.
   13  *
   14  * Unique Local IPv6 Unicast Addresses are defined by rfc4193.
   15  * prefix is fc00::/7, scope is global, routing is limited to roughly a site.
   16  */
   17 #define isv6mcast(addr)   ((addr)[0] == 0xff)
   18 #define islinklocal(addr) ((addr)[0] == 0xfe && ((addr)[1] & 0xc0) == 0x80)
   19 
   20 #define optexsts(np)    (nhgets((np)->ploadlen) > 24)
   21 #define issmcast(addr)  (memcmp((addr), v6solicitednode, 13) == 0)
   22 
   23 #ifndef MIN
   24 #define MIN(a, b) ((a) <= (b)? (a): (b))
   25 #endif
   26 
   27 enum {                          /* Header Types */
   28         HBH             = 0,    /* hop-by-hop multicast routing protocol */
   29         ICMP            = 1,
   30         IGMP            = 2,
   31         GGP             = 3,
   32         IPINIP          = 4,
   33         ST              = 5,
   34         TCP             = 6,
   35         UDP             = 17,
   36         ISO_TP4         = 29,
   37         RH              = 43,
   38         FH              = 44,
   39         IDRP            = 45,
   40         RSVP            = 46,
   41         AH              = 51,
   42         ESP             = 52,
   43         ICMPv6          = 58,
   44         NNH             = 59,
   45         DOH             = 60,
   46         ISO_IP          = 80,
   47         IGRP            = 88,
   48         OSPF            = 89,
   49 
   50         Maxhdrtype      = 256,
   51 };
   52 
   53 enum {
   54         /* multicast flags and scopes */
   55 
   56 //      Well_known_flg  = 0,
   57 //      Transient_flg   = 1,
   58 
   59 //      Interface_local_scop = 1,
   60         Link_local_scop = 2,
   61 //      Site_local_scop = 5,
   62 //      Org_local_scop  = 8,
   63         Global_scop     = 14,
   64 
   65         /* various prefix lengths */
   66         SOLN_PREF_LEN   = 13,
   67 
   68         /* icmpv6 unreachability codes */
   69         Icmp6_no_route          = 0,
   70         Icmp6_ad_prohib         = 1,
   71         Icmp6_out_src_scope     = 2,
   72         Icmp6_adr_unreach       = 3,
   73         Icmp6_port_unreach      = 4,
   74         Icmp6_gress_src_fail    = 5,
   75         Icmp6_rej_route         = 6,
   76         Icmp6_unknown           = 7,  /* our own invention for internal use */
   77 
   78         /* various flags & constants */
   79         v6MINTU         = 1280,
   80         HOP_LIMIT       = 255,
   81         IP6HDR          = 20,           /* sizeof(Ip6hdr) */
   82 
   83         /* option types */
   84 
   85         /* neighbour discovery */
   86         SRC_LLADDR      = 1,
   87         TARGET_LLADDR   = 2,
   88         PREFIX_INFO     = 3,
   89         REDIR_HEADER    = 4,
   90         MTU_OPTION      = 5,
   91         /* new since rfc2461; see iana.org/assignments/icmpv6-parameters */
   92         V6nd_home       = 8,
   93         V6nd_srcaddrs   = 9,            /* rfc3122 */
   94         V6nd_ip         = 17,
   95         /* /lib/rfc/drafts/draft-jeong-dnsop-ipv6-dns-discovery-12.txt */
   96         V6nd_rdns       = 25,
   97         /* plan 9 extensions */
   98         V6nd_9fs        = 250,
   99         V6nd_9auth      = 251,
  100 
  101         SRC_UNSPEC      = 0,
  102         SRC_UNI         = 1,
  103         TARG_UNI        = 2,
  104         TARG_MULTI      = 3,
  105 
  106         Tunitent        = 1,
  107         Tuniproxy       = 2,
  108         Tunirany        = 3,
  109 
  110         /* Node constants */
  111         MAX_MULTICAST_SOLICIT   = 3,
  112         RETRANS_TIMER           = 1000,
  113 };
  114 
  115 typedef struct Ip6hdr   Ip6hdr;
  116 typedef struct Opthdr   Opthdr;
  117 typedef struct Routinghdr Routinghdr;
  118 typedef struct Fraghdr6 Fraghdr6;
  119 
  120 struct  Ip6hdr {
  121         uchar   vcf[4];         /* version:4, traffic class:8, flow label:20 */
  122         uchar   ploadlen[2];    /* payload length: packet length - 40 */
  123         uchar   proto;          /* next header type */
  124         uchar   ttl;            /* hop limit */
  125         uchar   src[IPaddrlen];
  126         uchar   dst[IPaddrlen];
  127 };
  128 
  129 struct  Opthdr {
  130         uchar   nexthdr;
  131         uchar   len;
  132 };
  133 
  134 /*
  135  * Beware routing header type 0 (loose source routing); see
  136  * http://www.secdev.org/conf/IPv6_RH_security-csw07.pdf.
  137  * Type 1 is unused.  Type 2 is for MIPv6 (mobile IPv6) filtering
  138  * against type 0 header.
  139  */
  140 struct  Routinghdr {
  141         uchar   nexthdr;
  142         uchar   len;
  143         uchar   rtetype;
  144         uchar   segrem;
  145 };
  146 
  147 struct  Fraghdr6 {
  148         uchar   nexthdr;
  149         uchar   res;
  150         uchar   offsetRM[2];    /* Offset, Res, M flag */
  151         uchar   id[4];
  152 };
  153 
  154 extern uchar v6allnodesN[IPaddrlen];
  155 extern uchar v6allnodesL[IPaddrlen];
  156 extern uchar v6allroutersN[IPaddrlen];
  157 extern uchar v6allroutersL[IPaddrlen];
  158 extern uchar v6allnodesNmask[IPaddrlen];
  159 extern uchar v6allnodesLmask[IPaddrlen];
  160 extern uchar v6solicitednode[IPaddrlen];
  161 extern uchar v6solicitednodemask[IPaddrlen];
  162 extern uchar v6Unspecified[IPaddrlen];
  163 extern uchar v6loopback[IPaddrlen];
  164 extern uchar v6loopbackmask[IPaddrlen];
  165 extern uchar v6linklocal[IPaddrlen];
  166 extern uchar v6linklocalmask[IPaddrlen];
  167 extern uchar v6multicast[IPaddrlen];
  168 extern uchar v6multicastmask[IPaddrlen];
  169 
  170 extern int v6llpreflen;
  171 extern int v6mcpreflen;
  172 extern int v6snpreflen;
  173 extern int v6aNpreflen;
  174 extern int v6aLpreflen;
  175 
  176 extern int ReTransTimer;
  177 
  178 void ipv62smcast(uchar *, uchar *);
  179 void icmpns(Fs *f, uchar* src, int suni, uchar* targ, int tuni, uchar* mac);
  180 void icmpna(Fs *f, uchar* src, uchar* dst, uchar* targ, uchar* mac, uchar flags);
  181 void icmpttlexceeded6(Fs *f, Ipifc *ifc, Block *bp);
  182 void icmppkttoobig6(Fs *f, Ipifc *ifc, Block *bp);
  183 void icmphostunr(Fs *f, Ipifc *ifc, Block *bp, int code, int free);

Cache object: f8cb10dc21b6fdf8ab8358cf45858a9c


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.