~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/net/if_inet6.h

Version: ~ [ linux-5.12-rc7 ] ~ [ linux-5.11.13 ] ~ [ linux-5.10.29 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.111 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.186 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.230 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.266 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.266 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  *      inet6 interface/address list definitions
  3  *      Linux INET6 implementation 
  4  *
  5  *      Authors:
  6  *      Pedro Roque             <pedro_m@yahoo.com>     
  7  *
  8  *
  9  *      This program is free software; you can redistribute it and/or
 10  *      modify it under the terms of the GNU General Public License
 11  *      as published by the Free Software Foundation; either version
 12  *      2 of the License, or (at your option) any later version.
 13  */
 14 
 15 #ifndef _NET_IF_INET6_H
 16 #define _NET_IF_INET6_H
 17 
 18 #include <linux/ipv6.h>
 19 
 20 #define IF_RA_OTHERCONF 0x80
 21 #define IF_RA_MANAGED   0x40
 22 #define IF_RA_RCVD      0x20
 23 #define IF_RS_SENT      0x10
 24 
 25 #ifdef __KERNEL__
 26 
 27 struct inet6_ifaddr 
 28 {
 29         struct in6_addr         addr;
 30         __u32                   prefix_len;
 31         
 32         __u32                   valid_lft;
 33         __u32                   prefered_lft;
 34         unsigned long           tstamp;
 35         atomic_t                refcnt;
 36         spinlock_t              lock;
 37 
 38         __u8                    probes;
 39         __u8                    flags;
 40 
 41         __u16                   scope;
 42 
 43         struct timer_list       timer;
 44 
 45         struct inet6_dev        *idev;
 46 
 47         struct inet6_ifaddr     *lst_next;      /* next addr in addr_lst */
 48         struct inet6_ifaddr     *if_next;       /* next addr in inet6_dev */
 49 
 50         int                     dead;
 51 };
 52 
 53 struct ip6_sf_socklist
 54 {
 55         unsigned int            sl_max;
 56         unsigned int            sl_count;
 57         struct in6_addr         sl_addr[0];
 58 };
 59 
 60 #define IP6_SFLSIZE(count)      (sizeof(struct ip6_sf_socklist) + \
 61         (count) * sizeof(struct in6_addr))
 62 
 63 #define IP6_SFBLOCK     10      /* allocate this many at once */
 64 
 65 struct ipv6_mc_socklist
 66 {
 67         struct in6_addr         addr;
 68         int                     ifindex;
 69         struct ipv6_mc_socklist *next;
 70         unsigned int            sfmode;         /* MCAST_{INCLUDE,EXCLUDE} */
 71         struct ip6_sf_socklist  *sflist;
 72 };
 73 
 74 struct ip6_sf_list
 75 {
 76         struct ip6_sf_list      *sf_next;
 77         struct in6_addr         sf_addr;
 78         unsigned long           sf_count[2];    /* include/exclude counts */
 79         unsigned char           sf_gsresp;      /* include in g & s response? */
 80         unsigned char           sf_oldin;       /* change state */
 81         unsigned char           sf_crcount;     /* retrans. left to send */
 82 };
 83 
 84 #define MAF_TIMER_RUNNING       0x01
 85 #define MAF_LAST_REPORTER       0x02
 86 #define MAF_LOADED              0x04
 87 #define MAF_NOREPORT            0x08
 88 #define MAF_GSQUERY             0x10
 89 
 90 struct ifmcaddr6
 91 {
 92         struct in6_addr         mca_addr;
 93         struct inet6_dev        *idev;
 94         struct ifmcaddr6        *next;
 95         struct ip6_sf_list      *mca_sources;
 96         struct ip6_sf_list      *mca_tomb;
 97         unsigned int            mca_sfmode;
 98         unsigned long           mca_sfcount[2];
 99         struct timer_list       mca_timer;
100         unsigned                mca_flags;
101         int                     mca_users;
102         atomic_t                mca_refcnt;
103         spinlock_t              mca_lock;
104         unsigned char           mca_crcount;
105 };
106 
107 /* Anycast stuff */
108 
109 struct ipv6_ac_socklist
110 {
111         struct in6_addr         acl_addr;
112         int                     acl_ifindex;
113         struct ipv6_ac_socklist *acl_next;
114 };
115 
116 struct ifacaddr6
117 {
118         struct in6_addr         aca_addr;
119         struct inet6_dev        *aca_idev;
120         struct ifacaddr6        *aca_next;
121         int                     aca_users;
122         atomic_t                aca_refcnt;
123         spinlock_t              aca_lock;
124 };
125 
126 #define IFA_HOST        IPV6_ADDR_LOOPBACK
127 #define IFA_LINK        IPV6_ADDR_LINKLOCAL
128 #define IFA_SITE        IPV6_ADDR_SITELOCAL
129 #define IFA_GLOBAL      0x0000U
130 
131 struct inet6_dev 
132 {
133         struct net_device               *dev;
134 
135         struct inet6_ifaddr     *addr_list;
136 
137         struct ifmcaddr6        *mc_list;
138         struct ifmcaddr6        *mc_tomb;
139         rwlock_t                mc_lock;
140         unsigned long           mc_v1_seen;
141         unsigned long           mc_maxdelay;
142         unsigned char           mc_qrv;
143         unsigned char           mc_gq_running;
144         unsigned char           mc_ifc_count;
145         struct timer_list       mc_gq_timer;    /* general query timer */
146         struct timer_list       mc_ifc_timer;   /* interface change timer */
147 
148         struct ifacaddr6        *ac_list;
149         rwlock_t                lock;
150         atomic_t                refcnt;
151         __u32                   if_flags;
152         int                     dead;
153 
154         struct neigh_parms      *nd_parms;
155         struct inet6_dev        *next;
156         struct ipv6_devconf     cnf;
157 };
158 
159 extern struct ipv6_devconf ipv6_devconf;
160 
161 static inline void ipv6_eth_mc_map(struct in6_addr *addr, char *buf)
162 {
163         /*
164          *      +-------+-------+-------+-------+-------+-------+
165          *      |   33  |   33  | DST13 | DST14 | DST15 | DST16 |
166          *      +-------+-------+-------+-------+-------+-------+
167          */
168 
169         buf[0]= 0x33;
170         buf[1]= 0x33;
171 
172         memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32));
173 }
174 
175 static inline void ipv6_tr_mc_map(struct in6_addr *addr, char *buf)
176 {
177         /* All nodes FF01::1, FF02::1, FF02::1:FFxx:xxxx */
178 
179         if (((addr->s6_addr[0] == 0xFF) &&
180             ((addr->s6_addr[1] == 0x01) || (addr->s6_addr[1] == 0x02)) &&
181              (addr->s6_addr16[1] == 0) &&
182              (addr->s6_addr32[1] == 0) &&
183              (addr->s6_addr32[2] == 0) &&
184              (addr->s6_addr16[6] == 0) &&
185              (addr->s6_addr[15] == 1)) ||
186             ((addr->s6_addr[0] == 0xFF) &&
187              (addr->s6_addr[1] == 0x02) &&
188              (addr->s6_addr16[1] == 0) &&
189              (addr->s6_addr32[1] == 0) &&
190              (addr->s6_addr16[4] == 0) &&
191              (addr->s6_addr[10] == 0) &&
192              (addr->s6_addr[11] == 1) &&
193              (addr->s6_addr[12] == 0xff)))
194         {
195                 buf[0]=0xC0;
196                 buf[1]=0x00;
197                 buf[2]=0x01;
198                 buf[3]=0x00;
199                 buf[4]=0x00;
200                 buf[5]=0x00;
201         /* All routers FF0x::2 */
202         } else if ((addr->s6_addr[0] ==0xff) &&
203                 ((addr->s6_addr[1] & 0xF0) == 0) &&
204                 (addr->s6_addr16[1] == 0) &&
205                 (addr->s6_addr32[1] == 0) &&
206                 (addr->s6_addr32[2] == 0) &&
207                 (addr->s6_addr16[6] == 0) &&
208                 (addr->s6_addr[15] == 2))
209         {
210                 buf[0]=0xC0;
211                 buf[1]=0x00;
212                 buf[2]=0x02;
213                 buf[3]=0x00;
214                 buf[4]=0x00;
215                 buf[5]=0x00;
216         } else {
217                 unsigned char i ; 
218                 
219                 i = addr->s6_addr[15] & 7 ; 
220                 buf[0]=0xC0;
221                 buf[1]=0x00;
222                 buf[2]=0x00;
223                 buf[3]=0x01 << i ; 
224                 buf[4]=0x00;
225                 buf[5]=0x00;
226         }
227 }
228 
229 static inline void ipv6_arcnet_mc_map(const struct in6_addr *addr, char *buf)
230 {
231         buf[0] = 0x00;
232 }
233 #endif
234 #endif
235 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp