dca4ca3df8
* replace hard coded user and mode for hping-suid option with SPECIAL_PERMS. * replace remaining of hard coded "man" with ${PKGMANDIR}. * add DESTDIR support. * merge patch-a{e,g}, both for same file. * patch to replace __sun__ with __sun for portability, pkglint(1) said. * also regen other patches with mkpatches(1).
58 lines
1.7 KiB
Text
58 lines
1.7 KiB
Text
$NetBSD: patch-am,v 1.2 2009/02/11 08:06:17 obache Exp $
|
|
|
|
--- sendtcp.c.orig 2002-06-17 15:56:42.000000000 +0000
|
|
+++ sendtcp.c
|
|
@@ -26,10 +26,12 @@ void send_tcp(void)
|
|
char *packet, *data;
|
|
struct mytcphdr *tcp;
|
|
struct pseudohdr *pseudoheader;
|
|
- unsigned char *tstamp;
|
|
+ unsigned char *opts;
|
|
|
|
+ if (opt_tcp_mss)
|
|
+ tcp_opt_size += 4;
|
|
if (opt_tcp_timestamp)
|
|
- tcp_opt_size = 12;
|
|
+ tcp_opt_size += 12;
|
|
|
|
packet_size = TCPHDR_SIZE + tcp_opt_size + data_size;
|
|
packet = malloc(PSEUDOHDR_SIZE + packet_size);
|
|
@@ -39,7 +41,7 @@ void send_tcp(void)
|
|
}
|
|
pseudoheader = (struct pseudohdr*) packet;
|
|
tcp = (struct mytcphdr*) (packet+PSEUDOHDR_SIZE);
|
|
- tstamp = (unsigned char*) (packet+PSEUDOHDR_SIZE+TCPHDR_SIZE);
|
|
+ opts = (unsigned char*) (packet+PSEUDOHDR_SIZE+TCPHDR_SIZE);
|
|
data = (char*) (packet+PSEUDOHDR_SIZE+TCPHDR_SIZE+tcp_opt_size);
|
|
|
|
memset(packet, 0, PSEUDOHDR_SIZE+packet_size);
|
|
@@ -62,14 +64,24 @@ void send_tcp(void)
|
|
tcp->th_win = htons(src_winsize);
|
|
tcp->th_flags = tcp_th_flags;
|
|
|
|
+ /* tcp MSS option */
|
|
+ if (opt_tcp_mss) {
|
|
+ opts[0] = 2;
|
|
+ opts[1] = 4; /* 4 bytes, kind+len+MSS */
|
|
+ opts[2] = tcp_mss >> 8;
|
|
+ opts[3] = tcp_mss & 0xff;
|
|
+ opts += 4;
|
|
+ }
|
|
+
|
|
/* tcp timestamp option */
|
|
if (opt_tcp_timestamp) {
|
|
__u32 randts = rand() ^ (rand() << 16);
|
|
- tstamp[0] = tstamp[1] = 1; /* NOOP */
|
|
- tstamp[2] = 8;
|
|
- tstamp[3] = 10; /* 10 bytes, kind+len+T1+T2 */
|
|
- memcpy(tstamp+4, &randts, 4); /* random */
|
|
- memset(tstamp+8, 0, 4); /* zero */
|
|
+ opts[0] = opts[1] = 1; /* NOOP */
|
|
+ opts[2] = 8;
|
|
+ opts[3] = 10; /* 10 bytes, kind+len+T1+T2 */
|
|
+ memcpy(opts+4, &randts, 4); /* random */
|
|
+ memset(opts+8, 0, 4); /* zero */
|
|
+ opts += 12;
|
|
}
|
|
|
|
/* data */
|