10 |
|
* 2. Redistributions in binary form must reproduce the above copyright |
11 |
|
* notice, this list of conditions and the following disclaimer in the |
12 |
|
* documentation and/or other materials provided with the distribution. |
13 |
< |
* 3. All advertising materials mentioning features or use of this software |
14 |
< |
* must display the following acknowledgement: |
15 |
< |
* This product includes software developed by the University of |
16 |
< |
* California, Berkeley and its contributors. |
17 |
< |
* 4. Neither the name of the University nor the names of its contributors |
13 |
> |
* 3. Neither the name of the University nor the names of its contributors |
14 |
|
* may be used to endorse or promote products derived from this software |
15 |
|
* without specific prior written permission. |
16 |
|
* |
71 |
|
|
72 |
|
/* |
73 |
|
* Structure of an internet header, naked of options. |
78 |
– |
* |
79 |
– |
* We declare ip_len and ip_off to be short, rather than u_short |
80 |
– |
* pragmatically since otherwise unsigned comparisons can result |
81 |
– |
* against negative integers quite easily, and fail in subtle ways. |
74 |
|
*/ |
75 |
+ |
#ifdef PRAGMA_PACK_SUPPORTED |
76 |
+ |
#pragma pack(1) |
77 |
+ |
#endif |
78 |
+ |
|
79 |
|
struct ip { |
80 |
|
#ifdef WORDS_BIGENDIAN |
81 |
< |
u_int ip_v:4, /* version */ |
81 |
> |
u_char ip_v:4, /* version */ |
82 |
|
ip_hl:4; /* header length */ |
83 |
|
#else |
84 |
< |
u_int ip_hl:4, /* header length */ |
84 |
> |
u_char ip_hl:4, /* header length */ |
85 |
|
ip_v:4; /* version */ |
86 |
|
#endif |
87 |
|
u_int8_t ip_tos; /* type of service */ |
88 |
< |
int16_t ip_len; /* total length */ |
88 |
> |
u_int16_t ip_len; /* total length */ |
89 |
|
u_int16_t ip_id; /* identification */ |
90 |
< |
int16_t ip_off; /* fragment offset field */ |
90 |
> |
u_int16_t ip_off; /* fragment offset field */ |
91 |
|
#define IP_DF 0x4000 /* don't fragment flag */ |
92 |
|
#define IP_MF 0x2000 /* more fragments flag */ |
93 |
|
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ |
95 |
|
u_int8_t ip_p; /* protocol */ |
96 |
|
u_int16_t ip_sum; /* checksum */ |
97 |
|
struct in_addr ip_src,ip_dst; /* source and dest address */ |
98 |
< |
}; |
98 |
> |
} PACKED__; |
99 |
> |
|
100 |
> |
#ifdef PRAGMA_PACK_SUPPORTED |
101 |
> |
#pragma pack(0) |
102 |
> |
#endif |
103 |
|
|
104 |
|
#define IP_MAXPACKET 65535 /* maximum packet size */ |
105 |
|
|
143 |
|
/* |
144 |
|
* Time stamp option structure. |
145 |
|
*/ |
146 |
+ |
#ifdef PRAGMA_PACK_SUPPORTED |
147 |
+ |
#pragma pack(1) |
148 |
+ |
#endif |
149 |
+ |
|
150 |
|
struct ip_timestamp { |
151 |
|
u_int8_t ipt_code; /* IPOPT_TS */ |
152 |
|
u_int8_t ipt_len; /* size of structure (variable) */ |
153 |
|
u_int8_t ipt_ptr; /* index of current entry */ |
154 |
|
#ifdef WORDS_BIGENDIAN |
155 |
< |
u_int ipt_oflw:4, /* overflow counter */ |
155 |
> |
u_char ipt_oflw:4, /* overflow counter */ |
156 |
|
ipt_flg:4; /* flags, see below */ |
157 |
|
#else |
158 |
< |
u_int ipt_flg:4, /* flags, see below */ |
158 |
> |
u_char ipt_flg:4, /* flags, see below */ |
159 |
|
ipt_oflw:4; /* overflow counter */ |
160 |
|
#endif |
161 |
|
union ipt_timestamp { |
165 |
|
n_long ipt_time; |
166 |
|
} ipt_ta[1]; |
167 |
|
} ipt_timestamp; |
168 |
< |
}; |
168 |
> |
} PACKED__; |
169 |
> |
|
170 |
> |
#ifdef PRAGMA_PACK_SUPPORTED |
171 |
> |
#pragma pack(0) |
172 |
> |
#endif |
173 |
|
|
174 |
|
/* flag bits for ipt_flg */ |
175 |
|
#define IPOPT_TS_TSONLY 0 /* timestamps only */ |
216 |
|
/* |
217 |
|
* Overlay for ip header used by other protocols (tcp, udp). |
218 |
|
*/ |
219 |
+ |
#ifdef PRAGMA_PACK_SUPPORTED |
220 |
+ |
#pragma pack(1) |
221 |
+ |
#endif |
222 |
+ |
|
223 |
|
struct ipovly { |
224 |
|
caddr32_t ih_next, ih_prev; /* for protocol sequence q's */ |
225 |
|
u_int8_t ih_x1; /* (unused) */ |
226 |
|
u_int8_t ih_pr; /* protocol */ |
227 |
< |
int16_t ih_len; /* protocol length */ |
227 |
> |
u_int16_t ih_len; /* protocol length */ |
228 |
|
struct in_addr ih_src; /* source internet address */ |
229 |
|
struct in_addr ih_dst; /* destination internet address */ |
230 |
< |
}; |
230 |
> |
} PACKED__; |
231 |
> |
|
232 |
> |
#ifdef PRAGMA_PACK_SUPPORTED |
233 |
> |
#pragma pack(0) |
234 |
> |
#endif |
235 |
|
|
236 |
|
/* |
237 |
|
* Ip reassembly queue structure. Each fragment |
257 |
|
*/ |
258 |
|
struct ipasfrag { |
259 |
|
#ifdef WORDS_BIGENDIAN |
260 |
< |
u_int ip_v:4, |
260 |
> |
u_char ip_v:4, |
261 |
|
ip_hl:4; |
262 |
|
#else |
263 |
< |
u_int ip_hl:4, |
263 |
> |
u_char ip_hl:4, |
264 |
|
ip_v:4; |
265 |
|
#endif |
266 |
|
/* BUG : u_int changed to u_int8_t. |
269 |
|
u_int8_t ipf_mff; /* XXX overlays ip_tos: use low bit |
270 |
|
* to avoid destroying tos (PPPDTRuu); |
271 |
|
* copied from (ip_off&IP_MF) */ |
272 |
< |
int16_t ip_len; |
272 |
> |
u_int16_t ip_len; |
273 |
|
u_int16_t ip_id; |
274 |
< |
int16_t ip_off; |
274 |
> |
u_int16_t ip_off; |
275 |
|
u_int8_t ip_ttl; |
276 |
|
u_int8_t ip_p; |
277 |
|
u_int16_t ip_sum; |