--- bing-1.1.3.orig/bing.c
+++ bing-1.1.3/bing.c
@@ -104,7 +104,9 @@
#include
/* More specific includes/declarations */
+#ifndef __GNU__
#include
+#endif /* __GNU__ */
#include
#include
#include
@@ -152,7 +154,9 @@
* standard libraries.
*/
#include
+#ifndef __GNU__
#include
+#endif /* __GNU__ */
#include
#include "mod_icmp.h"
@@ -320,9 +324,7 @@
struct hoststats {
/* Host info */
- char hnamebuf[MAXHOSTNAMELEN];
char *hostname;
- struct sockaddr_in whereto;
struct sockaddr_in *to;
struct timestats *ts;
};
@@ -365,28 +367,19 @@
struct hoststats *hs;
char *target;
{
- struct hostent *hp;
+ struct addrinfo hints, *ai;
+ int r;
- hs->to = &hs->whereto;
-
- memset((char *)hs->to, 0, sizeof(struct sockaddr_in));
- hs->to->sin_family = AF_INET;
- hs->to->sin_addr.s_addr = inet_addr(target);
- if (hs->to->sin_addr.s_addr != (u_int)-1)
- hs->hostname = target;
- else {
- hp = gethostbyname(target);
- if (!hp) {
- (void)fprintf(stderr,
- "bing: unknown host %s\n", target);
- exit(1);
- }
- hs->to->sin_family = hp->h_addrtype;
- memcpy((caddr_t)&hs->to->sin_addr, hp->h_addr, hp->h_length);
- strncpy(hs->hnamebuf, hp->h_name, sizeof(hs->hnamebuf) - 1);
- hs->hnamebuf[sizeof(hs->hnamebuf)-1] = '\0';
- hs->hostname = hs->hnamebuf;
+ memset(&hints, 0, sizeof hints);
+ hints.ai_family = AF_INET;
+ hints.ai_flags = AI_CANONNAME;
+ if((r = getaddrinfo(target, NULL, &hints, &ai))) {
+ fprintf(stderr, "bing: couldn't resolve %s: %s\n",
+ target, gai_strerror(r));
+ exit(1);
}
+ hs->to = (struct sockaddr_in *) ai->ai_addr;
+ hs->hostname = ai->ai_canonname;
}
void randomfill(bp, len, seed)
@@ -677,18 +670,22 @@
pr_addr(l)
u_long l;
{
- struct hostent *hp;
- static char buf[80];
+ static char buf[MAXHOSTNAMELEN+19];
+ struct sockaddr_in sa;
+ int r;
+
+ sa.sin_family = AF_INET;
+ sa.sin_port = 0;
+ memcpy(&sa.sin_addr, &l, sizeof l);
+
+ r = getnameinfo((struct sockaddr *) &sa, sizeof sa, buf, sizeof buf,
+ NULL, 0, (options & F_NUMERIC) ? NI_NUMERICHOST : 0);
+ if(r) {
+ fprintf(stderr, "bing: getaddrinfo: %s\n", gai_strerror(r));
+ exit(1);
+ }
- if ((options & F_NUMERIC) ||
- !(hp = gethostbyaddr((char *)&l, 4, AF_INET)))
- (void)snprintf(snfargs(buf, sizeof(buf), "%s"),
- inet_ntoa(*(struct in_addr *)&l));
- else
- (void)snprintf(snfargs(buf, sizeof(buf), "%s (%s)"),
- hp->h_name,
- inet_ntoa(*(struct in_addr *)&l));
- return(buf);
+ return buf;
}
/*
--- bing-1.1.3.orig/debian/bing.debhelper.log
+++ bing-1.1.3/debian/bing.debhelper.log
@@ -0,0 +1,12 @@
+dh_installdirs
+dh_installdocs
+dh_installmanpages
+dh_installchangelogs
+dh_strip
+dh_compress
+dh_fixperms
+dh_installdeb
+dh_shlibdeps
+dh_gencontrol
+dh_md5sums
+dh_builddeb
--- bing-1.1.3.orig/debian/copyright
+++ bing-1.1.3/debian/copyright
@@ -0,0 +1,47 @@
+This package was debianized by Mark Purcell on
+Tue Jan 14 22:51:46 EST 2003.
+
+It was downloaded from http://fgouget.free.fr/bing/bing_src-readme-1st.shtml
+
+Upstream Authors: fgouget@free.fr (unofficial 1.1.3 bing release)
+ Pierre Beyssac (Orignal bing author)
+
+Copyright:
+
+ * Copyright (c) 1995,1997 Pierre Beyssac.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Pierre Beyssac,
+ * Mike Muss, the University of California, Berkeley and its contributors.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted under the terms of the BSD License.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+On Debian GNU/Linux systems, the complete text of the BSD License can be
+found in `/usr/share/common-licenses/BSD'.
+
--- bing-1.1.3.orig/debian/watch
+++ bing-1.1.3/debian/watch
@@ -0,0 +1,24 @@
+# Example watch control file for uscan
+# Rename this file to "watch" and then you can run the "uscan" command
+# to check for upstream updates and more.
+# See uscan(1) for format
+
+# Compulsory line, this is a version 3 file
+version=3
+
+# Uncomment to examine a Webpage
+#
+#http://www.example.com/downloads.php #PACKAGE#-(.*)\.tar\.gz
+
+# Uncomment to examine a Webserver directory
+#http://www.example.com/pub/#PACKAGE#-(.*)\.tar\.gz
+
+# Uncommment to examine a FTP server
+#ftp://ftp.example.com/pub/#PACKAGE#-(.*)\.tar\.gz debian uupdate
+
+# Uncomment to find new files on sourceforge, for devscripts >= 2.9
+# http://sf.net/#PACKAGE#/#PACKAGE#-(.*)\.tar\.gz
+
+# Uncomment to find new files on GooglePages
+# http://example.googlepages.com/foo.html #PACKAGE#-(.*)\.tar\.gz
+http://fgouget.free.fr/bing/index-en.shtml bing_src-(.*).tar.gz
--- bing-1.1.3.orig/debian/control
+++ bing-1.1.3/debian/control
@@ -0,0 +1,18 @@
+Source: bing
+Section: net
+Priority: optional
+Maintainer: Mark Purcell
+Build-Depends: debhelper (>> 3.0.0)
+Homepage: http://fgouget.free.fr/bing/bing_src-readme-1st.shtml
+Standards-Version: 3.8.0
+
+Package: bing
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: Empirical stochastic bandwidth tester
+ Bing is a point-to-point bandwidth measurement tool (hence the 'b'),
+ based on ping.
+ .
+ Bing determines the real (raw, as opposed to available or average)
+ throughput on a link by measuring ICMP echo requests' round trip times
+ for different packet sizes at each end of the link.
--- bing-1.1.3.orig/debian/README.Debian
+++ bing-1.1.3/debian/README.Debian
@@ -0,0 +1,14 @@
+bing in Debian
++------------+
+
+Previous versions of bing were installed setuid root. However, as the
+program never actually drops superuser privileges and as such may be
+abused by ordinary users, and because bandwidth measurement is usually
+only done by the superuser, the setuid bit has been removed in version
+1.0.4-5.3.
+
+If, by any chance, you wish to get the old state back (that's not quite
+recommended on multi-user systems), just run `chmod 4755 /usr/sbin/bing`
+as root.
+
+ -- Josip Rodin, Sun, 20 Feb 2000 05:00:11 +0100
--- bing-1.1.3.orig/debian/changelog
+++ bing-1.1.3/debian/changelog
@@ -0,0 +1,77 @@
+bing (1.1.3-2) unstable; urgency=low
+
+ * Fix "segfaults on IPv6 addresses" Patch from Jeremie Koenig
+ (Closes: #511407)
+ * Update to Standards Version 3.8.0
+ - Add Homepage: & debian/watch
+
+ -- Mark Purcell Mon, 12 Jan 2009 11:42:18 +1100
+
+bing (1.1.3-1) unstable; urgency=low
+
+ * New upstream release, Thanks Stephane Bortzmeyer.
+ * Reapply Nikunj A. Dadhania HURD patch (Fixes: Bug#109724)
+ * Update debian/copyright (Closes: Bug#169064)
+ * bing now displays Mbps or Kbps as most sensible (Closes: Bug#27597,
+ Bug#61771, Bug#119818)
+
+ -- Mark Purcell Tue, 14 Jan 2003 23:04:12 +1100
+
+bing (1.0.5-3) unstable; urgency=low
+
+ * Apply Nikunj A. Dadhania HURD patch (Fixes: Bug#109724)
+
+ -- Mark Purcell Thu, 3 Jan 2002 11:51:35 +1100
+
+bing (1.0.5-2) unstable; urgency=low
+
+ * Fix spelling (Closes: Bug#124453)
+ * NMU Fixed bugs - Closed: (Closes: #37197, #45733, #55585, #58514)
+
+ -- Mark Purcell Sun, 23 Dec 2001 20:38:46 +1100
+
+bing (1.0.5-1) unstable; urgency=low
+
+ * New maintainer (Closes: Bug#123534)
+ * New upstream release (Closes: Bug#83124)
+ * Added Build-Depends: (Closes: Bug#70259)
+
+ -- Mark Purcell Mon, 17 Dec 2001 22:07:47 +1100
+
+bing (1.0.4-5.3.1) frozen unstable; urgency=low
+
+ * Reupload of 1.0.4-5.3 into frozen, too, as it fixes two bugs (one
+ of them RC). Sorry for wasting bandwidth :)
+
+ -- Josip Rodin Sat, 26 Feb 2000 22:03:31 +0100
+
+bing (1.0.4-5.3) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Removed suid bit, added README.Debian explaining it, an applied
+ the patch for the buffer overflow, closes: #58514.
+ * Suidless bing now really belongs to /usr/sbin, closes: #55585.
+
+ -- Josip Rodin Sat, 26 Feb 2000 17:40:54 +0100
+
+bing (1.0.4-5.2) unstable; urgency=low
+
+ * Non-maintainer upload, approved by maintainer.
+ * Changed packaging to use debhelper, and updated for Policy 3.x.
+ * Use suidregister to register (mode 4755) binary /usr/sbin/bing.
+ * Fix the license and URL in the copyright file (fixes: #37197).
+
+ -- Josip Rodin Sat, 25 Sep 1999 03:41:45 +0200
+
+bing (1.0.4-5.1) unstable; urgency=low
+
+ * Non-maintainer release.
+ * Libc6 compile.
+
+ -- Martin Mitchell Mon, 10 Nov 1997 18:12:40 +1100
+
+bing (1.0.4-5) unstable; urgency=low
+
+ * Convert to new package format.
+
+ -- Michael Shields Tue, 13 May 1997 01:39:51 +0000
--- bing-1.1.3.orig/debian/rules
+++ bing-1.1.3/debian/rules
@@ -0,0 +1,36 @@
+#!/usr/bin/make -f
+# Derived partly from dh_make's example.
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+ $(MAKE) CC="gcc" CFLAGS="-g -O2 -Wall" CLIBS="-s" bing
+ touch $@
+
+clean:
+ $(MAKE) clean
+ dh_clean build-stamp
+
+binary-indep:
+# Nothing to do here, no arch-independant packages here.
+
+binary-arch: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs /usr/sbin
+ install -m 0755 bing debian/tmp/usr/sbin/bing
+ dh_installdocs Readme.1st Readme.txt
+ dh_installmanpages
+ dh_installchangelogs ChangeLog
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary binary-indep binary-arch