head 1.3; access; symbols pkgsrc-2023Q4:1.3.0.120 pkgsrc-2023Q4-base:1.3 pkgsrc-2023Q3:1.3.0.118 pkgsrc-2023Q3-base:1.3 pkgsrc-2023Q2:1.3.0.116 pkgsrc-2023Q2-base:1.3 pkgsrc-2023Q1:1.3.0.114 pkgsrc-2023Q1-base:1.3 pkgsrc-2022Q4:1.3.0.112 pkgsrc-2022Q4-base:1.3 pkgsrc-2022Q3:1.3.0.110 pkgsrc-2022Q3-base:1.3 pkgsrc-2022Q2:1.3.0.108 pkgsrc-2022Q2-base:1.3 pkgsrc-2022Q1:1.3.0.106 pkgsrc-2022Q1-base:1.3 pkgsrc-2021Q4:1.3.0.104 pkgsrc-2021Q4-base:1.3 pkgsrc-2021Q3:1.3.0.102 pkgsrc-2021Q3-base:1.3 pkgsrc-2021Q2:1.3.0.100 pkgsrc-2021Q2-base:1.3 pkgsrc-2021Q1:1.3.0.98 pkgsrc-2021Q1-base:1.3 pkgsrc-2020Q4:1.3.0.96 pkgsrc-2020Q4-base:1.3 pkgsrc-2020Q3:1.3.0.94 pkgsrc-2020Q3-base:1.3 pkgsrc-2020Q2:1.3.0.90 pkgsrc-2020Q2-base:1.3 pkgsrc-2020Q1:1.3.0.70 pkgsrc-2020Q1-base:1.3 pkgsrc-2019Q4:1.3.0.92 pkgsrc-2019Q4-base:1.3 pkgsrc-2019Q3:1.3.0.88 pkgsrc-2019Q3-base:1.3 pkgsrc-2019Q2:1.3.0.86 pkgsrc-2019Q2-base:1.3 pkgsrc-2019Q1:1.3.0.84 pkgsrc-2019Q1-base:1.3 pkgsrc-2018Q4:1.3.0.82 pkgsrc-2018Q4-base:1.3 pkgsrc-2018Q3:1.3.0.80 pkgsrc-2018Q3-base:1.3 pkgsrc-2018Q2:1.3.0.78 pkgsrc-2018Q2-base:1.3 pkgsrc-2018Q1:1.3.0.76 pkgsrc-2018Q1-base:1.3 pkgsrc-2017Q4:1.3.0.74 pkgsrc-2017Q4-base:1.3 pkgsrc-2017Q3:1.3.0.72 pkgsrc-2017Q3-base:1.3 pkgsrc-2017Q2:1.3.0.68 pkgsrc-2017Q2-base:1.3 pkgsrc-2017Q1:1.3.0.66 pkgsrc-2017Q1-base:1.3 pkgsrc-2016Q4:1.3.0.64 pkgsrc-2016Q4-base:1.3 pkgsrc-2016Q3:1.3.0.62 pkgsrc-2016Q3-base:1.3 pkgsrc-2016Q2:1.3.0.60 pkgsrc-2016Q2-base:1.3 pkgsrc-2016Q1:1.3.0.58 pkgsrc-2016Q1-base:1.3 pkgsrc-2015Q4:1.3.0.56 pkgsrc-2015Q4-base:1.3 pkgsrc-2015Q3:1.3.0.54 pkgsrc-2015Q3-base:1.3 pkgsrc-2015Q2:1.3.0.52 pkgsrc-2015Q2-base:1.3 pkgsrc-2015Q1:1.3.0.50 pkgsrc-2015Q1-base:1.3 pkgsrc-2014Q4:1.3.0.48 pkgsrc-2014Q4-base:1.3 pkgsrc-2014Q3:1.3.0.46 pkgsrc-2014Q3-base:1.3 pkgsrc-2014Q2:1.3.0.44 pkgsrc-2014Q2-base:1.3 pkgsrc-2014Q1:1.3.0.42 pkgsrc-2014Q1-base:1.3 pkgsrc-2013Q4:1.3.0.40 pkgsrc-2013Q4-base:1.3 pkgsrc-2013Q3:1.3.0.38 pkgsrc-2013Q3-base:1.3 pkgsrc-2013Q2:1.3.0.36 pkgsrc-2013Q2-base:1.3 pkgsrc-2013Q1:1.3.0.34 pkgsrc-2013Q1-base:1.3 pkgsrc-2012Q4:1.3.0.32 pkgsrc-2012Q4-base:1.3 pkgsrc-2012Q3:1.3.0.30 pkgsrc-2012Q3-base:1.3 pkgsrc-2012Q2:1.3.0.28 pkgsrc-2012Q2-base:1.3 pkgsrc-2012Q1:1.3.0.26 pkgsrc-2012Q1-base:1.3 pkgsrc-2011Q4:1.3.0.24 pkgsrc-2011Q4-base:1.3 pkgsrc-2011Q3:1.3.0.22 pkgsrc-2011Q3-base:1.3 pkgsrc-2011Q2:1.3.0.20 pkgsrc-2011Q2-base:1.3 pkgsrc-2011Q1:1.3.0.18 pkgsrc-2011Q1-base:1.3 pkgsrc-2010Q4:1.3.0.16 pkgsrc-2010Q4-base:1.3 pkgsrc-2010Q3:1.3.0.14 pkgsrc-2010Q3-base:1.3 pkgsrc-2010Q2:1.3.0.12 pkgsrc-2010Q2-base:1.3 pkgsrc-2010Q1:1.3.0.10 pkgsrc-2010Q1-base:1.3 pkgsrc-2009Q4:1.3.0.8 pkgsrc-2009Q4-base:1.3 pkgsrc-2009Q3:1.3.0.6 pkgsrc-2009Q3-base:1.3 pkgsrc-2009Q2:1.3.0.4 pkgsrc-2009Q2-base:1.3 pkgsrc-2009Q1:1.3.0.2 pkgsrc-2009Q1-base:1.3 pkgsrc-2008Q4:1.2.0.26 pkgsrc-2008Q4-base:1.2 pkgsrc-2008Q3:1.2.0.24 pkgsrc-2008Q3-base:1.2 cube-native-xorg:1.2.0.22 cube-native-xorg-base:1.2 pkgsrc-2008Q2:1.2.0.20 pkgsrc-2008Q2-base:1.2 cwrapper:1.2.0.18 pkgsrc-2008Q1:1.2.0.16 pkgsrc-2008Q1-base:1.2 pkgsrc-2007Q4:1.2.0.14 pkgsrc-2007Q4-base:1.2 pkgsrc-2007Q3:1.2.0.12 pkgsrc-2007Q3-base:1.2 pkgsrc-2007Q2:1.2.0.10 pkgsrc-2007Q2-base:1.2 pkgsrc-2007Q1:1.2.0.8 pkgsrc-2007Q1-base:1.2 pkgsrc-2006Q4:1.2.0.6 pkgsrc-2006Q4-base:1.2 pkgsrc-2006Q3:1.2.0.4 pkgsrc-2006Q3-base:1.2 pkgsrc-2006Q2:1.2.0.2 pkgsrc-2006Q2-base:1.2 pkgsrc-2006Q1:1.1.0.2 pkgsrc-2006Q1-base:1.1; locks; strict; comment @# @; 1.3 date 2009.02.11.08.06.17; author obache; state Exp; branches; next 1.2; 1.2 date 2006.03.30.13.51.29; author salo; state Exp; branches; next 1.1; 1.1 date 2006.03.14.02.29.11; author joerg; state Exp; branches; next ; desc @@ 1.3 log @* detection of endian in bytesex.h is not enough, use result of byteorder.h. * 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). @ text @$NetBSD$ --- getifname.c.orig 2004-05-03 08:55:53.000000000 +0000 +++ getifname.c @@@@ -17,7 +17,7 @@@@ #include /* close */ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \ - defined(__bsdi__) || defined(__APPLE__) + defined(__bsdi__) || defined(__APPLE__) || defined(__DragonFly__) #include #include #include @@@@ -27,12 +27,12 @@@@ #include "globals.h" #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && \ - !defined(__linux__) && !defined(__sun__) && !defined(__bsdi__) && \ - !defined(__APPLE__) + !defined(__linux__) && !defined(__sun) && !defined(__bsdi__) && \ + !defined(__APPLE__) && !defined(__DragonFly__) #error Sorry, interface code not implemented. #endif -#ifdef __sun__ +#ifdef __sun #include #include #include @@@@ -40,15 +40,16 @@@@ static int get_output_if(struct sockaddr_in *dest, struct sockaddr_in *ifip); -#if (defined OSTYPE_LINUX) || (defined __sun__) +#if (defined OSTYPE_LINUX) || (defined __sun) int get_if_name(void) { int fd; struct ifconf ifc; - struct ifreq ibuf[16], - ifr, + struct ifreq ifr, *ifrp, *ifend; + char *ibuf; + int ibuflen; struct sockaddr_in sa; struct sockaddr_in output_if_addr; int known_output_if = 0; @@@@ -72,21 +73,40 @@@@ int get_if_name(void) return -1; } - memset(ibuf, 0, sizeof(struct ifreq)*16); - ifc.ifc_len = sizeof ibuf; + ibuf = NULL; + ibuflen = 16 * sizeof(struct ifreq); + for (;;) { + char *nibuf = (char *) realloc(ibuf, ibuflen); + if (!nibuf) { + perror("[get_if_name] realloc"); + goto go_out; + } + + ibuf = nibuf; + memset(ibuf, 0, ibuflen); + ifc.ifc_len = ibuflen; ifc.ifc_buf = (caddr_t) ibuf; /* gets interfaces list */ if ( ioctl(fd, SIOCGIFCONF, (char*)&ifc) == -1 || ifc.ifc_len < sizeof(struct ifreq) ) { perror("[get_if_name] ioctl(SIOCGIFCONF)"); - close(fd); - return -1; + goto go_out; + } + + if (ifc.ifc_len + sizeof(struct ifreq) <= ibuflen) + break; + if (ibuflen >= 1024 * sizeof(struct ifreq)) { + fprintf(stderr, "Warning: Too many network " + "interfaces.\n"); + break; + } + ibuflen *= 2; } /* ifrp points to buffer and ifend points to buffer's end */ - ifrp = ibuf; - ifend = (struct ifreq*) ((char*)ibuf + ifc.ifc_len); + ifrp = (struct ifreq *) ibuf; + ifend = (struct ifreq *) (ibuf + ifc.ifc_len); for (; ifrp < ifend; ifrp++) { strlcpy(ifr.ifr_name, ifrp->ifr_name, sizeof(ifr.ifr_name)); @@@@ -155,27 +175,28 @@@@ int get_if_name(void) } else { -#ifdef __sun__ +#ifdef __sun /* somehow solaris is braidamaged in wrt ifr_mtu */ h_if_mtu = ifr.ifr_metric; #else h_if_mtu = ifr.ifr_mtu; #endif } - close(fd); - return 0; + goto go_out; } /* interface not found, use 'lo' */ strlcpy(ifname, "lo", 1024); strlcpy(ifstraddr, "127.0.0.1", 1024); h_if_mtu = 1500; +go_out: + free(ibuf); close(fd); return 0; } #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \ - defined(__bsdi__) || defined(__APPLE__) + defined(__bsdi__) || defined(__APPLE__) || defined(__DragonFly__) /* return interface informations : - from the specified (-I) interface @ 1.2 log @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 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 and FIX: fixed cksum.c. Bad outgoing packet checksum with some packet. Thanks to Brett Eldridge . 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 and Jan-Hinrich Fessel ) ADD: A few useful ICMP options ADD: Add support for : WLAN (Fabian Melzow ) ATM (Debian bug #193436, thanks to Domenico Andreoli) Token Ring (jim.r.halfpenny@@britishairways.com) ADD: MacOSX patches (Hans-Joachim Knobloch ) FIX: --rand-source patches from Quentin Garnier . ensure randomness . do not stop on errors when using a E or D class address (BSD only?) @ text @d3 2 a4 2 --- getifname.c.orig 2004-05-03 10:55:53.000000000 +0200 +++ getifname.c 2006-03-22 19:56:40.000000000 +0100 d14 2 a15 1 @@@@ -28,7 +28,7 @@@@ d18 1 a18 1 !defined(__linux__) && !defined(__sun__) && !defined(__bsdi__) && \ d20 1 d25 97 a121 1 @@@@ -175,7 +175,7 @@@@ @ 1.1 log @DragonFly support. @ text @d3 3 a5 4 --- getifname.c.orig 2006-03-14 02:23:00.000000000 +0000 +++ getifname.c @@@@ -15,7 +15,7 @@@@ #include d8 3 a10 2 -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) d13 2 a14 4 #endif /* defined(__*BSD__) */ @@@@ -23,7 +23,7 @@@@ #include "hping2.h" #include "globals.h" d16 4 a19 2 -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__linux__) && !defined(__sun__) +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__linux__) && !defined(__sun__) && !defined(__DragonFly__) d23 1 a23 2 @@@@ -169,7 +169,7 @@@@ int get_if_name(void) return 0; d26 3 a28 2 -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) @