summaryrefslogtreecommitdiff
path: root/net/hping/patches/patch-af
diff options
context:
space:
mode:
authorsalo <salo@pkgsrc.org>2006-03-30 13:51:28 +0000
committersalo <salo@pkgsrc.org>2006-03-30 13:51:28 +0000
commitd898109ed68abc3a02b766cf1c65f39b21430b48 (patch)
tree54bae37249aec75634e8d74985dc07c17aa3f327 /net/hping/patches/patch-af
parenta722f7d806b35663ff8821132e5150fb45faec51 (diff)
downloadpkgsrc-d898109ed68abc3a02b766cf1c65f39b21430b48.tar.gz
Update to hping2, release candidate 3
Changes: - don't install hping suid root by default, add "hping-suid" option. - add bunch on patches from Pavel Kankovsky <peak at argo.troja.mff.cuni.cz> namely: add --flood and --tcp-mss options (self-explanatory), some checksum and interface binding fixes and warning fixes 2.0.0rc3: ======= FIX: Fix for interface guessing with aliases on BSD Thanks <michel.gravey(@)orange.fr> and <cognet(@)freebsd.org> FIX: fixed cksum.c. Bad outgoing packet checksum with some packet. Thanks to Brett Eldridge <beldridg@pobox.com>. ADD: scan mode (--scan) ADD: A rc4-based PRNG to use with --rand-source and --rand-dest FIX: Fix -I option for BSD/Apple ADD: Add support for BSDI and MacOSX (thanks Dennis Opacki <dopacki@adotout.com> and Jan-Hinrich Fessel <Jan-Hinrich.Fessel@T-Mobile.de>) ADD: A few useful ICMP options ADD: Add support for : WLAN (Fabian Melzow <biop0b@web.de>) ATM (Debian bug #193436, thanks to Domenico Andreoli) Token Ring (jim.r.halfpenny@britishairways.com) ADD: MacOSX patches (Hans-Joachim Knobloch <knobloch@secorvo.de>) FIX: --rand-source patches from Quentin Garnier <hping@quatriemek.com> . ensure randomness . do not stop on errors when using a E or D class address (BSD only?)
Diffstat (limited to 'net/hping/patches/patch-af')
-rw-r--r--net/hping/patches/patch-af78
1 files changed, 78 insertions, 0 deletions
diff --git a/net/hping/patches/patch-af b/net/hping/patches/patch-af
new file mode 100644
index 00000000000..f82c42fad50
--- /dev/null
+++ b/net/hping/patches/patch-af
@@ -0,0 +1,78 @@
+$NetBSD: patch-af,v 1.1 2006/03/30 13:51:29 salo Exp $
+
+--- ars.c.orig 2003-07-28 11:00:54.000000000 +0200
++++ ars.c 2005-11-05 21:35:00.000000000 +0100
+@@ -372,7 +372,7 @@
+ }
+ if (nbytes == 1) {
+ oddbyte = 0;
+- *((u_int16_t *) &oddbyte) = *(u_int8_t *) buf;
++ *((u_int8_t *) &oddbyte) = *((u_int8_t *) buf);
+ sum += oddbyte;
+ }
+ sum = (sum >> 16) + (sum & 0xffff);
+@@ -381,6 +381,13 @@
+ }
+
+ /* Multiple buffers checksum facility */
++/*
++ * Important facts about the checksum (sum = ~cksum, Ai are bytes):
++ * 1. sum(A0...A2i-1,A2i...A2n-1) = sum(A0...A2i-1) + sum(A2i...B2n-1),
++ * 2. sum(A0...A2i,A2i+1...A2n-1) = sum(A0...A2i,0) + sum(0,A2i+1...A2n-1)
++ * 3. sum(A0...A2n-1,A2n) = sum(A0...A2n-1,A2n,0) (ex definitiones)
++ * 4. sum(0,A0...Ak) = swap_bytes(sum(A0...Ak))
++ */
+ u_int16_t ars_multi_cksum(struct mc_context *c, int op, void *vbuf,
+ size_t nbytes)
+ {
+@@ -394,38 +401,27 @@
+ c->old = 0;
+ return -ARS_OK;
+ } else if (op == ARS_MC_UPDATE) {
+- if (c->oddbyte_flag) {
+- u_int8_t *x = (u_int8_t*)&oddbyte;
+- oddbyte = 0;
+- *((u_int16_t *) &oddbyte) = c->oddbyte << 8;
+- *((u_int16_t *) &oddbyte) |= *(u_int8_t *) buf;
+- oddbyte = (x[0] << 8) | x[1]; /* fix endianess */
+- c->old += oddbyte;
+- nbytes--;
+- c->oddbyte_flag = 0;
+- /* We need to stay aligned -- bad slowdown, fix? */
+- tmp = alloca(nbytes);
+- memcpy(tmp, vbuf+1, nbytes);
+- buf = tmp;
+- }
+- sum = c->old;
++ sum = 0;
+ while (nbytes > 1) {
+ sum += *buf++;
+ nbytes -= 2;
+ }
+- c->old = sum;
+ if (nbytes == 1) {
+- c->oddbyte = *(u_int8_t*) buf;
+- c->oddbyte_flag++;
++ oddbyte = 0;
++ *((u_int8_t *) &oddbyte) = *((u_int8_t *) buf);
++ sum += oddbyte;
+ }
++ if (c->oddbyte_flag) {
++ /* reverse checksum endianness */
++ sum = (sum >> 16) + (sum & 0xffff);
++ sum += (sum >> 16);
++ sum = ((sum & 0xff00) >> 8) | ((sum & 0xff) << 8);
++ }
++ c->old += sum;
++ c->oddbyte_flag ^= (nbytes == 1 ? 1 : 0);
+ return -ARS_OK;
+ } else if (op == ARS_MC_FINAL) {
+ sum = c->old;
+- if (c->oddbyte_flag == 1) {
+- oddbyte = 0;
+- *((u_int16_t *) &oddbyte) = c->oddbyte;
+- sum += oddbyte;
+- }
+ sum = (sum >> 16) + (sum & 0xffff);
+ sum += (sum >> 16);
+ return (u_int16_t) ~sum;