Commit | Line | Data |
---|---|---|
8ae0e4b4 | 1 | /* |
0880b18e | 2 | * Copyright (c) 1982, 1986 Regents of the University of California. |
8ae0e4b4 KM |
3 | * All rights reserved. The Berkeley software License Agreement |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
f112c673 | 6 | * @(#)ip_var.h 7.2 (Berkeley) %G% |
8ae0e4b4 | 7 | */ |
77e50f35 BJ |
8 | |
9 | /* | |
10 | * Overlay for ip header used by other protocols (tcp, udp). | |
11 | */ | |
12 | struct ipovly { | |
eb44bfb2 BJ |
13 | caddr_t ih_next, ih_prev; /* for protocol sequence q's */ |
14 | u_char ih_x1; /* (unused) */ | |
15 | u_char ih_pr; /* protocol */ | |
2b4b57cd BJ |
16 | short ih_len; /* protocol length */ |
17 | struct in_addr ih_src; /* source internet address */ | |
18 | struct in_addr ih_dst; /* destination internet address */ | |
77e50f35 BJ |
19 | }; |
20 | ||
21 | /* | |
22 | * Ip reassembly queue structure. Each fragment | |
23 | * being reassembled is attached to one of these structures. | |
24 | * They are timed out after ipq_ttl drops to 0, and may also | |
25 | * be reclaimed if memory becomes tight. | |
26 | */ | |
27 | struct ipq { | |
28 | struct ipq *next,*prev; /* to other reass headers */ | |
29 | u_char ipq_ttl; /* time for reass q to live */ | |
30 | u_char ipq_p; /* protocol of this fragment */ | |
31 | u_short ipq_id; /* sequence id for reassembly */ | |
32 | struct ipasfrag *ipq_next,*ipq_prev; | |
33 | /* to ip headers of fragments */ | |
2b4b57cd | 34 | struct in_addr ipq_src,ipq_dst; |
77e50f35 BJ |
35 | }; |
36 | ||
37 | /* | |
38 | * Ip header, when holding a fragment. | |
af8f6a21 SL |
39 | * |
40 | * Note: ipf_next must be at same offset as ipq_next above | |
77e50f35 BJ |
41 | */ |
42 | struct ipasfrag { | |
f112c673 | 43 | #if ENDIAN == LITTLE |
77e50f35 BJ |
44 | u_char ip_hl:4, |
45 | ip_v:4; | |
f112c673 MK |
46 | #endif |
47 | #if ENDIAN == BIG | |
48 | u_char ip_v:4, | |
49 | ip_hl:4; | |
498aff44 | 50 | #endif |
77e50f35 BJ |
51 | u_char ipf_mff; /* copied from (ip_off&IP_MF) */ |
52 | short ip_len; | |
53 | u_short ip_id; | |
54 | short ip_off; | |
55 | u_char ip_ttl; | |
56 | u_char ip_p; | |
57 | u_short ip_sum; | |
eb44bfb2 BJ |
58 | struct ipasfrag *ipf_next; /* next fragment */ |
59 | struct ipasfrag *ipf_prev; /* previous fragment */ | |
77e50f35 BJ |
60 | }; |
61 | ||
8b2d0afb MK |
62 | /* |
63 | * Structure stored in mbuf in inpcb.ip_options | |
64 | * and passed to ip_output when ip options are in use. | |
65 | * The actual length of the options (including ipopt_dst) | |
66 | * is in m_len. | |
67 | */ | |
68 | #define MAX_IPOPTLEN 40 | |
69 | ||
70 | struct ipoption { | |
71 | struct in_addr ipopt_dst; /* first-hop dst if source routed */ | |
72 | char ipopt_list[MAX_IPOPTLEN]; /* options proper */ | |
73 | }; | |
74 | ||
2b4b57cd | 75 | struct ipstat { |
8b2d0afb MK |
76 | long ips_total; /* total packets received */ |
77 | long ips_badsum; /* checksum bad */ | |
78 | long ips_tooshort; /* packet too short */ | |
79 | long ips_toosmall; /* not enough data */ | |
80 | long ips_badhlen; /* ip header length < data size */ | |
81 | long ips_badlen; /* ip length < ip header length */ | |
82 | long ips_fragments; /* fragments received */ | |
83 | long ips_fragdropped; /* frags dropped (dups, out of space) */ | |
84 | long ips_fragtimeout; /* fragments timed out */ | |
3f22f2b1 MK |
85 | long ips_forward; /* packets forwarded */ |
86 | long ips_cantforward; /* packets rcvd for unreachable dest */ | |
8b2d0afb | 87 | long ips_redirectsent; /* packets forwarded on same net */ |
2b4b57cd BJ |
88 | }; |
89 | ||
77e50f35 | 90 | #ifdef KERNEL |
0e3f761f | 91 | /* flags passed to ip_output as last parameter */ |
8f45cd54 MK |
92 | #define IP_FORWARDING 0x1 /* most of ip header exists */ |
93 | #define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables */ | |
94 | #define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */ | |
0e3f761f | 95 | |
2b4b57cd | 96 | struct ipstat ipstat; |
77e50f35 | 97 | struct ipq ipq; /* ip reass. queue */ |
77e50f35 | 98 | u_short ip_id; /* ip packet ctr, for ids */ |
8b2d0afb MK |
99 | |
100 | struct mbuf *ip_srcroute(); | |
77e50f35 | 101 | #endif |