123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- --- traceroute-2.0.19.orig/traceroute/mod-tcp.c 2012-03-27 16:01:15.000000000 +0200
- +++ traceroute-2.0.19/traceroute/mod-tcp.c 2013-12-29 20:16:23.000000000 +0100
- @@ -18,6 +18,24 @@
- #include <netinet/ip6.h>
- #include <netinet/tcp.h>
-
- +#if !defined(__GLIBC__)
- +# define TCPOPT_EOL 0
- +# define TCPOPT_NOP 1
- +# define TCPOPT_MAXSEG 2
- +# define TCPOLEN_MAXSEG 4
- +# define TCPOPT_WINDOW 3
- +# define TCPOLEN_WINDOW 3
- +# define TCPOPT_SACK_PERMITTED 4 /* Experimental */
- +# define TCPOLEN_SACK_PERMITTED 2
- +# define TCPOPT_SACK 5 /* Experimental */
- +# define TCPOPT_TIMESTAMP 8
- +# define TCPOLEN_TIMESTAMP 10
- +# define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
- +
- +# define TCPOPT_TSTAMP_HDR \
- + (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
- +#endif
- +
-
- #include "traceroute.h"
-
- @@ -33,11 +51,11 @@ static unsigned int dest_port = 0;
- static int raw_sk = -1;
- static int last_ttl = 0;
-
- -static u_int8_t buf[1024]; /* enough, enough... */
- +static uint8_t buf[1024]; /* enough, enough... */
- static size_t csum_len = 0;
- static struct tcphdr *th = NULL;
-
- -#define TH_FLAGS(TH) (((u_int8_t *) (TH))[13])
- +#define TH_FLAGS(TH) (((uint8_t *) (TH))[13])
- #define TH_FIN 0x01
- #define TH_SYN 0x02
- #define TH_RST 0x04
- @@ -164,7 +182,7 @@ static CLIF_option tcp_options[] = {
- static int check_sysctl (const char *name) {
- int fd, res;
- char buf[sizeof (SYSCTL_PREFIX) + strlen (name) + 1];
- - u_int8_t ch;
- + uint8_t ch;
-
- strcpy (buf, SYSCTL_PREFIX);
- strcat (buf, name);
- @@ -191,8 +209,8 @@ static int tcp_init (const sockaddr_any
- sockaddr_any src;
- int mtu;
- socklen_t len;
- - u_int8_t *ptr;
- - u_int16_t *lenp;
- + uint8_t *ptr;
- + uint16_t *lenp;
-
-
- dest_addr = *dest;
- @@ -286,10 +304,10 @@ static int tcp_init (const sockaddr_any
- ptr += len;
- }
-
- - lenp = (u_int16_t *) ptr;
- - ptr += sizeof (u_int16_t);
- - *((u_int16_t *) ptr) = htons ((u_int16_t) IPPROTO_TCP);
- - ptr += sizeof (u_int16_t);
- + lenp = (uint16_t *) ptr;
- + ptr += sizeof (uint16_t);
- + *((uint16_t *) ptr) = htons ((uint16_t) IPPROTO_TCP);
- + ptr += sizeof (uint16_t);
-
-
- /* Construct TCP header */
- @@ -309,13 +327,13 @@ static int tcp_init (const sockaddr_any
-
- /* Build TCP options */
-
- - ptr = (u_int8_t *) (th + 1);
- + ptr = (uint8_t *) (th + 1);
-
- if (flags & TH_SYN) {
- *ptr++ = TCPOPT_MAXSEG; /* 2 */
- *ptr++ = TCPOLEN_MAXSEG; /* 4 */
- - *((u_int16_t *) ptr) = htons (mss ? mss : mtu);
- - ptr += sizeof (u_int16_t);
- + *((uint16_t *) ptr) = htons (mss ? mss : mtu);
- + ptr += sizeof (uint16_t);
- }
-
- if (flags & FL_TSTAMP) {
- @@ -330,10 +348,10 @@ static int tcp_init (const sockaddr_any
- *ptr++ = TCPOPT_TIMESTAMP; /* 8 */
- *ptr++ = TCPOLEN_TIMESTAMP; /* 10 */
-
- - *((u_int32_t *) ptr) = random_seq (); /* really! */
- - ptr += sizeof (u_int32_t);
- - *((u_int32_t *) ptr) = (flags & TH_ACK) ? random_seq () : 0;
- - ptr += sizeof (u_int32_t);
- + *((uint32_t *) ptr) = random_seq (); /* really! */
- + ptr += sizeof (uint32_t);
- + *((uint32_t *) ptr) = (flags & TH_ACK) ? random_seq () : 0;
- + ptr += sizeof (uint32_t);
- }
- else if (flags & FL_SACK) {
- *ptr++ = TCPOPT_NOP; /* 1 */
- @@ -355,7 +373,7 @@ static int tcp_init (const sockaddr_any
- if (csum_len > sizeof (buf))
- error ("impossible"); /* paranoia */
-
- - len = ptr - (u_int8_t *) th;
- + len = ptr - (uint8_t *) th;
- if (len & 0x03) error ("impossible"); /* as >>2 ... */
-
- *lenp = htons (len);
- @@ -436,7 +454,7 @@ static probe *tcp_check_reply (int sk, i
- char *buf, size_t len) {
- probe *pb;
- struct tcphdr *tcp = (struct tcphdr *) buf;
- - u_int16_t sport, dport;
- + uint16_t sport, dport;
-
-
- if (len < 8) return NULL; /* too short */
|