aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-08-02 10:55:32 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-08-02 10:55:32 +0000
commitc61d5c8db8521b96362ae0ca7ba1aee14c12b934 (patch)
tree5af27e4751ecae51387a99872b66a8cd6e621caa /networking
parent70b84b8e3681e2f0629bc6a8a9c8c98ae7dcf8b5 (diff)
downloadbusybox-w32-c61d5c8db8521b96362ae0ca7ba1aee14c12b934.tar.gz
busybox-w32-c61d5c8db8521b96362ae0ca7ba1aee14c12b934.tar.bz2
busybox-w32-c61d5c8db8521b96362ae0ca7ba1aee14c12b934.zip
More libc5 fixups
-Erik git-svn-id: svn://busybox.net/trunk/busybox@3195 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'networking')
-rw-r--r--networking/traceroute.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/networking/traceroute.c b/networking/traceroute.c
index f4c67cf41..a3abd0a00 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -81,6 +81,96 @@
81#include <netinet/ip.h> 81#include <netinet/ip.h>
82#include <netinet/ip_icmp.h> 82#include <netinet/ip_icmp.h>
83 83
84
85 /* It turns out that libc5 doesn't have proper icmp support
86 * built into it header files, so we have to supplement it */
87#if __GNU_LIBRARY__ < 5
88static const int ICMP_MINLEN = 8; /* abs minimum */
89
90struct icmp_ra_addr
91{
92 u_int32_t ira_addr;
93 u_int32_t ira_preference;
94};
95
96
97struct icmp
98{
99 u_int8_t icmp_type; /* type of message, see below */
100 u_int8_t icmp_code; /* type sub code */
101 u_int16_t icmp_cksum; /* ones complement checksum of struct */
102 union
103 {
104 u_char ih_pptr; /* ICMP_PARAMPROB */
105 struct in_addr ih_gwaddr; /* gateway address */
106 struct ih_idseq /* echo datagram */
107 {
108 u_int16_t icd_id;
109 u_int16_t icd_seq;
110 } ih_idseq;
111 u_int32_t ih_void;
112
113 /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
114 struct ih_pmtu
115 {
116 u_int16_t ipm_void;
117 u_int16_t ipm_nextmtu;
118 } ih_pmtu;
119
120 struct ih_rtradv
121 {
122 u_int8_t irt_num_addrs;
123 u_int8_t irt_wpa;
124 u_int16_t irt_lifetime;
125 } ih_rtradv;
126 } icmp_hun;
127#define icmp_pptr icmp_hun.ih_pptr
128#define icmp_gwaddr icmp_hun.ih_gwaddr
129#define icmp_id icmp_hun.ih_idseq.icd_id
130#define icmp_seq icmp_hun.ih_idseq.icd_seq
131#define icmp_void icmp_hun.ih_void
132#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
133#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
134#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
135#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
136#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
137 union
138 {
139 struct
140 {
141 u_int32_t its_otime;
142 u_int32_t its_rtime;
143 u_int32_t its_ttime;
144 } id_ts;
145 struct
146 {
147 struct ip idi_ip;
148 /* options and then 64 bits of data */
149 } id_ip;
150 struct icmp_ra_addr id_radv;
151 u_int32_t id_mask;
152 u_int8_t id_data[1];
153 } icmp_dun;
154#define icmp_otime icmp_dun.id_ts.its_otime
155#define icmp_rtime icmp_dun.id_ts.its_rtime
156#define icmp_ttime icmp_dun.id_ts.its_ttime
157#define icmp_ip icmp_dun.id_ip.idi_ip
158#define icmp_radv icmp_dun.id_radv
159#define icmp_mask icmp_dun.id_mask
160#define icmp_data icmp_dun.id_data
161};
162
163#define ICMP_MINLEN 8 /* abs minimum */
164#define ICMP_UNREACH 3 /* dest unreachable, codes: */
165#define ICMP_TIMXCEED 11 /* time exceeded, code: */
166#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
167#define ICMP_UNREACH_NET 0 /* bad net */
168#define ICMP_UNREACH_HOST 1 /* bad host */
169#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
170#define ICMP_UNREACH_PORT 3 /* bad port */
171#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
172#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
173#endif
84 174
85 175
86#define MAXPACKET 65535 /* max ip packet size */ 176#define MAXPACKET 65535 /* max ip packet size */