This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPFire 3.x development tree".
The branch, master has been updated via 236898d61338706c7a8f22f80eb7a2d917619805 (commit) via 0606fca83ae5f5c5f4cca2724526f73f958f109f (commit) via 7e42e81b075291d0f4a42d470560d396b171d40f (commit) via 65b89fb5f7a391ee633b17b0eec073f30ecdaf58 (commit) via 35238ce4fc5266f6b81e466628f4d9d25c92dfda (commit) via 46b9f9ec9ee88e2175c66f8833fa7526378f7a74 (commit) via 6f19833f473ff4360147e593f07f54cd8da37e27 (commit) via e3a40b9851a8dcea07af83289ecfdc46d89cba2a (commit) via 229c9d5addb287e46fc11bc59f9f64c12e293471 (commit) via 8fb7289c5d1bfe6867ebcacdd6093fed2c31be2c (commit) via 53b9464eb8ea1269ed8e3df9a3eac83aff573e32 (commit) via dd735451301d0556b4b18303128cf7dab88105cc (commit) from 7bc8c930020f443795850cf831e431061fb96d1d (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 236898d61338706c7a8f22f80eb7a2d917619805 Author: Michael Tremer michael.tremer@ipfire.org Date: Thu Nov 4 12:54:16 2010 +0100
net-tools: New package.
Originally created by Stefan Schantl.
commit 0606fca83ae5f5c5f4cca2724526f73f958f109f Author: Michael Tremer michael.tremer@ipfire.org Date: Sun Oct 31 22:59:41 2010 +0100
naoki: Add dependency command for packages.
commit 7e42e81b075291d0f4a42d470560d396b171d40f Merge: e3a40b9 65b89fb Author: Michael Tremer michael.tremer@ipfire.org Date: Sun Oct 31 16:12:53 2010 +0100
Merge remote branch 'stevee/updates' into next
commit 65b89fb5f7a391ee633b17b0eec073f30ecdaf58 Author: Schantl Stefan Stevee@ipfire.org Date: Sun Oct 31 15:50:56 2010 +0100
xz: Update to 5.0.0.
commit 35238ce4fc5266f6b81e466628f4d9d25c92dfda Author: Schantl Stefan Stevee@ipfire.org Date: Sun Oct 31 15:48:18 2010 +0100
iptables: Update to 1.4.10.
commit 46b9f9ec9ee88e2175c66f8833fa7526378f7a74 Author: Schantl Stefan Stevee@ipfire.org Date: Sun Oct 31 15:45:25 2010 +0100
strongswan: Update to 4.5.0.
commit 6f19833f473ff4360147e593f07f54cd8da37e27 Merge: dd73545 7bc8c93 Author: Schantl Stefan Stevee@ipfire.org Date: Sun Oct 31 15:37:13 2010 +0100
Merge branch 'master' of ssh://git.ipfire.org/pub/git/ipfire-3.x into updates
commit e3a40b9851a8dcea07af83289ecfdc46d89cba2a Author: Michael Tremer michael.tremer@ipfire.org Date: Sat Oct 30 16:15:12 2010 +0200
gcc: Update patchset and fix errors.
commit 229c9d5addb287e46fc11bc59f9f64c12e293471 Merge: 8fb7289 53b9464 Author: Michael Tremer michael.tremer@ipfire.org Date: Sat Oct 30 10:19:38 2010 +0200
Merge branch 'master' of ssh://git.ipfire.org/pub/git/people/ms/ipfire-3.x into next
commit 8fb7289c5d1bfe6867ebcacdd6093fed2c31be2c Author: Michael Tremer michael.tremer@ipfire.org Date: Sat Oct 30 10:18:31 2010 +0200
naoki: Add -fasynchronous-unwind-tables to CFLAGS on i686.
commit 53b9464eb8ea1269ed8e3df9a3eac83aff573e32 Author: Michael Tremer michael.tremer@ipfire.org Date: Fri Oct 29 11:58:28 2010 +0200
gcc: Remove some awkward GNU debugger files.
commit dd735451301d0556b4b18303128cf7dab88105cc Author: Schantl Stefan Stevee@ipfire.org Date: Mon Oct 25 21:26:55 2010 +0200
dosfstools: Update to 3.0.10.
-----------------------------------------------------------------------
Summary of changes: config/architectures.conf | 2 +- naoki/__init__.py | 19 + naoki/terminal.py | 5 + pkgs/core/dosfstools/dosfstools.nm | 2 +- pkgs/core/gcc/gcc.nm | 5 +- .../patches/gcc-4.5.0-piepatches-20100421.patch | 1056 -------------------- pkgs/core/gcc/patches/gcc-4.5.1-esp-20101030.patch | 876 ++++++++++++++++ pkgs/core/gcc/patches/gcc45-pr33763.patch | 153 +++ pkgs/core/gcc/patches/gcc45-pr38757.patch | 118 +++ pkgs/core/iptables/iptables.nm | 2 +- pkgs/core/net-tools/config.h | 75 ++ pkgs/core/net-tools/config.make | 37 + pkgs/core/net-tools/ether-wake.8 | 81 ++ pkgs/core/net-tools/ether-wake.c | 392 ++++++++ pkgs/core/net-tools/ipmaddr.8 | 34 + pkgs/core/net-tools/iptunnel.8 | 42 + pkgs/core/net-tools/mii-diag.8 | 160 +++ pkgs/core/net-tools/mii-diag.c | 650 ++++++++++++ pkgs/core/net-tools/net-tools.nm | 166 +++ .../patches/net-tools-1.57-bug22040.patch | 50 + .../net-tools/patches/net-tools-1.60-IA64.patch | 33 + .../patches/net-tools-1.60-a-option.patch | 44 + .../net-tools-1.60-arp-unaligned-access.patch | 116 +++ .../net-tools/patches/net-tools-1.60-arp_man.patch | 13 + .../patches/net-tools-1.60-arp_overflow.patch | 11 + .../net-tools-1.60-avoid-name-resolution.patch | 31 + .../net-tools/patches/net-tools-1.60-bcast.patch | 99 ++ .../patches/net-tools-1.60-clear-flag.patch | 38 + .../net-tools-1.60-continous-flush-stdout.patch | 61 ++ .../net-tools/patches/net-tools-1.60-cycle.patch | 311 ++++++ .../core/net-tools/patches/net-tools-1.60-de.patch | 11 + .../patches/net-tools-1.60-debug-fix.patch | 61 ++ .../patches/net-tools-1.60-duplicate-tcp.patch | 194 ++++ .../patches/net-tools-1.60-ec_hw_null.patch | 12 + .../net-tools/patches/net-tools-1.60-fgets.patch | 41 + .../net-tools/patches/net-tools-1.60-gcc33.patch | 31 + .../net-tools/patches/net-tools-1.60-gcc34.patch | 36 + .../net-tools/patches/net-tools-1.60-hfi.patch | 183 ++++ .../patches/net-tools-1.60-hostname-short.patch | 38 + .../patches/net-tools-1.60-hostname_man.patch | 36 + .../patches/net-tools-1.60-i-option.patch | 57 ++ .../patches/net-tools-1.60-ib-warning.patch | 15 + .../patches/net-tools-1.60-ifaceopt.patch | 52 + ...et-tools-1.60-ifconfig-long-iface-crasher.patch | 36 + .../patches/net-tools-1.60-ifconfig.patch | 107 ++ .../patches/net-tools-1.60-ifconfig_ib.patch | 202 ++++ .../patches/net-tools-1.60-ifconfig_man.patch | 14 + .../patches/net-tools-1.60-inet6-lookup.patch | 81 ++ .../patches/net-tools-1.60-interface.patch | 110 ++ .../patches/net-tools-1.60-interface_stack.patch | 115 +++ .../net-tools/patches/net-tools-1.60-ipx.patch | 36 + .../net-tools/patches/net-tools-1.60-isofix.patch | 33 + .../patches/net-tools-1.60-large-indexes.patch | 12 + .../patches/net-tools-1.60-makefile-berlios.patch | 69 ++ .../patches/net-tools-1.60-man-RHEL-bugs.patch | 18 + .../patches/net-tools-1.60-man-obsolete.patch | 267 +++++ .../net-tools/patches/net-tools-1.60-man.patch | 132 +++ .../patches/net-tools-1.60-manydevs.patch | 13 + .../patches/net-tools-1.60-masqinfo-raw-ip.patch | 14 + .../patches/net-tools-1.60-metric-tunnel-man.patch | 21 + .../patches/net-tools-1.60-mii-gigabit.patch | 240 +++++ .../patches/net-tools-1.60-mii-refactor.patch | 224 +++++ .../patches/net-tools-1.60-mii-tool-obsolete.patch | 25 + .../patches/net-tools-1.60-miiioctl.patch | 17 + .../net-tools/patches/net-tools-1.60-nameif.patch | 67 ++ .../patches/net-tools-1.60-nameif_strncpy.patch | 13 + .../patches/net-tools-1.60-netdevice.patch | 22 + .../net-tools/patches/net-tools-1.60-netmask.patch | 61 ++ .../patches/net-tools-1.60-netstat-I-fix.patch | 10 + .../net-tools-1.60-netstat-interfaces-crash.patch | 25 + .../patches/net-tools-1.60-netstat-leak.patch | 11 + .../patches/net-tools-1.60-netstat-probe.patch | 15 + .../patches/net-tools-1.60-netstat_inode.patch | 186 ++++ .../patches/net-tools-1.60-netstat_stop_trim.patch | 91 ++ .../patches/net-tools-1.60-netstat_ulong.patch | 11 + .../net-tools/patches/net-tools-1.60-note.patch | 13 + .../patches/net-tools-1.60-num-ports.patch | 78 ++ .../patches/net-tools-1.60-overflow.patch | 57 ++ .../net-tools/patches/net-tools-1.60-parse.patch | 70 ++ .../net-tools/patches/net-tools-1.60-pie.patch | 13 + .../patches/net-tools-1.60-remove_node.patch | 24 + .../net-tools/patches/net-tools-1.60-return.patch | 28 + .../patches/net-tools-1.60-scanf-format.patch | 140 +++ .../patches/net-tools-1.60-sctp-addrs.patch | 346 +++++++ .../patches/net-tools-1.60-sctp-quiet.patch | 11 + .../net-tools/patches/net-tools-1.60-sctp.patch | 617 ++++++++++++ .../net-tools/patches/net-tools-1.60-selinux.patch | 225 +++++ .../net-tools/patches/net-tools-1.60-siunits.patch | 80 ++ .../net-tools/patches/net-tools-1.60-skip.patch | 13 + .../patches/net-tools-1.60-slattach-fchown.patch | 24 + .../patches/net-tools-1.60-statalias.patch | 15 + .../net-tools-1.60-statistics-doubleword.patch | 366 +++++++ .../patches/net-tools-1.60-statistics.patch | 65 ++ .../patches/net-tools-1.60-statistics_buffer.patch | 12 + .../net-tools/patches/net-tools-1.60-stdo.patch | 11 + .../patches/net-tools-1.60-trailingblank.patch | 26 + .../patches/net-tools-1.60-trim_iface.patch | 31 + .../net-tools/patches/net-tools-1.60-trunc.patch | 42 + .../net-tools/patches/net-tools-1.60-ulong.patch | 215 ++++ .../patches/net-tools-1.60-virtualname.patch | 36 + .../patches/net-tools-1.60-x25-proc.patch | 13 + pkgs/core/strongswan/strongswan.nm | 2 +- pkgs/core/xz/xz.nm | 2 +- 103 files changed, 9260 insertions(+), 1062 deletions(-) delete mode 100644 pkgs/core/gcc/patches/gcc-4.5.0-piepatches-20100421.patch create mode 100644 pkgs/core/gcc/patches/gcc-4.5.1-esp-20101030.patch create mode 100644 pkgs/core/gcc/patches/gcc45-pr33763.patch create mode 100644 pkgs/core/gcc/patches/gcc45-pr38757.patch create mode 100644 pkgs/core/net-tools/config.h create mode 100644 pkgs/core/net-tools/config.make create mode 100644 pkgs/core/net-tools/ether-wake.8 create mode 100644 pkgs/core/net-tools/ether-wake.c create mode 100644 pkgs/core/net-tools/ipmaddr.8 create mode 100644 pkgs/core/net-tools/iptunnel.8 create mode 100644 pkgs/core/net-tools/mii-diag.8 create mode 100644 pkgs/core/net-tools/mii-diag.c create mode 100644 pkgs/core/net-tools/net-tools.nm create mode 100644 pkgs/core/net-tools/patches/net-tools-1.57-bug22040.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-IA64.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-a-option.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-arp-unaligned-access.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-arp_man.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-arp_overflow.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-avoid-name-resolution.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-bcast.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-clear-flag.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-continous-flush-stdout.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-cycle.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-de.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-debug-fix.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-duplicate-tcp.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-ec_hw_null.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-fgets.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-gcc33.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-gcc34.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-hfi.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-hostname-short.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-hostname_man.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-i-option.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-ib-warning.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-ifaceopt.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-ifconfig-long-iface-crasher.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-ifconfig.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-ifconfig_ib.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-ifconfig_man.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-inet6-lookup.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-interface.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-interface_stack.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-ipx.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-isofix.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-large-indexes.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-makefile-berlios.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-man-RHEL-bugs.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-man-obsolete.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-man.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-manydevs.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-masqinfo-raw-ip.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-metric-tunnel-man.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-mii-gigabit.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-mii-refactor.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-mii-tool-obsolete.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-miiioctl.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-nameif.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-nameif_strncpy.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-netdevice.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-netmask.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-netstat-I-fix.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-netstat-interfaces-crash.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-netstat-leak.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-netstat-probe.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-netstat_inode.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-netstat_stop_trim.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-netstat_ulong.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-note.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-num-ports.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-overflow.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-parse.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-pie.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-remove_node.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-return.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-scanf-format.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-sctp-addrs.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-sctp-quiet.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-sctp.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-selinux.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-siunits.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-skip.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-slattach-fchown.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-statalias.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-statistics-doubleword.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-statistics.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-statistics_buffer.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-stdo.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-trailingblank.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-trim_iface.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-trunc.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-ulong.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-virtualname.patch create mode 100644 pkgs/core/net-tools/patches/net-tools-1.60-x25-proc.patch
Difference in files: diff --git a/config/architectures.conf b/config/architectures.conf index e01a008..c197dd5 100644 --- a/config/architectures.conf +++ b/config/architectures.conf @@ -8,7 +8,7 @@ default = i686 machine = i686 personality = linux32
-cflags = -O2 -fomit-frame-pointer -pipe +cflags = -O2 -fomit-frame-pointer -fasynchronous-unwind-tables -pipe cxxflags = %(cflags)s
;[i586] diff --git a/naoki/__init__.py b/naoki/__init__.py index 4b1c7fa..4ad6ae1 100644 --- a/naoki/__init__.py +++ b/naoki/__init__.py @@ -92,6 +92,7 @@ class Naoki(object): return 1
actionmap = { + "dependencies" : self.call_package_dependencies, "info" : self.call_package_info, "list" : self.call_package_list, "groups" : self.call_package_groups, @@ -101,6 +102,24 @@ class Naoki(object):
return actionmap[args.action.name](args.action)
+ def call_package_dependencies(self, args): + repo = self._get_source_repos() + + p = repo.find_package_by_name(args.package) + if not p: + raise Exception, "Could not find package: %s" % args.package + + deps = dependencies.DependencySet() + for dep in p.get_dependencies() + p.get_dependencies("build"): + deps.add_dependency(dep) + + deps.resolve() + + identifiers = set([d.identifier for d in deps.dependencies]) + + for identifier in sorted(identifiers): + print identifier + def call_package_info(self, args): # Source repositories repo = self._get_source_repos() diff --git a/naoki/terminal.py b/naoki/terminal.py index 0e9fdb2..039f8a9 100644 --- a/naoki/terminal.py +++ b/naoki/terminal.py @@ -292,6 +292,11 @@ class Commandline(object): # Package Parser("package", parsers=[ + Parser("dependencies", + help="Show package dependencies.", + arguments=[ + Argument("package", help="Name of the package."), + ]), Parser("info", help="Show detailed information about given packages", arguments=[ diff --git a/pkgs/core/dosfstools/dosfstools.nm b/pkgs/core/dosfstools/dosfstools.nm index 7b6d980..91d505b 100644 --- a/pkgs/core/dosfstools/dosfstools.nm +++ b/pkgs/core/dosfstools/dosfstools.nm @@ -25,7 +25,7 @@ include $(PKGROOT)/Include
PKG_NAME = dosfstools -PKG_VER = 3.0.1 +PKG_VER = 3.0.10 PKG_REL = 0
PKG_MAINTAINER = diff --git a/pkgs/core/gcc/gcc.nm b/pkgs/core/gcc/gcc.nm index fb94bac..b1cc18a 100644 --- a/pkgs/core/gcc/gcc.nm +++ b/pkgs/core/gcc/gcc.nm @@ -26,7 +26,7 @@ include $(PKGROOT)/Include
PKG_NAME = gcc PKG_VER = 4.5.1 -PKG_REL = 0 +PKG_REL = 2
PKG_MAINTAINER = Michael Tremer michael.tremer@ipfire.org PKG_GROUP = Development/Compilers @@ -178,4 +178,7 @@ define STAGE_INSTALL -mkdir -pv $(BUILDROOT)/lib ln -sfv ../usr/bin/cpp $(BUILDROOT)/lib/cpp ln -sfv gcc $(BUILDROOT)/usr/bin/cc + + # Remove some GNU debugger stuff. + rm -vf $(BUILDROOT)/usr/lib/lib*.py endef diff --git a/pkgs/core/gcc/patches/gcc-4.5.0-piepatches-20100421.patch b/pkgs/core/gcc/patches/gcc-4.5.0-piepatches-20100421.patch deleted file mode 100644 index e525d5b..0000000 --- a/pkgs/core/gcc/patches/gcc-4.5.0-piepatches-20100421.patch +++ /dev/null @@ -1,1056 +0,0 @@ -diff -Nur gcc-4.5.0-vanilla/configure gcc-4.5.0/configure ---- gcc-4.5.0-vanilla/configure 2010-04-02 19:35:47.000000000 +0200 -+++ gcc-4.5.0/configure 2010-04-21 15:21:09.762948361 +0200 -@@ -707,6 +707,7 @@ - CFLAGS - CC - target_subdir -+enable_esp - host_subdir - build_subdir - build_libsubdir -@@ -1485,6 +1486,11 @@ - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-gold use gold instead of ld - --enable-libada build libada directory -+ --enable-esp -+ Enable Stack protector, Position independent executable and -+ Fortify_sources as default if we have suppot for it when compiling -+ and link with -z relro and -z now as default. -+ Linux targets supported i*86, x86_64, powerpc*, ia64, arm* and mips - --enable-libssp build libssp directory - --enable-build-with-cxx build with C++ compiler instead of C compiler - --disable-ppl-version-check disable check for PPL version -@@ -3164,6 +3170,24 @@ - noconfigdirs="$noconfigdirs gnattools" - fi - -+# Check whether --enable-esp was given and target have the support. -+# Check whether --enable-esp or --disable-esp was given. -+if test "${enable_esp+set}" = set; then -+ enableval="$enable_esp" -+ -+ case $target in -+ i?86*-*-linux* | x86_64*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux* | mips-*-linux*) -+ enable_esp=yes -+ ;; -+ *) -+ { { echo "$as_me:$LINENO: error: *** --enable-esp is not supported on this $target target." >&5 -+echo "$as_me: error: *** --enable-esp is not supported on this $target target." >&2;} -+ { (exit 1); exit 1; }; } -+ ;; -+ esac -+ -+fi; -+ - # Check whether --enable-libssp was given. - if test "${enable_libssp+set}" = set; then : - enableval=$enable_libssp; ENABLE_LIBSSP=$enableval -@@ -14290,6 +14314,9 @@ - *) stage1_cflags="-g -J" ;; - esac ;; - esac -+if test x$enable_esp = xyes; then -+ stage1_cflags="$stage1_cflags -fno-stack-protector" -+fi - - # This is aimed to mimic bootstrap with a non-GCC compiler to catch problems. - if test "$GCC" = yes -a "$ENABLE_BUILD_WITH_CXX" != yes; then -diff -Nur gcc-4.5.0-vanilla/gcc/config/i386/linux64.h gcc-4.5.0/gcc/config/i386/linux64.h ---- gcc-4.5.0-vanilla/gcc/config/i386/linux64.h 2010-03-24 21:44:48.000000000 +0100 -+++ gcc-4.5.0/gcc/config/i386/linux64.h 2010-04-21 15:21:16.730815972 +0200 -@@ -115,7 +115,7 @@ - /* This macro may be overridden in i386/k*bsd-gnu.h. */ - #define REG_NAME(reg) reg - --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ - /* i386 glibc provides __stack_chk_guard in %gs:0x14, - x86_64 glibc provides it in %fs:0x28. */ - #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14) -diff -Nur gcc-4.5.0-vanilla/gcc/config/i386/linux.h gcc-4.5.0/gcc/config/i386/linux.h ---- gcc-4.5.0-vanilla/gcc/config/i386/linux.h 2010-03-24 21:44:48.000000000 +0100 -+++ gcc-4.5.0/gcc/config/i386/linux.h 2010-04-21 15:21:16.721813554 +0200 -@@ -212,7 +212,7 @@ - /* This macro may be overridden in i386/k*bsd-gnu.h. */ - #define REG_NAME(reg) reg - --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ - /* i386 glibc provides __stack_chk_guard in %gs:0x14. */ - #define TARGET_THREAD_SSP_OFFSET 0x14 - #endif -diff -Nur gcc-4.5.0-vanilla/gcc/config/linux.h gcc-4.5.0/gcc/config/linux.h ---- gcc-4.5.0-vanilla/gcc/config/linux.h 2009-04-09 17:00:19.000000000 +0200 -+++ gcc-4.5.0/gcc/config/linux.h 2010-04-21 15:21:16.667815357 +0200 -@@ -43,7 +43,11 @@ - object constructed before entering `main'. */ - - #undef STARTFILE_SPEC --#if defined HAVE_LD_PIE -+#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINTS) -+#define STARTFILE_SPEC \ -+ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} crti.o%s \ -+ %{static:%{pie:crtbeginTS.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}" -+#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINTS) - #define STARTFILE_SPEC \ - "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ - crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" -diff -Nur gcc-4.5.0-vanilla/gcc/config/rs6000/linux64.h gcc-4.5.0/gcc/config/rs6000/linux64.h ---- gcc-4.5.0-vanilla/gcc/config/rs6000/linux64.h 2010-03-17 05:44:37.000000000 +0100 -+++ gcc-4.5.0/gcc/config/rs6000/linux64.h 2010-04-21 15:21:16.732816308 +0200 -@@ -162,7 +162,7 @@ - #endif - - #define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \ --%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \ -+%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} \ - %{memb} %{!memb: %{msdata=eabi: -memb}} \ - %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \ - %{mcall-freebsd: -mbig} \ -@@ -525,7 +525,7 @@ - - #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" - --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ - /* ppc32 glibc provides __stack_chk_guard in -0x7008(2), - ppc64 glibc provides it at -0x7010(13). */ - #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008) -diff -Nur gcc-4.5.0-vanilla/gcc/config/rs6000/linux.h gcc-4.5.0/gcc/config/rs6000/linux.h ---- gcc-4.5.0-vanilla/gcc/config/rs6000/linux.h 2007-08-02 12:49:31.000000000 +0200 -+++ gcc-4.5.0/gcc/config/rs6000/linux.h 2010-04-21 15:21:16.731819651 +0200 -@@ -117,7 +117,7 @@ - - #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" - --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ - /* ppc32 glibc provides __stack_chk_guard in -0x7008(2). */ - #define TARGET_THREAD_SSP_OFFSET -0x7008 - #endif -diff -Nur gcc-4.5.0-vanilla/gcc/config/rs6000/sysv4.h gcc-4.5.0/gcc/config/rs6000/sysv4.h ---- gcc-4.5.0-vanilla/gcc/config/rs6000/sysv4.h 2009-11-25 21:23:20.000000000 +0100 -+++ gcc-4.5.0/gcc/config/rs6000/sysv4.h 2010-04-21 15:21:16.674812959 +0200 -@@ -883,7 +883,12 @@ - %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \ - %{!shared: %{profile:-lc_p} %{!profile:-lc}}}" - --#ifdef HAVE_LD_PIE -+#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINTS) -+#define STARTFILE_LINUX_SPEC \ -+ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ -+ %{mnewlib:ecrti.o%s;:crti.o%s} \ -+ {static:%{pie:crtbeginTS.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}" -+#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINTS) - #define STARTFILE_LINUX_SPEC "\ - %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ - %{mnewlib:ecrti.o%s;:crti.o%s} \ -diff -Nur gcc-4.5.0-vanilla/gcc/config/s390/linux.h gcc-4.5.0/gcc/config/s390/linux.h ---- gcc-4.5.0-vanilla/gcc/config/s390/linux.h 2007-08-02 12:49:31.000000000 +0200 -+++ gcc-4.5.0/gcc/config/s390/linux.h 2010-04-21 15:21:16.738814124 +0200 -@@ -93,7 +93,7 @@ - - #define MD_UNWIND_SUPPORT "config/s390/linux-unwind.h" - --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ - /* s390 glibc provides __stack_chk_guard in 0x14(tp), - s390x glibc provides it at 0x28(tp). */ - #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14) -diff -Nur gcc-4.5.0-vanilla/gcc/config/sparc/linux64.h gcc-4.5.0/gcc/config/sparc/linux64.h ---- gcc-4.5.0-vanilla/gcc/config/sparc/linux64.h 2009-12-08 00:31:01.000000000 +0100 -+++ gcc-4.5.0/gcc/config/sparc/linux64.h 2010-04-21 15:21:16.749816158 +0200 -@@ -298,7 +298,7 @@ - #undef NEED_INDICATE_EXEC_STACK - #define NEED_INDICATE_EXEC_STACK 1 - --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ - /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14], - sparc64 glibc provides it at [%g7 + 0x28]. */ - #define TARGET_THREAD_SSP_OFFSET (TARGET_ARCH64 ? 0x28 : 0x14) -diff -Nur gcc-4.5.0-vanilla/gcc/config/sparc/linux.h gcc-4.5.0/gcc/config/sparc/linux.h ---- gcc-4.5.0-vanilla/gcc/config/sparc/linux.h 2009-12-08 00:31:01.000000000 +0100 -+++ gcc-4.5.0/gcc/config/sparc/linux.h 2010-04-21 15:21:16.746815839 +0200 -@@ -172,7 +172,7 @@ - #undef NEED_INDICATE_EXEC_STACK - #define NEED_INDICATE_EXEC_STACK 1 - --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ - /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14]. */ - #define TARGET_THREAD_SSP_OFFSET 0x14 - #endif -diff -Nur gcc-4.5.0-vanilla/gcc/config.in gcc-4.5.0/gcc/config.in ---- gcc-4.5.0-vanilla/gcc/config.in 2010-04-14 11:30:07.000000000 +0200 -+++ gcc-4.5.0/gcc/config.in 2010-04-21 15:21:09.879812904 +0200 -@@ -52,6 +52,12 @@ - #endif - - -+/* Define to 1 to enable crtbeginTS.o. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_CRTBEGINTS -+#endif -+ -+ - /* Define to 1 to specify that we are using the BID decimal floating point - format instead of DPD */ - #ifndef USED_FOR_TARGET -@@ -71,6 +77,12 @@ - #endif - - -+/* Define to 1 to enable esp. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_ESP -+#endif -+ -+ - /* Define to 1 to enable fixed-point arithmetic extension to C. */ - #ifndef USED_FOR_TARGET - #undef ENABLE_FIXED_POINT -@@ -996,6 +1008,12 @@ - #endif - - -+/* Define to 1 if your compiler supports -fstack-protector */ -+#ifndef USED_FOR_TARGET -+#undef HAVE_GCC_SSP -+#endif -+ -+ - /* Define to 1 if you have the `getchar_unlocked' function. */ - #ifndef USED_FOR_TARGET - #undef HAVE_GETCHAR_UNLOCKED -diff -Nur gcc-4.5.0-vanilla/gcc/configure gcc-4.5.0/gcc/configure ---- gcc-4.5.0-vanilla/gcc/configure 2010-03-26 06:40:32.000000000 +0100 -+++ gcc-4.5.0/gcc/configure 2010-04-21 15:21:09.784072083 +0200 -@@ -678,6 +678,8 @@ - HOST_LIBS - GGC - libgcc_visibility -+enable_esp -+enable_crtbeginTS - gcc_cv_readelf - gcc_cv_objdump - ORIGINAL_NM_FOR_TARGET -@@ -24576,6 +24578,50 @@ - ;; - esac - -+echo "$as_me:$LINENO: checking linker -z now support" >&5 -+echo $ECHO_N "checking linker -z now support... $ECHO_C" >&6 -+if test "${gcc_cv_ld_now+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ gcc_cv_ld_now=no -+if test $in_tree_ld = yes ; then -+ if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \ -+ && test $in_tree_ld_is_elf = yes; then -+ gcc_cv_ld_now=yes -+ fi -+elif test x$gcc_cv_ld != x; then -+ # Check if linker supports -z now options -+ if $gcc_cv_ld --help 2>/dev/null | grep now > /dev/null; then -+ gcc_cv_ld_now=yes -+ fi -+fi -+ -+fi -+echo "$as_me:$LINENO: result: $gcc_cv_ld_now" >&5 -+echo "${ECHO_T}$gcc_cv_ld_now" >&6 -+ -+echo "$as_me:$LINENO: checking linker -z relro support" >&5 -+echo $ECHO_N "checking linker -z relro support... $ECHO_C" >&6 -+if test "${gcc_cv_ld_relro+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ gcc_cv_ld_relro=no -+if test $in_tree_ld = yes ; then -+ if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \ -+ && test $in_tree_ld_is_elf = yes; then -+ gcc_cv_ld_relro=yes -+ fi -+elif test x$gcc_cv_ld != x; then -+ # Check if linker supports -z relro and -z norelro options -+ if $gcc_cv_ld --help 2>/dev/null | grep relro > /dev/null; then -+ gcc_cv_ld_relro=yes -+ fi -+fi -+ -+fi -+echo "$as_me:$LINENO: result: $gcc_cv_ld_relro" >&5 -+echo "${ECHO_T}$gcc_cv_ld_relro" >&6 -+ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --build-id support" >&5 - $as_echo_n "checking linker --build-id support... " >&6; } - if test "${gcc_cv_ld_buildid+set}" = set; then : -@@ -24729,6 +24775,146 @@ - - fi - -+if test x$gcc_cv_libc_provides_ssp = xyes; then -+ echo "$as_me:$LINENO: checking whether $CC support -fstack-protector" >&5 -+echo $ECHO_N "checking whether $CC support -fstack-protector... $ECHO_C" >&6 -+if test "${gcc_cv_cc_stack_protector+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+ saved_CFLAGS="$CFLAGS" -+ CFLAGS="$CFLAGS -fstack-protector" -+ cat >conftest.$ac_ext <<_ACEOF -+#ifndef __SSP__ -+#error -+#endif -+ -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: "$ac_compile"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: $? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" -+ || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: "$ac_try"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: $? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: "$ac_try"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: $? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ -+ case $target in -+ i?86*-*-linux* | x86_64*-*-linux* | powerpc-*-linux* | powerpc64-*-linux*) -+ if test x$set_have_as_tls = xyes; then -+ gcc_cv_cc_stack_protector=yes -+ else -+ gcc_cv_cc_stack_protector=no -+ fi -+ ;; -+ *) -+ cc_cv_cc_stack_protector=yes -+ ;; -+ esac -+ -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+gcc_cv_cc_stack_protector=no -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ CFLAGS="$saved_CFLAGS" -+ -+fi -+echo "$as_me:$LINENO: result: $gcc_cv_cc_stack_protector" >&5 -+echo "${ECHO_T}$gcc_cv_cc_stack_protector" >&6 -+fi -+if test x$gcc_cv_cc_stack_protector = xyes; then -+ -+cat >>confdefs.h <<_ACEOF -+#define HAVE_GCC_SSP 1 -+_ACEOF -+ -+fi -+ -+ -+if test x$enable_esp = xyes ; then -+case $target in -+ ia64*-*-linux*) -+ if test x$gcc_cv_ld_now = xyes; then -+ enable_esp_ld=yes -+ else -+ enable_esp_ld=no -+ fi -+ ;; -+ *-*-linux*) -+ if test x$gcc_cv_ld_relro = xyes && test x$gcc_cv_ld_now = xyes; then -+ enable_esp_ld=yes -+ else -+ enable_esp_ld=no -+ fi -+ ;; -+ *) -+ enable_esp_ld=no -+ ;; -+ esac -+else -+ enable_esp_ld=no -+fi -+if test x$enable_esp_ld = xyes; then -+ -+cat >>confdefs.h <<_ACEOF -+#define ENABLE_ESP 1 -+_ACEOF -+ -+fi -+if test x$enable_esp = xyes && test x$enable_esp_ld = xno; then -+ { { echo "$as_me:$LINENO: error: *** --enable-esp is not supported. You don't have -z,relro or -z,now support in the linker." >&5 -+echo "$as_me: error: *** --enable-esp is not supported. You don't have -z,relro or -z,now support in the linker." >&2;} -+ { (exit 1); exit 1; }; } -+fi -+ -+echo "$as_me:$LINENO: checking for crtbeginTS.o support" >&5 -+echo $ECHO_N "checking for crtbeginTS.o support... $ECHO_C" >&6 -+if test "${enable_crtbeginTS+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+if test x$enable_esp = xyes ; then -+ case "$target" in -+ ia64*-*-linux*) -+ enable_crtbeginTS=no ;; -+ *-*-linux*) -+ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then -+ enable_crtbeginTS=yes -+ fi -+ ;; -+ *) enable_crtbeginTS=no ;; -+ esac -+fi -+ -+fi -+echo "$as_me:$LINENO: result: $enable_crtbeginTS" >&5 -+echo "${ECHO_T}$enable_crtbeginTS" >&6 -+ -+if test x$enable_crtbeginTS = xyes; then -+ -+cat >>confdefs.h <<_ACEOF -+#define ENABLE_CRTBEGINTS 1 -+_ACEOF -+ -+fi -+ - # Check if TFmode long double should be used by default or not. - # Some glibc targets used DFmode long double, but with glibc 2.4 - # and later they can use TFmode. -diff -Nur gcc-4.5.0-vanilla/gcc/cp/lang-specs.h gcc-4.5.0/gcc/cp/lang-specs.h ---- gcc-4.5.0-vanilla/gcc/cp/lang-specs.h 2007-08-06 13:10:19.000000000 +0200 -+++ gcc-4.5.0/gcc/cp/lang-specs.h 2010-04-21 15:21:16.684816335 +0200 -@@ -47,7 +47,7 @@ - %(cpp_options) %2 -o %{save-temps:%b.ii} %{!save-temps:%g.ii} \n}\ - cc1plus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.ii} %{!save-temps:%g.ii}}\ - %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\ -- %(cc1_options) %2 %{+e1*}\ -+ %(cc1_options) %(esp_options) %2 %{+e1*}\ - %{!fsyntax-only:-o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}}", - CPLUSPLUS_CPP_SPEC, 0, 0}, - {"@c++", -@@ -57,11 +57,11 @@ - %(cpp_options) %2 -o %{save-temps:%b.ii} %{!save-temps:%g.ii} \n}\ - cc1plus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.ii} %{!save-temps:%g.ii}}\ - %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\ -- %(cc1_options) %2 %{+e1*}\ -+ %(cc1_options) %(esp_options) %2 %{+e1*}\ - %{!fsyntax-only:%(invoke_as)}}}}", - CPLUSPLUS_CPP_SPEC, 0, 0}, - {".ii", "@c++-cpp-output", 0, 0, 0}, - {"@c++-cpp-output", - "%{!M:%{!MM:%{!E:\ -- cc1plus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ -+ cc1plus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, -diff -Nur gcc-4.5.0-vanilla/gcc/doc/invoke.texi gcc-4.5.0/gcc/doc/invoke.texi ---- gcc-4.5.0-vanilla/gcc/doc/invoke.texi 2010-04-06 16:02:22.000000000 +0200 -+++ gcc-4.5.0/gcc/doc/invoke.texi 2010-04-21 15:21:16.796812184 +0200 -@@ -7856,6 +7856,11 @@ - @opindex fstack-protector-all - Like @option{-fstack-protector} except that all functions are protected. - -+NOTE: When --enable-esp this option is enabled by default -+for C, C++, ObjC, ObjC++, if neither @option{-fno-stack-protector} -+or @option{-nostdlib} or @option{-nodefaultlibs} or -+@option{-fstack-protector} are found. -+ - @item -fsection-anchors - @opindex fsection-anchors - Try to reduce the number of symbolic address calculations by using -@@ -8705,6 +8710,12 @@ - that were used to generate code (@option{-fpie}, @option{-fPIE}, - or model suboptions) when you specify this option. - -+NOTE: When --enable-esp this option is enabled by default -+for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE} -+or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or -+@option{-nostartfiles} or @option{-shared} or @option{-pg} or @option{-p} -+are found. -+ - @item -rdynamic - @opindex rdynamic - Pass the flag @option{-export-dynamic} to the ELF linker, on targets -@@ -17251,6 +17262,11 @@ - @code{__pie__} and @code{__PIE__}. The macros have the value 1 - for @option{-fpie} and 2 for @option{-fPIE}. - -+NOTE: When --enable-esp this option is enabled by default -+for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE} -+or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or -+@option{-nostartfiles} or @option{-shared} are found. -+ - @item -fno-jump-tables - @opindex fno-jump-tables - Do not use jump tables for switch statements even where it would be -diff -Nur gcc-4.5.0-vanilla/gcc/esp.h gcc-4.5.0/gcc/esp.h ---- gcc-4.5.0-vanilla/gcc/esp.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.5.0/gcc/esp.h 2010-04-21 15:21:16.622811922 +0200 -@@ -0,0 +1,148 @@ -+/* License terms see GNU GENERAL PUBLIC LICENSE Version 3. -+ * Version 20100409.1 -+ * Magnus Granberg (Zorry) zorry@gentoo.org */ -+#ifndef GCC_ESP_H -+#define GCC_ESP_H -+ -+/* This file will add -fstack-protector, -fPIE, -pie -D_FORTIFY_SOURCES=2 -z,relro and -z,now -+ as default if the defines and the spec allow it. -+ -+ On Gentoo -+ Added a hack for gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass -+ to support older hardened GCC patches and we don't need to change the code on gcc-specs-* and _filter-hardened. -+ We use -fstack-protector-all instead of -fstack-protector -+ This will add some unsupported upstream commands options as -nopie. -+ -D__KERNEL__ is added so we don't have -fPIE and -fstack-protector-all when building kernels. -+ ESP_CC1_SPEC is added to CC1_SPEC. -+ -D_FORTIFY_SOURCES=2 is added with gentoo's patchset as default so no need to set it hear. -+ ESP_LINK_SPEC will not add -z,relro as it default on with binutils. -+ ESP_CC1_STRICT_SPEC is added so we don't use gcc/opts.c to disable it. -+ ESP_OPTIONS_PIE_CHECK_SPEC check for -pie, -p, -pg, -profile, -static and -shared. -+ ENABLE_CRTBEGINTS add support for crtbeginTS.o, build -static with -fPIE or -fpie. -+*/ -+#ifdef ENABLE_ESP -+ -+ /* Hack to support gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass */ -+ #define ESP_CC1_SPEC " %(esp_cc1_ssp) %(esp_cc1_pie) %(esp_cc1_strict)" -+ #ifdef HAVE_GCC_SSP -+ #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: }}" -+ #else -+ #define ESP_CC1_SSP_SPEC "" -+ #endif -+ #define ESP_CC1_PIE_SPEC "%{!nopie: }" -+ #define ESP_CC1_STRICT_SPEC "%{!fstrict-overflow:%{!fno-strict-overflow: -fno-strict-overflow}}" -+ -+ /* ESP_LINK_SPEC is added to LINK_PIE_SPEC if esp is enable -+ -z now will be added if we don't have -vanilla spec */ -+ #define ESP_LINK_SPEC "%(esp_link_now)" -+ #define ESP_LINK_NOW_SPEC "%{!now:-z now}" -+ -+ /* ESP_OPTIONS_SPEC is added to the compiler spec in gcc/gcc.c */ -+ #define ESP_OPTIONS_SPEC "%(esp_options_ssp)" -+ -+ /* ESP_CPP_OPTIONS_SPEC is added to the cpp_options spec in gcc/gcc.c -+ For precompiling headers. */ -+ #define ESP_CPP_OPTIONS_SPEC "%(esp_options_ssp)" -+ -+ /* This will add -fstack-protector-all if we don't have -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector -+ -fstack-protector-all and we have TARGET_LIBC_PROVIDES_SSP and HAVE_GCC_SSP defined. */ -+ #ifdef HAVE_GCC_SSP -+ #define ESP_OPTIONS_SSP_SPEC \ -+ "%{!D__KERNEL__:%{!nostdlib:%{!nodefaultlibs: %{!fno-stack-protector: \ -+ %{!fstack-protector:%{!fstack-protector-all:-fstack-protector-all}}}}}}" -+ #else -+ #define ESP_OPTIONS_SSP_SPEC "" -+ #endif -+ -+ /* If HAVE_LD_PIE not defined we will not add any -fPIE -pie */ -+ #ifdef HAVE_LD_PIE -+ -+ /* We use ESP_COMMAND_OPTIONS_SPEC to add pie command-line options. */ -+ #define ESP_COMMAND_OPTIONS_SPEC "%{!D__KERNEL__:%{!nopie:%(esp_options_pie) %(esp_link_pie)}}" -+ -+ /* This will add -fPIE if we don't have -pie -fpic -fPIC -fpie -fPIE -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static -+ -nostdlib -nostartfiles. */ -+ /* With ENABLE_CRTBEGINTS we don't need to check for -static */ -+ #ifdef ENABLE_CRTBEGINTS -+ #define ESP_OPTIONS_PIE_SPEC \ -+ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \ -+ %{!shared: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }" -+ #else -+ #define ESP_OPTIONS_PIE_SPEC \ -+ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \ -+ %{!shared: %{!static: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }}" -+ #endif -+ -+ /* This will add -pie if we don't have -pie -A -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static -r -nostdlib -+ -nostartfiles */ -+ /* With ENABLE_CRTBEGINTS we don't need to check for -static -+ and we add -pie only to get the start and endfiles. -pie will not go to the linker. */ -+ #ifdef ENABLE_CRTBEGINTS -+ #define ESP_LINK_PIE_SPEC \ -+ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!r: \ -+ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}" -+ #else -+ #define ESP_LINK_PIE_SPEC \ -+ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r: \ -+ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}}" -+ #endif -+ -+ /* This will check if shared is set when -static -pie -fPIE -fpie -fno-PIC -fno-pic, -pie is set when -static -pg -p -profile. -+ If set it will make gcc print out "-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible" or -+ "-pie and pg|p|profile are incompatible" */ -+ /* With ENABLE_CRTBEGINTS we don't need to check for -static */ -+ #ifdef ENABLE_CRTBEGINTS -+ #define ESP_OPTIONS_PIE_CHECK_SPEC \ -+ "%{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}} \ -+ %{pie:%{pg|p|profile:%e-pie and -pg|p|profile are incompatible}}" -+ #else -+ #define ESP_OPTIONS_PIE_CHECK_SPEC \ -+ "%{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}} \ -+ %{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible}}" -+ #endif -+ -+ /* We don't pass -pie to the linker when -static */ -+ #ifdef ENABLE_CRTBEGINTS -+ #define LINK_PIE_SPEC "%{!static:%{pie:-pie}} %(esp_link) " -+ #else -+ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link) " -+ #endif -+ -+ #else -+ #define ESP_OPTIONS_PIE_SPEC "" -+ #define ESP_OPTIONS_PIE_CHECK_SPEC "" -+ #define ESP_LINK_PIE_SPEC "" -+ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link) " -+ #endif -+ -+ /* We add extra spec name's to the EXTRA_SPECS list */ -+ #define ESP_EXTRA_SPECS \ -+ { "esp_cc1", ESP_CC1_SPEC }, \ -+ { "esp_cc1_pie", ESP_CC1_PIE_SPEC }, \ -+ { "esp_cc1_ssp", ESP_CC1_SSP_SPEC }, \ -+ { "esp_cc1_strict", ESP_CC1_STRICT_SPEC }, \ -+ { "esp_link", ESP_LINK_SPEC }, \ -+ { "esp_link_now", ESP_LINK_NOW_SPEC }, \ -+ { "esp_link_pie", ESP_LINK_PIE_SPEC }, \ -+ { "esp_command_options", ESP_COMMAND_OPTIONS_SPEC }, \ -+ { "esp_cpp_options", ESP_CPP_OPTIONS_SPEC }, \ -+ { "esp_options", ESP_OPTIONS_SPEC }, \ -+ { "esp_options_pie", ESP_OPTIONS_PIE_SPEC }, \ -+ { "esp_options_pie_check", ESP_OPTIONS_PIE_CHECK_SPEC }, \ -+ { "esp_options_ssp", ESP_OPTIONS_SSP_SPEC } -+ -+ static const char *esp_command_options_spec = ESP_COMMAND_OPTIONS_SPEC; -+ static const char *cc1_spec = CC1_SPEC ESP_CC1_SPEC; -+ -+#else /* If not ESP_ENABLE defined do this. */ -+ -+ #define ESP_OPTIONS_SPEC "" -+ #define ESP_CPP_OPTIONS_SPEC "" -+ -+ /* We add extra spec name's to the EXTRA_SPECS list */ -+ #define ESP_EXTRA_SPECS \ -+ { "esp_options", ESP_OPTIONS_SPEC }, \ -+ { "esp_cpp_options", ESP_CPP_OPTIONS_SPEC } -+ -+#endif -+#endif /* End GCC_ESP_H */ -diff -Nur gcc-4.5.0-vanilla/gcc/gcc.c gcc-4.5.0/gcc/gcc.c ---- gcc-4.5.0-vanilla/gcc/gcc.c 2010-02-11 13:23:08.000000000 +0100 -+++ gcc-4.5.0/gcc/gcc.c 2010-04-21 15:21:16.589812777 +0200 -@@ -84,6 +84,7 @@ - #include "gcc.h" - #include "flags.h" - #include "opts.h" -+#include "esp.h" /* for --enable-esp support */ - - #ifdef HAVE_MMAP_FILE - # include <sys/mman.h> -@@ -822,7 +823,9 @@ - - static const char *asm_debug; - static const char *cpp_spec = CPP_SPEC; -+#ifndef ENABLE_ESP - static const char *cc1_spec = CC1_SPEC; -+#endif - static const char *cc1plus_spec = CC1PLUS_SPEC; - static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC; - static const char *link_ssp_spec = LINK_SSP_SPEC; -@@ -885,7 +888,7 @@ - static const char *cpp_options = - "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\ - %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\ -- %{undef} %{save-temps*:-fpch-preprocess}"; -+ %{undef} %{save-temps*:-fpch-preprocess} %(esp_cpp_options)"; - - /* This contains cpp options which are not passed when the preprocessor - output will be used by another program. */ -@@ -893,6 +896,9 @@ - - /* NB: This is shared amongst all front-ends, except for Ada. */ - static const char *cc1_options = -+#ifdef ENABLE_ESP -+"%(esp_options_pie_check)" -+#endif - "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ - %1 %{!Q:-quiet} %{!dumpbase:-dumpbase %B} %{d*} %{m*} %{a*}\ - %{fcompare-debug-second:%:compare-debug-auxbase-opt(%b)} \ -@@ -1075,15 +1081,15 @@ - %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \ - %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\ - cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \ -- %(cc1_options)}\ -+ %(cc1_options) %(esp_options)}\ - %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\ -- cc1 %(cpp_unique_options) %(cc1_options)}}}\ -+ cc1 %(cpp_unique_options) %(cc1_options) %(esp_options)}}}\ - %{!fsyntax-only:%(invoke_as)}} \ - %{combine:\ - %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \ - %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i}}\ - %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\ -- cc1 %(cpp_unique_options) %(cc1_options)}}\ -+ cc1 %(cpp_unique_options) %(cc1_options) %(esp_options)}}\ - %{!fsyntax-only:%(invoke_as)}}}}}}", 0, 1, 1}, - {"-", - "%{!E:%e-E or -x required when input is from standard input}\ -@@ -1106,7 +1112,7 @@ - %W{o*:--output-pch=%*}%V}}}}}}", 0, 0, 0}, - {".i", "@cpp-output", 0, 1, 0}, - {"@cpp-output", -- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0}, -+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(esp_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0}, - {".s", "@assembler", 0, 1, 0}, - {"@assembler", - "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 1, 0}, -@@ -1699,18 +1705,23 @@ - INIT_STATIC_SPEC ("sysroot_hdrs_suffix_spec", &sysroot_hdrs_suffix_spec), - }; - --#ifdef EXTRA_SPECS /* additional specs needed */ -+/* EXTRA_SPECS needs to be defined */ -+#ifndef EXTRA_SPECS -+#define EXTRA_SPECS -+#endif -+ -+/* EXTRA_SPECS and ESP_EXTRA_SPECS add additional specs */ - /* Structure to keep track of just the first two args of a spec_list. -- That is all that the EXTRA_SPECS macro gives us. */ -+ That is all that the EXTRA_SPECS and ESP_EXTRA_SPECS macro gives us. */ - struct spec_list_1 - { - const char *const name; - const char *const ptr; - }; - --static const struct spec_list_1 extra_specs_1[] = { EXTRA_SPECS }; -+/* ESP_EXTRA_SPECS before EXTRA_SPECS */ -+static const struct spec_list_1 extra_specs_1[] = { ESP_EXTRA_SPECS, EXTRA_SPECS }; - static struct spec_list *extra_specs = (struct spec_list *) 0; --#endif - - /* List of dynamically allocates specs that have been defined so far. */ - -@@ -1798,7 +1809,6 @@ - if (verbose_flag) - notice ("Using built-in specs.\n"); - --#ifdef EXTRA_SPECS - extra_specs = XCNEWVEC (struct spec_list, ARRAY_SIZE (extra_specs_1)); - - for (i = ARRAY_SIZE (extra_specs_1) - 1; i >= 0; i--) -@@ -1811,7 +1821,6 @@ - sl->ptr_spec = &sl->ptr; - next = sl; - } --#endif - - for (i = ARRAY_SIZE (static_specs) - 1; i >= 0; i--) - { -@@ -7111,6 +7120,12 @@ - gcc_exec_prefix = concat (gcc_exec_prefix, spec_machine, dir_separator_str, - spec_version, dir_separator_str, NULL); - -+#ifdef ENABLE_ESP -+ /* Process ESP_COMMAND_OPTIONS_SPEC, adding any new options to the end -+ of the command line. */ -+ do_self_spec (esp_command_options_spec); -+#endif -+ - /* Now we have the specs. - Set the `valid' bits for switches that match anything in any spec. */ - -diff -Nur gcc-4.5.0-vanilla/gcc/Makefile.in gcc-4.5.0/gcc/Makefile.in ---- gcc-4.5.0-vanilla/gcc/Makefile.in 2010-04-02 09:49:06.000000000 +0200 -+++ gcc-4.5.0/gcc/Makefile.in 2010-04-21 15:21:10.033812913 +0200 -@@ -636,13 +636,24 @@ - INHIBIT_LIBC_CFLAGS = -Dinhibit_libc - endif - -+# We don't want __stack_chk_fail in crt* and libgcc2.a. -+# We don't want to compile crtbegin, crtend and crtbeginT with -fPIE. -+enable_esp = @enable_esp@ -+ifeq ($(enable_esp),yes) -+ESP_NOPIE_CFLAGS = -fno-PIE -+ESP_NOSSP_CFLAGS = -fno-stack-protector -+else -+ESP_NOPIE_CFLAGS= -+ESP_NOSSP_CFLAGS= -+endif -+ - # Options to use when compiling libgcc2.a. - # - LIBGCC2_DEBUG_CFLAGS = -g - LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \ - $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \ - -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ -- $(INHIBIT_LIBC_CFLAGS) -+ $(INHIBIT_LIBC_CFLAGS) $(ESP_NOSSP_CFLAGS) - - # Additional options to use when compiling libgcc2.a. - # Some targets override this to -isystem include -@@ -655,7 +666,7 @@ - CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ - -finhibit-size-directive -fno-inline -fno-exceptions \ - -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \ -- $(INHIBIT_LIBC_CFLAGS) -+ $(INHIBIT_LIBC_CFLAGS) $(ESP_NOSSP_CFLAGS) - - # Additional sources to handle exceptions; overridden by targets as needed. - LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ -@@ -685,6 +696,12 @@ - # The rules for compiling them should be in the t-* file for the machine. - EXTRA_PARTS = @extra_parts@ - -+# We add crtbeginTS.o to the EXTRA_PARTS list if enable_crtbeginTS = yes -+enable_crtbeginTS = @enable_crtbeginTS@ -+ifeq ($(enable_crtbeginTS),yes) -+EXTRA_PARTS += crtbeginTS.o -+endif -+ - # List of extra object files that should be compiled and linked with - # compiler proper (cc1, cc1obj, cc1plus). - EXTRA_OBJS = @extra_objs@ -@@ -1863,9 +1880,10 @@ - echo LIBGCC_SYNC = '$(LIBGCC_SYNC)' >> tmp-libgcc.mvars - echo LIBGCC_SYNC_CFLAGS = '$(LIBGCC_SYNC_CFLAGS)' >> tmp-libgcc.mvars - echo CRTSTUFF_CFLAGS = '$(CRTSTUFF_CFLAGS)' >> tmp-libgcc.mvars -- echo CRTSTUFF_T_CFLAGS = '$(CRTSTUFF_T_CFLAGS)' >> tmp-libgcc.mvars -+ echo CRTSTUFF_T_CFLAGS = '$(CRTSTUFF_T_CFLAGS) $(ESP_NOPIE_CFLAGS)' >> tmp-libgcc.mvars - echo CRTSTUFF_T_CFLAGS_S = '$(CRTSTUFF_T_CFLAGS_S)' >> tmp-libgcc.mvars - echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars -+ echo enable_crtbeginTS = '$(enable_crtbeginTS)' >> tmp-libgcc.mvars - - mv tmp-libgcc.mvars libgcc.mvars - -@@ -1899,12 +1917,14 @@ - $(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ - gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) - $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ -+ $(ESP_NOPIE_CFLAGS) \ - -c $(srcdir)/crtstuff.c -DCRT_BEGIN \ - -o $(T)crtbegin$(objext) - - $(T)crtend.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ - gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) - $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ -+ $(ESP_NOPIE_CFLAGS) \ - -c $(srcdir)/crtstuff.c -DCRT_END \ - -o $(T)crtend$(objext) - -@@ -1925,9 +1945,19 @@ - $(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ - gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) - $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ -+ $(ESP_NOPIE_CFLAGS) \ - -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \ - -o $(T)crtbeginT$(objext) - -+# This is a version of crtbegin for -static -fPIE links if esp is enable. -+ifeq ($(enable_crtbeginTS),yes) -+$(T)crtbeginTS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ -+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) -+ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \ -+ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O \ -+ -o $(T)crtbeginTS$(objext) -+endif -+ - # Compile the start modules crt0.o and mcrt0.o that are linked with - # every program - $(T)crt0.o: s-crt0 ; @true -diff -Nur gcc-4.5.0-vanilla/gcc/objc/lang-specs.h gcc-4.5.0/gcc/objc/lang-specs.h ---- gcc-4.5.0-vanilla/gcc/objc/lang-specs.h 2007-08-02 12:37:36.000000000 +0200 -+++ gcc-4.5.0/gcc/objc/lang-specs.h 2010-04-21 15:21:16.702913793 +0200 -@@ -30,13 +30,13 @@ - %{traditional|ftraditional|traditional-cpp:\ - %eGNU Objective C no longer supports traditional compilation}\ - %{save-temps|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps:%b.mi} %{!save-temps:%g.mi} \n\ -- cc1obj -fpreprocessed %{save-temps:%b.mi} %{!save-temps:%g.mi} %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}\ -+ cc1obj -fpreprocessed %{save-temps:%b.mi} %{!save-temps:%g.mi} %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}}\ - %{!save-temps:%{!no-integrated-cpp:\ -- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}}\ -+ cc1obj %(cpp_unique_options) %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}}}\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, - {".mi", "@objc-cpp-output", 0, 0, 0}, - {"@objc-cpp-output", -- "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\ -+ "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, - {"@objective-c-header", - "%{E|M|MM:cc1obj -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}\ -@@ -45,10 +45,10 @@ - %{traditional|ftraditional|traditional-cpp:\ - %eGNU Objective C no longer supports traditional compilation}\ - %{save-temps|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps:%b.mi} %{!save-temps:%g.mi} \n\ -- cc1obj -fpreprocessed %b.mi %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\ -+ cc1obj -fpreprocessed %b.mi %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\ - -o %g.s %{!o*:--output-pch=%i.gch}\ - %W{o*:--output-pch=%*}%V}\ - %{!save-temps:%{!no-integrated-cpp:\ -- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\ -+ cc1obj %(cpp_unique_options) %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\ - -o %g.s %{!o*:--output-pch=%i.gch}\ - %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0}, -diff -Nur gcc-4.5.0-vanilla/gcc/objcp/lang-specs.h gcc-4.5.0/gcc/objcp/lang-specs.h ---- gcc-4.5.0-vanilla/gcc/objcp/lang-specs.h 2007-08-02 12:38:44.000000000 +0200 -+++ gcc-4.5.0/gcc/objcp/lang-specs.h 2010-04-21 15:21:16.708817730 +0200 -@@ -36,7 +36,7 @@ - %(cpp_options) %2 -o %{save-temps:%b.mii} %{!save-temps:%g.mii} \n}\ - cc1objplus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.mii} %{!save-temps:%g.mii}}\ - %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\ -- %(cc1_options) %2 %{+e1*}\ -+ %(cc1_options) %(esp_options) %2 %{+e1*}\ - -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}", - CPLUSPLUS_CPP_SPEC, 0, 0}, - {"@objective-c++", -@@ -46,15 +46,15 @@ - %(cpp_options) %2 -o %{save-temps:%b.mii} %{!save-temps:%g.mii} \n}\ - cc1objplus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.mii} %{!save-temps:%g.mii}}\ - %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\ -- %(cc1_options) %2 %{+e1*}\ -+ %(cc1_options) %(esp_options) %2 %{+e1*}\ - %{!fsyntax-only:%(invoke_as)}}}}", - CPLUSPLUS_CPP_SPEC, 0, 0}, - {".mii", "@objective-c++-cpp-output", 0, 0, 0}, - {"@objective-c++-cpp-output", - "%{!M:%{!MM:%{!E:\ -- cc1objplus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ -+ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, - {"@objc++-cpp-output", - "%{!M:%{!MM:%{!E:\ -- cc1objplus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ -+ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, -diff -Nur gcc-4.5.0-vanilla/gcc/varasm.c gcc-4.5.0/gcc/varasm.c ---- gcc-4.5.0-vanilla/gcc/varasm.c 2010-03-27 12:56:30.000000000 +0100 -+++ gcc-4.5.0/gcc/varasm.c 2010-04-21 15:21:16.606812404 +0200 -@@ -5961,7 +5961,11 @@ - bool is_local; - - is_local = targetm.binds_local_p (decl); -- if (!flag_shlib) -+ #ifdef ENABLE_ESP -+ if (!flag_pic) -+ #else -+ if (!flag_shlib) -+ #endif - { - if (is_local) - kind = TLS_MODEL_LOCAL_EXEC; -diff -Nur gcc-4.5.0-vanilla/libgcc/Makefile.in gcc-4.5.0/libgcc/Makefile.in ---- gcc-4.5.0-vanilla/libgcc/Makefile.in 2010-03-30 15:08:52.000000000 +0200 -+++ gcc-4.5.0/libgcc/Makefile.in 2010-04-21 15:21:10.824811514 +0200 -@@ -291,6 +291,12 @@ - gen-hide-list = echo > $@ - endif - -+# We add crtbeginTS.o to the EXTRA_PARTS list if enable_crtbeginTS = yes -+enable_libgcc_crtbeginTS = $(enable_crtbeginTS) -+ifeq ($(enable_libgcc_crtbeginTS),yes) -+EXTRA_PARTS += crtbeginTS.o -+endif -+ - ifneq ($(EXTRA_PARTS),) - extra-parts = libgcc-extra-parts - INSTALL_PARTS = $(EXTRA_PARTS) -@@ -842,6 +848,13 @@ - crtbeginT.o: $(gcc_srcdir)/crtstuff.c - $(crt_compile) $(CRTSTUFF_T_CFLAGS) \ - -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -+ -+# This is a version of crtbegin for -static -fPIE links. -+ifeq ($(enable_libgcc_crtbeginTS),yes) -+crtbeginTS.o: $(gcc_srcdir)/crtstuff.c -+ $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \ -+ -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O -+endif - endif - - # Build extra startfiles in the libgcc directory. -diff -Nur gcc-4.5.0-vanilla/libmudflap/configure gcc-4.5.0/libmudflap/configure ---- gcc-4.5.0-vanilla/libmudflap/configure 2009-12-05 18:18:53.000000000 +0100 -+++ gcc-4.5.0/libmudflap/configure 2010-04-21 15:21:09.843811773 +0200 -@@ -652,6 +652,7 @@ - MAINTAINER_MODE_FALSE - MAINTAINER_MODE_TRUE - am__untar -+enable_esp - am__tar - AMTAR - am__leading_dot -diff -Nur gcc-4.5.0-vanilla/libmudflap/Makefile.in gcc-4.5.0/libmudflap/Makefile.in ---- gcc-4.5.0-vanilla/libmudflap/Makefile.in 2010-04-02 20:18:06.000000000 +0200 -+++ gcc-4.5.0/libmudflap/Makefile.in 2010-04-21 15:21:10.844815108 +0200 -@@ -304,10 +304,18 @@ - MAINT_CHARSET = latin1 - SUBDIRS = testsuite - -+# Some stuff don't compile with PIE or SSP -+enable_esp = @enable_esp@ -+ifeq ($(enable_esp),yes) -+NO_ESP_CFLAGS = -fno-stack-protector -U_FORTIFY_SOURCE -+else -+NO_ESP_CFLAGS = -+endif -+ - # May be used by various substitution variables. - gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) --AM_CFLAGS = -Wall $(SECTION_FLAGS) --@LIBMUDFLAPTH_FALSE@libmudflapth = -+AM_CFLAGS = -Wall $(SECTION_FLAGS) $(NO_ESP_CFLAGS) -+@LIBMUDFLAPTH_FALSE@libmudflapth = - @LIBMUDFLAPTH_TRUE@libmudflapth = libmudflapth.la - toolexeclib_LTLIBRARIES = libmudflap.la $(libmudflapth) - libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include -diff -Nur gcc-4.5.0-vanilla/Makefile.in gcc-4.5.0/Makefile.in ---- gcc-4.5.0-vanilla/Makefile.in 2010-02-17 12:01:44.000000000 +0100 -+++ gcc-4.5.0/Makefile.in 2010-04-21 15:21:10.022812548 +0200 -@@ -350,9 +350,17 @@ - BUILD_PREFIX = @BUILD_PREFIX@ - BUILD_PREFIX_1 = @BUILD_PREFIX_1@ - -+# Some stuff don't compile with SSP -+enable_esp = @enable_esp@ -+ifeq ($(enable_esp),yes) -+ESP_NOSSP_CFLAGS = -fno-stack-protector -+else -+ESP_NOSSP_CFLAGS= -+endif -+ - # Flags to pass to stage2 and later makes. They are defined - # here so that they can be overridden by Makefile fragments. --BOOT_CFLAGS= -g -O2 -+BOOT_CFLAGS= -g -O2 $(ESP_NOSSP_CFLAGS) - BOOT_LDFLAGS= - BOOT_ADAFLAGS=-gnatpg -gnata - -@@ -397,9 +405,9 @@ - - CFLAGS = @CFLAGS@ - LDFLAGS = @LDFLAGS@ --LIBCFLAGS = $(CFLAGS) -+LIBCFLAGS = $(CFLAGS) $(ESP_NOSSP_CFLAGS) - CXXFLAGS = @CXXFLAGS@ --LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates -+LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates $(ESP_NOSSP_CFLAGS) - - TFLAGS = - diff --git a/pkgs/core/gcc/patches/gcc-4.5.1-esp-20101030.patch b/pkgs/core/gcc/patches/gcc-4.5.1-esp-20101030.patch new file mode 100644 index 0000000..d9c0daa --- /dev/null +++ b/pkgs/core/gcc/patches/gcc-4.5.1-esp-20101030.patch @@ -0,0 +1,876 @@ +diff -Nur gcc-4.5.1-vanilla/configure gcc-4.5.1/configure +--- gcc-4.5.1-vanilla/configure 2010-06-24 23:06:37.000000000 +0200 ++++ gcc-4.5.1/configure 2010-10-30 15:13:15.694229807 +0200 +@@ -707,6 +707,7 @@ + CFLAGS + CC + target_subdir ++enable_esp + host_subdir + build_subdir + build_libsubdir +@@ -1485,6 +1486,11 @@ + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-gold use gold instead of ld + --enable-libada build libada directory ++ --enable-esp ++ Enable Stack protector, Position independent executable as ++ default if we have suppot for it when compiling ++ and link with -z relro and -z now as default. ++ Linux targets supported i*86, x86_64, powerpc, powerpc64, ia64 and arm + --enable-libssp build libssp directory + --enable-build-with-cxx build with C++ compiler instead of C compiler + --disable-ppl-version-check disable check for PPL version +@@ -3164,6 +3170,25 @@ + noconfigdirs="$noconfigdirs gnattools" + fi + ++# Check whether --enable-esp was given and target have the support. ++# Check whether --enable-esp or --disable-esp was given. ++if test "${enable_esp+set}" = set; then ++ enableval="$enable_esp" ++ ++ case $target in ++ i?86*-*-linux* | x86_64*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*) ++ enable_esp=yes ++ ;; ++ *) ++ { { echo "$as_me:$LINENO: error: *** --enable-esp is not supported on this $target target." >&5 ++echo "$as_me: error: *** --enable-esp is not supported on this $target target." >&2;} ++ { (exit 1); exit 1; }; } ++ ;; ++ esac ++ ++fi; ++ ++ + # Check whether --enable-libssp was given. + if test "${enable_libssp+set}" = set; then : + enableval=$enable_libssp; ENABLE_LIBSSP=$enableval +@@ -14354,6 +14379,9 @@ + *) stage1_cflags="-g -J" ;; + esac ;; + esac ++if test x$enable_esp = xyes; then ++ stage1_cflags="$stage1_cflags -fno-stack-protector" ++fi + + # This is aimed to mimic bootstrap with a non-GCC compiler to catch problems. + if test "$GCC" = yes -a "$ENABLE_BUILD_WITH_CXX" != yes; then +diff -Nur gcc-4.5.1-vanilla/gcc/config/linux.h gcc-4.5.1/gcc/config/linux.h +--- gcc-4.5.1-vanilla/gcc/config/linux.h 2009-04-09 17:00:19.000000000 +0200 ++++ gcc-4.5.1/gcc/config/linux.h 2010-10-30 15:13:15.845989169 +0200 +@@ -43,7 +43,11 @@ + object constructed before entering `main'. */ + + #undef STARTFILE_SPEC +-#if defined HAVE_LD_PIE ++#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINTS) ++#define STARTFILE_SPEC \ ++ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} crti.o%s \ ++ %{static:%{pie:crtbeginTS.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}" ++#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINTS) + #define STARTFILE_SPEC \ + "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ + crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" +diff -Nur gcc-4.5.1-vanilla/gcc/config/rs6000/linux64.h gcc-4.5.1/gcc/config/rs6000/linux64.h +--- gcc-4.5.1-vanilla/gcc/config/rs6000/linux64.h 2010-03-17 05:44:37.000000000 +0100 ++++ gcc-4.5.1/gcc/config/rs6000/linux64.h 2010-10-30 15:13:15.843989710 +0200 +@@ -162,7 +162,7 @@ + #endif + + #define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \ +-%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \ ++%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} \ + %{memb} %{!memb: %{msdata=eabi: -memb}} \ + %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \ + %{mcall-freebsd: -mbig} \ +diff -Nur gcc-4.5.1-vanilla/gcc/config/rs6000/sysv4.h gcc-4.5.1/gcc/config/rs6000/sysv4.h +--- gcc-4.5.1-vanilla/gcc/config/rs6000/sysv4.h 2009-11-25 21:23:20.000000000 +0100 ++++ gcc-4.5.1/gcc/config/rs6000/sysv4.h 2010-10-30 15:13:15.846988480 +0200 +@@ -883,7 +883,12 @@ + %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \ + %{!shared: %{profile:-lc_p} %{!profile:-lc}}}" + +-#ifdef HAVE_LD_PIE ++#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINTS) ++#define STARTFILE_LINUX_SPEC "\ ++%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ ++%{mnewlib:ecrti.o%s;:crti.o%s} \ ++%{static:%{pie:crtbeginTS.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}" ++#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINTS) + #define STARTFILE_LINUX_SPEC "\ + %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ + %{mnewlib:ecrti.o%s;:crti.o%s} \ +diff -Nur gcc-4.5.1-vanilla/gcc/config.in gcc-4.5.1/gcc/config.in +--- gcc-4.5.1-vanilla/gcc/config.in 2010-07-31 11:34:58.000000000 +0200 ++++ gcc-4.5.1/gcc/config.in 2010-10-30 15:13:15.784230669 +0200 +@@ -52,6 +52,12 @@ + #endif + + ++/* Define to 1 to enable crtbeginTS.o. */ ++#ifndef USED_FOR_TARGET ++#undef ENABLE_CRTBEGINTS ++#endif ++ ++ + /* Define to 1 to specify that we are using the BID decimal floating point + format instead of DPD */ + #ifndef USED_FOR_TARGET +@@ -71,6 +77,12 @@ + #endif + + ++/* Define to 1 to enable esp. */ ++#ifndef USED_FOR_TARGET ++#undef ENABLE_ESP ++#endif ++ ++ + /* Define to 1 to enable fixed-point arithmetic extension to C. */ + #ifndef USED_FOR_TARGET + #undef ENABLE_FIXED_POINT +diff -Nur gcc-4.5.1-vanilla/gcc/configure gcc-4.5.1/gcc/configure +--- gcc-4.5.1-vanilla/gcc/configure 2010-06-14 12:38:18.000000000 +0200 ++++ gcc-4.5.1/gcc/configure 2010-10-30 15:13:15.707229526 +0200 +@@ -680,6 +680,8 @@ + HOST_LIBS + GGC + libgcc_visibility ++enable_esp ++enable_crtbeginTS + gcc_cv_readelf + gcc_cv_objdump + ORIGINAL_NM_FOR_TARGET +@@ -24831,6 +24833,50 @@ + ;; + esac + ++echo "$as_me:$LINENO: checking linker -z now support" >&5 ++echo $ECHO_N "checking linker -z now support... $ECHO_C" >&6 ++if test "${gcc_cv_ld_now+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ gcc_cv_ld_now=no ++if test $in_tree_ld = yes ; then ++ if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \ ++ && test $in_tree_ld_is_elf = yes; then ++ gcc_cv_ld_now=yes ++ fi ++elif test x$gcc_cv_ld != x; then ++ # Check if linker supports -z now options ++ if $gcc_cv_ld --help 2>/dev/null | grep now > /dev/null; then ++ gcc_cv_ld_now=yes ++ fi ++fi ++ ++fi ++echo "$as_me:$LINENO: result: $gcc_cv_ld_now" >&5 ++echo "${ECHO_T}$gcc_cv_ld_now" >&6 ++ ++echo "$as_me:$LINENO: checking linker -z relro support" >&5 ++echo $ECHO_N "checking linker -z relro support... $ECHO_C" >&6 ++if test "${gcc_cv_ld_relro+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ gcc_cv_ld_relro=no ++if test $in_tree_ld = yes ; then ++ if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \ ++ && test $in_tree_ld_is_elf = yes; then ++ gcc_cv_ld_relro=yes ++ fi ++elif test x$gcc_cv_ld != x; then ++ # Check if linker supports -z relro and -z norelro options ++ if $gcc_cv_ld --help 2>/dev/null | grep relro > /dev/null; then ++ gcc_cv_ld_relro=yes ++ fi ++fi ++ ++fi ++echo "$as_me:$LINENO: result: $gcc_cv_ld_relro" >&5 ++echo "${ECHO_T}$gcc_cv_ld_relro" >&6 ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --build-id support" >&5 + $as_echo_n "checking linker --build-id support... " >&6; } + if test "${gcc_cv_ld_buildid+set}" = set; then : +@@ -25014,6 +25060,74 @@ + + fi + ++if test x$enable_esp = xyes ; then ++case $target in ++ ia64*-*-linux*) ++ if test x$gcc_cv_ld_now = xyes; then ++ enable_esp_ld=yes ++ else ++ enable_esp_ld=no ++ fi ++ ;; ++ *-*-linux*) ++ if test x$gcc_cv_ld_relro = xyes && test x$gcc_cv_ld_now = xyes; then ++ enable_esp_ld=yes ++ else ++ enable_esp_ld=no ++ fi ++ ;; ++ *) ++ enable_esp_ld=no ++ ;; ++ esac ++else ++ enable_espf_ld=no ++fi ++if test x$enable_esp_ld = xyes; then ++ ++cat >>confdefs.h <<_ACEOF ++#define ENABLE_ESP 1 ++_ACEOF ++ ++fi ++ ++if test x$enable_esp = xyes && test x$enable_esp_ld = xno; then ++ { { echo "$as_me:$LINENO: error: *** --enable-esp is not supported. You don't have -z,relro or -z,now support in the linker." >&5 ++echo "$as_me: error: *** --enable-esp is not supported. You don't have -z,relro or -z,now support in the linker." >&2;} ++ { (exit 1); exit 1; }; } ++fi ++ ++echo "$as_me:$LINENO: checking for crtbeginTS.o support" >&5 ++echo $ECHO_N "checking for crtbeginTS.o support... $ECHO_C" >&6 ++if test "${enable_crtbeginTS+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ++if test x$enable_esp = xyes ; then ++ case "$target" in ++ ia64*-*-linux*) ++ enable_crtbeginTS=no ;; ++ *-*-linux*) ++ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then ++ enable_crtbeginTS=yes ++ fi ++ ;; ++ *) enable_crtbeginTS=no ;; ++ esac ++fi ++ ++fi ++echo "$as_me:$LINENO: result: $enable_crtbeginTS" >&5 ++echo "${ECHO_T}$enable_crtbeginTS" >&6 ++ ++if test x$enable_crtbeginTS = xyes; then ++ ++cat >>confdefs.h <<_ACEOF ++#define ENABLE_CRTBEGINTS 1 ++_ACEOF ++ ++fi ++ + # Check if TFmode long double should be used by default or not. + # Some glibc targets used DFmode long double, but with glibc 2.4 + # and later they can use TFmode. +diff -Nur gcc-4.5.1-vanilla/gcc/cp/lang-specs.h gcc-4.5.1/gcc/cp/lang-specs.h +--- gcc-4.5.1-vanilla/gcc/cp/lang-specs.h 2007-08-06 13:10:19.000000000 +0200 ++++ gcc-4.5.1/gcc/cp/lang-specs.h 2010-10-30 15:13:15.849979777 +0200 +@@ -47,7 +47,7 @@ + %(cpp_options) %2 -o %{save-temps:%b.ii} %{!save-temps:%g.ii} \n}\ + cc1plus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.ii} %{!save-temps:%g.ii}}\ + %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\ +- %(cc1_options) %2 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + %{!fsyntax-only:-o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {"@c++", +@@ -57,11 +57,11 @@ + %(cpp_options) %2 -o %{save-temps:%b.ii} %{!save-temps:%g.ii} \n}\ + cc1plus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.ii} %{!save-temps:%g.ii}}\ + %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\ +- %(cc1_options) %2 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + %{!fsyntax-only:%(invoke_as)}}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {".ii", "@c++-cpp-output", 0, 0, 0}, + {"@c++-cpp-output", + "%{!M:%{!MM:%{!E:\ +- cc1plus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ ++ cc1plus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, +diff -Nur gcc-4.5.1-vanilla/gcc/doc/invoke.texi gcc-4.5.1/gcc/doc/invoke.texi +--- gcc-4.5.1-vanilla/gcc/doc/invoke.texi 2010-04-06 16:02:22.000000000 +0200 ++++ gcc-4.5.1/gcc/doc/invoke.texi 2010-10-30 15:13:15.864979490 +0200 +@@ -7856,6 +7856,11 @@ + @opindex fstack-protector-all + Like @option{-fstack-protector} except that all functions are protected. + ++NOTE: When --enable-esp this option is enabled by default ++for C, C++, ObjC, ObjC++, if neither @option{-fno-stack-protector} ++or @option{-nostdlib} or @option{-nodefaultlibs} or ++@option{-fstack-protector} are found. ++ + @item -fsection-anchors + @opindex fsection-anchors + Try to reduce the number of symbolic address calculations by using +@@ -8705,6 +8710,12 @@ + that were used to generate code (@option{-fpie}, @option{-fPIE}, + or model suboptions) when you specify this option. + ++NOTE: When --enable-esp this option is enabled by default ++for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE} ++or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or ++@option{-nostartfiles} or @option{-shared} or @option{-pg} or @option{-p} ++are found. ++ + @item -rdynamic + @opindex rdynamic + Pass the flag @option{-export-dynamic} to the ELF linker, on targets +@@ -17251,6 +17262,11 @@ + @code{__pie__} and @code{__PIE__}. The macros have the value 1 + for @option{-fpie} and 2 for @option{-fPIE}. + ++NOTE: When --enable-esp this option is enabled by default ++for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE} ++or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or ++@option{-nostartfiles} or @option{-shared} are found. ++ + @item -fno-jump-tables + @opindex fno-jump-tables + Do not use jump tables for switch statements even where it would be +diff -Nur gcc-4.5.1-vanilla/gcc/esp.h gcc-4.5.1/gcc/esp.h +--- gcc-4.5.1-vanilla/gcc/esp.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.5.1/gcc/esp.h 2010-10-30 15:13:15.841979565 +0200 +@@ -0,0 +1,145 @@ ++/* License terms see GNU GENERAL PUBLIC LICENSE Version 3. ++ * Version 20100527.1 ++ * Magnus Granberg (Zorry) zorry@gentoo.org */ ++#ifndef GCC_ESP_H ++#define GCC_ESP_H ++ ++/* This file will add -fstack-protector-all, -fPIE, -pie and -z now ++ as default if the defines and the spec allow it. ++ Added a hack for gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass ++ to support older hardened GCC patches and we don't need to change the code on gcc-specs-* and _filter-hardened. ++ This will add some unsupported upstream commands options as -nopie and -nonow. ++ -D__KERNEL__ is added so we don't have -fPIE, -pie and -fstack-protector-all when building kernels. ++ ESP_CC1_SPEC is added to CC1_SPEC. ++ ESP_CC1_STRICT_OVERFLOW_SPEC is added so we don't disable the strict-overflow check. ++ ESP_LINK_PIE_CHECK_SPEC check for -pie, -p, -pg, -profile and -static. ++ ENABLE_CRTBEGINTS add support for crtbeginTS.o, build -static with -fPIE or -fpie. ++*/ ++#ifdef ENABLE_ESP ++ ++ /* Hack to support gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass */ ++ #define ESP_CC1_SPEC " %(esp_cc1_ssp) %(esp_cc1_pie) %(esp_cc1_strict_overflow)" ++ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) ++ #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: }}" ++ #else ++ #define ESP_CC1_SSP_SPEC "" ++ #endif ++ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP ) ++ #define ESP_CC1_PIE_SPEC "%{!nopie: }" ++ #else ++ #define ESP_CC1_PIE_SPEC "" ++ #endif ++ #define ESP_CC1_STRICT_OVERFLOW_SPEC "%{!fstrict-overflow:%{!fno-strict-overflow: -fno-strict-overflow}}" ++ ++ /* ESP_LINK_SPEC is added to LINK_PIE_SPEC if esp is enable ++ -z now will be added if we don't have -vanilla spec. We do a -pie incompatible check ++ Don't remove the specs in the end */ ++ #define ESP_LINK_SPEC "%(esp_link_now) %(esp_link_pie_check) " ++ #define ESP_LINK_NOW_SPEC "%{!nonow:-z now}" ++ ++ /* We use ESP_COMMAND_OPTIONS_SPEC to add pie command-line options. */ ++ #define ESP_COMMAND_OPTIONS_SPEC "%{!D__KERNEL__:%{!nopie:%(esp_options_pie) %(esp_link_pie)}}" ++ ++ /* ESP_OPTIONS_SPEC is added to the compiler spec in gcc/gcc.c */ ++ #define ESP_OPTIONS_SPEC "%(esp_options_ssp)" ++ ++ /* ESP_CPP_OPTIONS_SPEC is added to the cpp_options spec in gcc/gcc.c ++ For precompiling headers. */ ++ #define ESP_CPP_OPTIONS_SPEC "%(esp_options_ssp)" ++ ++ /* This will add -fstack-protector-all if we don't have -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector ++ -fstack-protector-all and we have EFAULT_SSP or EFAULT_PIE_SSP defined. */ ++ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) ++ #define ESP_OPTIONS_SSP_SPEC \ ++ "%{!D__KERNEL__:%{!nostdlib:%{!nodefaultlibs: %{!fno-stack-protector: \ ++ %{!fstack-protector:%{!fstack-protector-all:-fstack-protector-all}}}}}}" ++ #else ++ #define ESP_OPTIONS_SSP_SPEC "" ++ #endif ++ ++ /* If EFAULT_PIE or EFAULT_PIE_SSP is defined we will add -fPIE -pie */ ++ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP ) ++ ++ /* This will add -fPIE if we don't have -pie -fpic -fPIC -fpie -fPIE -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static ++ -nostdlib -nostartfiles. */ ++ /* With ENABLE_CRTBEGINTS we don't need to check for -static */ ++ #ifdef ENABLE_CRTBEGINTS ++ #define ESP_OPTIONS_PIE_SPEC \ ++ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \ ++ %{!shared: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }" ++ #else ++ #define ESP_OPTIONS_PIE_SPEC \ ++ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \ ++ %{!shared: %{!static: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }}" ++ #endif ++ ++ /* This will add -pie if we don't have -pie -A -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static -r -nostdlib ++ -nostartfiles */ ++ /* With ENABLE_CRTBEGINTS we don't need to check for -static ++ and we add -pie only to get the start and endfiles. -pie will not go to the linker. */ ++ #ifdef ENABLE_CRTBEGINTS ++ #define ESP_LINK_PIE_SPEC \ ++ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!r: \ ++ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}" ++ #else ++ #define ESP_LINK_PIE_SPEC \ ++ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r: \ ++ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}}" ++ #endif ++ ++ /* This will check if -pie is set when (-static) -pg -p -profile. If set it will make gcc print out ++ "-pie and (static)|pg|p|profile are incompatible when linking" */ ++ /* With ENABLE_CRTBEGINTS we don't need to check for -static */ ++ #ifdef ENABLE_CRTBEGINTS ++ #define ESP_LINK_PIE_CHECK_SPEC \ ++ "%{pie:%{pg|p|profile:%e-pie and -pg|p|profile are incompatible when linking}}" ++ #else ++ #define ESP_LINK_PIE_CHECK_SPEC \ ++ "%{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible when linking}}" ++ #endif ++ ++ /* We don't pass -pie to the linker when -static. */ ++ #ifdef ENABLE_CRTBEGINTS ++ #define LINK_PIE_SPEC "%{!static:%{pie:-pie}} %(esp_link)" ++ #else ++ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)" ++ #endif ++ ++ #else ++ #define ESP_OPTIONS_PIE_SPEC "" ++ #define ESP_LINK_PIE_CHECK_SPEC "" ++ #define ESP_LINK_PIE_SPEC "" ++ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)" ++ #endif ++ ++ /* We add extra spec name's to the EXTRA_SPECS list */ ++ #define ESP_EXTRA_SPECS \ ++ { "esp_cc1", ESP_CC1_SPEC }, \ ++ { "esp_cc1_pie", ESP_CC1_PIE_SPEC }, \ ++ { "esp_cc1_ssp", ESP_CC1_SSP_SPEC }, \ ++ { "esp_cc1_strict_overflow", ESP_CC1_STRICT_OVERFLOW_SPEC }, \ ++ { "esp_link", ESP_LINK_SPEC }, \ ++ { "esp_link_now", ESP_LINK_NOW_SPEC }, \ ++ { "esp_link_pie", ESP_LINK_PIE_SPEC }, \ ++ { "esp_link_pie_check", ESP_LINK_PIE_CHECK_SPEC }, \ ++ { "esp_command_options", ESP_COMMAND_OPTIONS_SPEC }, \ ++ { "esp_cpp_options", ESP_CPP_OPTIONS_SPEC }, \ ++ { "esp_options", ESP_OPTIONS_SPEC }, \ ++ { "esp_options_pie", ESP_OPTIONS_PIE_SPEC }, \ ++ { "esp_options_ssp", ESP_OPTIONS_SSP_SPEC } ++ ++ static const char *esp_command_options_spec = ESP_COMMAND_OPTIONS_SPEC; ++ static const char *cc1_spec = CC1_SPEC ESP_CC1_SPEC; ++ ++#else /* If not ESP_ENABLE defined do this. */ ++ ++ #define ESP_OPTIONS_SPEC "" ++ #define ESP_CPP_OPTIONS_SPEC "" ++ ++ /* We add extra spec name's to the EXTRA_SPECS list */ ++ #define ESP_EXTRA_SPECS \ ++ { "esp_options", ESP_OPTIONS_SPEC }, \ ++ { "esp_cpp_options", ESP_CPP_OPTIONS_SPEC } ++ ++#endif ++#endif /* End GCC_ESP_H */ +diff -Nur gcc-4.5.1-vanilla/gcc/gcc.c gcc-4.5.1/gcc/gcc.c +--- gcc-4.5.1-vanilla/gcc/gcc.c 2010-04-18 19:46:08.000000000 +0200 ++++ gcc-4.5.1/gcc/gcc.c 2010-10-30 15:13:15.834979921 +0200 +@@ -84,6 +84,7 @@ + #include "gcc.h" + #include "flags.h" + #include "opts.h" ++#include "esp.h" /* for --enable-esp support */ + + #ifdef HAVE_MMAP_FILE + # include <sys/mman.h> +@@ -822,7 +823,9 @@ + + static const char *asm_debug; + static const char *cpp_spec = CPP_SPEC; ++#ifndef ENABLE_ESP + static const char *cc1_spec = CC1_SPEC; ++#endif + static const char *cc1plus_spec = CC1PLUS_SPEC; + static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC; + static const char *link_ssp_spec = LINK_SSP_SPEC; +@@ -885,7 +888,7 @@ + static const char *cpp_options = + "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\ + %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\ +- %{undef} %{save-temps*:-fpch-preprocess}"; ++ %{undef} %{save-temps*:-fpch-preprocess} %(esp_cpp_options)"; + + /* This contains cpp options which are not passed when the preprocessor + output will be used by another program. */ +@@ -1075,15 +1078,15 @@ + %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \ + %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\ + cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \ +- %(cc1_options)}\ ++ %(cc1_options) %(esp_options)}\ + %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\ +- cc1 %(cpp_unique_options) %(cc1_options)}}}\ ++ cc1 %(cpp_unique_options) %(cc1_options) %(esp_options)}}}\ + %{!fsyntax-only:%(invoke_as)}} \ + %{combine:\ + %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \ + %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i}}\ + %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\ +- cc1 %(cpp_unique_options) %(cc1_options)}}\ ++ cc1 %(cpp_unique_options) %(cc1_options) %(esp_options)}}\ + %{!fsyntax-only:%(invoke_as)}}}}}}", 0, 1, 1}, + {"-", + "%{!E:%e-E or -x required when input is from standard input}\ +@@ -1106,7 +1109,7 @@ + %W{o*:--output-pch=%*}%V}}}}}}", 0, 0, 0}, + {".i", "@cpp-output", 0, 1, 0}, + {"@cpp-output", +- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0}, ++ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(esp_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0}, + {".s", "@assembler", 0, 1, 0}, + {"@assembler", + "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 1, 0}, +@@ -1699,18 +1702,23 @@ + INIT_STATIC_SPEC ("sysroot_hdrs_suffix_spec", &sysroot_hdrs_suffix_spec), + }; + +-#ifdef EXTRA_SPECS /* additional specs needed */ ++/* EXTRA_SPECS needs to be defined */ ++#ifndef EXTRA_SPECS ++#define EXTRA_SPECS ++#endif ++ ++/* EXTRA_SPECS and ESP_EXTRA_SPECS add additional specs */ + /* Structure to keep track of just the first two args of a spec_list. +- That is all that the EXTRA_SPECS macro gives us. */ ++ That is all that the EXTRA_SPECS and ESP_EXTRA_SPECS macro gives us. */ + struct spec_list_1 + { + const char *const name; + const char *const ptr; + }; + +-static const struct spec_list_1 extra_specs_1[] = { EXTRA_SPECS }; ++/* ESP_EXTRA_SPECS before EXTRA_SPECS */ ++static const struct spec_list_1 extra_specs_1[] = { ESP_EXTRA_SPECS, EXTRA_SPECS }; + static struct spec_list *extra_specs = (struct spec_list *) 0; +-#endif + + /* List of dynamically allocates specs that have been defined so far. */ + +@@ -1798,7 +1806,6 @@ + if (verbose_flag) + notice ("Using built-in specs.\n"); + +-#ifdef EXTRA_SPECS + extra_specs = XCNEWVEC (struct spec_list, ARRAY_SIZE (extra_specs_1)); + + for (i = ARRAY_SIZE (extra_specs_1) - 1; i >= 0; i--) +@@ -1811,7 +1818,6 @@ + sl->ptr_spec = &sl->ptr; + next = sl; + } +-#endif + + for (i = ARRAY_SIZE (static_specs) - 1; i >= 0; i--) + { +@@ -7111,6 +7117,12 @@ + gcc_exec_prefix = concat (gcc_exec_prefix, spec_machine, dir_separator_str, + spec_version, dir_separator_str, NULL); + ++#ifdef ENABLE_ESP ++ /* Process ESP_COMMAND_OPTIONS_SPEC, adding any new options to the end ++ of the command line. */ ++ do_self_spec (esp_command_options_spec); ++#endif ++ + /* Now we have the specs. + Set the `valid' bits for switches that match anything in any spec. */ + +diff -Nur gcc-4.5.1-vanilla/gcc/Makefile.in gcc-4.5.1/gcc/Makefile.in +--- gcc-4.5.1-vanilla/gcc/Makefile.in 2010-06-30 15:26:17.000000000 +0200 ++++ gcc-4.5.1/gcc/Makefile.in 2010-10-30 15:13:15.822979675 +0200 +@@ -640,13 +640,24 @@ + INHIBIT_LIBC_CFLAGS = -Dinhibit_libc + endif + ++# We don't want __stack_chk_fail in crt* and libgcc2.a. ++# We don't want to compile crtbegin, crtend and crtbeginT with -fPIE. ++enable_esp = @enable_esp@ ++ifeq ($(enable_esp),yes) ++ESP_NOPIE_CFLAGS = -fno-PIE ++ESP_NOSSP_CFLAGS = -fno-stack-protector ++else ++ESP_NOPIE_CFLAGS= ++ESP_NOSSP_CFLAGS= ++endif ++ + # Options to use when compiling libgcc2.a. + # + LIBGCC2_DEBUG_CFLAGS = -g + LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \ + $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \ + -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ +- $(INHIBIT_LIBC_CFLAGS) ++ $(INHIBIT_LIBC_CFLAGS) $(ESP_NOSSP_CFLAGS) + + # Additional options to use when compiling libgcc2.a. + # Some targets override this to -isystem include +@@ -659,7 +670,7 @@ + CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ + -finhibit-size-directive -fno-inline -fno-exceptions \ + -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \ +- $(INHIBIT_LIBC_CFLAGS) ++ $(INHIBIT_LIBC_CFLAGS) $(ESP_NOSSP_CFLAGS) + + # Additional sources to handle exceptions; overridden by targets as needed. + LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ +@@ -689,6 +700,12 @@ + # The rules for compiling them should be in the t-* file for the machine. + EXTRA_PARTS = @extra_parts@ + ++# We add crtbeginTS.o to the EXTRA_PARTS list if enable_crtbeginTS = yes ++enable_crtbeginTS = @enable_crtbeginTS@ ++ifeq ($(enable_crtbeginTS),yes) ++EXTRA_PARTS += crtbeginTS.o ++endif ++ + # List of extra object files that should be compiled and linked with + # compiler proper (cc1, cc1obj, cc1plus). + EXTRA_OBJS = @extra_objs@ +@@ -1867,9 +1884,10 @@ + echo LIBGCC_SYNC = '$(LIBGCC_SYNC)' >> tmp-libgcc.mvars + echo LIBGCC_SYNC_CFLAGS = '$(LIBGCC_SYNC_CFLAGS)' >> tmp-libgcc.mvars + echo CRTSTUFF_CFLAGS = '$(CRTSTUFF_CFLAGS)' >> tmp-libgcc.mvars +- echo CRTSTUFF_T_CFLAGS = '$(CRTSTUFF_T_CFLAGS)' >> tmp-libgcc.mvars ++ echo CRTSTUFF_T_CFLAGS = '$(CRTSTUFF_T_CFLAGS) $(ESP_NOPIE_CFLAGS)' >> tmp-libgcc.mvars + echo CRTSTUFF_T_CFLAGS_S = '$(CRTSTUFF_T_CFLAGS_S)' >> tmp-libgcc.mvars + echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars ++ echo enable_crtbeginTS = '$(enable_crtbeginTS)' >> tmp-libgcc.mvars + + mv tmp-libgcc.mvars libgcc.mvars + +@@ -1903,12 +1921,14 @@ + $(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ + gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) + $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ ++ $(ESP_NOPIE_CFLAGS) \ + -c $(srcdir)/crtstuff.c -DCRT_BEGIN \ + -o $(T)crtbegin$(objext) + + $(T)crtend.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ + gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) + $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ ++ $(ESP_NOPIE_CFLAGS) \ + -c $(srcdir)/crtstuff.c -DCRT_END \ + -o $(T)crtend$(objext) + +@@ -1929,9 +1949,19 @@ + $(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ + gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) + $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \ ++ $(ESP_NOPIE_CFLAGS) \ + -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \ + -o $(T)crtbeginT$(objext) + ++# This is a version of crtbegin for -static -fPIE links if esp is enable. ++ifeq ($(enable_crtbeginTS),yes) ++$(T)crtbeginTS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ ++ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H) ++ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \ ++ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O \ ++ -o $(T)crtbeginTS$(objext) ++endif ++ + # Compile the start modules crt0.o and mcrt0.o that are linked with + # every program + $(T)crt0.o: s-crt0 ; @true +diff -Nur gcc-4.5.1-vanilla/gcc/objc/lang-specs.h gcc-4.5.1/gcc/objc/lang-specs.h +--- gcc-4.5.1-vanilla/gcc/objc/lang-specs.h 2007-08-02 12:37:36.000000000 +0200 ++++ gcc-4.5.1/gcc/objc/lang-specs.h 2010-10-30 15:13:15.851989223 +0200 +@@ -30,13 +30,13 @@ + %{traditional|ftraditional|traditional-cpp:\ + %eGNU Objective C no longer supports traditional compilation}\ + %{save-temps|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps:%b.mi} %{!save-temps:%g.mi} \n\ +- cc1obj -fpreprocessed %{save-temps:%b.mi} %{!save-temps:%g.mi} %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}\ ++ cc1obj -fpreprocessed %{save-temps:%b.mi} %{!save-temps:%g.mi} %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}}\ + %{!save-temps:%{!no-integrated-cpp:\ +- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}}\ ++ cc1obj %(cpp_unique_options) %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}}}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, + {".mi", "@objc-cpp-output", 0, 0, 0}, + {"@objc-cpp-output", +- "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\ ++ "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, + {"@objective-c-header", + "%{E|M|MM:cc1obj -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}\ +@@ -45,10 +45,10 @@ + %{traditional|ftraditional|traditional-cpp:\ + %eGNU Objective C no longer supports traditional compilation}\ + %{save-temps|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps:%b.mi} %{!save-temps:%g.mi} \n\ +- cc1obj -fpreprocessed %b.mi %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\ ++ cc1obj -fpreprocessed %b.mi %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\ + -o %g.s %{!o*:--output-pch=%i.gch}\ + %W{o*:--output-pch=%*}%V}\ + %{!save-temps:%{!no-integrated-cpp:\ +- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\ ++ cc1obj %(cpp_unique_options) %(cc1_options) %(esp_options) %{print-objc-runtime-info} %{gen-decls}\ + -o %g.s %{!o*:--output-pch=%i.gch}\ + %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0}, +diff -Nur gcc-4.5.1-vanilla/gcc/objcp/lang-specs.h gcc-4.5.1/gcc/objcp/lang-specs.h +--- gcc-4.5.1-vanilla/gcc/objcp/lang-specs.h 2007-08-02 12:38:44.000000000 +0200 ++++ gcc-4.5.1/gcc/objcp/lang-specs.h 2010-10-30 15:13:15.852989302 +0200 +@@ -36,7 +36,7 @@ + %(cpp_options) %2 -o %{save-temps:%b.mii} %{!save-temps:%g.mii} \n}\ + cc1objplus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.mii} %{!save-temps:%g.mii}}\ + %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\ +- %(cc1_options) %2 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {"@objective-c++", +@@ -46,15 +46,15 @@ + %(cpp_options) %2 -o %{save-temps:%b.mii} %{!save-temps:%g.mii} \n}\ + cc1objplus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.mii} %{!save-temps:%g.mii}}\ + %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\ +- %(cc1_options) %2 %{+e1*}\ ++ %(cc1_options) %(esp_options) %2 %{+e1*}\ + %{!fsyntax-only:%(invoke_as)}}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {".mii", "@objective-c++-cpp-output", 0, 0, 0}, + {"@objective-c++-cpp-output", + "%{!M:%{!MM:%{!E:\ +- cc1objplus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ ++ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, + {"@objc++-cpp-output", + "%{!M:%{!MM:%{!E:\ +- cc1objplus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ ++ cc1objplus -fpreprocessed %i %(cc1_options) %(esp_options) %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, +diff -Nur gcc-4.5.1-vanilla/gcc/varasm.c gcc-4.5.1/gcc/varasm.c +--- gcc-4.5.1-vanilla/gcc/varasm.c 2010-03-27 12:56:30.000000000 +0100 ++++ gcc-4.5.1/gcc/varasm.c 2010-10-30 15:13:15.839995541 +0200 +@@ -5961,7 +5961,11 @@ + bool is_local; + + is_local = targetm.binds_local_p (decl); +- if (!flag_shlib) ++ #ifdef ENABLE_ESP ++ if (!flag_pic) ++ #else ++ if (!flag_shlib) ++ #endif + { + if (is_local) + kind = TLS_MODEL_LOCAL_EXEC; +diff -Nur gcc-4.5.1-vanilla/libgcc/Makefile.in gcc-4.5.1/libgcc/Makefile.in +--- gcc-4.5.1-vanilla/libgcc/Makefile.in 2010-03-30 15:08:52.000000000 +0200 ++++ gcc-4.5.1/libgcc/Makefile.in 2010-10-30 15:13:15.824991986 +0200 +@@ -291,6 +291,12 @@ + gen-hide-list = echo > $@ + endif + ++# We add crtbeginTS.o to the EXTRA_PARTS list if enable_crtbeginTS = yes ++enable_libgcc_crtbeginTS = $(enable_crtbeginTS) ++ifeq ($(enable_libgcc_crtbeginTS),yes) ++EXTRA_PARTS += crtbeginTS.o ++endif ++ + ifneq ($(EXTRA_PARTS),) + extra-parts = libgcc-extra-parts + INSTALL_PARTS = $(EXTRA_PARTS) +@@ -842,6 +848,13 @@ + crtbeginT.o: $(gcc_srcdir)/crtstuff.c + $(crt_compile) $(CRTSTUFF_T_CFLAGS) \ + -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O ++ ++# This is a version of crtbegin for -static -fPIE links. ++ifeq ($(enable_libgcc_crtbeginTS),yes) ++crtbeginTS.o: $(gcc_srcdir)/crtstuff.c ++ $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \ ++ -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O ++endif + endif + + # Build extra startfiles in the libgcc directory. +diff -Nur gcc-4.5.1-vanilla/libmudflap/configure gcc-4.5.1/libmudflap/configure +--- gcc-4.5.1-vanilla/libmudflap/configure 2010-06-10 10:58:13.000000000 +0200 ++++ gcc-4.5.1/libmudflap/configure 2010-10-30 15:13:15.768230485 +0200 +@@ -652,6 +652,7 @@ + MAINTAINER_MODE_FALSE + MAINTAINER_MODE_TRUE + am__untar ++enable_esp + am__tar + AMTAR + am__leading_dot +diff -Nur gcc-4.5.1-vanilla/libmudflap/Makefile.in gcc-4.5.1/libmudflap/Makefile.in +--- gcc-4.5.1-vanilla/libmudflap/Makefile.in 2010-04-02 20:18:06.000000000 +0200 ++++ gcc-4.5.1/libmudflap/Makefile.in 2010-10-30 15:13:15.826989769 +0200 +@@ -304,9 +304,17 @@ + MAINT_CHARSET = latin1 + SUBDIRS = testsuite + ++# Some stuff don't compile with SSP and FORTIFY_SOURCE ++enable_esp = @enable_esp@ ++ifeq ($(enable_esp),yes) ++ NO_ESP_CFLAGS = -fno-stack-protector -U_FORTIFY_SOURCE ++else ++ NO_ESP_CFLAGS = ++endif ++ + # May be used by various substitution variables. + gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) +-AM_CFLAGS = -Wall $(SECTION_FLAGS) ++AM_CFLAGS = -Wall $(SECTION_FLAGS) $(NO_ESP_CFLAGS) + @LIBMUDFLAPTH_FALSE@libmudflapth = + @LIBMUDFLAPTH_TRUE@libmudflapth = libmudflapth.la + toolexeclib_LTLIBRARIES = libmudflap.la $(libmudflapth) +diff -Nur gcc-4.5.1-vanilla/Makefile.in gcc-4.5.1/Makefile.in +--- gcc-4.5.1-vanilla/Makefile.in 2010-06-10 19:05:59.000000000 +0200 ++++ gcc-4.5.1/Makefile.in 2010-10-30 15:13:15.816979901 +0200 +@@ -350,9 +350,17 @@ + BUILD_PREFIX = @BUILD_PREFIX@ + BUILD_PREFIX_1 = @BUILD_PREFIX_1@ + ++# Some stuff don't compile with SSP ++enable_esp = @enable_esp@ ++ifeq ($(enable_esp),yes) ++ESP_NOSSP_CFLAGS = -fno-stack-protector ++else ++ESP_NOSSP_CFLAGS= ++endif ++ + # Flags to pass to stage2 and later makes. They are defined + # here so that they can be overridden by Makefile fragments. +-BOOT_CFLAGS= -g -O2 ++BOOT_CFLAGS= -g -O2 $(ESP_NOSSP_CFLAGS) + BOOT_LDFLAGS= + BOOT_ADAFLAGS=-gnatpg -gnata + +@@ -397,9 +405,9 @@ + + CFLAGS = @CFLAGS@ + LDFLAGS = @LDFLAGS@ +-LIBCFLAGS = $(CFLAGS) ++LIBCFLAGS = $(CFLAGS) $(ESP_NOSSP_CFLAGS) + CXXFLAGS = @CXXFLAGS@ +-LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates ++LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates $(ESP_NOSSP_CFLAGS) + + TFLAGS = + diff --git a/pkgs/core/gcc/patches/gcc45-pr33763.patch b/pkgs/core/gcc/patches/gcc45-pr33763.patch new file mode 100644 index 0000000..dfc9d59 --- /dev/null +++ b/pkgs/core/gcc/patches/gcc45-pr33763.patch @@ -0,0 +1,153 @@ +2007-11-06 Jakub Jelinek jakub@redhat.com + + PR tree-optimization/33763 + * gcc.dg/pr33763.c: New test. + * g++.dg/opt/inline13.C: New test. + +2007-11-06 Jan Hubicka jh@suse.cz + + PR tree-optimization/33763 + * tree-inline.c (expand_call_inline): Silently ignore always_inline + attribute for redefined extern inline functions. + +--- a/gcc/tree-inline.c.jj 2007-11-06 09:29:04.000000000 +0100 ++++ b/gcc/tree-inline.c 2007-11-06 16:19:12.000000000 +0100 +@@ -3157,6 +3157,12 @@ expand_call_inline (basic_block bb, gimp + goto egress; + + if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) ++ /* For extern inline functions that get redefined we always ++ silently ignored alway_inline flag. Better behaviour would ++ be to be able to keep both bodies and use extern inline body ++ for inlining, but we can't do that because frontends overwrite ++ the body. */ ++ && !cg_edge->callee->local.redefined_extern_inline + /* Avoid warnings during early inline pass. */ + && cgraph_global_info_ready) + { +--- a/gcc/testsuite/gcc.dg/pr33763.c.jj 2007-11-06 16:19:12.000000000 +0100 ++++ b/gcc/testsuite/gcc.dg/pr33763.c 2007-11-06 16:19:12.000000000 +0100 +@@ -0,0 +1,60 @@ ++/* PR tree-optimization/33763 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2" } */ ++ ++typedef struct ++{ ++ void *a; ++ void *b; ++} T; ++extern void *foo (const char *, const char *); ++extern void *bar (void *, const char *, T); ++extern int baz (const char *, int); ++ ++extern inline __attribute__ ((always_inline, gnu_inline)) int ++baz (const char *x, int y) ++{ ++ return 2; ++} ++ ++int ++baz (const char *x, int y) ++{ ++ return 1; ++} ++ ++int xa, xb; ++ ++static void * ++inl (const char *x, const char *y) ++{ ++ T t = { &xa, &xb }; ++ int *f = (int *) __builtin_malloc (sizeof (int)); ++ const char *z; ++ int o = 0; ++ void *r = 0; ++ ++ for (z = y; *z; z++) ++ { ++ if (*z == 'r') ++ o |= 1; ++ if (*z == 'w') ++ o |= 2; ++ } ++ if (o == 1) ++ *f = baz (x, 0); ++ if (o == 2) ++ *f = baz (x, 1); ++ if (o == 3) ++ *f = baz (x, 2); ++ ++ if (o && *f > 0) ++ r = bar (f, "w", t); ++ return r; ++} ++ ++void * ++foo (const char *x, const char *y) ++{ ++ return inl (x, y); ++} +--- a/gcc/testsuite/g++.dg/opt/inline13.C.jj 2007-11-06 16:20:20.000000000 +0100 ++++ b/gcc/testsuite/g++.dg/opt/inline13.C 2007-11-06 16:21:30.000000000 +0100 +@@ -0,0 +1,60 @@ ++// PR tree-optimization/33763 ++// { dg-do compile } ++// { dg-options "-O2" } ++ ++typedef struct ++{ ++ void *a; ++ void *b; ++} T; ++extern void *foo (const char *, const char *); ++extern void *bar (void *, const char *, T); ++extern int baz (const char *, int); ++ ++extern inline __attribute__ ((always_inline, gnu_inline)) int ++baz (const char *x, int y) ++{ ++ return 2; ++} ++ ++int ++baz (const char *x, int y) ++{ ++ return 1; ++} ++ ++int xa, xb; ++ ++static void * ++inl (const char *x, const char *y) ++{ ++ T t = { &xa, &xb }; ++ int *f = (int *) __builtin_malloc (sizeof (int)); ++ const char *z; ++ int o = 0; ++ void *r = 0; ++ ++ for (z = y; *z; z++) ++ { ++ if (*z == 'r') ++ o |= 1; ++ if (*z == 'w') ++ o |= 2; ++ } ++ if (o == 1) ++ *f = baz (x, 0); ++ if (o == 2) ++ *f = baz (x, 1); ++ if (o == 3) ++ *f = baz (x, 2); ++ ++ if (o && *f > 0) ++ r = bar (f, "w", t); ++ return r; ++} ++ ++void * ++foo (const char *x, const char *y) ++{ ++ return inl (x, y); ++} diff --git a/pkgs/core/gcc/patches/gcc45-pr38757.patch b/pkgs/core/gcc/patches/gcc45-pr38757.patch new file mode 100644 index 0000000..d3aec2d --- /dev/null +++ b/pkgs/core/gcc/patches/gcc45-pr38757.patch @@ -0,0 +1,118 @@ +2009-03-18 Jakub Jelinek jakub@redhat.com + + PR debug/38757 + * langhooks.h (struct lang_hooks): Add source_language langhook. + * langhooks-def.h (LANG_HOOKS_SOURCE_LANGUAGE): Define to NULL. + (LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_SOURCE_LANGUAGE. + * c-lang.c (c_source_language): New function. + (LANG_HOOKS_SOURCE_LANGUAGE): Define. + * dwarf2out.c (add_prototyped_attribute): Add DW_AT_prototype + also for DW_LANG_{C,C99,ObjC}. + (gen_compile_unit_die): Use lang_hooks.source_language () to + determine if DW_LANG_C99 or DW_LANG_C89 should be returned. + +--- a/gcc/langhooks.h.jj 2010-06-30 09:48:30.000000000 +0200 ++++ b/gcc/langhooks.h 2010-07-01 16:15:22.432616871 +0200 +@@ -454,6 +454,10 @@ struct lang_hooks + is enabled. */ + bool eh_use_cxa_end_cleanup; + ++ /* Return year of the source language standard version if the FE supports ++ multiple versions of the standard. */ ++ int (*source_language) (void); ++ + /* Whenever you add entries here, make sure you adjust langhooks-def.h + and langhooks.c accordingly. */ + }; +--- a/gcc/langhooks-def.h.jj 2010-06-30 09:48:30.000000000 +0200 ++++ b/gcc/langhooks-def.h 2010-07-01 16:16:07.427460761 +0200 +@@ -1,5 +1,5 @@ + /* Default macros to initialize the lang_hooks data structure. +- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 ++ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Free Software Foundation, Inc. + Contributed by Alexandre Oliva aoliva@redhat.com + +@@ -111,6 +111,7 @@ extern void lhd_omp_firstprivatize_type_ + #define LANG_HOOKS_EH_PERSONALITY lhd_gcc_personality + #define LANG_HOOKS_EH_RUNTIME_TYPE lhd_pass_through_t + #define LANG_HOOKS_EH_USE_CXA_END_CLEANUP false ++#define LANG_HOOKS_SOURCE_LANGUAGE NULL + + /* Attribute hooks. */ + #define LANG_HOOKS_ATTRIBUTE_TABLE NULL +@@ -301,6 +302,7 @@ extern void lhd_end_section (void); + LANG_HOOKS_EH_PERSONALITY, \ + LANG_HOOKS_EH_RUNTIME_TYPE, \ + LANG_HOOKS_EH_USE_CXA_END_CLEANUP, \ ++ LANG_HOOKS_SOURCE_LANGUAGE, \ + } + + #endif /* GCC_LANG_HOOKS_DEF_H */ +--- a/gcc/c-lang.c.jj 2010-06-30 09:48:30.000000000 +0200 ++++ b/gcc/c-lang.c 2010-07-01 16:14:25.396197804 +0200 +@@ -1,6 +1,6 @@ + /* Language-specific hook definitions for C front end. + Copyright (C) 1991, 1995, 1997, 1998, +- 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008 ++ 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008, 2009 + Free Software Foundation, Inc. + + This file is part of GCC. +@@ -37,6 +37,12 @@ along with GCC; see the file COPYING3. + + enum c_language_kind c_language = clk_c; + ++static int ++c_source_language (void) ++{ ++ return flag_isoc99 ? 1999 : 1989; ++} ++ + /* Lang hooks common to C and ObjC are declared in c-objc-common.h; + consequently, there should be very few hooks below. */ + +@@ -44,6 +50,8 @@ enum c_language_kind c_language = clk_c; + #define LANG_HOOKS_NAME "GNU C" + #undef LANG_HOOKS_INIT + #define LANG_HOOKS_INIT c_objc_common_init ++#undef LANG_HOOKS_SOURCE_LANGUAGE ++#define LANG_HOOKS_SOURCE_LANGUAGE c_source_language + + /* Each front end provides its own lang hook initializer. */ + struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; +--- a/gcc/dwarf2out.c.jj 2010-07-01 14:07:41.000000000 +0200 ++++ b/gcc/dwarf2out.c 2010-07-01 16:13:24.597354717 +0200 +@@ -17150,9 +17150,18 @@ add_bit_size_attribute (dw_die_ref die, + static inline void + add_prototyped_attribute (dw_die_ref die, tree func_type) + { +- if (get_AT_unsigned (comp_unit_die, DW_AT_language) == DW_LANG_C89 +- && TYPE_ARG_TYPES (func_type) != NULL) +- add_AT_flag (die, DW_AT_prototyped, 1); ++ switch (get_AT_unsigned (comp_unit_die, DW_AT_language)) ++ { ++ case DW_LANG_C: ++ case DW_LANG_C89: ++ case DW_LANG_C99: ++ case DW_LANG_ObjC: ++ if (TYPE_ARG_TYPES (func_type) != NULL) ++ add_AT_flag (die, DW_AT_prototyped, 1); ++ break; ++ default: ++ break; ++ } + } + + /* Add an 'abstract_origin' attribute below a given DIE. The DIE is found +@@ -19246,6 +19255,10 @@ gen_compile_unit_die (const char *filena + language = DW_LANG_ObjC; + else if (strcmp (language_string, "GNU Objective-C++") == 0) + language = DW_LANG_ObjC_plus_plus; ++ else if (strcmp (language_string, "GNU C") == 0 ++ && lang_hooks.source_language ++ && lang_hooks.source_language () >= 1999) ++ language = DW_LANG_C99; + } + + add_AT_unsigned (die, DW_AT_language, language); diff --git a/pkgs/core/iptables/iptables.nm b/pkgs/core/iptables/iptables.nm index ec98529..4d98234 100644 --- a/pkgs/core/iptables/iptables.nm +++ b/pkgs/core/iptables/iptables.nm @@ -25,7 +25,7 @@ include $(PKGROOT)/Include
PKG_NAME = iptables -PKG_VER = 1.4.9.1 +PKG_VER = 1.4.10 PKG_REL = 0
PKG_MAINTAINER = diff --git a/pkgs/core/net-tools/config.h b/pkgs/core/net-tools/config.h new file mode 100644 index 0000000..7bb954a --- /dev/null +++ b/pkgs/core/net-tools/config.h @@ -0,0 +1,75 @@ +/* +* config.h Automatically generated configuration includefile +* +* NET-TOOLS A collection of programs that form the base set of the +* NET-3 Networking Distribution for the LINUX operating +* system. +* +* DO NOT EDIT DIRECTLY +* +*/ + +/* + * + * Internationalization + * + * The net-tools package has currently been translated to French, + * German and Brazilian Portugese. Other translations are, of + * course, welcome. Answer `n' here if you have no support for + * internationalization on your system. + * + */ +#define I18N 1 + +/* + * + * Protocol Families. + * + */ +#define HAVE_AFUNIX 1 +#define HAVE_AFINET 1 +#define HAVE_AFINET6 1 +#define HAVE_AFIPX 1 +#define HAVE_AFATALK 1 +#define HAVE_AFAX25 1 +#define HAVE_AFNETROM 1 +#define HAVE_AFROSE 1 +#define HAVE_AFX25 0 +#define HAVE_AFECONET 1 +#define HAVE_AFDECnet 0 +#define HAVE_AFASH 1 + +/* + * + * Device Hardware types. + * + */ +#define HAVE_HWETHER 1 +#define HAVE_HWARC 1 +#define HAVE_HWSLIP 0 +#define HAVE_HWPPP 1 +#define HAVE_HWTUNNEL 1 +#define HAVE_HWSTRIP 1 +#define HAVE_HWTR 1 +#define HAVE_HWAX25 1 +#define HAVE_HWROSE 1 +#define HAVE_HWNETROM 1 +#define HAVE_HWX25 0 +#define HAVE_HWFR 1 +#define HAVE_HWSIT 1 +#define HAVE_HWFDDI 1 +#define HAVE_HWHIPPI 1 +#define HAVE_HWASH 1 +#define HAVE_HWHDLCLAPB 1 +#define HAVE_HWIRDA 1 +#define HAVE_HWEC 1 +#define HAVE_HWIB 1 + +/* + * + * Other Features. + * + */ +#define HAVE_FW_MASQUERADE 1 +#define HAVE_IP_TOOLS 1 +#define HAVE_MII 1 diff --git a/pkgs/core/net-tools/config.make b/pkgs/core/net-tools/config.make new file mode 100644 index 0000000..68fb178 --- /dev/null +++ b/pkgs/core/net-tools/config.make @@ -0,0 +1,37 @@ +I18N=1 +HAVE_AFUNIX=1 +HAVE_AFINET=1 +HAVE_AFINET6=1 +HAVE_AFIPX=1 +HAVE_AFATALK=1 +HAVE_AFAX25=1 +HAVE_AFNETROM=1 +HAVE_AFROSE=1 +HAVE_AFX25=1 +HAVE_AFECONET=1 +# HAVE_AFDECnet=0 +HAVE_AFASH=1 +HAVE_HWETHER=1 +HAVE_HWARC=1 +HAVE_HWSLIP=1 +HAVE_HWPPP=1 +HAVE_HWTUNNEL=1 +HAVE_HWSTRIP=1 +HAVE_HWTR=1 +HAVE_HWAX25=1 +HAVE_HWROSE=1 +HAVE_HWNETROM=1 +HAVE_HWX25=1 +HAVE_HWFR=1 +HAVE_HWSIT=1 +HAVE_HWFDDI=1 +HAVE_HWHIPPI=1 +HAVE_HWASH=1 +HAVE_HWHDLCLAPB=1 +HAVE_HWIRDA=1 +HAVE_HWEC=1 +HAVE_HWIB=1 +HAVE_FW_MASQUERADE=1 +HAVE_IP_TOOLS=1 +HAVE_MII=1 +HAVE_SELINUX=0 diff --git a/pkgs/core/net-tools/ether-wake.8 b/pkgs/core/net-tools/ether-wake.8 new file mode 100644 index 0000000..26b4f85 --- /dev/null +++ b/pkgs/core/net-tools/ether-wake.8 @@ -0,0 +1,81 @@ +." Hey, EMACS: -*- nroff -*- +." First parameter, NAME, should be all caps +." Second parameter, SECTION, should be 1-8, maybe w/ subsection +." other parameters are allowed: see man(7), man(1) +.TH ETHER-WAKE 8 "March 31, 2003" "Scyld" +." Please adjust this date whenever revising the manpage. +." +." Some roff macros, for reference: +." .nh disable hyphenation +." .hy enable hyphenation +." .ad l left justify +." .ad b justify to both left and right margins +." .nf disable filling +." .fi enable filling +." .br insert line break +." .sp <n> insert n+1 empty lines +." for manpage-specific macros, see man(7) +.SH NAME +ether-wake - A tool to send a Wake-On-LAN "Magic Packet" +.SH SYNOPSIS +.B ether-wake +.RI [ options ] " Host-ID" +.SH DESCRIPTION +This manual page documents the usage of the +.B ether-wake +command. +.PP +." TeX users may be more comfortable with the \fB<whatever>\fP and +." \fI<whatever>\fP escape sequences to invode bold face and italics, +." respectively. +\fBether-wake\fP is a program that generates and transmits a Wake-On-LAN +(WOL) "Magic Packet", used for restarting machines that have been +soft-powered-down (ACPI D3-warm state). It generates the standard +AMD Magic Packet format, optionally with a password included. The +single required parameter is a station (MAC) address or a host ID that can +be translated to a MAC address by an +.BR ethers (5) +database specified in +.BR nsswitch.conf (5) +. +.SH OPTIONS +\fBether-wake\fP needs a single dash (ÂŽ-ÂŽ) in front of options. +A summary of options is included below. +.TP +.B -b +Send the wake-up packet to the broadcast address. +.TP +.B -D +Increase the Debug Level. +.TP +.B -i ifname +Use interface ifname instead of the default "eth0". +.TP +.B -p passwd +Append a four or six byte password to the packet. Only a few adapters +need or support this. A six byte password may be specified in Ethernet hex +format (00:22:44:66:88:aa) or four byte dotted decimal (192.168.1.1) format. +A four byte password must use the dotted decimal format. + +.TP +.B -V +Show the program version information. + +.SH EXIT STATUS +This program returns 0 on success. +A permission failures (e.g. run as a non-root user) results in an exit +status of 2. Unrecognized or invalid parameters result in an exit +status of 3. Failure to retrieve network interface information or send +a packet will result in an exit status of 1. + +.SH SEE ALSO +.BR arp (8). +.br +.SH SECURITY +On some non-Linux systems dropping root capability allows the process to be +dumped, traced or debugged. +If someone traces this program, they get control of a raw socket. +Linux handles this safely, but beware when porting this program. +.SH AUTHOR +The etherwake program was written by Donald Becker at Scyld Computing +Corporation for use with the Scyld(*(Tm) Beowulf System. diff --git a/pkgs/core/net-tools/ether-wake.c b/pkgs/core/net-tools/ether-wake.c new file mode 100644 index 0000000..eef22a7 --- /dev/null +++ b/pkgs/core/net-tools/ether-wake.c @@ -0,0 +1,392 @@ +/* ether-wake.c: Send a magic packet to wake up sleeping machines. */ + +static char version_msg[] = +"ether-wake.c: v1.09 11/12/2003 Donald Becker, http://www.scyld.com/"; +static char brief_usage_msg[] = +"usage: ether-wake [-i <ifname>] [-p aa:bb:cc:dd[:ee:ff]] 00:11:22:33:44:55\n" +" Use '-u' to see the complete set of options.\n"; +static char usage_msg[] = +"usage: ether-wake [-i <ifname>] [-p aa:bb:cc:dd[:ee:ff]] 00:11:22:33:44:55\n" +"\n" +" This program generates and transmits a Wake-On-LAN (WOL)\n" +" "Magic Packet", used for restarting machines that have been\n" +" soft-powered-down (ACPI D3-warm state).\n" +" It currently generates the standard AMD Magic Packet format, with\n" +" an optional password appended.\n" +"\n" +" The single required parameter is the Ethernet MAC (station) address\n" +" of the machine to wake or a host ID with known NSS 'ethers' entry.\n" +" The MAC address may be found with the 'arp' program while the target\n" +" machine is awake.\n" +"\n" +" Options:\n" +" -b Send wake-up packet to the broadcast address.\n" +" -D Increase the debug level.\n" +" -i ifname Use interface IFNAME instead of the default 'eth0'.\n" +" -p <pw> Append the four or six byte password PW to the packet.\n" +" A password is only required for a few adapter types.\n" +" The password may be specified in ethernet hex format\n" +" or dotted decimal (Internet address)\n" +" -p 00:22:44:66:88:aa\n" +" -p 192.168.1.1\n"; + +/* + This program generates and transmits a Wake-On-LAN (WOL) "Magic Packet", + used for restarting machines that have been soft-powered-down + (ACPI D3-warm state). It currently generates the standard AMD Magic Packet + format, with an optional password appended. + + This software may be used and distributed according to the terms + of the GNU Public License, incorporated herein by reference. + Contact the author for use under other terms. + + This source file was originally part of the network tricks package, and + is now distributed to support the Scyld Beowulf system. + Copyright 1999-2003 Donald Becker and Scyld Computing Corporation. + + The author may be reached as becker@scyld, or C/O + Scyld Computing Corporation + 914 Bay Ridge Road, Suite 220 + Annapolis MD 21403 + + Notes: + On some systems dropping root capability allows the process to be + dumped, traced or debugged. + If someone traces this program, they get control of a raw socket. + Linux handles this safely, but beware when porting this program. + + An alternative to needing 'root' is using a UDP broadcast socket, however + doing so only works with adapters configured for unicast+broadcast Rx + filter. That configuration consumes more power. +*/ + +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <errno.h> +#include <ctype.h> +#include <string.h> + +#if 0 /* Only exists on some versions. */ +#include <ioctls.h> +#endif + +#include <sys/socket.h> + +#include <sys/types.h> +#include <sys/ioctl.h> +#include <linux/if.h> + +#include <features.h> +#if __GLIBC__ >= 2 && __GLIBC_MINOR >= 1 +#include <netpacket/packet.h> +#include <net/ethernet.h> +#else +#include <asm/types.h> +#include <linux/if_packet.h> +#include <linux/if_ether.h> +#endif +#include <netdb.h> +#include <netinet/ether.h> + +/* Grrr, no consistency between include versions. + Enable this if setsockopt() isn't declared with your library. */ +#if 0 +extern int setsockopt __P ((int __fd, int __level, int __optname, + __ptr_t __optval, int __optlen)); +#else /* New, correct head files. */ +#include <sys/socket.h> +#endif + +u_char outpack[1000]; +int outpack_sz = 0; +int debug = 0; +u_char wol_passwd[6]; +int wol_passwd_sz = 0; + +static int opt_no_src_addr = 0, opt_broadcast = 0; + +static int get_dest_addr(const char *arg, struct ether_addr *eaddr); +static int get_fill(unsigned char *pkt, struct ether_addr *eaddr); +static int get_wol_pw(const char *optarg); + +int main(int argc, char *argv[]) +{ + char *ifname = "eth0"; + int one = 1; /* True, for socket options. */ + int s; /* Raw socket */ + int errflag = 0, verbose = 0, do_version = 0; + int perm_failure = 0; + int i, c, pktsize; +#if defined(PF_PACKET) + struct sockaddr_ll whereto; +#else + struct sockaddr whereto; /* who to wake up */ +#endif + struct ether_addr eaddr; + + while ((c = getopt(argc, argv, "bDi:p:uvV")) != -1) + switch (c) { + case 'b': opt_broadcast++; break; + case 'D': debug++; break; + case 'i': ifname = optarg; break; + case 'p': get_wol_pw(optarg); break; + case 'u': printf(usage_msg); return 0; + case 'v': verbose++; break; + case 'V': do_version++; break; + case '?': + errflag++; + } + if (verbose || do_version) + printf("%s\n", version_msg); + if (errflag) { + fprintf(stderr, brief_usage_msg); + return 3; + } + + if (optind == argc) { + fprintf(stderr, "Specify the Ethernet address as 00:11:22:33:44:55.\n"); + return 3; + } + + /* Note: PF_INET, SOCK_DGRAM, IPPROTO_UDP would allow SIOCGIFHWADDR to + work as non-root, but we need SOCK_PACKET to specify the Ethernet + destination address. */ +#if defined(PF_PACKET) + s = socket(PF_PACKET, SOCK_RAW, 0); +#else + s = socket(AF_INET, SOCK_PACKET, SOCK_PACKET); +#endif + if (s < 0) { + if (errno == EPERM) + fprintf(stderr, "ether-wake: This program must be run as root.\n"); + else + perror("ether-wake: socket"); + perm_failure++; + } + /* Don't revert if debugging allows a normal user to get the raw socket. */ + setuid(getuid()); + + /* We look up the station address before reporting failure so that + errors may be reported even when run as a normal user. + */ + if (get_dest_addr(argv[optind], &eaddr) != 0) + return 3; + if (perm_failure && ! debug) + return 2; + + pktsize = get_fill(outpack, &eaddr); + + /* Fill in the source address, if possible. + The code to retrieve the local station address is Linux specific. */ + if (! opt_no_src_addr) { + struct ifreq if_hwaddr; + unsigned char *hwaddr = if_hwaddr.ifr_hwaddr.sa_data; + + strcpy(if_hwaddr.ifr_name, ifname); + if (ioctl(s, SIOCGIFHWADDR, &if_hwaddr) < 0) { + fprintf(stderr, "SIOCGIFHWADDR on %s failed: %s\n", ifname, + strerror(errno)); + /* Magic packets still work if our source address is bogus, but + we fail just to be anal. */ + return 1; + } + memcpy(outpack+6, if_hwaddr.ifr_hwaddr.sa_data, 6); + + if (verbose) { + printf("The hardware address (SIOCGIFHWADDR) of %s is type %d " + "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x.\n", ifname, + if_hwaddr.ifr_hwaddr.sa_family, hwaddr[0], hwaddr[1], + hwaddr[2], hwaddr[3], hwaddr[4], hwaddr[5]); + } + } + + if (wol_passwd_sz > 0) { + memcpy(outpack+pktsize, wol_passwd, wol_passwd_sz); + pktsize += wol_passwd_sz; + } + + if (verbose > 1) { + printf("The final packet is: "); + for (i = 0; i < pktsize; i++) + printf(" %2.2x", outpack[i]); + printf(".\n"); + } + + /* This is necessary for broadcasts to work */ + if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, (char *)&one, sizeof(one)) < 0) + perror("setsockopt: SO_BROADCAST"); + +#if defined(PF_PACKET) + { + struct ifreq ifr; + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + if (ioctl(s, SIOCGIFINDEX, &ifr) == -1) { + fprintf(stderr, "SIOCGIFINDEX on %s failed: %s\n", ifname, + strerror(errno)); + return 1; + } + memset(&whereto, 0, sizeof(whereto)); + whereto.sll_family = AF_PACKET; + whereto.sll_ifindex = ifr.ifr_ifindex; + /* The manual page incorrectly claims the address must be filled. + We do so because the code may change to match the docs. */ + whereto.sll_halen = ETH_ALEN; + memcpy(whereto.sll_addr, outpack, ETH_ALEN); + + } +#else + whereto.sa_family = 0; + strcpy(whereto.sa_data, ifname); +#endif + + if ((i = sendto(s, outpack, pktsize, 0, (struct sockaddr *)&whereto, + sizeof(whereto))) < 0) + perror("sendto"); + else if (debug) + printf("Sendto worked ! %d.\n", i); + +#ifdef USE_SEND + if (bind(s, (struct sockaddr *)&whereto, sizeof(whereto)) < 0) + perror("bind"); + else if (send(s, outpack, 100, 0) < 0) + perror("send"); +#endif +#ifdef USE_SENDMSG + { + struct msghdr msghdr = { 0,}; + struct iovec iovector[1]; + msghdr.msg_name = &whereto; + msghdr.msg_namelen = sizeof(whereto); + msghdr.msg_iov = iovector; + msghdr.msg_iovlen = 1; + iovector[0].iov_base = outpack; + iovector[0].iov_len = pktsize; + if ((i = sendmsg(s, &msghdr, 0)) < 0) + perror("sendmsg"); + else if (debug) + printf("sendmsg worked, %d (%d).\n", i, errno); + } +#endif + + return 0; +} + +/* Convert the host ID string to a MAC address. + The string may be a + Host name + IP address string + MAC address string +*/ + +static int get_dest_addr(const char *hostid, struct ether_addr *eaddr) +{ + struct ether_addr *eap; + + eap = ether_aton(hostid); + if (eap) { + *eaddr = *eap; + if (debug) + fprintf(stderr, "The target station address is %s.\n", + ether_ntoa(eaddr)); + } else if (ether_hostton(hostid, eaddr) == 0) { + if (debug) + fprintf(stderr, "Station address for hostname %s is %s.\n", + hostid, ether_ntoa(eaddr)); + } else { + (void)fprintf(stderr, + "ether-wake: The Magic Packet host address must be " + "specified as\n" + " - a station address, 00:11:22:33:44:55, or\n" + " - a hostname with a known 'ethers' entry.\n"); + return -1; + } + return 0; +} + + +static int get_fill(unsigned char *pkt, struct ether_addr *eaddr) +{ + int offset, i; + unsigned char *station_addr = eaddr->ether_addr_octet; + + if (opt_broadcast) + memset(pkt+0, 0xff, 6); + else + memcpy(pkt, station_addr, 6); + memcpy(pkt+6, station_addr, 6); + pkt[12] = 0x08; /* Or 0x0806 for ARP, 0x8035 for RARP */ + pkt[13] = 0x42; + offset = 14; + + memset(pkt+offset, 0xff, 6); + offset += 6; + + for (i = 0; i < 16; i++) { + memcpy(pkt+offset, station_addr, 6); + offset += 6; + } + if (debug) { + fprintf(stderr, "Packet is "); + for (i = 0; i < offset; i++) + fprintf(stderr, " %2.2x", pkt[i]); + fprintf(stderr, ".\n"); + } + return offset; +} + +static int get_wol_pw(const char *optarg) +{ + int passwd[6]; + int byte_cnt; + int i; + + byte_cnt = sscanf(optarg, "%2x:%2x:%2x:%2x:%2x:%2x", + &passwd[0], &passwd[1], &passwd[2], + &passwd[3], &passwd[4], &passwd[5]); + if (byte_cnt < 4) + byte_cnt = sscanf(optarg, "%d.%d.%d.%d", + &passwd[0], &passwd[1], &passwd[2], &passwd[3]); + if (byte_cnt < 4) { + fprintf(stderr, "Unable to read the Wake-On-LAN password.\n"); + return 0; + } + printf(" The Magic packet password is %2.2x %2.2x %2.2x %2.2x (%d).\n", + passwd[0], passwd[1], passwd[2], passwd[3], byte_cnt); + for (i = 0; i < byte_cnt; i++) + wol_passwd[i] = passwd[i]; + return wol_passwd_sz = byte_cnt; +} + +#if 0 +{ + to = (struct sockaddr_in *)&whereto; + to->sin_family = AF_INET; + if (inet_aton(target, &to->sin_addr)) { + hostname = target; + } + memset (&sa, 0, sizeof sa); + sa.sa_family = AF_INET; + strncpy (sa.sa_data, interface, sizeof sa.sa_data); + sendto (sock, buf, bufix + len, 0, &sa, sizeof sa); + strncpy (sa.sa_data, interface, sizeof sa.sa_data); +#if 1 + sendto (sock, buf, bufix + len, 0, &sa, sizeof sa); +#else + bind (sock, &sa, sizeof sa); + connect(); + send (sock, buf, bufix + len, 0); +#endif +} +#endif + + +/* + * Local variables: + * compile-command: "gcc -O -Wall -o ether-wake ether-wake.c" + * c-indent-level: 4 + * c-basic-offset: 4 + * c-indent-level: 4 + * tab-width: 4 + * End: + */ diff --git a/pkgs/core/net-tools/ipmaddr.8 b/pkgs/core/net-tools/ipmaddr.8 new file mode 100644 index 0000000..d2b0046 --- /dev/null +++ b/pkgs/core/net-tools/ipmaddr.8 @@ -0,0 +1,34 @@ +." Process this file with +." groff -man -Tascii iptstate.8 +." +.TH IPMADDR 8 "SEPTEMBER 2009" "" "" +." +." Man page written by Jiri Popelka <jpopelka AT redhat DOT com> +." +.SH NAME +.B ipmaddr +- adds, deletes, and displays multicast addresses + +.SH SYNOPSIS +.B /usr/sbin/ipmaddr +.RB [< operation >] +.RB [< args >] + +.SH NOTE +.P +This program is obsolete. For replacement check \fBip maddress\fR. + +.SH DESCRIPTION +The \fBipmaddr\fR command can perform one of the following operations: + +.B add +- add a multicast address + +.B del +- delete a multicast address + +.B show +- list multicast addresses + +.SH SEE ALSO +.BR ip (8). diff --git a/pkgs/core/net-tools/iptunnel.8 b/pkgs/core/net-tools/iptunnel.8 new file mode 100644 index 0000000..2dacd40 --- /dev/null +++ b/pkgs/core/net-tools/iptunnel.8 @@ -0,0 +1,42 @@ +." Process this file with +." groff -man -Tascii iptstate.8 +." +.TH IPTUNNEL 8 "SEPTEMBER 2009" "" "" +." +." Man page written by Jiri Popelka <jpopelka AT redhat DOT com> +." +.SH NAME + +.B iptunnel +- creates, deletes, and displays configured tunnels + +.SH SYNOPSIS +.B /usr/sbin/iptunnel +.RB [< operation >] +.RB [< args >] + +.SH NOTE +.P +This program is obsolete. For replacement check \fBip tunnel\fR. + +.SH DESCRIPTION +The \fBiptunnel\fR +command creates configured tunnels for sending and receiving +IPV6 or IPV4 packets that are encapsulated as the payload of an IPV4 +datagram. + +The +.B iptunnel +command can perform one of the following operations: + +.B create +- create a tunnel interface, which you must subsequently configure. + +.B delete +- delete a tunnel interface. You must disable the tunnel before you can delete it. + +.B show +- show the tunnel attributes (name, tunnel end points, next hop for tunneled packets). + +.SH SEE ALSO +.BR ip (8). diff --git a/pkgs/core/net-tools/mii-diag.8 b/pkgs/core/net-tools/mii-diag.8 new file mode 100644 index 0000000..aa0dc0b --- /dev/null +++ b/pkgs/core/net-tools/mii-diag.8 @@ -0,0 +1,160 @@ +." Hey, EMACS: -*- nroff -*- +." $Revision: 1.1 $ $Date: 2003/09/06 17:20:17 $ +." First parameter, NAME, should be all caps +." Second parameter, SECTION, should be 1-8, maybe w/ subsection +." other parameters are allowed: see man(7), man(1) +.TH MII-DIAG 8 "September 9, 2003" "Scyld Beowulf*(Tm" +." Please adjust this date whenever revising the manpage. +." +." Some roff macros, for reference: +." .nh disable hyphenation +." .hy enable hyphenation +." .ad l left justify +." .ad b justify to both left and right margins +." .nf disable filling +." .fi enable filling +." .br insert line break +." .sp <n> insert n+1 empty lines +." for manpage-specific macros, see man(7) +.SH NAME +mii-diag - Network adapter control and monitoring +.SH SYNOPSIS +.B mii-diag +.RI [ options ] <interface> +.SH DESCRIPTION +This manual page documents briefly the +.B mii-diag +network adapter control and monitoring command. +Addition documentation is available from http://scyld.com/diag/index.html. + +." TeX users may be more comfortable with the \fB<whatever>\fP and +." \fI<whatever>\fP escape sequences to invoke bold face and italics, +." respectively. +.PP +This \fBmii-diag\fP command configures, controls and monitors the +transceiver management registers for network interfaces, and configures +driver operational parameters. For transceiver control \fBmii-diag\fP +uses the Media Independent Interface (MII) standard (thus the command name). +It also has additional Linux-specific controls to communicate parameters +such as message enable settings and buffer sizes to the underlying device +driver. +.PP +The MII standard defines registers that control and report network +transceiver capabilities, link settings and errors. Examples are link +speed, duplex, capabilities advertised to the link partner, status LED +indications and link error counters. + +.SH OPTIONS +The \fBmii-diag\fP command supports both single character and long +option names. Short options use a single dash (ÂŽ-ÂŽ) in front of the option +character. For options without parameters, multiple options may be +concatenated after a single dash. Long options are prefixed by two +dashes (ÂŽ--ÂŽ), and may be abbreviated with a unique prefix. +A long option may take a parameter of the form --arg=param or --arg param. + +.PP +A summary of options is as follows. + +.TP +.B -A, --advertise <speed|setting> +.BR +.B -F, --fixed-speed <speed|setting> + +Speed is one of: 100baseT4, 100baseTx, 100baseTx-FD, 100baseTx-HD, 10baseT, +10baseT-FD, 10baseT-HD. For more precise control an explict numeric +register setting is also allowed. + + +.TP +.B -a, --all-interfaces +Show the status of all interfaces. This option is not recommended with +any other option, especially ones that change settings. + +.TP +.B -s,--status +Return exit status 2 if there is no link beat. + +.TP +.B -D +Increase the debugging level. This may be used to understand the +actions the command is taking. + +.TP +.B -g, --read-parameters +Show driver-specific parameters. + +.TP +.B -G, --set-parameters value[,value...] +Set driver-specific parameters. +Set a adapter-specific parameters. +Parameters are comma separated, with missing elements retaining the +existing value. + +.TP +.B -v +Increase the verbosity level. Additional "-v" options increase the +level further. + +.TP +.B -V +Show the program version information. + +.TP +.B -w, --watch +Continuously monitor the transceiver and report changes. + +.TP +.B -? +Emit usage information. + +.SH DESCRIPTION + +.PP +Calling the command with just the interface name (which defaults to +'eth0' if missing) produces extensive output describing the transceiver +capabilities, configuration and current status. + +.PP +The '--monitor' option allows scripting link beat changes. +.PP +This option is similar to --watch, but with lower overhead and simplifed +output. It polls the interface only once a second and the output format +is a single line per link change with three fixed words + <unknown|down||negotiating|up> <STATUS> <PARTNER-CAP> +.PP +Example output: mii-diag --monitor eth0 + down 0x7809 0x0000 + negotiating 0x7829 0x45e1 + up 0x782d 0x45e1 + down 0x7809 0x0000 + +.PP +This may be used as + mii-diag --monitor eth0 | + while read linkstatus bmsr linkpar; do + case $linkstatus in + up) ifup eth0 ;; + down) ifdown eth0 ;; + esac + done + +.PP +It may be useful to shorten the DHCP client daemon timeout if it does +not receive an address by adding the following setting to +/etc/sysconfig/network: +DHCPCDARGS="-t 3" + +.SH SEE ALSO +.BR ether-wake (8), net-diag (8), mii-tool (8). +.br +Addition documentation is available from http://scyld.com/diag/index.html. + +.SH KNOWN BUGS +The --all-interfaces option is quirky. There are very few settings that +are usefully applied to all interfaces. + +.SH AUTHOR +The manual pages, diagnostic commands, and many of the underlying Linux +network drivers were written by Donald Becker for the Scyld +Beowulf(*(Tm) cluster system. + diff --git a/pkgs/core/net-tools/mii-diag.c b/pkgs/core/net-tools/mii-diag.c new file mode 100644 index 0000000..17d8bef --- /dev/null +++ b/pkgs/core/net-tools/mii-diag.c @@ -0,0 +1,650 @@ +/* Mode: C; + * mii-diag.c: Examine and set the MII registers of a network interfaces. + + Usage: mii-diag [-vw] interface. + + This program reads and writes the Media Independent Interface (MII) + management registers on network transceivers. The registers control + and report network link settings and errors. Examples are link speed, + duplex, capabilities advertised to the link partner, status LED + indications and link error counters. + + Notes: + The compile-command is at the end of this source file. + This program works with drivers that implement MII ioctl() calls. + + Written/copyright 1997-2003 by Donald Becker becker@scyld.com + + This program is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public + License as published by the Free Software Foundation. + + The author may be reached as becker@scyld.com, or C/O + Scyld Computing Corporation + 914 Bay Ridge Road, Suite 220 + Annapolis MD 21403 + + References + http://scyld.com/expert/mii-status.html + http://scyld.com/expert/NWay.html + http://www.national.com/pf/DP/DP83840.html +*/ + +static char version[] = +"mii-diag.c:v2.11 3/21/2005 Donald Becker (becker@scyld.com)\n" +" http://www.scyld.com/diag/index.html%5Cn"; + +static const char usage_msg[] = +"Usage: %s [--help] [-aDfrRvVw] [-AF <speed+duplex>] [--watch] <interface>.\n"; +static const char long_usage_msg[] = +"Usage: %s [-aDfrRvVw] [-AF <speed+duplex>] [--watch] <interface>.\n\ +\n\ + This program configures and monitors the transceiver management registers\n\ + for network interfaces. It uses the Media Independent Interface (MII)\n\ + standard with additional Linux-specific controls to communicate with the\n\ + underlying device driver. The MII registers control and report network\n\ + link settings and errors. Examples are link speed, duplex, capabilities\n\ + advertised to the link partner, status LED indications and link error\n\ + counters.\n\ +\n\ + The common usage is\n\ + mii-diag eth0\n\ +\n\ + The default interface is "eth0".\n\ + Frequently used options are\n\ + -A --advertise <speed|setting>\n\ + -F --fixed-speed <speed>\n\ + Speed is one of: 100baseT4, 100baseTx, 100baseTx-FD, 100baseTx-HD,\n\ + 10baseT, 10baseT-FD, 10baseT-HD\n\ + -s --status Return exit status 2 if there is no link beat.\n\ +\n\ + Less frequently used options are\n\ + -a --all-interfaces Show the status all interfaces\n\ + (Not recommended with options that change settings.)\n\ + -D --debug\n\ + -g --read-parameters Get driver-specific parameters.\n\ + -G --set-parameters PARMS Set driver-specific parameters.\n\ + Parameters are comma separated, missing parameters retain\n\ + their previous values.\n\ + -M --msg-level LEVEL Set the driver message bit map.\n\ + -p --phy ADDR Set the PHY (MII address) to report.\n\ + -r --restart Restart the link autonegotiation.\n\ + -R --reset Reset the transceiver.\n\ + -v --verbose Report each action taken.\n\ + -V --version Emit version information.\n\ + -w --watch Continuously monitor the transceiver and report changes.\n\ +\n\ + This command returns success (zero) if the interface information can be\n\ + read. If the --status option is passed, a zero return means that the\n\ + interface has link beat.\n\ +"; + +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <ctype.h> +#include <string.h> +#include <errno.h> +#include <fcntl.h> +#include <getopt.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/ioctl.h> +#include <net/if.h> +#ifdef use_linux_libc5 +#include <linux/if_arp.h> +#include <linux/if_ether.h> +#endif + +typedef u_int32_t u32; +typedef u_int16_t u16; +typedef u_int8_t u8; + +#if defined(SIOCGPARAMS) && SIOCGPARAMS != SIOCDEVPRIVATE+3 +#error Changed definition for SIOCGPARAMS +#else +#define SIOCGPARAMS (SIOCDEVPRIVATE+3) /* Read operational parameters. */ +#define SIOCSPARAMS (SIOCDEVPRIVATE+4) /* Set operational parameters. */ +#endif + +const char shortopts[] = "aA:C:DfF:gG:hmM:p:rRsvVw?"; +struct option longopts[] = { + /* { name has_arg *flag val } */ + {"all-interfaces", 0, 0, 'a'}, /* Show all interfaces. */ + {"advertise", 1, 0, 'A'}, /* Change the capabilities advertised. */ + {"BMCR", 1, 0, 'C'}, /* Set the control register. */ + {"debug", 0, 0, 'D'}, /* Increase the debug level. */ + {"force", 0, 0, 'f'}, /* Force the operation. */ + {"fixed-speed", 1, 0, 'F'}, /* Fixed speed name. */ + {"read-parameters", 0, 0, 'g'}, /* Show general settings values. */ + {"set-parameters", 1, 0, 'G'}, /* Write general settings values. */ + {"help", 0, 0, 'h'}, /* Print a long usage message. */ + {"monitor", 0, 0, 'm'}, /* Monitor status register. */ + {"msg-level", 1, 0, 'M'}, /* Set the driver message level. */ + {"phy", 1, 0, 'p'}, /* Set the PHY (MII address) to report. */ + {"restart", 0, 0, 'r'}, /* Restart the link negotiation */ + {"reset", 0, 0, 'R'}, /* Reset the transceiver. */ + {"status", 0, 0, 's'}, /* Non-zero exit status w/ no link beat. */ + {"verbose", 0, 0, 'v'}, /* Report each action taken. */ + {"version", 0, 0, 'V'}, /* Emit version information. */ + {"watch", 0, 0, 'w'}, /* Constantly monitor the port. */ + {"error", 0, 0, '?'}, /* Return the error message. */ + { 0, 0, 0, 0 } +}; + +/* Usually in libmii.c, but trivial substitions are below. */ +extern int show_mii_details(long ioaddr, int phy_id); +extern void monitor_mii(long ioaddr, int phy_id); +int show_mii_details(long ioaddr, int phy_id) __attribute__((weak)); +void monitor_mii(long ioaddr, int phy_id) __attribute__((weak)); + + +/* Command-line flags. */ +unsigned int opt_a = 0, /* Show-all-interfaces flag. */ + opt_f = 0, /* Force the operation. */ + opt_g = 0, + opt_G = 0, + verbose = 0, /* Verbose flag. */ + debug = 0, + opt_version = 0, + opt_restart = 0, + opt_reset = 0, + opt_status = 0, + opt_watch = 0; +static int msg_level = -1; +static int set_BMCR = -1; +static int nway_advertise = 0; +static int fixed_speed = -1; +static int override_phy = -1; +char *opt_G_string = NULL; + +/* Internal values. */ +int new_ioctl_nums; +int skfd = -1; /* AF_INET socket for ioctl() calls. */ +struct ifreq ifr; + +int do_one_xcvr(int skfd); +int show_basic_mii(long ioaddr, int phy_id); +int mdio_read(int skfd, int phy_id, int location); +void mdio_write(int skfd, int phy_id, int location, int value); +static int parse_advertise(const char *capabilities); +static void monitor_status(long ioaddr, int phy_id); + + +int +main(int argc, char **argv) +{ + int c, errflag = 0; + char **spp, *ifname; + char *progname = rindex(argv[0], '/') ? rindex(argv[0], '/')+1 : argv[0]; + + while ((c = getopt_long(argc, argv, shortopts, longopts, 0)) != EOF) + switch (c) { + case 'a': opt_a++; break; + case 'A': nway_advertise |= parse_advertise(optarg); + if (nway_advertise == -1) errflag++; + break; + case 'C': set_BMCR = strtoul(optarg, NULL, 16); break; + case 'D': debug++; break; + case 'f': opt_f++; break; + case 'F': fixed_speed = parse_advertise(optarg); + if (fixed_speed == -1) errflag++; + break; + case 'g': opt_g++; break; + case 'G': opt_G++; opt_G_string = strdup(optarg); break; + case 'm': opt_watch++; opt_status++; break; + case 'M': msg_level = strtoul(optarg, NULL, 0); break; + case 'h': fprintf(stderr, long_usage_msg, progname); return 0; + case 'p': override_phy = atoi(optarg); break; + case 'r': opt_restart++; break; + case 'R': opt_reset++; break; + case 's': opt_status++; break; + case 'v': verbose++; break; + case 'V': opt_version++; break; + case 'w': opt_watch++; break; + case '?': errflag++; break; + } + if (errflag) { + fprintf(stderr, usage_msg, progname); + return 2; + } + + if (verbose || opt_version) + printf(version); + + /* Open a basic socket. */ + if ((skfd = socket(AF_INET, SOCK_DGRAM,0)) < 0) { + perror("socket"); + return 1; + } + + if (debug) + fprintf(stderr, "DEBUG: argc=%d, optind=%d and argv[optind] is %s.\n", + argc, optind, argv[optind]); + + /* No remaining args means show all interfaces. */ + if (optind == argc) { + ifname = "eth0"; + fprintf(stderr, "Using the default interface 'eth0'.\n"); + } else { + /* Copy the interface name. */ + spp = argv + optind; + ifname = *spp++; + } + + if (ifname == NULL) { + ifname = "eth0"; + fprintf(stderr, "Using the default interface 'eth0'.\n"); + } + + /* Verify that the interface supports the ioctl(), and if + it is using the new or old SIOCGMIIPHY value (grrr...). + */ + { + u16 *data = (u16 *)(&ifr.ifr_data); + + strncpy(ifr.ifr_name, ifname, IFNAMSIZ); + data[0] = 0; + + if (ioctl(skfd, 0x8947, &ifr) >= 0) { + new_ioctl_nums = 1; + } else if (ioctl(skfd, SIOCDEVPRIVATE, &ifr) >= 0) { + new_ioctl_nums = 0; + } else { + fprintf(stderr, "SIOCGMIIPHY on %s failed: %s\n", ifname, + strerror(errno)); + (void) close(skfd); + return 1; + } + if (verbose) + printf(" Using the %s SIOCGMIIPHY value on PHY %d " + "(BMCR 0x%4.4x).\n", + new_ioctl_nums ? "new" : "old", data[0], data[3]); + } + + do_one_xcvr(skfd); + + (void) close(skfd); + return 0; +} + +int do_one_xcvr(int skfd) +{ + u16 *data = (u16 *)(&ifr.ifr_data); + u32 *data32 = (u32 *)(&ifr.ifr_data); + unsigned phy_id = data[0]; + + if (override_phy >= 0) { + printf("Using the specified MII PHY index %d.\n", override_phy); + phy_id = override_phy; + } + + if (opt_g || opt_G || msg_level >= 0) { + if (ioctl(skfd, SIOCGPARAMS, &ifr) < 0) { + fprintf(stderr, "SIOCGPARAMS on %s failed: %s\n", ifr.ifr_name, + strerror(errno)); + return -1; + } + } + if (opt_g) { + int i; + printf("Driver general parameter settings:"); + for (i = 0; i*sizeof(u32) < sizeof(ifr.ifr_ifru); i++) { + printf(" %d", data32[i]); + } + printf(".\n"); + } + if (opt_G) { + /* Set up to four arbitrary driver parameters from the -G parameter. + The format is comma separated integers, with a missing element + retaining the previous value. + */ + char *str = opt_G_string; + int i; + for (i = 0; str && i < 4; i++) { + char *endstr; + u32 newval = strtol(str, &endstr, 0); + if (debug) + printf(" parse string '%s' value %d end '%s'.\n", + str, newval, endstr); + if (str == endstr) { + if (endstr[0] == ',') /* No parameter */ + str = endstr+1; + else { + fprintf(stderr, "Invalid driver parameter '%s'.\n", str); + str = index(str, ','); + } + } else if (endstr[0] == ',') { + data32[i] = newval; + str = endstr + 1; + } else if (endstr[0] == 0) { + data32[i] = newval; + break; + } + } + printf("Setting new driver general parameters:"); + for (i = 0; i*sizeof(u32) < sizeof(ifr.ifr_ifru); i++) { + printf(" %d", data32[i]); + } + printf(".\n"); + if (ioctl(skfd, SIOCSPARAMS, &ifr) < 0) { + fprintf(stderr, "SIOCSPARAMS on %s failed: %s\n", ifr.ifr_name, + strerror(errno)); + return -1; + } + } + if (msg_level >= 0) { + data32[0] = msg_level; + if (ioctl(skfd, SIOCSPARAMS, &ifr) < 0) { + fprintf(stderr, "SIOCSPARAMS on %s failed: %s\n", ifr.ifr_name, + strerror(errno)); + return -1; + } + } + + if (opt_reset) { + printf("Resetting the transceiver...\n"); + mdio_write(skfd, phy_id, 0, 0x8000); + } + /* Note: PHY addresses > 32 are pseudo-MII devices, usually built-in. */ + if (phy_id < 64 && nway_advertise > 0) { + printf(" Setting the media capability advertisement register of " + "PHY #%d to 0x%4.4x.\n", phy_id, nway_advertise | 1); + mdio_write(skfd, phy_id, 4, nway_advertise | 1); + mdio_write(skfd, phy_id, 0, 0x1000); + } + + if (opt_restart) { + printf("Restarting negotiation...\n"); + mdio_write(skfd, phy_id, 0, 0x0000); + mdio_write(skfd, phy_id, 0, 0x1200); + } + /* To force 100baseTx-HD do mdio_write(skfd, phy_id, 0, 0x2000); */ + if (fixed_speed >= 0) { + int reg0_val = 0; + if (fixed_speed & 0x0180) /* 100mpbs */ + reg0_val |= 0x2000; + if ((fixed_speed & 0x0140) && /* A full duplex type and */ + ! (fixed_speed & 0x0820)) /* no half duplex types. */ + reg0_val |= 0x0100; + printf("Setting the speed to "fixed", Control register %4.4x.\n", + reg0_val); + mdio_write(skfd, phy_id, 0, reg0_val); + } + if (set_BMCR >= 0) { + printf("Setting the Basic Mode Control Register to 0x%4.4x.\n", + set_BMCR); + mdio_write(skfd, phy_id, 0, set_BMCR); + } + + if (opt_watch && opt_status) + monitor_status(skfd, phy_id); + + show_basic_mii(skfd, phy_id); +#ifdef LIBMII + if (verbose) + show_mii_details(skfd, phy_id); +#else + if (verbose || debug) { + int mii_reg, mii_val; + printf(" MII PHY #%d transceiver registers:", phy_id); + for (mii_reg = 0; mii_reg < 32; mii_reg++) { + mii_val = mdio_read(skfd, phy_id, mii_reg); + printf("%s %4.4x", (mii_reg % 8) == 0 ? "\n " : "", + mii_val); + } + printf("\n"); + } +#endif + + if (opt_watch) + monitor_mii(skfd, phy_id); + if (opt_status && + (mdio_read(skfd, phy_id, 1) & 0x0004) == 0) + exit(2); + return 0; +} + +int mdio_read(int skfd, int phy_id, int location) +{ + u16 *data = (u16 *)(&ifr.ifr_data); + + data[0] = phy_id; + data[1] = location; + + if (ioctl(skfd, new_ioctl_nums ? 0x8948 : SIOCDEVPRIVATE+1, &ifr) < 0) { + fprintf(stderr, "SIOCGMIIREG on %s failed: %s\n", ifr.ifr_name, + strerror(errno)); + return -1; + } + return data[3]; +} + +void mdio_write(int skfd, int phy_id, int location, int value) +{ + u16 *data = (u16 *)(&ifr.ifr_data); + + data[0] = phy_id; + data[1] = location; + data[2] = value; + + if (ioctl(skfd, new_ioctl_nums ? 0x8949 : SIOCDEVPRIVATE+2, &ifr) < 0) { + fprintf(stderr, "SIOCSMIIREG on %s failed: %s\n", ifr.ifr_name, + strerror(errno)); + } +} + +/* Parse the command line argument for advertised capabilities. */ +static int parse_advertise(const char *capabilities) +{ + const char *mtypes[] = { + "100baseT4", "100baseTx", "100baseTx-FD", "100baseTx-HD", + "10baseT", "10baseT-FD", "10baseT-HD", 0, + }; + char *endptr; + int cap_map[] = { 0x0200, 0x0180, 0x0100, 0x0080, 0x0060, 0x0040, 0x0020,}; + int i; + if ( ! capabilities) { + fprintf(stderr, "You passed -A 'NULL'. You must provide a media" + " list to advertise!\n"); + return -1; + } + if (debug) + fprintf(stderr, "Advertise string is '%s'.\n", capabilities); + for (i = 0; mtypes[i]; i++) + if (strcasecmp(mtypes[i], capabilities) == 0) + return cap_map[i]; + if ((i = strtol(capabilities, &endptr, 16)) <= 0xffff && endptr[0] == 0) + return i; + fprintf(stderr, "Invalid media advertisement value '%s'.\n" + " Either pass a numeric value or one of the following names:\n", + capabilities); + for (i = 0; mtypes[i]; i++) + fprintf(stderr, " %-14s %3.3x\n", mtypes[i], cap_map[i]); + return -1; +} + +/* Trivial versions if we don't link against libmii.c */ +static const char *media_names[] = { + "10baseT", "10baseT-FD", "100baseTx", "100baseTx-FD", "100baseT4", + "Flow-control", 0, +}; +/* Various non-good bits in the command register. */ +static const char *bmcr_bits[] = { + " Internal Collision-Test enabled!\n", "", /* 0x0080,0x0100 */ + " Restarted auto-negotiation in progress!\n", + " Transceiver isolated from the MII!\n", + " Transceiver powered down!\n", "", "", + " Transceiver in loopback mode!\n", + " Transceiver currently being reset!\n", +}; + +int show_basic_mii(long ioaddr, int phy_id) +{ + int mii_reg, i; + u16 mii_val[32]; + u16 bmcr, bmsr, new_bmsr, nway_advert, lkpar; + + for (mii_reg = 0; mii_reg < 8; mii_reg++) + mii_val[mii_reg] = mdio_read(ioaddr, phy_id, mii_reg); + if ( ! verbose) { + printf("Basic registers of MII PHY #%d: ", phy_id); + for (mii_reg = 0; mii_reg < 8; mii_reg++) + printf(" %4.4x", mii_val[mii_reg]); + printf(".\n"); + } + + if (mii_val[0] == 0xffff || mii_val[1] == 0x0000) { + printf(" No MII transceiver present!.\n"); + if (! opt_f) { + printf(" Use '--force' to view the information anyway.\n"); + return -1; + } + } + /* Descriptive rename. */ + bmcr = mii_val[0]; + bmsr = mii_val[1]; + nway_advert = mii_val[4]; + lkpar = mii_val[5]; + + if (lkpar & 0x4000) { + int negotiated = nway_advert & lkpar & 0x3e0; + int max_capability = 0; + /* Scan for the highest negotiated capability, highest priority + (100baseTx-FDX) to lowest (10baseT-HDX). */ + int media_priority[] = {8, 9, 7, 6, 5}; /* media_names[i-5] */ + printf(" The autonegotiated capability is %4.4x.\n", negotiated); + for (i = 0; media_priority[i]; i++) + if (negotiated & (1 << media_priority[i])) { + max_capability = media_priority[i]; + break; + } + if (max_capability) + printf("The autonegotiated media type is %s.\n", + media_names[max_capability - 5]); + else + printf("No common media type was autonegotiated!\n" + "This is extremely unusual and typically indicates a " + "configuration error.\n" "Perhaps the advertised " + "capability set was intentionally limited.\n"); + } + printf(" Basic mode control register 0x%4.4x:", bmcr); + if (bmcr & 0x1000) + printf(" Auto-negotiation enabled.\n"); + else + printf(" Auto-negotiation disabled, with\n" + " Speed fixed at 10%s mbps, %s-duplex.\n", + bmcr & 0x2000 ? "0" : "", + bmcr & 0x0100 ? "full":"half"); + for (i = 0; i < 9; i++) + if (bmcr & (0x0080<<i)) + printf(bmcr_bits[i]); + + new_bmsr = mdio_read(ioaddr, phy_id, 1); + if ((bmsr & 0x0016) == 0x0004) + printf( " You have link beat, and everything is working OK.\n"); + else + printf(" Basic mode status register 0x%4.4x ... %4.4x.\n" + " Link status: %sestablished.\n", + bmsr, new_bmsr, + bmsr & 0x0004 ? "" : + (new_bmsr & 0x0004) ? "previously broken, but now re" : "not "); + if (verbose) { + printf(" This transceiver is capable of "); + if (bmsr & 0xF800) { + for (i = 15; i >= 11; i--) + if (bmsr & (1<<i)) + printf(" %s", media_names[i-11]); + } else + printf("<Warning! No media capabilities>"); + printf(".\n"); + printf(" %s to perform Auto-negotiation, negotiation %scomplete.\n", + bmsr & 0x0008 ? "Able" : "Unable", + bmsr & 0x0020 ? "" : "not "); + } + + if (bmsr & 0x0010) + printf(" Remote fault detected!\n"); + if (bmsr & 0x0002) + printf(" *** Link Jabber! ***\n"); + + if (lkpar & 0x4000) { + printf(" Your link partner advertised %4.4x:", + lkpar); + for (i = 5; i >= 0; i--) + if (lkpar & (0x20<<i)) + printf(" %s", media_names[i]); + printf("%s.\n", lkpar & 0x0400 ? ", w/ 802.3X flow control" : ""); + } else if (lkpar & 0x00A0) + printf(" Your link partner is generating %s link beat (no" + " autonegotiation).\n", + lkpar & 0x0080 ? "100baseTx" : "10baseT"); + else if ( ! (bmcr & 0x1000)) + printf(" Link partner information is not exchanged when in" + " fixed speed mode.\n"); + else if ( ! (new_bmsr & 0x004)) + ; /* If no partner, do not report status. */ + else if (lkpar == 0x0001 || lkpar == 0x0000) { + printf(" Your link partner does not do autonegotiation, and this " + "transceiver type\n does not report the sensed link " + "speed.\n"); + } else + printf(" Your link partner is strange, status %4.4x.\n", lkpar); + + printf(" End of basic transceiver information.\n\n"); + return 0; +} + +static void monitor_status(long ioaddr, int phy_id) +{ + unsigned int baseline_1 = 0x55555555; /* Always show initial status. */ + + while (1) { + unsigned int new_1 = mdio_read(ioaddr, phy_id, 1); + if (new_1 != baseline_1) { + printf("%-12s 0x%4.4x 0x%4.4x\n", + new_1 & 0x04 ? (new_1==0xffff ? "unknown" : "up") : + new_1 & 0x20 ? "negotiating" : "down", + new_1, mdio_read(ioaddr, phy_id, 5)); + fflush(stdout); + baseline_1 = new_1; + } + sleep(1); + } +} + +int show_mii_details(long ioaddr, int phy_id) +{ + int mii_reg, mii_val; + printf(" MII PHY #%d transceiver registers:", phy_id); + for (mii_reg = 0; mii_reg < 32; mii_reg++) { + mii_val = mdio_read(skfd, phy_id, mii_reg); + printf("%s %4.4x", (mii_reg % 8) == 0 ? "\n " : "", + mii_val); + } + printf("\nThis version of 'mii-diag' has not been linked with " + "the libmii.c library.\n" + " That library provides extended transceiver status reports.\n"); + return 0; +} + +void monitor_mii(long ioaddr, int phy_id) +{ + fprintf(stderr, "\nThis version of 'mii-diag' has not been linked with " + "the libmii.c library \n" + " required for the media monitor option.\n"); +} + + + +/* + * Local variables: + * version-control: t + * kept-new-versions: 5 + * c-indent-level: 4 + * c-basic-offset: 4 + * tab-width: 4 + * compile-command: "gcc -Wall -Wstrict-prototypes -O mii-diag.c -DLIBMII libmii.c -o mii-diag" + * simple-compile-command: "gcc mii-diag.c -o mii-diag" + * End: + */ diff --git a/pkgs/core/net-tools/net-tools.nm b/pkgs/core/net-tools/net-tools.nm new file mode 100644 index 0000000..0b915a7 --- /dev/null +++ b/pkgs/core/net-tools/net-tools.nm @@ -0,0 +1,166 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007, 2008 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see http://www.gnu.org/licenses/. # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include $(PKGROOT)/Include + +PKG_NAME = net-tools +PKG_VER = 1.60 +PKG_REL = 0 + +PKG_MAINTAINER = +PKG_GROUP = Sytem/Base +PKG_URL = http://net-tools.berlios.de/ +PKG_LICENSE = GPL+ +PKG_SUMMARY = Basic networking tools. + +PKG_BUILD_DEPS+= gettext + +define PKG_DESCRIPTION + The net-tools package contains basic networking tools, \ + including ifconfig, netstat, route, and others. +endef + +PKG_TARBALL = $(THISAPP).tar.bz2 + +# Manual list patches because they need to be applied in speical order +PKG_PATCHES = net-tools-1.57-bug22040.patch +PKG_PATCHES += $(THISAPP)-miiioctl.patch +PKG_PATCHES += $(THISAPP)-virtualname.patch +PKG_PATCHES += $(THISAPP)-cycle.patch +PKG_PATCHES += $(THISAPP)-nameif.patch +PKG_PATCHES += $(THISAPP)-ipx.patch +PKG_PATCHES += $(THISAPP)-inet6-lookup.patch +PKG_PATCHES += $(THISAPP)-man.patch +PKG_PATCHES += $(THISAPP)-gcc33.patch +PKG_PATCHES += $(THISAPP)-trailingblank.patch +PKG_PATCHES += $(THISAPP)-interface.patch +PKG_PATCHES += $(THISAPP)-gcc34.patch +PKG_PATCHES += $(THISAPP)-overflow.patch +PKG_PATCHES += $(THISAPP)-siunits.patch +PKG_PATCHES += $(THISAPP)-trunc.patch +PKG_PATCHES += $(THISAPP)-return.patch +PKG_PATCHES += $(THISAPP)-parse.patch +PKG_PATCHES += $(THISAPP)-netmask.patch +PKG_PATCHES += $(THISAPP)-ulong.patch +PKG_PATCHES += $(THISAPP)-bcast.patch +PKG_PATCHES += $(THISAPP)-mii-tool-obsolete.patch +PKG_PATCHES += $(THISAPP)-netstat_ulong.patch +PKG_PATCHES += $(THISAPP)-note.patch +PKG_PATCHES += $(THISAPP)-num-ports.patch +PKG_PATCHES += $(THISAPP)-duplicate-tcp.patch +PKG_PATCHES += $(THISAPP)-statalias.patch +PKG_PATCHES += $(THISAPP)-isofix.patch +PKG_PATCHES += $(THISAPP)-ifconfig_ib.patch +PKG_PATCHES += $(THISAPP)-de.patch +PKG_PATCHES += $(THISAPP)-pie.patch +PKG_PATCHES += $(THISAPP)-ifaceopt.patch +PKG_PATCHES += $(THISAPP)-trim_iface.patch +PKG_PATCHES += $(THISAPP)-stdo.patch +PKG_PATCHES += $(THISAPP)-statistics.patch +PKG_PATCHES += $(THISAPP)-ifconfig.patch +PKG_PATCHES += $(THISAPP)-arp_overflow.patch +PKG_PATCHES += $(THISAPP)-hostname_man.patch +PKG_PATCHES += $(THISAPP)-interface_stack.patch +PKG_PATCHES += $(THISAPP)-selinux.patch +PKG_PATCHES += $(THISAPP)-netstat_stop_trim.patch +PKG_PATCHES += $(THISAPP)-netstat_inode.patch +PKG_PATCHES += $(THISAPP)-fgets.patch +PKG_PATCHES += $(THISAPP)-ifconfig_man.patch +PKG_PATCHES += $(THISAPP)-x25-proc.patch +PKG_PATCHES += $(THISAPP)-sctp.patch +PKG_PATCHES += $(THISAPP)-arp_man.patch +PKG_PATCHES += $(THISAPP)-ifconfig-long-iface-crasher.patch +PKG_PATCHES += $(THISAPP)-netdevice.patch +PKG_PATCHES += $(THISAPP)-skip.patch +PKG_PATCHES += $(THISAPP)-netstat-I-fix.patch +PKG_PATCHES += $(THISAPP)-nameif_strncpy.patch +PKG_PATCHES += $(THISAPP)-arp-unaligned-access.patch +PKG_PATCHES += $(THISAPP)-sctp-quiet.patch +PKG_PATCHES += $(THISAPP)-remove_node.patch +PKG_PATCHES += $(THISAPP)-netstat-interfaces-crash.patch +PKG_PATCHES += $(THISAPP)-ec_hw_null.patch +PKG_PATCHES += $(THISAPP)-statistics_buffer.patch +PKG_PATCHES += $(THISAPP)-sctp-addrs.patch +PKG_PATCHES += $(THISAPP)-i-option.patch +PKG_PATCHES += $(THISAPP)-a-option.patch +PKG_PATCHES += $(THISAPP)-clear-flag.patch +PKG_PATCHES += $(THISAPP)-metric-tunnel-man.patch +PKG_PATCHES += $(THISAPP)-netstat-probe.patch +PKG_PATCHES += $(THISAPP)-scanf-format.patch +PKG_PATCHES += $(THISAPP)-avoid-name-resolution.patch +PKG_PATCHES += $(THISAPP)-continous-flush-stdout.patch +PKG_PATCHES += $(THISAPP)-debug-fix.patch +PKG_PATCHES += $(THISAPP)-ib-warning.patch +PKG_PATCHES += $(THISAPP)-man-obsolete.patch +PKG_PATCHES += $(THISAPP)-man-RHEL-bugs.patch +PKG_PATCHES += $(THISAPP)-masqinfo-raw-ip.patch +PKG_PATCHES += $(THISAPP)-makefile-berlios.patch +PKG_PATCHES += $(THISAPP)-slattach-fchown.patch +PKG_PATCHES += $(THISAPP)-hostname-short.patch +PKG_PATCHES += $(THISAPP)-mii-refactor.patch +PKG_PATCHES += $(THISAPP)-IA64.patch +PKG_PATCHES += $(THISAPP)-large-indexes.patch +PKG_PATCHES += $(THISAPP)-statistics-doubleword.patch +PKG_PATCHES += $(THISAPP)-mii-gigabit.patch +PKG_PATCHES += $(THISAPP)-netstat-leak.patch + +define STAGE_PREPARE_CMDS + # Copy config files + cp $(DIR_SOURCE)/config.h $(DIR_APP) + cp $(DIR_SOURCE)/config.make $(DIR_APP) + + # Copy additional man pages + cp $(DIR_SOURCE)/*.8 $(DIR_APP)/man/en_US + + # Copy source for ether-wake and mii-diag + cp $(DIR_SOURCE)/ether-wake.c $(DIR_APP) + cp $(DIR_SOURCE)/mii-diag.c $(DIR_APP) +endef + +define STAGE_BUILD + cd $(DIR_APP) && make $(PARELLISMFLAGS) CC=gcc + + # Compile ether-wake + cd $(DIR_APP) && gcc $(CFLAGS) -o ether-wake ether-wake.c + + # Compile mii-diag + cd $(DIR_APP) && gcc $(CFLAGS) -o mii-diag mii-diag.c +endef + +define STAGE_INSTALL + cd $(DIR_APP) && mv man/de_DE man/de + cd $(DIR_APP) && mv man/fr_FR man/fr + cd $(DIR_APP) && mv man/pt_BR man/pt + + cd $(DIR_APP) && make BASEDIR=$(BUILDROOT) mandir=/usr/share/man install + + # Install ether-wake and mii-diag + install -m 755 $(DIR_APP)/ether-wake $(BUILDROOT)/sbin + install -m 755 $(DIR_APP)/mii-diag $(BUILDROOT)/sbin + + # Remove tools we do not want + rm -rvf \ + $(BUILDROOT)/sbin/{arp,ifconfig,ip,nameif,plipconfig,rarp,route,slattach}* \ + $(BUILDROOT)/usr/share/man/{,*}/man*/{arp,ifconfig,ip,nameif,plipconfig,rarp,route,slattach}* +endef diff --git a/pkgs/core/net-tools/patches/net-tools-1.57-bug22040.patch b/pkgs/core/net-tools/patches/net-tools-1.57-bug22040.patch new file mode 100644 index 0000000..76f04d5 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.57-bug22040.patch @@ -0,0 +1,50 @@ +--- net-tools-1.57/arp.c.orig Sun May 14 17:57:41 2000 ++++ net-tools-1.57/arp.c Sat Nov 25 15:05:27 2000 +@@ -618,6 +618,7 @@ + fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -Ds <hostname> <if> [netmask <nm>] pub <-''-\n\n")); + + fprintf(stderr, _(" -a display (all) hosts in alternative (BSD) style\n")); ++ fprintf(stderr, _(" -e display (all) hosts in default (Linux) style\n")); + fprintf(stderr, _(" -s, --set set a new ARP entry\n")); + fprintf(stderr, _(" -d, --delete delete a specified entry\n")); + fprintf(stderr, _(" -v, --verbose be verbose\n")); +--- net-tools-1.57/man/en_US/arp.8.orig Sat Nov 25 15:13:26 2000 ++++ net-tools-1.57/man/en_US/arp.8 Sat Nov 25 15:15:12 2000 +@@ -3,7 +3,7 @@ + arp - manipulate the system ARP cache + .SH SYNOPSIS + .B arp +-.RB [ -vn ] ++.RB [ -evn ] + .RB [ "-H type" ] + .RB [ "-i if" ] + .B -a +@@ -60,7 +60,7 @@ + shows numerical addresses instead of trying to determine symbolic host, port + or user names. + .TP +-.B "-H type, --hw-type type" ++.B "-H type, --hw-type type, -t type" + When setting or reading the ARP cache, this optional parameter tells + .B arp + which class of entries it should check for. The default value of +@@ -81,7 +81,8 @@ + .B hostname + parameter is not used, + .B all +-entries will be displayed. ++entries will be displayed. ++The entries will be displayed in alternate (BSD) style. + .TP + .B "-d hostname, --delete hostname" + Remove any entry for the specified host. This can be used if the +@@ -91,6 +92,9 @@ + Use the interface + .BR ifa "'s" + hardware address. ++.TP ++.B "-e" ++Shows the entries in default (Linux) style. + .TP + .B "-i If, --device If" + Select an interface. When dumping the ARP cache only entries matching diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-IA64.patch b/pkgs/core/net-tools/patches/net-tools-1.60-IA64.patch new file mode 100644 index 0000000..0e59c3f --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-IA64.patch @@ -0,0 +1,33 @@ +diff -up net-tools-1.60/ifconfig.c.IA64 net-tools-1.60/ifconfig.c +--- net-tools-1.60/ifconfig.c.IA64 2010-01-02 11:35:39.000000000 +0100 ++++ net-tools-1.60/ifconfig.c 2010-01-02 11:35:39.000000000 +0100 +@@ -894,7 +894,8 @@ int main(int argc, char **argv) + continue; + } + +- memcpy(&ip, &sin.sin_addr.s_addr, sizeof(unsigned long)); ++ memset(&ip, 0, sizeof(unsigned long)); ++ memcpy(&ip, &sin.sin_addr.s_addr, sizeof(sin.sin_addr.s_addr)); + + if (get_nmbc_parent(ifr.ifr_name, &nm, &bc) < 0) { + fprintf(stderr, _("Interface %s not initialized\n"), +diff -up net-tools-1.60/lib/interface.c.IA64 net-tools-1.60/lib/interface.c +--- net-tools-1.60/lib/interface.c.IA64 2010-01-02 11:35:39.000000000 +0100 ++++ net-tools-1.60/lib/interface.c 2010-01-02 12:03:05.000000000 +0100 +@@ -491,14 +491,14 @@ int if_fetch(struct interface *ife) + if (ioctl(skfd, SIOCGOUTFILL, &ifr) < 0) + ife->outfill = 0; + else +- ife->outfill = (unsigned int) ifr.ifr_data; ++ ife->outfill = (unsigned long) ifr.ifr_data; + #endif + #ifdef SIOCGKEEPALIVE + strcpy(ifr.ifr_name, ifname); + if (ioctl(skfd, SIOCGKEEPALIVE, &ifr) < 0) + ife->keepalive = 0; + else +- ife->keepalive = (unsigned int) ifr.ifr_data; ++ ife->keepalive = (unsigned long) ifr.ifr_data; + #endif + } + #endif diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-a-option.patch b/pkgs/core/net-tools/patches/net-tools-1.60-a-option.patch new file mode 100644 index 0000000..b17db8d --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-a-option.patch @@ -0,0 +1,44 @@ +--- net-tools-1.60/man/de_DE/arp.8.a-option 2008-07-08 16:35:08.000000000 +0200 ++++ net-tools-1.60/man/de_DE/arp.8 2008-07-08 16:35:35.000000000 +0200 +@@ -77,7 +77,7 @@ Andere m(:ogliche Werte sind Netzwerkst + and + .RB "NET/ROM (" netrom ")." + .TP +-.B "-a [Rechnername], --display [Rechnername]" ++.B "-a [Rechnername], --all [Rechnername]" + Zeigt die Eintr(:age der angegebenen Rechner an. Wird kein + .B hostname + Argument verwendet, so werden alle Eintr(:age aufgelistet. +--- net-tools-1.60/man/en_US/arp.8.a-option 2008-07-08 16:35:41.000000000 +0200 ++++ net-tools-1.60/man/en_US/arp.8 2008-07-08 16:35:48.000000000 +0200 +@@ -76,7 +76,7 @@ Other values might include network techn + and + .RB "NET/ROM (" netrom ")." + .TP +-.B "-a [hostname], --display [hostname]" ++.B "-a [hostname], --all [hostname]" + Shows the entries of the specified hosts. If the + .B hostname + parameter is not used, +--- net-tools-1.60/man/fr_FR/arp.8.a-option 2008-07-08 16:35:53.000000000 +0200 ++++ net-tools-1.60/man/fr_FR/arp.8 2008-07-08 16:36:03.000000000 +0200 +@@ -81,7 +81,7 @@ D'autres valeurs doivent correspondre à + and + .RB "NET/ROM (" netrom ")." + .TP +-.B "-a [nom_d_hôte], --display [nom_d_hôte]" ++.B "-a [nom_d_hôte], --all [nom_d_hôte]" + Affiche les entrées concernant l'hôte spécifié. Si le paramètre + .B nom_d_hôte + n'est pas utilisé, +--- net-tools-1.60/man/pt_BR/arp.8.a-option 2008-07-08 16:38:13.000000000 +0200 ++++ net-tools-1.60/man/pt_BR/arp.8 2008-07-08 16:38:20.000000000 +0200 +@@ -77,7 +77,7 @@ Outros valores podem incluir tecnologias + e + .RB "NET/ROM (" netrom ")." + .TP +-.B "-a [máquina], --display [máquina]" ++.B "-a [máquina], --all [máquina]" + Mostra as entradas das máquinas especificadas. Se o parâmetro + .B máquina + não for usado, diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-arp-unaligned-access.patch b/pkgs/core/net-tools/patches/net-tools-1.60-arp-unaligned-access.patch new file mode 100644 index 0000000..ed0c99a --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-arp-unaligned-access.patch @@ -0,0 +1,116 @@ +--- net-tools-1.60/arp.c 2001-04-08 10:05:05.000000000 -0700 ++++ net-tools-1.60.new/arp.c 2006-01-31 13:10:01.479716750 -0800 +@@ -100,7 +100,7 @@ static int arp_del(char **args) + { + char host[128]; + struct arpreq req; +- struct sockaddr sa; ++ struct sockaddr_storage ss; + int flags = 0; + int err; + +@@ -112,12 +112,12 @@ static int arp_del(char **args) + return (-1); + } + safe_strncpy(host, *args, (sizeof host)); +- if (ap->input(0, host, &sa) < 0) { ++ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) { + ap->herror(host); + return (-1); + } + /* If a host has more than one address, use the correct one! */ +- memcpy((char *) &req.arp_pa, (char *) &sa, sizeof(struct sockaddr)); ++ memcpy((char *) &req.arp_pa, (char *) &ss, sizeof(struct sockaddr)); + + if (hw_set) + req.arp_ha.sa_family = hw->type; +@@ -177,11 +177,11 @@ static int arp_del(char **args) + usage(); + if (strcmp(*args, "255.255.255.255") != 0) { + strcpy(host, *args); +- if (ap->input(0, host, &sa) < 0) { ++ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) { + ap->herror(host); + return (-1); + } +- memcpy((char *) &req.arp_netmask, (char *) &sa, ++ memcpy((char *) &req.arp_netmask, (char *) &ss, + sizeof(struct sockaddr)); + req.arp_flags |= ATF_NETMASK; + } +@@ -260,7 +260,7 @@ static int arp_set(char **args) + { + char host[128]; + struct arpreq req; +- struct sockaddr sa; ++ struct sockaddr_storage ss; + int flags; + + memset((char *) &req, 0, sizeof(req)); +@@ -271,12 +271,12 @@ static int arp_set(char **args) + return (-1); + } + safe_strncpy(host, *args++, (sizeof host)); +- if (ap->input(0, host, &sa) < 0) { ++ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) { + ap->herror(host); + return (-1); + } + /* If a host has more than one address, use the correct one! */ +- memcpy((char *) &req.arp_pa, (char *) &sa, sizeof(struct sockaddr)); ++ memcpy((char *) &req.arp_pa, (char *) &ss, sizeof(struct sockaddr)); + + /* Fetch the hardware address. */ + if (*args == NULL) { +@@ -346,11 +346,11 @@ static int arp_set(char **args) + usage(); + if (strcmp(*args, "255.255.255.255") != 0) { + strcpy(host, *args); +- if (ap->input(0, host, &sa) < 0) { ++ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) { + ap->herror(host); + return (-1); + } +- memcpy((char *) &req.arp_netmask, (char *) &sa, ++ memcpy((char *) &req.arp_netmask, (char *) &ss, + sizeof(struct sockaddr)); + flags |= ATF_NETMASK; + } +@@ -519,7 +519,7 @@ static void arp_disp(char *name, char *i + static int arp_show(char *name) + { + char host[100]; +- struct sockaddr sa; ++ struct sockaddr_storage ss; + char ip[100]; + char hwa[100]; + char mask[100]; +@@ -535,11 +535,11 @@ static int arp_show(char *name) + if (name != NULL) { + /* Resolve the host name. */ + safe_strncpy(host, name, (sizeof host)); +- if (ap->input(0, host, &sa) < 0) { ++ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) { + ap->herror(host); + return (-1); + } +- safe_strncpy(host, ap->sprint(&sa, 1), sizeof(host)); ++ safe_strncpy(host, ap->sprint((struct sockaddr*)&ss, 1), sizeof(host)); + } + /* Open the PROCps kernel table. */ + if ((fp = fopen(_PATH_PROCNET_ARP, "r")) == NULL) { +@@ -575,10 +575,11 @@ static int arp_show(char *name) + if (opt_n) + hostname = "?"; + else { +- if (ap->input(0, ip, &sa) < 0) ++ if (ap->input(0, ip, (struct sockaddr*)&ss) < 0) + hostname = ip; + else +- hostname = ap->sprint(&sa, opt_n | 0x8000); ++ hostname = ap->sprint((struct sockaddr*)&ss, ++ opt_n | 0x8000); + if (strcmp(hostname, ip) == 0) + hostname = "?"; + } + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-arp_man.patch b/pkgs/core/net-tools/patches/net-tools-1.60-arp_man.patch new file mode 100644 index 0000000..7175ddc --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-arp_man.patch @@ -0,0 +1,13 @@ +--- net-tools-1.60/man/en_US/arp.8.old 2006-05-02 14:38:10.000000000 +0200 ++++ net-tools-1.60/man/en_US/arp.8 2006-05-02 14:44:23.000000000 +0200 +@@ -150,8 +150,8 @@ + is used as default. + .sp 1 + The format of the file is simple; it +-only contains ASCII text lines with a hostname, and a hardware +-address separated by whitespace. Additionally the ++only contains ASCII text lines with a hardware ++address and a hostname separated by whitespace. Additionally the + .BR "pub" , " temp" " and" " netmask" + flags can be used. + .LP diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-arp_overflow.patch b/pkgs/core/net-tools/patches/net-tools-1.60-arp_overflow.patch new file mode 100644 index 0000000..4679a51 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-arp_overflow.patch @@ -0,0 +1,11 @@ +--- net-tools-1.60/arp.c.old 2005-08-03 08:23:46.000000000 +0200 ++++ net-tools-1.60/arp.c 2005-08-03 11:02:10.000000000 +0200 +@@ -235,7 +235,7 @@ + struct ifreq ifr; + struct hwtype *xhw; + +- strcpy(ifr.ifr_name, ifname); ++ strncpy(ifr.ifr_name, ifname, IFNAMSIZ); + if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) < 0) { + fprintf(stderr, _("arp: cant get HW-Address for `%s': %s.\n"), ifname, strerror(errno)); + return (-1); diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-avoid-name-resolution.patch b/pkgs/core/net-tools/patches/net-tools-1.60-avoid-name-resolution.patch new file mode 100644 index 0000000..365fcd2 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-avoid-name-resolution.patch @@ -0,0 +1,31 @@ +diff -up net-tools-1.60/netstat.c.avoid-name-resolution net-tools-1.60/netstat.c +--- net-tools-1.60/netstat.c.avoid-name-resolution 2009-08-28 10:48:40.000000000 +0200 ++++ net-tools-1.60/netstat.c 2009-08-14 12:36:56.000000000 +0200 +@@ -961,6 +961,10 @@ static void tcp_do_one(int lnr, const ch + &d, local_addr, &local_port, rem_addr, &rem_port, &state, + &txq, &rxq, &timer_run, &time_len, &retr, &uid, &timeout, &inode, more); + ++ if (!flag_all && ++ ((flag_lst && rem_port) || (!flag_lst && !rem_port))) ++ return; ++ + if (strlen(local_addr) > 8) { + #if HAVE_AFINET6 + /* Demangle what the kernel gives us */ +@@ -1014,7 +1018,7 @@ static void tcp_do_one(int lnr, const ch + flag_not & FLAG_NUM_HOST), sizeof(local_addr)); + safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, flag_not & FLAG_NUM_HOST), + sizeof(rem_addr)); +- if (flag_all || (flag_lst && !rem_port) || (!flag_lst && rem_port)) { ++ + snprintf(buffer, sizeof(buffer), "%s", + get_sname(htons(local_port), "tcp", + flag_not & FLAG_NUM_PORT)); +@@ -1075,7 +1079,6 @@ static void tcp_do_one(int lnr, const ch + rxq, txq, local_addr, rem_addr, _(tcp_state[state])); + + finish_this_one(uid,inode,timers); +- } + } + + static int tcp_info(void) diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-bcast.patch b/pkgs/core/net-tools/patches/net-tools-1.60-bcast.patch new file mode 100644 index 0000000..9489e26 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-bcast.patch @@ -0,0 +1,99 @@ +--- net-tools-1.60/ifconfig.c.broadcast 2004-11-03 12:05:30.000000000 +0100 ++++ net-tools-1.60/ifconfig.c 2004-11-04 15:39:32.817077232 +0100 +@@ -36,6 +36,7 @@ + #include <sys/ioctl.h> + #include <netinet/in.h> + #include <net/if.h> ++#include <netinet/ip.h> + #include <net/if_arp.h> + #include <stdio.h> + #include <errno.h> +@@ -138,6 +139,7 @@ + perror("SIOCSIFFLAGS"); + return -1; + } ++ + return (0); + } + +@@ -212,17 +214,41 @@ + exit(0); + } + +-static int set_netmask(int skfd, struct ifreq *ifr, struct sockaddr *sa) ++static int set_netmask(int skfd, struct ifreq *ifr, struct sockaddr *sa, int new_bcast) + { + int err = 0; +- +- memcpy((char *) &ifr->ifr_netmask, (char *) sa, +- sizeof(struct sockaddr)); ++ struct sockaddr_in * ip_addr, * netmask, *bcast; ++ struct ifreq ifraddr; ++ struct ifreq ifrbcast; ++ ++ memcpy((char *) &ifr->ifr_netmask, (char *) sa, ++ sizeof(struct sockaddr)); + if (ioctl(skfd, SIOCSIFNETMASK, ifr) < 0) { + fprintf(stderr, "SIOCSIFNETMASK: %s\n", + strerror(errno)); + err = 1; + } ++ ++ if (new_bcast) { ++ memcpy(&ifraddr,ifr,sizeof(struct ifreq)); ++ memcpy(&ifrbcast,ifr,sizeof(struct ifreq)); ++ ++ if (ioctl(skfd, SIOCGIFADDR, &ifraddr) < 0) { ++ fprintf(stderr, "SIOCGIFADDR: %s\n", strerror(errno)); ++ err = 1; ++ } ++ ++ ip_addr = (struct sockaddr_in *)&ifraddr.ifr_addr; ++ netmask = (struct sockaddr_in *)&ifr->ifr_netmask; ++ bcast = (struct sockaddr_in *)&ifrbcast.ifr_broadaddr; ++ /* calculate new broadcast adress */ ++ bcast->sin_addr.s_addr = ip_addr->sin_addr.s_addr | ~netmask->sin_addr.s_addr; ++ /* set new broadcast adress */ ++ if (ioctl(skfd, SIOCSIFBRDADDR, &ifrbcast) < 0) { ++ fprintf(stderr, "SIOCSIFBROADCAST: %s\n", strerror(errno)); ++ err = 1; ++ } ++ } + return 0; + } + +@@ -234,7 +260,7 @@ + struct aftype *ap; + struct hwtype *hw; + struct ifreq ifr; +- int goterr = 0, didnetmask = 0, donetmask = 0; ++ int goterr = 0, didnetmask = 0, donetmask = 0, dobcast = 1; + char **spp; + int fd; + #if HAVE_AFINET6 +@@ -506,6 +532,7 @@ + strerror(errno)); + goterr = 1; + } ++ dobcast = 0; + spp++; + } + goterr |= set_flag(ifr.ifr_name, IFF_BROADCAST); +@@ -542,7 +569,7 @@ + continue; + } + didnetmask++; +- goterr = set_netmask(ap->fd, &ifr, &sa); ++ goterr = set_netmask(ap->fd, &ifr, &sa, dobcast); + spp++; + continue; + } +@@ -964,7 +991,7 @@ + /* set CIDR netmask */ + if (donetmask) { + donetmask = 0; +- goterr = set_netmask(skfd, &ifr, &sa_netmask); ++ goterr = set_netmask(skfd, &ifr, &sa_netmask, dobcast); + didnetmask++; + } + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-clear-flag.patch b/pkgs/core/net-tools/patches/net-tools-1.60-clear-flag.patch new file mode 100644 index 0000000..b8f3c59 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-clear-flag.patch @@ -0,0 +1,38 @@ +--- net-tools-1.60/ifconfig.c.clear-flag 2008-07-08 11:21:33.000000000 +0200 ++++ net-tools-1.60/ifconfig.c 2008-07-08 11:22:55.000000000 +0200 +@@ -465,7 +465,7 @@ int main(int argc, char **argv) + } + if (!strcmp(*spp, "-allmulti")) { + goterr |= clr_flag(ifr.ifr_name, IFF_ALLMULTI); +- if (test_flag(ifr.ifr_name, IFF_MULTICAST) > 0) ++ if (test_flag(ifr.ifr_name, IFF_ALLMULTI) > 0) + fprintf(stderr, _("Warning: Interface %s still in ALLMULTI mode.\n"), ifr.ifr_name); + spp++; + continue; +@@ -488,7 +488,7 @@ int main(int argc, char **argv) + } + if (!strcmp(*spp, "-dynamic")) { + goterr |= clr_flag(ifr.ifr_name, IFF_DYNAMIC); +- if (test_flag(ifr.ifr_name, IFF_MULTICAST) > 0) ++ if (test_flag(ifr.ifr_name, IFF_DYNAMIC) > 0) + fprintf(stderr, _("Warning: Interface %s still in DYNAMIC mode.\n"), ifr.ifr_name); + spp++; + continue; +@@ -547,7 +547,7 @@ int main(int argc, char **argv) + + if (!strcmp(*spp, "-broadcast")) { + goterr |= clr_flag(ifr.ifr_name, IFF_BROADCAST); +- if (test_flag(ifr.ifr_name, IFF_MULTICAST) > 0) ++ if (test_flag(ifr.ifr_name, IFF_BROADCAST) > 0) + fprintf(stderr, _("Warning: Interface %s still in BROADCAST mode.\n"), ifr.ifr_name); + spp++; + continue; +@@ -676,7 +676,7 @@ int main(int argc, char **argv) + } + if (!strcmp(*spp, "-pointopoint")) { + goterr |= clr_flag(ifr.ifr_name, IFF_POINTOPOINT); +- if (test_flag(ifr.ifr_name, IFF_MULTICAST) > 0) ++ if (test_flag(ifr.ifr_name, IFF_POINTOPOINT) > 0) + fprintf(stderr, _("Warning: Interface %s still in POINTOPOINT mode.\n"), ifr.ifr_name); + spp++; + continue; diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-continous-flush-stdout.patch b/pkgs/core/net-tools/patches/net-tools-1.60-continous-flush-stdout.patch new file mode 100644 index 0000000..57e9d66 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-continous-flush-stdout.patch @@ -0,0 +1,61 @@ +diff -up net-tools-1.60/netstat.c.continous-flush-stdout net-tools-1.60/netstat.c +--- net-tools-1.60/netstat.c.continous-flush-stdout 2009-08-28 10:57:12.000000000 +0200 ++++ net-tools-1.60/netstat.c 2009-08-28 10:58:48.000000000 +0200 +@@ -357,6 +357,12 @@ static void prg_cache_clear(void) + prg_cache_loaded=0; + } + ++static void wait_continous(const int reptimer) ++{ ++ fflush(stdout); ++ sleep(reptimer); ++} ++ + static void extract_type_1_socket_inode(const char lname[], unsigned long * inode_p, int * status) { + + /* If lname is of the form "socket:[12345]", extract the "12345" +@@ -2289,7 +2295,7 @@ int main + flag_not & FLAG_NUM_PORT, flag_exp); + if (i || !flag_cnt) + break; +- sleep(reptimer); ++ wait_continous(reptimer); + } + #else + ENOSUPP("netstat.c", "FW_MASQUERADE"); +@@ -2305,7 +2311,7 @@ int main + + if(i || !flag_cnt) + break; +- sleep(reptimer); ++ wait_continous(reptimer); + } + return(i); + } +@@ -2329,7 +2335,7 @@ int main + i = route_info(afname, options); + if (i || !flag_cnt) + break; +- sleep(reptimer); ++ wait_continous(reptimer); + } + return (i); + } +@@ -2338,7 +2344,7 @@ int main + i = iface_info(); + if (!flag_cnt || i) + break; +- sleep(reptimer); ++ wait_continous(reptimer); + } + return (i); + } +@@ -2470,7 +2476,7 @@ int main + } + if (!flag_cnt || i) + break; +- sleep(reptimer); ++ wait_continous(reptimer); + prg_cache_clear(); + tcp_node_hash_clear(); + } diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-cycle.patch b/pkgs/core/net-tools/patches/net-tools-1.60-cycle.patch new file mode 100644 index 0000000..ce659ec --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-cycle.patch @@ -0,0 +1,311 @@ +--- net-tools-1.60/lib/interface.c.cycle 2003-02-11 14:29:29.000000000 +0100 ++++ net-tools-1.60/lib/interface.c 2003-02-11 14:29:29.000000000 +0100 +@@ -90,6 +90,7 @@ + static struct interface *int_list, *int_last; + + static int if_readlist_proc(char *); ++static int if_readlist_rep(char *, struct interface *); + + static struct interface *add_interface(char *name) + { +@@ -128,11 +129,13 @@ + int for_all_interfaces(int (*doit) (struct interface *, void *), void *cookie) + { + struct interface *ife; ++ int err; + + if (!int_list && (if_readlist() < 0)) + return -1; + for (ife = int_list; ife; ife = ife->next) { +- int err = doit(ife, cookie); ++ if_readlist_rep(ife->name, ife); ++ err = doit(ife, cookie); + if (err) + return err; + } +@@ -369,6 +372,42 @@ + return err; + } + ++ ++static int if_readlist_rep(char *target, struct interface *ife) ++{ ++ FILE *fh; ++ char buf[512]; ++ int err; ++ ++ fh = fopen(_PATH_PROCNET_DEV, "r"); ++ if (!fh) { ++ fprintf(stderr, _("Warning: cannot open %s (%s). Limited output.\n"), ++ _PATH_PROCNET_DEV, strerror(errno)); ++ return if_readconf(); ++ } ++ fgets(buf, sizeof buf, fh); /* eat line */ ++ fgets(buf, sizeof buf, fh); ++ ++ procnetdev_vsn = procnetdev_version(buf); ++ ++ err = 0; ++ while (fgets(buf, sizeof buf, fh)) { ++ char *s, name[IFNAMSIZ]; ++ s = get_name(name, buf); ++ get_dev_fields(s, ife); ++ ife->statistics_valid = 1; ++ if (target && !strcmp(target,name)) ++ break; ++ } ++ if (ferror(fh)) { ++ perror(_PATH_PROCNET_DEV); ++ err = -1; ++ } ++ ++ fclose(fh); ++ return err; ++} ++ + int if_readlist(void) + { + int err = if_readlist_proc(NULL); +--- net-tools-1.60/man/en_US/netstat.8.cycle 2001-01-07 13:43:57.000000000 +0100 ++++ net-tools-1.60/man/en_US/netstat.8 2003-02-11 14:29:29.000000000 +0100 +@@ -30,6 +30,7 @@ + .RB [ --program | -p ] + .RB [ --verbose | -v ] + .RB [ --continuous | -c] ++.RB [delay] + .P + .B netstat + .RB { --route | -r } +@@ -39,6 +40,7 @@ + .RB [ --numeric | -n ] + .RB [ --numeric-hosts ] [ --numeric-ports ] [ --numeric-ports ] + .RB [ --continuous | -c] ++.RB [delay] + .P + .B netstat + .RB { --interfaces | -i } +@@ -50,12 +52,14 @@ + .RB [ --numeric | -n ] + .RB [ --numeric-hosts ] [ --numeric-ports ] [ --numeric-ports ] + .RB [ --continuous | -c] ++.RB [delay] + .P + .B netstat + .RB { --groups | -g } + .RB [ --numeric | -n ] + .RB [ --numeric-hosts ] [ --numeric-ports ] [ --numeric-ports ] + .RB [ --continuous | -c] ++.RB [delay] + .P + .B netstat + .RB { --masquerade | -M } +@@ -63,12 +67,14 @@ + .RB [ --numeric | -n ] + .RB [ --numeric-hosts ] [ --numeric-ports ] [ --numeric-ports ] + .RB [ --continuous | -c] ++.RB [delay] + .P + .B netstat + .RB { --statistics | -s } + .RB [ --tcp | -t ] + .RB [ --udp | -u ] + .RB [ --raw | -w ] ++.RB [delay] + .P + .B netstat + .RB { --version | -V } +@@ -170,6 +176,10 @@ + Print routing information from the FIB. (This is the default.) + .SS "-C" + Print routing information from the route cache. ++.SS delay ++Netstat will cycle printing through statistics every ++.B delay ++seconds. + .IR UP . + .P + .SH OUTPUT +--- net-tools-1.60/netstat.c.cycle 2003-02-11 14:29:29.000000000 +0100 ++++ net-tools-1.60/netstat.c 2003-02-11 15:07:26.000000000 +0100 +@@ -102,7 +102,7 @@ + #endif + + /* prototypes for statistics.c */ +-void parsesnmp(int, int, int); ++int parsesnmp(int, int, int); + void inittab(void); + + typedef enum { +@@ -1440,6 +1440,8 @@ + + static int iface_info(void) + { ++ static int count=0; ++ + if (skfd < 0) { + if ((skfd = sockets_open(0)) < 0) { + perror("socket"); +@@ -1449,20 +1451,21 @@ + } + if (flag_exp < 2) { + ife_short = 1; +- printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n")); ++ if(!(count % 8)) ++ printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n")); + } + + if (for_all_interfaces(do_if_print, &flag_all) < 0) { + perror(_("missing interface information")); + exit(1); + } +- if (flag_cnt) ++ if (!flag_cnt) { + free_interface_list(); +- else { + close(skfd); + skfd = -1; + } + ++ count++; + return 0; + } + +@@ -1478,7 +1481,7 @@ + { + fprintf(stderr, _("usage: netstat [-veenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}\n")); + fprintf(stderr, _(" netstat [-vnNcaeol] [<Socket> ...]\n")); +- fprintf(stderr, _(" netstat { [-veenNac] -i | [-cnNe] -M | -s }\n\n")); ++ fprintf(stderr, _(" netstat { [-veenNac] -i | [-cnNe] -M | -s } [delay]\n\n")); + + fprintf(stderr, _(" -r, --route display routing table\n")); + fprintf(stderr, _(" -i, --interfaces display interface table\n")); +@@ -1514,6 +1517,7 @@ + (int argc, char *argv[]) { + int i; + int lop; ++ int reptimer = 1; + struct option longopts[] = + { + AFTRANS_OPTS, +@@ -1655,6 +1659,12 @@ + flag_sta++; + } + ++ if(argc == optind + 1) { ++ if((reptimer = atoi(argv[optind])) <= 0) ++ usage(); ++ flag_cnt++; ++ } ++ + if (flag_int + flag_rou + flag_mas + flag_sta > 1) + usage(); + +@@ -1666,7 +1676,7 @@ + + flag_arg = flag_tcp + flag_udp + flag_raw + flag_unx + flag_ipx + + flag_ax25 + flag_netrom + flag_igmp + flag_x25; +- ++ + if (flag_mas) { + #if HAVE_FW_MASQUERADE && HAVE_AFINET + #if MORE_THAN_ONE_MASQ_AF +@@ -1678,7 +1688,7 @@ + flag_not & FLAG_NUM_PORT, flag_exp); + if (i || !flag_cnt) + break; +- sleep(1); ++ sleep(reptimer); + } + #else + ENOSUPP("netstat.c", "FW_MASQUERADE"); +@@ -1688,9 +1698,15 @@ + } + + if (flag_sta) { ++ for(;;) { + inittab(); +- parsesnmp(flag_raw, flag_tcp, flag_udp); +- exit(0); ++ i = parsesnmp(flag_raw, flag_tcp, flag_udp); ++ ++ if(i || !flag_cnt) ++ break; ++ sleep(reptimer); ++ } ++ return(i); + } + + if (flag_rou) { +@@ -1712,7 +1728,7 @@ + i = route_info(afname, options); + if (i || !flag_cnt) + break; +- sleep(1); ++ sleep(reptimer); + } + return (i); + } +@@ -1721,7 +1737,7 @@ + i = iface_info(); + if (!flag_cnt || i) + break; +- sleep(1); ++ sleep(reptimer); + } + return (i); + } +@@ -1847,7 +1863,7 @@ + } + if (!flag_cnt || i) + break; +- sleep(1); ++ sleep(reptimer); + prg_cache_clear(); + } + return (i); +--- net-tools-1.60/statistics.c.cycle 2001-02-02 19:01:23.000000000 +0100 ++++ net-tools-1.60/statistics.c 2003-02-11 14:29:29.000000000 +0100 +@@ -338,7 +338,7 @@ + } + + +-void parsesnmp(int flag_raw, int flag_tcp, int flag_udp) ++int parsesnmp(int flag_raw, int flag_tcp, int flag_udp) + { + FILE *f; + +@@ -347,12 +347,14 @@ + f = fopen("/proc/net/snmp", "r"); + if (!f) { + perror(_("cannot open /proc/net/snmp")); +- return; ++ return(1); + } + process_fd(f); + +- if (ferror(f)) ++ if (ferror(f)) { + perror("/proc/net/snmp"); ++ return(1); ++ } + + fclose(f); + +@@ -361,12 +363,14 @@ + if (f) { + process_fd(f); + +- if (ferror(f)) +- perror("/proc/net/netstat"); ++ if (ferror(f)) { ++ perror("/proc/net/netstat"); ++ return(1); ++ } + + fclose(f); + } +- return; ++ return(0); + } + + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-de.patch b/pkgs/core/net-tools/patches/net-tools-1.60-de.patch new file mode 100644 index 0000000..f015f13 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-de.patch @@ -0,0 +1,11 @@ +--- net-tools-1.60/po/de.po.old 2005-02-16 16:46:02.000000000 +0100 ++++ net-tools-1.60/po/de.po 2005-02-16 16:54:07.886323928 +0100 +@@ -64,7 +64,7 @@ + + #: ../arp.c:467 + msgid "(incomplete)" +-msgstr "(unvollsändig)" ++msgstr "(unvollständig)" + + #: ../arp.c:484 + #, c-format diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-debug-fix.patch b/pkgs/core/net-tools/patches/net-tools-1.60-debug-fix.patch new file mode 100644 index 0000000..ae5fd33 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-debug-fix.patch @@ -0,0 +1,61 @@ +diff -up net-tools-1.60/lib/rose.c.debug-fix net-tools-1.60/lib/rose.c +--- net-tools-1.60/lib/rose.c.debug-fix 2000-03-05 12:26:03.000000000 +0100 ++++ net-tools-1.60/lib/rose.c 2009-09-01 13:02:20.000000000 +0200 +@@ -86,7 +86,7 @@ static int ROSE_input(int type, char *bu + if (strlen(bufp) != 10) { + strcpy(ROSE_errmsg, _("Node address must be ten digits")); + #ifdef DEBUG +- fprintf(stderr, "rose_input(%s): %s !\n", ROSE_errmsg, orig); ++ fprintf(stderr, "rose_input(%s): %s !\n", bufp, ROSE_errmsg); + #endif + errno = EINVAL; + return (-1); +@@ -99,7 +99,7 @@ static int ROSE_input(int type, char *bu + + /* All done. */ + #ifdef DEBUG +- fprintf(stderr, "rose_input(%s): ", orig); ++ fprintf(stderr, "rose_input(%s): ", bufp); + for (i = 0; i < sizeof(rose_address); i++) + fprintf(stderr, "%02X ", sap->sa_data[i] & 0377); + fprintf(stderr, "\n"); +diff -up net-tools-1.60/lib/x25.c.debug-fix net-tools-1.60/lib/x25.c +--- net-tools-1.60/lib/x25.c.debug-fix 2000-05-20 20:53:25.000000000 +0200 ++++ net-tools-1.60/lib/x25.c 2009-09-01 13:06:05.000000000 +0200 +@@ -81,6 +81,7 @@ X25_input(int type, char *bufp, struct s + unsigned char *ptr; + char *p; + unsigned int sigdigits; ++ int i; + + sap->sa_family = x25_aftype.af; + ptr = ((struct sockaddr_x25 *)sap)->sx25_addr.x25_addr; +@@ -90,7 +91,7 @@ X25_input(int type, char *bufp, struct s + if (strlen(bufp)>18) { + strcpy(X25_errmsg, _("Address can't exceed eighteen digits with sigdigits")); + #ifdef DEBUG +- fprintf(stderr, "x25_input(%s): %s !\n", X25_errmsg, orig); ++ fprintf(stderr, "x25_input(%s): %s !\n", bufp, X25_errmsg); + #endif + errno = EINVAL; + return(-1); +@@ -108,7 +109,7 @@ X25_input(int type, char *bufp, struct s + *p = '/'; + strcpy(X25_errmsg, _("Invalid address")); + #ifdef DEBUG +- fprintf(stderr, "x25_input(%s): %s !\n", X25_errmsg, orig); ++ fprintf(stderr, "x25_input(%s): %s !\n", bufp, X25_errmsg); + #endif + errno = EINVAL; + return(-1); +@@ -118,8 +119,8 @@ X25_input(int type, char *bufp, struct s + + /* All done. */ + #ifdef DEBUG +- fprintf(stderr, "x25_input(%s): ", orig); +- for (i = 0; i < sizeof(x25_address); i++) ++ fprintf(stderr, "x25_input(%s): ", bufp); ++ for (i = 0; i < sizeof(sap->sa_data); i++) + fprintf(stderr, "%02X ", sap->sa_data[i] & 0377); + fprintf(stderr, "\n"); + #endif diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-duplicate-tcp.patch b/pkgs/core/net-tools/patches/net-tools-1.60-duplicate-tcp.patch new file mode 100644 index 0000000..1b6f3b0 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-duplicate-tcp.patch @@ -0,0 +1,194 @@ +--- net-tools-1.60/netstat.c.foo Mon Apr 22 14:25:20 2002 ++++ net-tools-1.60/netstat.c Mon Apr 22 14:25:22 2002 +@@ -435,6 +435,162 @@ + " will not be shown, you would have to be root to see it all.)\n")); + } + ++#define TCP_HASH_SIZE 1009 ++ ++static struct tcp_node { ++ struct tcp_node *next; ++ char *socket_pair; ++} *tcp_node_hash[TCP_HASH_SIZE]; ++ ++static unsigned int tcp_node_compute_string_hash(const char *p) ++{ ++ unsigned int h = *p; ++ ++ if (h) ++ for (p += 1; *p != '\0'; p++) ++ h = (h << 5) - h + *p; ++ ++ return h; ++} ++ ++#define TCP_NODE_HASH_STRING(x) \ ++ (tcp_node_compute_string_hash(x) % TCP_HASH_SIZE) ++ ++static void tcp_node_hash_clear(void) ++{ ++ int i; ++ struct tcp_node *next_node; ++ struct tcp_node *tmp_node; ++ for (i=0; i < TCP_HASH_SIZE; i++) { ++ if (tcp_node_hash[i]) { ++ /* free the children of this hash bucket */ ++ next_node = tcp_node_hash[i]->next; ++ while (next_node) { ++ tmp_node = next_node; ++ next_node = next_node->next; ++ free(tmp_node->socket_pair); ++ free(tmp_node); ++ } ++ ++ /* free the bucket itself */ ++ free(tcp_node_hash[i]); ++ tcp_node_hash[i] = NULL; ++ } ++ } ++} ++ ++/* This function takes a socket pair string. If it already exists in ++ the hash it returns -1, otherwise it returns 0. */ ++ ++static int tcp_node_hash_check_and_append(const char *local_addr, ++ int local_port, ++ const char *rem_addr, ++ int rem_port) ++{ ++ unsigned int hash_val; ++ struct tcp_node *tmp_node; ++ int tmp_string_len; ++ char *tmp_string;; ++ ++ /* Size of the string is the size of the two lengths of the address ++ strings plus enough sizes for the colons and the ports. */ ++ tmp_string_len = strlen(local_addr) + strlen(rem_addr) + 32; ++ tmp_string = malloc(tmp_string_len); ++ if (!tmp_string) ++ return 0; ++ ++ if (snprintf(tmp_string, tmp_string_len - 1, "%s:%d:%s:%d", ++ local_addr, local_port, rem_addr, rem_port) < 0) { ++ free(tmp_string); ++ return 0; ++ } ++ ++ hash_val = TCP_NODE_HASH_STRING(tmp_string); ++ ++ /* See if we have to allocate this node */ ++ if (!tcp_node_hash[hash_val]) { ++ tcp_node_hash[hash_val] = malloc(sizeof(struct tcp_node)); ++ if (!tcp_node_hash[hash_val]) { ++ free(tmp_string); ++ return 0; ++ } ++ ++ memset(tcp_node_hash[hash_val], 0, sizeof(struct tcp_node)); ++ ++ /* Stuff this new value into the hash bucket and return early */ ++ tcp_node_hash[hash_val]->socket_pair = tmp_string; ++ return 0; ++ } ++ ++ /* Try to find the value in the hash bucket. */ ++ tmp_node = tcp_node_hash[hash_val]; ++ while (tmp_node) { ++ if (!strcmp(tmp_node->socket_pair, tmp_string)) { ++ free(tmp_string); ++ return -1; ++ } ++ tmp_node = tmp_node->next; ++ } ++ ++ /* If we got this far it means that it isn't in the hash bucket. ++ Add it to the front since it's faster that way. */ ++ tmp_node = tcp_node_hash[hash_val]; ++ ++ tcp_node_hash[hash_val] = malloc(sizeof(struct tcp_node)); ++ if (!tcp_node_hash[hash_val]) { ++ free(tmp_string); ++ tcp_node_hash[hash_val] = tmp_node; ++ return 0; ++ } ++ ++ tcp_node_hash[hash_val]->socket_pair = tmp_string; ++ tcp_node_hash[hash_val]->next = tmp_node; ++ ++ return 0; ++} ++ ++#if 0 ++static void tcp_node_hash_report_bucket_size(void) ++{ ++ int max = 0; ++ int min = 0; ++ int num = 0; ++ int total = 0; ++ struct tcp_node *tmp_node; ++ int tmp, i; ++ float avg; ++ ++ for (i=0; i < TCP_HASH_SIZE; i++) { ++ tmp_node = tcp_node_hash[i]; ++ if (!tmp_node) ++ continue; ++ ++ tmp = 0; ++ ++ num++; ++ tmp = 1; ++ ++ while (tmp_node) { ++ tmp++; ++ tmp_node = tmp_node->next; ++ } ++ ++ total += tmp; ++ if (tmp > max) ++ max = tmp; ++ ++ if (min == 0 || tmp < min) ++ min = tmp; ++ } ++ ++ avg = (float)total/(float)num; ++ ++ printf("%d nodes in %d buckets min/max/avg %d/%d/%.2f\n", ++ total, num, min, max, avg); ++ ++} ++#endif ++ + #if HAVE_AFNETROM + static const char *netrom_state[] = + { +@@ -752,11 +908,20 @@ + fprintf(stderr, _("warning, got bogus tcp line.\n")); + return; + } ++ + if ((ap = get_afntype(((struct sockaddr *) &localaddr)->sa_family)) == NULL) { + fprintf(stderr, _("netstat: unsupported address family %d !\n"), + ((struct sockaddr *) &localaddr)->sa_family); + return; + } ++ ++ /* make sure that we haven't seen this socket pair before */ ++ if (tcp_node_hash_check_and_append(local_addr, local_port, ++ rem_addr, rem_port) < 0) { ++ /* fprintf(stderr, _("warning, got duplicate tcp line.\n")); */ ++ return; ++ } ++ + if (state == TCP_LISTEN) { + time_len = 0; + retr = 0L; +@@ -1880,6 +2045,7 @@ + break; + sleep(reptimer); + prg_cache_clear(); ++ tcp_node_hash_clear(); + } + return (i); + } diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-ec_hw_null.patch b/pkgs/core/net-tools/patches/net-tools-1.60-ec_hw_null.patch new file mode 100644 index 0000000..be4028d --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-ec_hw_null.patch @@ -0,0 +1,12 @@ +diff -up net-tools-1.60/lib/ec_hw.c.ec_hw_null net-tools-1.60/lib/ec_hw.c +--- net-tools-1.60/lib/ec_hw.c.ec_hw_null 1999-11-20 22:02:53.000000000 +0100 ++++ net-tools-1.60/lib/ec_hw.c 2009-09-15 16:33:27.000000000 +0200 +@@ -15,7 +15,7 @@ + #include "config.h" + + #if HAVE_HWEC +- ++#include <stdlib.h> + #include <net/if_arp.h> + #include "net-support.h" + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-fgets.patch b/pkgs/core/net-tools/patches/net-tools-1.60-fgets.patch new file mode 100644 index 0000000..27641da --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-fgets.patch @@ -0,0 +1,41 @@ +Fix for when arp_disp_2() is called without opt_n set. If there is a DNS lookup, an +entry is added to /proc/net/arp after fopen(), resulting in a duplicate entry. + +--- net-tools-1.60/arp.c.fgets 2005-12-10 14:52:04.000000000 -0500 ++++ net-tools-1.60/arp.c 2005-12-11 00:15:59.000000000 -0500 +@@ -528,7 +528,7 @@ static int arp_show(char *name) + int type, flags; + FILE *fp; + char *hostname; +- int num, entries = 0, showed = 0; ++ int num, entries, showed = 0; + + host[0] = '\0'; + +@@ -546,18 +546,21 @@ static int arp_show(char *name) + perror(_PATH_PROCNET_ARP); + return (-1); + } ++ /* Count number of entries, in case file changes */ ++ for (entries = 0; fgets(line, sizeof(line), fp); entries++); ++ entries--; ++ fseek (fp, 0L, SEEK_SET); + /* Bypass header -- read until newline */ + if (fgets(line, sizeof(line), fp) != (char *) NULL) { + strcpy(mask, "-"); + strcpy(dev, "-"); + /* Read the ARP cache entries. */ +- for (; fgets(line, sizeof(line), fp);) { +- num = sscanf(line, "%s 0x%x 0x%x %100s %100s %100s\n", +- ip, &type, &flags, hwa, mask, dev); +- if (num < 4) ++ for (num = 0; num < entries; num++) { ++ fgets(line, sizeof(line), fp); ++ if (sscanf(line, "%s 0x%x 0x%x %100s %100s %100s\n", ++ ip, &type, &flags, hwa, mask, dev) < 4) + break; + +- entries++; + /* if the user specified hw-type differs, skip it */ + if (hw_set && (type != hw->type)) + continue; diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-gcc33.patch b/pkgs/core/net-tools/patches/net-tools-1.60-gcc33.patch new file mode 100644 index 0000000..a6ae422 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-gcc33.patch @@ -0,0 +1,31 @@ +--- net-tools-1.60/mii-tool.c.gcc33 2003-05-22 23:34:06.000000000 -0400 ++++ net-tools-1.60/mii-tool.c 2003-05-22 23:34:57.000000000 -0400 +@@ -378,17 +378,17 @@ + + /*--------------------------------------------------------------------*/ + +-const char *usage = +-"usage: %s [-VvRrwl] [-A media,... | -F media] [interface ...] +- -V, --version display version information +- -v, --verbose more verbose output +- -R, --reset reset MII to poweron state +- -r, --restart restart autonegotiation +- -w, --watch monitor for link status changes +- -l, --log with -w, write events to syslog +- -A, --advertise=media,... advertise only specified media +- -F, --force=media force specified media technology +-media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD, ++const char *usage = "\ ++usage: %s [-VvRrwl] [-A media,... | -F media] [interface ...]\n\ ++ -V, --version display version information\n\ ++ -v, --verbose more verbose output\n\ ++ -R, --reset reset MII to poweron state\n\ ++ -r, --restart restart autonegotiation\n\ ++ -w, --watch monitor for link status changes\n\ ++ -l, --log with -w, write events to syslog\n\ ++ -A, --advertise=media,... advertise only specified media\n\ ++ -F, --force=media force specified media technology\n\ ++media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,\n\ + (to advertise both HD and FD) 100baseTx, 10baseT\n"; + + int main(int argc, char **argv) diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-gcc34.patch b/pkgs/core/net-tools/patches/net-tools-1.60-gcc34.patch new file mode 100644 index 0000000..5f700c1 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-gcc34.patch @@ -0,0 +1,36 @@ +--- net-tools-1.60/lib/inet_sr.c.gcc34 2000-02-20 22:46:45.000000000 +0100 ++++ net-tools-1.60/lib/inet_sr.c 2004-03-30 15:57:25.276049571 +0200 +@@ -105,6 +105,7 @@ + case 2: + isnet = 0; break; + default: ++ ; + } + + /* Fill in the other fields. */ +--- net-tools-1.60/hostname.c.gcc34 2004-03-30 15:58:12.979830341 +0200 ++++ net-tools-1.60/hostname.c 2004-03-30 15:58:47.110380585 +0200 +@@ -98,6 +98,7 @@ + fprintf(stderr, _("%s: name too long\n"), program_name); + break; + default: ++ ; + } + exit(1); + }; +@@ -117,6 +118,7 @@ + fprintf(stderr, _("%s: name too long\n"), program_name); + break; + default: ++ ; + } + exit(1); + }; +@@ -180,6 +182,7 @@ + printf("%s\n", hp->h_name); + break; + default: ++ ; + } + } + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-hfi.patch b/pkgs/core/net-tools/patches/net-tools-1.60-hfi.patch new file mode 100644 index 0000000..bce9832 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-hfi.patch @@ -0,0 +1,183 @@ +diff -up net-tools-1.60/config.in.hfi net-tools-1.60/config.in +--- net-tools-1.60/config.in.hfi 2010-09-16 17:20:04.000000000 +0200 ++++ net-tools-1.60/config.in 2010-09-16 19:17:35.000000000 +0200 +@@ -83,6 +83,7 @@ bool '(Cisco)-HDLC/LAPB support' HAVE_HW + bool 'IrDA support' HAVE_HWIRDA y + bool 'Econet hardware support' HAVE_HWEC n + bool 'InfiniBand hardware support' HAVE_HWIB y ++bool 'HFI support' HAVE_HWHFI y + * + * + * Other Features. +diff -up net-tools-1.60/lib/hfi.c.hfi net-tools-1.60/lib/hfi.c +--- net-tools-1.60/lib/hfi.c.hfi 2010-09-16 19:17:58.000000000 +0200 ++++ net-tools-1.60/lib/hfi.c 2010-09-16 19:19:49.000000000 +0200 +@@ -0,0 +1,125 @@ ++#include "config.h" ++ ++#if HAVE_HWHFI ++#include <sys/types.h> ++#include <sys/socket.h> ++#include <net/if_arp.h> ++#include <stdlib.h> ++#include <stdio.h> ++#include <errno.h> ++#include <ctype.h> ++#include <string.h> ++#include <unistd.h> ++#include "net-support.h" ++#include "pathnames.h" ++#include "intl.h" ++#include "util.h" ++ ++extern struct hwtype hfi_hwtype; ++ ++#define HF_ALEN 6 /* from hf_if.h */ ++ ++/* Display an HFI address in readable format. */ ++static char *pr_hfi(unsigned char *ptr) ++{ ++ static char buff[64]; ++ ++ snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X", ++ (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), ++ (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377) ++ ); ++ return (buff); ++} ++ ++ ++/* Input an HFI address and convert to binary. */ ++static int in_hfi(char *bufp, struct sockaddr *sap) ++{ ++ unsigned char *ptr; ++ char c, *orig; ++ int i; ++ unsigned val; ++ ++ sap->sa_family = hfi_hwtype.type; ++ ptr = sap->sa_data; ++ ++ i = 0; ++ orig = bufp; ++ while ((*bufp != '\0') && (i < HF_ALEN)) { ++ val = 0; ++ c = *bufp++; ++ if (isdigit(c)) ++ val = c - '0'; ++ else if (c >= 'a' && c <= 'f') ++ val = c - 'a' + 10; ++ else if (c >= 'A' && c <= 'F') ++ val = c - 'A' + 10; ++ else { ++#ifdef DEBUG ++ fprintf(stderr, _("in_hfi(%s): invalid hfi address!\n"), orig); ++#endif ++ errno = EINVAL; ++ return (-1); ++ } ++ val <<= 4; ++ c = *bufp; ++ if (isdigit(c)) ++ val |= c - '0'; ++ else if (c >= 'a' && c <= 'f') ++ val |= c - 'a' + 10; ++ else if (c >= 'A' && c <= 'F') ++ val |= c - 'A' + 10; ++ else if (c == ':' || c == 0) ++ val >>= 4; ++ else { ++#ifdef DEBUG ++ fprintf(stderr, _("in_hfi(%s): invalid hfi address!\n"), orig); ++#endif ++ errno = EINVAL; ++ return (-1); ++ } ++ if (c != 0) ++ bufp++; ++ *ptr++ = (unsigned char) (val & 0377); ++ i++; ++ ++ /* We might get a semicolon here - not required. */ ++ if (*bufp == ':') { ++ if (i == HF_ALEN) { ++#ifdef DEBUG ++ fprintf(stderr, _("in_hfi(%s): trailing : ignored!\n"), ++ orig) ++#endif ++ ; /* nothing */ ++ } ++ bufp++; ++ } ++ } ++ ++ /* That's it. Any trailing junk? */ ++ if ((i == HF_ALEN) && (*bufp != '\0')) { ++#ifdef DEBUG ++ fprintf(stderr, _("in_hfi(%s): trailing junk!\n"), orig); ++ errno = EINVAL; ++ return (-1); ++#endif ++ } ++#ifdef DEBUG ++ fprintf(stderr, "in_hfi(%s): %s\n", orig, pr_hfi(sap->sa_data)); ++#endif ++ ++ return (0); ++} ++ ++#if !defined(ARPHRD_HFI) ++#define ARPHRD_HFI 37 /* goes into if_arp.h */ ++#endif ++ ++struct hwtype hfi_hwtype = ++{ ++ "hfi", NULL, /*"HFI", */ ARPHRD_HFI, HF_ALEN, ++ pr_hfi, in_hfi, NULL ++}; ++ ++ ++#endif /* HAVE_HWHFI */ +diff -up net-tools-1.60/lib/hw.c.hfi net-tools-1.60/lib/hw.c +--- net-tools-1.60/lib/hw.c.hfi 2010-09-16 17:20:04.000000000 +0200 ++++ net-tools-1.60/lib/hw.c 2010-09-16 19:21:28.000000000 +0200 +@@ -42,6 +42,7 @@ extern struct hwtype adaptive_hwtype; + extern struct hwtype strip_hwtype; + + extern struct hwtype ether_hwtype; ++extern struct hwtype hfi_hwtype; + extern struct hwtype fddi_hwtype; + extern struct hwtype hippi_hwtype; + extern struct hwtype tr_hwtype; +@@ -146,6 +147,9 @@ static struct hwtype *hwtypes[] = + #if HAVE_HWX25 + &x25_hwtype, + #endif ++#if HAVE_HWHFI ++ &hfi_hwtype, ++#endif + #if HAVE_HWIB + &ib_hwtype, + #endif +@@ -222,6 +226,9 @@ void hwinit() + #if HAVE_HWEC + ec_hwtype.title = _("Econet"); + #endif ++#if HAVE_HWHFI ++ hfi_hwtype.title = _("HFI"); ++#endif + #if HAVE_HWIB + ib_hwtype.title = _("InfiniBand"); + #endif +diff -up net-tools-1.60/lib/Makefile.hfi net-tools-1.60/lib/Makefile +--- net-tools-1.60/lib/Makefile.hfi 2010-09-16 17:20:04.000000000 +0200 ++++ net-tools-1.60/lib/Makefile 2010-09-16 19:22:34.000000000 +0200 +@@ -16,7 +16,7 @@ + # + + +-HWOBJS = hw.o loopback.o slip.o ether.o ax25.o ppp.o arcnet.o tr.o tunnel.o frame.o sit.o rose.o ash.o fddi.o hippi.o hdlclapb.o strip.o irda.o ec_hw.o x25.o ib.o ++HWOBJS = hw.o loopback.o slip.o ether.o ax25.o ppp.o arcnet.o tr.o tunnel.o frame.o sit.o rose.o ash.o fddi.o hippi.o hdlclapb.o strip.o irda.o ec_hw.o x25.o ib.o hfi.o + AFOBJS = unix.o inet.o inet6.o ax25.o ipx.o ddp.o ipx.o netrom.o af.o rose.o econet.o x25.o + AFGROBJS = inet_gr.o inet6_gr.o ipx_gr.o ddp_gr.o netrom_gr.o ax25_gr.o rose_gr.o getroute.o x25_gr.o + AFSROBJS = inet_sr.o inet6_sr.o netrom_sr.o ipx_sr.o setroute.o x25_sr.o diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-hostname-short.patch b/pkgs/core/net-tools/patches/net-tools-1.60-hostname-short.patch new file mode 100644 index 0000000..d9772e6 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-hostname-short.patch @@ -0,0 +1,38 @@ +diff -up net-tools-1.60/hostname.c.hostname-short net-tools-1.60/hostname.c +--- net-tools-1.60/hostname.c.hostname-short 2009-09-30 17:44:21.000000000 +0200 ++++ net-tools-1.60/hostname.c 2009-09-08 11:55:03.000000000 +0200 +@@ -176,11 +176,6 @@ static void showhname(char *hname, int c + case 'f': + printf("%s\n", hp->h_name); + break; +- case 's': +- if (p != NULL) +- *p = '\0'; +- printf("%s\n", hp->h_name); +- break; + default: + ; + } +@@ -270,6 +265,7 @@ int main(int argc, char **argv) + char myname[MAXHOSTNAMELEN + 1] = + {0}; + char *file = NULL; ++ char *p; + + static const struct option long_options[] = + { +@@ -370,7 +366,13 @@ int main(int argc, char **argv) + if (!type) + printf("%s\n", myname); + else +- showhname(myname, type); ++ if (type == 's') { ++ if (p = strchr(myname, '.')) ++ *p = '\0'; ++ printf("%s\n", myname); ++ } ++ else ++ showhname(myname, type); + break; + case 3: + if (file) { diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-hostname_man.patch b/pkgs/core/net-tools/patches/net-tools-1.60-hostname_man.patch new file mode 100644 index 0000000..6ce8b8a --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-hostname_man.patch @@ -0,0 +1,36 @@ +--- net-tools-1.60/man/en_US/hostname.1.gethostbyname 2005-10-14 11:33:41.000000000 +0200 ++++ net-tools-1.60/man/en_US/hostname.1 2005-10-15 11:46:14.646697600 +0200 +@@ -99,6 +99,33 @@ + complete FQDN of the system is returned with + .BR "hostname --fqdn" . + ++.LP ++The function ++.BR gethostname(2) ++is used to get the hostname. When the ++.BR "hostname -a, -d, -f or -i" ++is called will ++.BR gethostbyname(3) ++be called. The difference in ++.BR gethostname(2) ++and ++.BR gethostbyname(3) ++is that ++.BR gethostbyname(3) ++is network aware, so it consults ++.IR /etc/nsswitch.conf ++and ++.IR /etc/host.conf ++to decide whether to read information in ++.IR /etc/sysconfig/network ++or ++.IR /etc/hosts ++ ++To add another dimension to this, ++the ++.B hostname ++is also set when the network interface is brought up. ++ + .SS "SET NAME" + When called with one argument or with the + .B --file diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-i-option.patch b/pkgs/core/net-tools/patches/net-tools-1.60-i-option.patch new file mode 100644 index 0000000..3534202 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-i-option.patch @@ -0,0 +1,57 @@ +--- net-tools-1.60/netstat.c.i-option 2008-07-10 10:56:29.000000000 +0200 ++++ net-tools-1.60/netstat.c 2008-07-10 13:46:27.000000000 +0200 +@@ -2042,7 +2042,7 @@ static void usage(void) + fprintf(stderr, _(" netstat { [-veenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s } [delay]\n\n")); + + fprintf(stderr, _(" -r, --route display routing table\n")); +- fprintf(stderr, _(" -I, --interface=[<Iface>] display interface table for <Iface>\n")); ++ fprintf(stderr, _(" -I, --interfaces=<Iface> display interface table for <Iface>\n")); + fprintf(stderr, _(" -i, --interfaces display interface table\n")); + fprintf(stderr, _(" -g, --groups display multicast group memberships\n")); + fprintf(stderr, _(" -s, --statistics display networking statistics (like SNMP)\n")); +@@ -2085,7 +2085,6 @@ int main + AFTRANS_OPTS, + {"version", 0, 0, 'V'}, + {"interfaces", 2, 0, 'I'}, +- {"interfaces", 0, 0, 'i'}, + {"help", 0, 0, 'h'}, + {"route", 0, 0, 'r'}, + #if HAVE_FW_MASQUERADE +@@ -2173,10 +2172,6 @@ int main + if (optarg[0] == '=') optarg++; + if (optarg && strcmp(optarg, "(null)")) + flag_int_name = strdup(optarg); +- else { +- usage(); +- exit(1); +- } + flag_int++; + break; + case 'i': +--- net-tools-1.60/man/en_US/netstat.8.i-option 2008-07-10 13:55:04.000000000 +0200 ++++ net-tools-1.60/man/en_US/netstat.8 2008-07-15 12:21:51.000000000 +0200 +@@ -43,10 +43,10 @@ netstat - Print network connections, ro + .RB [delay] + .P + .B netstat +-.RB { --interfaces | -i } ++.RB { --interfaces | -I | -i } + .RI [ iface ] + .RB [ --all | -a ] +-.RB [ --extend | -e [ --extend | -e] ] ++.RB [ --extend | -e ] + .RB [ --verbose | -v ] + .RB [ --program | -p ] + .RB [ --numeric | -n ] +@@ -107,9 +107,8 @@ families will be printed. + Display the kernel routing tables. + .SS "--groups , -g" + Display multicast group membership information for IPv4 and IPv6. +-.SS "--interface=\fIiface \fR, \fB-i" +-Display a table of all network interfaces, or the specified +-.IR iface ) . ++.SS "--interfaces=\fIiface \fR, \fB-I=\fIiface \fR, \fB-i" ++Display a table of all network interfaces, or the specified \fIiface\fR. + .SS "--masquerade , -M" + Display a list of masqueraded connections. + .SS "--statistics , -s" diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-ib-warning.patch b/pkgs/core/net-tools/patches/net-tools-1.60-ib-warning.patch new file mode 100644 index 0000000..3b0c9c6 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-ib-warning.patch @@ -0,0 +1,15 @@ +diff -up net-tools-1.60/lib/ib.c.ib-warning net-tools-1.60/lib/ib.c +--- net-tools-1.60/lib/ib.c.ib-warning 2009-09-01 13:45:55.000000000 +0200 ++++ net-tools-1.60/lib/ib.c 2009-09-01 13:47:43.000000000 +0200 +@@ -48,7 +48,10 @@ static char *pr_ib(unsigned char *ptr) + pos += sprintf(pos, "%02X:", (*ptr++ & 0377)); + } + buff[strlen(buff) - 1] = '\0'; +- ++ char *ib_warning = "Ifconfig uses the ioctl access method to get the full address information, which limits hardware addresses to 8 bytes.\n" ++ "Because Infiniband address has 20 bytes, only the first 8 bytes are displayed correctly.\n" ++ "Ifconfig is obsolete! For replacement check ip.\n"; ++ fprintf(stderr, _(ib_warning)); + /* snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X", + (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), + (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377) diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-ifaceopt.patch b/pkgs/core/net-tools/patches/net-tools-1.60-ifaceopt.patch new file mode 100644 index 0000000..a561d07 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-ifaceopt.patch @@ -0,0 +1,52 @@ +--- net-tools-1.60/netstat.c.ifaceopt 2005-03-01 12:11:43.695661632 +0100 ++++ net-tools-1.60/netstat.c 2005-03-01 12:16:37.601981080 +0100 +@@ -1658,10 +1658,11 @@ + { + fprintf(stderr, _("usage: netstat [-veenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}\n")); + fprintf(stderr, _(" netstat [-vnNcaeol] [<Socket> ...]\n")); +- fprintf(stderr, _(" netstat { [-veenNac] -i[<Iface>] | [-cnNe] -M | -s } [delay]\n\n")); ++ fprintf(stderr, _(" netstat { [-veenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s } [delay]\n\n")); + + fprintf(stderr, _(" -r, --route display routing table\n")); +- fprintf(stderr, _(" -i, --interfaces=[<Iface>] display interface table\n")); ++ fprintf(stderr, _(" -I, --interfaces=[<Iface>] display interface table for <Iface>\n")); ++ fprintf(stderr, _(" -i, --interfaces display interface table\n")); + fprintf(stderr, _(" -g, --groups display multicast group memberships\n")); + fprintf(stderr, _(" -s, --statistics display networking statistics (like SNMP)\n")); + #if HAVE_FW_MASQUERADE +@@ -1700,7 +1701,8 @@ + { + AFTRANS_OPTS, + {"version", 0, 0, 'V'}, +- {"interfaces", 2, 0, 'i'}, ++ {"interfaces", 2, 0, 'I'}, ++ {"interfaces", 0, 0, 'i'}, + {"help", 0, 0, 'h'}, + {"route", 0, 0, 'r'}, + #if HAVE_FW_MASQUERADE +@@ -1738,7 +1740,8 @@ + getroute_init(); /* Set up AF routing support */ + + afname[0] = '\0'; +- while ((i = getopt_long(argc, argv, "MCFA:acdegphi::nNorstuVv?wxl", longopts, &lop)) != EOF) ++ ++ while ((i = getopt_long(argc, argv, "MCFA:acdegphiI::nNorstuVv?wxl", longopts, &lop)) != EOF) + switch (i) { + case -1: + break; +@@ -1779,11 +1782,14 @@ + case 'p': + flag_prg++; + break; +- case 'i': ++ case 'I': + if (optarg && strcmp(optarg, "(null)")) + flag_int_name = strdup(optarg); + flag_int++; + break; ++ case 'i': ++ flag_int++; ++ break; + case 'n': + flag_not |= FLAG_NUM; + break; diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-ifconfig-long-iface-crasher.patch b/pkgs/core/net-tools/patches/net-tools-1.60-ifconfig-long-iface-crasher.patch new file mode 100644 index 0000000..87fcc5d --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-ifconfig-long-iface-crasher.patch @@ -0,0 +1,36 @@ +diff -Naurp net-tools-1.60-ifconfig-new/lib/interface.c net-tools-1.60-ifconfig/lib/interface.c +--- net-tools-1.60-ifconfig-new/lib/interface.c 2006-03-23 07:02:48.000000000 +0100 ++++ net-tools-1.60-ifconfig/lib/interface.c 2006-03-23 09:58:45.000000000 +0100 +@@ -203,6 +203,7 @@ out: + + static char *get_name(char **namep, char *p) + { ++ int count = 0; + while (isspace(*p)) + p++; + char *name = *namep = p; +@@ -211,8 +212,13 @@ static char *get_name(char **namep, char + if (*p == ':') { /* could be an alias */ + char *dot = p, *dotname = name; + *name++ = *p++; +- while (isdigit(*p)) ++ count++; ++ while (isdigit(*p)){ + *name++ = *p++; ++ count++; ++ if (count == (IFNAMSIZ-1)) ++ break; ++ } + if (*p != ':') { /* it wasn't, backup */ + p = dot; + name = dotname; +@@ -223,6 +229,9 @@ static char *get_name(char **namep, char + break; + } + *name++ = *p++; ++ count++; ++ if (count == (IFNAMSIZ-1)) ++ break; + } + *name++ = '\0'; + return p; diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-ifconfig.patch b/pkgs/core/net-tools/patches/net-tools-1.60-ifconfig.patch new file mode 100644 index 0000000..a209bd4 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-ifconfig.patch @@ -0,0 +1,107 @@ +--- net-tools-1.60/ifconfig.c.new 2005-07-20 12:47:29.000000000 +0200 ++++ net-tools-1.60/ifconfig.c 2005-07-20 12:54:57.000000000 +0200 +@@ -175,6 +175,32 @@ + return (0); + } + ++/** test is a specified flag is set */ ++static int test_flag(char *ifname, short flags) ++{ ++ struct ifreq ifr; ++ int fd; ++ ++ if (strchr(ifname, ':')) { ++ /* This is a v4 alias interface. Downing it via a socket for ++ another AF may have bad consequences. */ ++ fd = get_socket_for_af(AF_INET); ++ if (fd < 0) { ++ fprintf(stderr, _("No support for INET on this system.\n")); ++ return -1; ++ } ++ } else ++ fd = skfd; ++ ++ safe_strncpy(ifr.ifr_name, ifname, IFNAMSIZ); ++ if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { ++ fprintf(stderr, _("%s: ERROR while testing interface flags: %s\n"), ++ ifname, strerror(errno)); ++ return -1; ++ } ++ return (ifr.ifr_flags & flags); ++} ++ + static void usage(void) + { + fprintf(stderr, _("Usage:\n ifconfig [-a] [-v] [-s] <interface> [[<AF>] <address>]\n")); +@@ -249,7 +275,7 @@ + err = 1; + } + } +- return 0; ++ return err; + } + + int main(int argc, char **argv) +@@ -415,6 +441,8 @@ + } + if (!strcmp(*spp, "-promisc")) { + goterr |= clr_flag(ifr.ifr_name, IFF_PROMISC); ++ if (test_flag(ifr.ifr_name, IFF_PROMISC) > 0) ++ fprintf(stderr, _("Warning: Interface %s still in promisc mode... maybe other application is running?\n"), ifr.ifr_name); + spp++; + continue; + } +@@ -425,6 +453,8 @@ + } + if (!strcmp(*spp, "-multicast")) { + goterr |= clr_flag(ifr.ifr_name, IFF_MULTICAST); ++ if (test_flag(ifr.ifr_name, IFF_MULTICAST) > 0) ++ fprintf(stderr, _("Warning: Interface %s still in MULTICAST mode.\n"), ifr.ifr_name); + spp++; + continue; + } +@@ -435,6 +465,8 @@ + } + if (!strcmp(*spp, "-allmulti")) { + goterr |= clr_flag(ifr.ifr_name, IFF_ALLMULTI); ++ if (test_flag(ifr.ifr_name, IFF_MULTICAST) > 0) ++ fprintf(stderr, _("Warning: Interface %s still in ALLMULTI mode.\n"), ifr.ifr_name); + spp++; + continue; + } +@@ -456,6 +488,8 @@ + } + if (!strcmp(*spp, "-dynamic")) { + goterr |= clr_flag(ifr.ifr_name, IFF_DYNAMIC); ++ if (test_flag(ifr.ifr_name, IFF_MULTICAST) > 0) ++ fprintf(stderr, _("Warning: Interface %s still in DYNAMIC mode.\n"), ifr.ifr_name); + spp++; + continue; + } +@@ -513,6 +547,8 @@ + + if (!strcmp(*spp, "-broadcast")) { + goterr |= clr_flag(ifr.ifr_name, IFF_BROADCAST); ++ if (test_flag(ifr.ifr_name, IFF_MULTICAST) > 0) ++ fprintf(stderr, _("Warning: Interface %s still in BROADCAST mode.\n"), ifr.ifr_name); + spp++; + continue; + } +@@ -569,7 +605,7 @@ + continue; + } + didnetmask++; +- goterr = set_netmask(ap->fd, &ifr, &sa, dobcast); ++ goterr |= set_netmask(ap->fd, &ifr, &sa, dobcast); + spp++; + continue; + } +@@ -640,6 +676,8 @@ + } + if (!strcmp(*spp, "-pointopoint")) { + goterr |= clr_flag(ifr.ifr_name, IFF_POINTOPOINT); ++ if (test_flag(ifr.ifr_name, IFF_MULTICAST) > 0) ++ fprintf(stderr, _("Warning: Interface %s still in POINTOPOINT mode.\n"), ifr.ifr_name); + spp++; + continue; + } diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-ifconfig_ib.patch b/pkgs/core/net-tools/patches/net-tools-1.60-ifconfig_ib.patch new file mode 100644 index 0000000..b5a234f --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-ifconfig_ib.patch @@ -0,0 +1,202 @@ +--- net-tools-1.60/config.in.ifconfig_ib 2000-05-21 16:32:12.000000000 +0200 ++++ net-tools-1.60/config.in 2005-02-09 10:36:26.000000000 +0100 +@@ -82,6 +82,7 @@ + bool '(Cisco)-HDLC/LAPB support' HAVE_HWHDLCLAPB n + bool 'IrDA support' HAVE_HWIRDA y + bool 'Econet hardware support' HAVE_HWEC n ++bool 'InfiniBand hardware support' HAVE_HWIB y + * + * + * Other Features. +--- net-tools-1.60/lib/hw.c.ifconfig_ib 2000-05-20 20:27:25.000000000 +0200 ++++ net-tools-1.60/lib/hw.c 2005-02-09 10:36:26.000000000 +0100 +@@ -73,6 +73,8 @@ + + extern struct hwtype ec_hwtype; + ++extern struct hwtype ib_hwtype; ++ + static struct hwtype *hwtypes[] = + { + +@@ -144,6 +146,9 @@ + #if HAVE_HWX25 + &x25_hwtype, + #endif ++#if HAVE_HWIB ++ &ib_hwtype, ++#endif + &unspec_hwtype, + NULL + }; +@@ -217,6 +222,9 @@ + #if HAVE_HWEC + ec_hwtype.title = _("Econet"); + #endif ++#if HAVE_HWIB ++ ib_hwtype.title = _("InfiniBand"); ++#endif + sVhwinit = 1; + } + +--- net-tools-1.60/lib/ib.c.ifconfig_ib 2005-02-09 10:36:26.000000000 +0100 ++++ net-tools-1.60/lib/ib.c 2005-02-09 10:42:21.000000000 +0100 +@@ -0,0 +1,147 @@ ++/* ++ * lib/ib.c This file contains an implementation of the "Infiniband" ++ * support functions. ++ * ++ * Version: $Id: ib.c,v 1.1 2005/02/06 11:00:47 tduffy Exp $ ++ * ++ * Author: Fred N. van Kempen, waltje@uwalt.nl.mugnet.org ++ * Copyright 1993 MicroWalt Corporation ++ * Tom Duffy tduffy@sun.com ++ * ++ * This program is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU General ++ * Public License as published by the Free Software ++ * Foundation; either version 2 of the License, or (at ++ * your option) any later version. ++ */ ++#include "config.h" ++ ++#if HAVE_HWIB ++#include <sys/types.h> ++#include <sys/socket.h> ++#include <net/if_arp.h> ++/*#include <linux/if_infiniband.h> - not in gcc-kernheaders*/ ++#include <stdlib.h> ++#include <stdio.h> ++#include <errno.h> ++#include <ctype.h> ++#include <string.h> ++#include <unistd.h> ++#include "net-support.h" ++#include "pathnames.h" ++#include "intl.h" ++#include "util.h" ++ ++extern struct hwtype ib_hwtype; ++ ++#define INFINIBAND_ALEN 20 ++ ++/* Display an InfiniBand address in readable format. */ ++static char *pr_ib(unsigned char *ptr) ++{ ++ static char buff[128]; ++ char *pos; ++ unsigned int i; ++ ++ pos = buff; ++ for (i = 0; i < INFINIBAND_ALEN; i++) { ++ pos += sprintf(pos, "%02X:", (*ptr++ & 0377)); ++ } ++ buff[strlen(buff) - 1] = '\0'; ++ ++ /* snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X", ++ (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), ++ (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377) ++ ); ++ */ ++ return (buff); ++} ++ ++ ++/* Input an Infiniband address and convert to binary. */ ++static int in_ib(char *bufp, struct sockaddr *sap) ++{ ++ unsigned char *ptr; ++ char c, *orig; ++ int i; ++ unsigned val; ++ ++ sap->sa_family = ib_hwtype.type; ++ ptr = sap->sa_data; ++ ++ i = 0; ++ orig = bufp; ++ while ((*bufp != '\0') && (i < INFINIBAND_ALEN)) { ++ val = 0; ++ c = *bufp++; ++ if (isdigit(c)) ++ val = c - '0'; ++ else if (c >= 'a' && c <= 'f') ++ val = c - 'a' + 10; ++ else if (c >= 'A' && c <= 'F') ++ val = c - 'A' + 10; ++ else { ++#ifdef DEBUG ++ fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig); ++#endif ++ errno = EINVAL; ++ return (-1); ++ } ++ val <<= 4; ++ c = *bufp; ++ if (isdigit(c)) ++ val |= c - '0'; ++ else if (c >= 'a' && c <= 'f') ++ val |= c - 'a' + 10; ++ else if (c >= 'A' && c <= 'F') ++ val |= c - 'A' + 10; ++ else if (c == ':' || c == 0) ++ val >>= 4; ++ else { ++#ifdef DEBUG ++ fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig); ++#endif ++ errno = EINVAL; ++ return (-1); ++ } ++ if (c != 0) ++ bufp++; ++ *ptr++ = (unsigned char) (val & 0377); ++ i++; ++ ++ /* We might get a semicolon here - not required. */ ++ if (*bufp == ':') { ++ if (i == INFINIBAND_ALEN) { ++#ifdef DEBUG ++ fprintf(stderr, _("in_ib(%s): trailing : ignored!\n"), ++ orig) ++#endif ++ ; /* nothing */ ++ } ++ bufp++; ++ } ++ } ++ ++ /* That's it. Any trailing junk? */ ++ if ((i == INFINIBAND_ALEN) && (*bufp != '\0')) { ++#ifdef DEBUG ++ fprintf(stderr, _("in_ib(%s): trailing junk!\n"), orig); ++ errno = EINVAL; ++ return (-1); ++#endif ++ } ++#ifdef DEBUG ++ fprintf(stderr, "in_ib(%s): %s\n", orig, pr_ib(sap->sa_data)); ++#endif ++ ++ return (0); ++} ++ ++ ++struct hwtype ib_hwtype = ++{ ++ "infiniband", NULL, ARPHRD_INFINIBAND, INFINIBAND_ALEN, ++ pr_ib, in_ib, NULL ++}; ++ ++#endif /* HAVE_HWIB */ +--- net-tools-1.60/lib/Makefile.ifconfig_ib 2000-10-28 12:59:42.000000000 +0200 ++++ net-tools-1.60/lib/Makefile 2005-02-09 10:36:26.000000000 +0100 +@@ -16,7 +16,7 @@ + # + + +-HWOBJS = hw.o loopback.o slip.o ether.o ax25.o ppp.o arcnet.o tr.o tunnel.o frame.o sit.o rose.o ash.o fddi.o hippi.o hdlclapb.o strip.o irda.o ec_hw.o x25.o ++HWOBJS = hw.o loopback.o slip.o ether.o ax25.o ppp.o arcnet.o tr.o tunnel.o frame.o sit.o rose.o ash.o fddi.o hippi.o hdlclapb.o strip.o irda.o ec_hw.o x25.o ib.o + AFOBJS = unix.o inet.o inet6.o ax25.o ipx.o ddp.o ipx.o netrom.o af.o rose.o econet.o x25.o + AFGROBJS = inet_gr.o inet6_gr.o ipx_gr.o ddp_gr.o netrom_gr.o ax25_gr.o rose_gr.o getroute.o x25_gr.o + AFSROBJS = inet_sr.o inet6_sr.o netrom_sr.o ipx_sr.o setroute.o x25_sr.o diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-ifconfig_man.patch b/pkgs/core/net-tools/patches/net-tools-1.60-ifconfig_man.patch new file mode 100644 index 0000000..f3509da --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-ifconfig_man.patch @@ -0,0 +1,14 @@ +--- net-tools-1.60/man/en_US/ifconfig.8.addr_man 2006-03-30 12:32:56.000000000 +0200 ++++ net-tools-1.60/man/en_US/ifconfig.8 2006-03-30 12:38:43.000000000 +0200 +@@ -39,6 +39,11 @@ + (Novell IPX) and + .B netrom + (AMPR Packet radio). ++All numbers supplied as parts in IPv4 dotted decimal notation may be decimal, ++octal, or hexadecimal, as specified in the ISO C standard (that is, a leading 0x ++or 0X implies hexadecimal; otherwise, a leading '0' implies octal; otherwise, ++the number is interpreted as decimal). Use of hexamedial and octal numbers ++is not RFC-compliant and therefore its use is discouraged and may go away. + .SH OPTIONS + .TP + .B interface diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-inet6-lookup.patch b/pkgs/core/net-tools/patches/net-tools-1.60-inet6-lookup.patch new file mode 100644 index 0000000..3d4854a --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-inet6-lookup.patch @@ -0,0 +1,81 @@ +--- net-tools-1.60/lib/inet6.c.inet6-lookup 2000-10-28 13:04:00.000000000 +0200 ++++ net-tools-1.60/lib/inet6.c 2003-05-21 15:28:50.000000000 +0200 +@@ -133,28 +133,9 @@ + } + + +-static int INET6_getsock(char *bufp, struct sockaddr *sap) +-{ +- struct sockaddr_in6 *sin6; +- +- sin6 = (struct sockaddr_in6 *) sap; +- sin6->sin6_family = AF_INET6; +- sin6->sin6_port = 0; +- +- if (inet_pton(AF_INET6, bufp, sin6->sin6_addr.s6_addr) <= 0) +- return (-1); +- +- return 16; /* ?;) */ +-} +- + static int INET6_input(int type, char *bufp, struct sockaddr *sap) + { +- switch (type) { +- case 1: +- return (INET6_getsock(bufp, sap)); +- default: +- return (INET6_resolve(bufp, (struct sockaddr_in6 *) sap)); +- } ++ return (INET6_resolve(bufp, (struct sockaddr_in6 *) sap)); + } + + +--- net-tools-1.60/lib/inet6_gr.c.inet6-lookup 2001-04-01 16:48:06.000000000 +0200 ++++ net-tools-1.60/lib/inet6_gr.c 2003-05-21 15:28:50.000000000 +0200 +@@ -100,7 +100,7 @@ + addr6p[4], addr6p[5], addr6p[6], addr6p[7]); + inet6_aftype.input(1, addr6, (struct sockaddr *) &saddr6); + snprintf(addr6, sizeof(addr6), "%s/%d", +- inet6_aftype.sprint((struct sockaddr *) &saddr6, 1), ++ inet6_aftype.sprint((struct sockaddr *) &saddr6, numeric), + prefix_len); + + /* Fetch and resolve the nexthop address. */ +@@ -109,7 +109,7 @@ + naddr6p[4], naddr6p[5], naddr6p[6], naddr6p[7]); + inet6_aftype.input(1, naddr6, (struct sockaddr *) &snaddr6); + snprintf(naddr6, sizeof(naddr6), "%s", +- inet6_aftype.sprint((struct sockaddr *) &snaddr6, 1)); ++ inet6_aftype.sprint((struct sockaddr *) &snaddr6, numeric)); + + /* Decode the flags. */ + strcpy(flags, "U"); +--- net-tools-1.60/lib/inet6_sr.c.inet6-lookup 2000-05-22 23:18:37.000000000 +0200 ++++ net-tools-1.60/lib/inet6_sr.c 2003-05-21 15:28:50.000000000 +0200 +@@ -63,7 +63,7 @@ + if (*args == NULL) + return (usage()); + +- strcpy(target, *args++); ++ safe_strncpy(target, *args++, sizeof(target)); + if (!strcmp(target, "default")) { + prefix_len = 0; + memset(&sa6, 0, sizeof(sa6)); +@@ -112,7 +112,7 @@ + return (usage()); + if (rt.rtmsg_flags & RTF_GATEWAY) + return (usage()); +- strcpy(gateway, *args); ++ safe_strncpy(gateway, *args, sizeof(gateway)); + if (inet6_aftype.input(1, gateway, + (struct sockaddr *) &sa6) < 0) { + inet6_aftype.herror(gateway); +@@ -152,7 +152,7 @@ + } + if (devname) { + memset(&ifr, 0, sizeof(ifr)); +- strcpy(ifr.ifr_name, devname); ++ safe_strncpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name)); + + if (ioctl(skfd, SIOGIFINDEX, &ifr) < 0) { + perror("SIOGIFINDEX"); diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-interface.patch b/pkgs/core/net-tools/patches/net-tools-1.60-interface.patch new file mode 100644 index 0000000..3a1bc91 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-interface.patch @@ -0,0 +1,110 @@ +--- net-tools-1.60/netstat.c.interface 2003-08-25 17:06:30.000000000 +0200 ++++ net-tools-1.60/netstat.c 2003-08-25 17:08:41.000000000 +0200 +@@ -129,6 +129,7 @@ + #define E_IOCTL -3 + + int flag_int = 0; ++char *flag_int_name = NULL; + int flag_rou = 0; + int flag_mas = 0; + int flag_sta = 0; +@@ -1441,6 +1442,7 @@ + static int iface_info(void) + { + static int count=0; ++ struct interface *ife = NULL; + + if (skfd < 0) { + if ((skfd = sockets_open(0)) < 0) { +@@ -1455,7 +1457,11 @@ + printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n")); + } + +- if (for_all_interfaces(do_if_print, &flag_all) < 0) { ++ if (flag_int_name) { ++ ife = lookup_interface(flag_int_name); ++ do_if_print(ife, &flag_all); ++ } ++ else if (for_all_interfaces(do_if_print, &flag_all) < 0) { + perror(_("missing interface information")); + exit(1); + } +@@ -1481,30 +1487,31 @@ + { + fprintf(stderr, _("usage: netstat [-veenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}\n")); + fprintf(stderr, _(" netstat [-vnNcaeol] [<Socket> ...]\n")); +- fprintf(stderr, _(" netstat { [-veenNac] -i | [-cnNe] -M | -s } [delay]\n\n")); ++ fprintf(stderr, _(" netstat { [-veenNac] -i[<Iface>] | [-cnNe] -M | -s } [delay]\n\n")); + +- fprintf(stderr, _(" -r, --route display routing table\n")); +- fprintf(stderr, _(" -i, --interfaces display interface table\n")); +- fprintf(stderr, _(" -g, --groups display multicast group memberships\n")); +- fprintf(stderr, _(" -s, --statistics display networking statistics (like SNMP)\n")); ++ fprintf(stderr, _(" -r, --route display routing table\n")); ++ fprintf(stderr, _(" -i, --interfaces=[<Iface>] display interface table\n")); ++ fprintf(stderr, _(" -g, --groups display multicast group memberships\n")); ++ fprintf(stderr, _(" -s, --statistics display networking statistics (like SNMP)\n")); + #if HAVE_FW_MASQUERADE +- fprintf(stderr, _(" -M, --masquerade display masqueraded connections\n\n")); ++ fprintf(stderr, _(" -M, --masquerade display masqueraded connections\n\n")); + #endif +- fprintf(stderr, _(" -v, --verbose be verbose\n")); +- fprintf(stderr, _(" -n, --numeric don't resolve names\n")); +- fprintf(stderr, _(" --numeric-hosts don't resolve host names\n")); +- fprintf(stderr, _(" --numeric-ports don't resolve port names\n")); +- fprintf(stderr, _(" --numeric-users don't resolve user names\n")); +- fprintf(stderr, _(" -N, --symbolic resolve hardware names\n")); +- fprintf(stderr, _(" -e, --extend display other/more information\n")); +- fprintf(stderr, _(" -p, --programs display PID/Program name for sockets\n")); +- fprintf(stderr, _(" -c, --continuous continuous listing\n\n")); +- fprintf(stderr, _(" -l, --listening display listening server sockets\n")); +- fprintf(stderr, _(" -a, --all, --listening display all sockets (default: connected)\n")); +- fprintf(stderr, _(" -o, --timers display timers\n")); +- fprintf(stderr, _(" -F, --fib display Forwarding Information Base (default)\n")); +- fprintf(stderr, _(" -C, --cache display routing cache instead of FIB\n\n")); ++ fprintf(stderr, _(" -v, --verbose be verbose\n")); ++ fprintf(stderr, _(" -n, --numeric don't resolve names\n")); ++ fprintf(stderr, _(" --numeric-hosts don't resolve host names\n")); ++ fprintf(stderr, _(" --numeric-ports don't resolve port names\n")); ++ fprintf(stderr, _(" --numeric-users don't resolve user names\n")); ++ fprintf(stderr, _(" -N, --symbolic resolve hardware names\n")); ++ fprintf(stderr, _(" -e, --extend display other/more information\n")); ++ fprintf(stderr, _(" -p, --programs display PID/Program name for sockets\n")); ++ fprintf(stderr, _(" -c, --continuous continuous listing\n\n")); ++ fprintf(stderr, _(" -l, --listening display listening server sockets\n")); ++ fprintf(stderr, _(" -a, --all, --listening display all sockets (default: connected)\n")); ++ fprintf(stderr, _(" -o, --timers display timers\n")); ++ fprintf(stderr, _(" -F, --fib display Forwarding Information Base (default)\n")); ++ fprintf(stderr, _(" -C, --cache display routing cache instead of FIB\n\n")); + ++ fprintf(stderr, _(" <Iface>: Name of interface to monitor/list.\n")); + fprintf(stderr, _(" <Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom\n")); + fprintf(stderr, _(" <AF>=Use '-A <af>' or '--<af>'; default: %s\n"), DFLT_AF); + fprintf(stderr, _(" List of possible address families (which support routing):\n")); +@@ -1522,7 +1529,7 @@ + { + AFTRANS_OPTS, + {"version", 0, 0, 'V'}, +- {"interfaces", 0, 0, 'i'}, ++ {"interfaces", 2, 0, 'i'}, + {"help", 0, 0, 'h'}, + {"route", 0, 0, 'r'}, + #if HAVE_FW_MASQUERADE +@@ -1560,7 +1567,7 @@ + getroute_init(); /* Set up AF routing support */ + + afname[0] = '\0'; +- while ((i = getopt_long(argc, argv, "MCFA:acdegphinNorstuVv?wxl", longopts, &lop)) != EOF) ++ while ((i = getopt_long(argc, argv, "MCFA:acdegphi::nNorstuVv?wxl", longopts, &lop)) != EOF) + switch (i) { + case -1: + break; +@@ -1602,6 +1609,8 @@ + flag_prg++; + break; + case 'i': ++ if (optarg && strcmp(optarg, "(null)")) ++ flag_int_name = strdup(optarg); + flag_int++; + break; + case 'n': diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-interface_stack.patch b/pkgs/core/net-tools/patches/net-tools-1.60-interface_stack.patch new file mode 100644 index 0000000..10bbe6d --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-interface_stack.patch @@ -0,0 +1,115 @@ +Bugzilla Bug 176714 â *** stack smashing detected ***: /sbin/ifconfig terminated + +--- a/lib/interface.c-old 2005-12-30 11:08:15.000000000 -0800 ++++ b/lib/interface.c 2005-12-30 11:17:02.000000000 -0800 +@@ -201,10 +201,11 @@ + return err; + } + +-static char *get_name(char *name, char *p) ++static char *get_name(char **namep, char *p) + { + while (isspace(*p)) + p++; ++ char *name = *namep = p; + while (*p) { + if (isspace(*p)) + break; +@@ -305,9 +306,10 @@ + { + static int proc_read; + FILE *fh; +- char buf[512]; + struct interface *ife; + int err; ++ char *line = NULL; ++ size_t linelen = 0; + + if (proc_read) + return 0; +@@ -320,8 +322,11 @@ + _PATH_PROCNET_DEV, strerror(errno)); + return if_readconf(); + } +- fgets(buf, sizeof buf, fh); /* eat line */ +- fgets(buf, sizeof buf, fh); ++ if (getline(&line, &linelen, fh) == -1 /* eat line */ ++ || getline(&line, &linelen, fh) == -1) { ++ err = -1; ++ goto out; ++ } + + #if 0 /* pretty, but can't cope with missing fields */ + fmt = proc_gen_fmt(_PATH_PROCNET_DEV, 1, fh, +@@ -346,13 +351,13 @@ + if (!fmt) + return -1; + #else +- procnetdev_vsn = procnetdev_version(buf); ++ procnetdev_vsn = procnetdev_version(line); + #endif + + err = 0; +- while (fgets(buf, sizeof buf, fh)) { +- char *s, name[IFNAMSIZ]; +- s = get_name(name, buf); ++ while (getline(&line, &linelen, fh) != -1) { ++ char *s, *name; ++ s = get_name(&name, line); + ife = add_interface(name); + get_dev_fields(s, ife); + ife->statistics_valid = 1; +@@ -368,6 +373,8 @@ + #if 0 + free(fmt); + #endif ++ out: ++ free(line); + fclose(fh); + return err; + } +@@ -376,8 +383,9 @@ + static int if_readlist_rep(char *target, struct interface *ife) + { + FILE *fh; +- char buf[512]; + int err; ++ char *line = NULL; ++ size_t linelen = 0; + + fh = fopen(_PATH_PROCNET_DEV, "r"); + if (!fh) { +@@ -385,15 +393,18 @@ + _PATH_PROCNET_DEV, strerror(errno)); + return if_readconf(); + } +- fgets(buf, sizeof buf, fh); /* eat line */ +- fgets(buf, sizeof buf, fh); ++ if (getline(&line, &linelen, fh) == -1 /* eat line */ ++ || getline(&line, &linelen, fh) == -1) { ++ err = -1; ++ goto out; ++ } + +- procnetdev_vsn = procnetdev_version(buf); ++ procnetdev_vsn = procnetdev_version(line); + + err = 0; +- while (fgets(buf, sizeof buf, fh)) { +- char *s, name[IFNAMSIZ]; +- s = get_name(name, buf); ++ while (getline(&line, &linelen, fh) != -1) { ++ char *s, *name; ++ s = get_name(&name, line); + get_dev_fields(s, ife); + if (target && !strcmp(target,name)) + { +@@ -406,6 +417,8 @@ + err = -1; + } + ++ out: ++ free(line); + fclose(fh); + return err; + } diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-ipx.patch b/pkgs/core/net-tools/patches/net-tools-1.60-ipx.patch new file mode 100644 index 0000000..d4458b9 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-ipx.patch @@ -0,0 +1,36 @@ +diff -urN net-tools-1.60/lib/ipx_gr.c net-tools-1.60.new/lib/ipx_gr.c +--- net-tools-1.60/lib/ipx_gr.c 2000-10-28 12:59:42.000000000 +0200 ++++ net-tools-1.60.new/lib/ipx_gr.c 2003-05-20 10:54:37.000000000 +0200 +@@ -64,7 +64,7 @@ + continue; + + /* Fetch and resolve the Destination */ +- (void) ap->input(5, net, &sa); ++ (void) ap->input(1, net, &sa); + strcpy(net, ap->sprint(&sa, numeric)); + + /* Fetch and resolve the Router Net */ +diff -urN net-tools-1.60/netstat.c net-tools-1.60.new/netstat.c +--- net-tools-1.60/netstat.c 2003-05-20 11:00:57.000000000 +0200 ++++ net-tools-1.60.new/netstat.c 2003-05-20 10:58:25.000000000 +0200 +@@ -1412,13 +1412,13 @@ + } + + /* Fetch and resolve the Source */ +- (void) ap->input(4, sad, &sa); ++ (void) ap->input(0, sad, &sa); + safe_strncpy(buf, ap->sprint(&sa, flag_not), sizeof(buf)); + snprintf(sad, sizeof(sad), "%s:%04X", buf, sport); + + if (!nc) { + /* Fetch and resolve the Destination */ +- (void) ap->input(4, dad, &sa); ++ (void) ap->input(0, dad, &sa); + safe_strncpy(buf, ap->sprint(&sa, flag_not), sizeof(buf)); + snprintf(dad, sizeof(dad), "%s:%04X", buf, dport); + } else +diff -urN net-tools-1.60/version.h net-tools-1.60.new/version.h +--- net-tools-1.60/version.h 1970-01-01 01:00:00.000000000 +0100 ++++ net-tools-1.60.new/version.h 2003-05-19 16:07:49.000000000 +0200 +@@ -0,0 +1 @@ ++#define RELEASE "net-tools 1.60" diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-isofix.patch b/pkgs/core/net-tools/patches/net-tools-1.60-isofix.patch new file mode 100644 index 0000000..4bbaff1 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-isofix.patch @@ -0,0 +1,33 @@ +--- net-tools-1.60/po/de.po.isofix 2000-10-28 12:59:43.000000000 +0200 ++++ net-tools-1.60/po/de.po 2005-01-10 11:29:29.407639208 +0100 +@@ -9,7 +9,7 @@ + "Last-Translator: Ralf Bächle ralf@gnu.org\n" + "Language-Team:\n" + "MIME-Version: 1.0\n" +-"Content-Type: text/plain; charset=iso8859-1\n" ++"Content-Type: text/plain; charset=iso-8859-1\n" + "Content-Transfer-Encoding: 8bit\n" + + #: ../arp.c:110 ../arp.c:269 +--- net-tools-1.60/po/fr.po.isofix 2000-02-20 22:47:00.000000000 +0100 ++++ net-tools-1.60/po/fr.po 2005-01-10 11:29:23.613520048 +0100 +@@ -9,7 +9,7 @@ + "Last-Translator: J.M.Vansteene vanstee@worldnet.fr\n" + "Language-Team:\n" + "MIME-Version: 1.0\n" +-"Content-Type: text/plain; charset=iso8859-1\n" ++"Content-Type: text/plain; charset=iso-8859-1\n" + "Content-Transfer-Encoding: 8bit\n" + + #: ../arp.c:110 ../arp.c:269 +--- net-tools-1.60/po/pt_BR.po.isofix 2000-02-20 22:47:06.000000000 +0100 ++++ net-tools-1.60/po/pt_BR.po 2005-01-10 11:29:16.294632688 +0100 +@@ -14,7 +14,7 @@ + "PO-Revision-Date: 1999-03-01 02:38+0100\n" + "Last-Translator: Arnaldo Carvalho de Melo acme@conectiva.com.br\n" + "MIME-Version: 1.0\n" +-"Content-Type: text/plain; charset=ISO8859-9\n" ++"Content-Type: text/plain; charset=iso-8859-9\n" + "Content-Transfer-Encoding: 8bit\n" + + #: ../arp.c:110 ../arp.c:269 diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-large-indexes.patch b/pkgs/core/net-tools/patches/net-tools-1.60-large-indexes.patch new file mode 100644 index 0000000..3585dbb --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-large-indexes.patch @@ -0,0 +1,12 @@ +diff -up net-tools-1.60/lib/interface.c.large-indexes net-tools-1.60/lib/interface.c +--- net-tools-1.60/lib/interface.c.large-indexes 2010-01-02 12:05:13.000000000 +0100 ++++ net-tools-1.60/lib/interface.c 2010-01-02 12:34:24.000000000 +0100 +@@ -766,7 +766,7 @@ void ife_print_long(struct interface *pt + /* FIXME: should be integrated into interface.c. */ + + if ((f = fopen(_PATH_PROCNET_IFINET6, "r")) != NULL) { +- while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n", ++ while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %08x %02x %02x %02x %20s\n", + addr6p[0], addr6p[1], addr6p[2], addr6p[3], + addr6p[4], addr6p[5], addr6p[6], addr6p[7], + &if_idx, &plen, &scope, &dad_status, devname) != EOF) { diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-makefile-berlios.patch b/pkgs/core/net-tools/patches/net-tools-1.60-makefile-berlios.patch new file mode 100644 index 0000000..7b9b007 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-makefile-berlios.patch @@ -0,0 +1,69 @@ +diff -up net-tools-1.60/lib/Makefile.makefile-berlios net-tools-1.60/lib/Makefile +--- net-tools-1.60/lib/Makefile.makefile-berlios 2009-09-15 18:07:12.000000000 +0200 ++++ net-tools-1.60/lib/Makefile 2009-09-15 18:07:12.000000000 +0200 +@@ -36,7 +36,7 @@ OBJS = $(sort $(VARIA) $(AFOBJS) $(HWOBJ + + # This can be overwritten by the TOPLEVEL Makefile + TOPDIR=.. +-CFLAGS += -I$(TOPDIR) -idirafter $(TOPDIR)/include # -fPIC ++CFLAGS += -I$(TOPDIR) -I$(TOPDIR)/include # -fPIC + SONAME=libnet-tools.so.0 + + .SUFFIXES: .a .so +diff -up net-tools-1.60/Makefile.makefile-berlios net-tools-1.60/Makefile +--- net-tools-1.60/Makefile.makefile-berlios 2009-09-15 18:07:12.000000000 +0200 ++++ net-tools-1.60/Makefile 2009-09-15 18:08:25.000000000 +0200 +@@ -88,10 +88,9 @@ endif + + # Compiler and Linker Options + # You may need to uncomment and edit these if you are using libc5 and IPv6. +-COPTS = -D_GNU_SOURCE -O2 -Wall -g # -I/usr/inet6/include +-ifeq ($(origin LOPTS), undefined) +-LOPTS = +-endif ++CFLAGS ?= -O2 -g ++CFLAGS += -fno-strict-aliasing # code needs a lot of work before strict aliasing is safe ++CPPFLAGS += -D_GNU_SOURCE + RESLIB = # -L/usr/inet6/lib -linet6 + + ifeq ($(HAVE_AFDECnet),1) +@@ -119,8 +118,9 @@ CFLAGS += -DHAVE_SELINUX + else + endif + +-CFLAGS += $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH) +-LDFLAGS += $(LOPTS) -L$(NET_LIB_PATH) ++CPPFLAGS += -I. -I$(TOPDIR)/include -I$(NET_LIB_PATH) ++LDFLAGS += -L$(NET_LIB_PATH) ++ + + SUBDIRS = man/ $(NET_LIB_PATH)/ + +@@ -131,8 +131,6 @@ LD = $(CC) + + NLIB = -l$(NET_LIB_NAME) + +-MDEFINES = COPTS='$(COPTS)' LOPTS='$(LOPTS)' TOPDIR='$(TOPDIR)' +- + %.o: %.c config.h version.h intl.h net-features.h $< + $(CC) $(CFLAGS) -c $< + +@@ -181,14 +179,15 @@ $(NET_LIB): config.h version.h intl.h li + + i18n.h: i18ndir + +-libdir: +- @$(MAKE) -C $(NET_LIB_PATH) $(MDEFINES) ++libdir: version.h ++ @$(MAKE) -C $(NET_LIB_PATH) + + i18ndir: + @$(MAKE) -C po + + subdirs: +- @for i in $(SUBDIRS); do $(MAKE) -C $$i $(MDEFINES) ; done ++ @for i in $(SUBDIRS); do $(MAKE) -C $$i || exit $$? ; done ++ + + ifconfig: $(NET_LIB) ifconfig.o + $(CC) $(LDFLAGS) -o ifconfig ifconfig.o $(NLIB) $(RESLIB) diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-man-RHEL-bugs.patch b/pkgs/core/net-tools/patches/net-tools-1.60-man-RHEL-bugs.patch new file mode 100644 index 0000000..03d68de --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-man-RHEL-bugs.patch @@ -0,0 +1,18 @@ +diff -up net-tools-1.60/man/de_DE/arp.8.man-RHEL-bugs net-tools-1.60/man/de/arp.8 +--- net-tools-1.60/man/de_DE/arp.8.man-RHEL-bugs 2009-09-09 15:52:27.000000000 +0200 ++++ net-tools-1.60/man/de_DE/arp.8 2009-09-09 15:59:33.000000000 +0200 +@@ -120,11 +120,9 @@ Flagge) kann + .B Netmaske + f(:ur ARP-Eintr(:age f(:ur ganze Subnetze angegeben werde. Von dieser + Praxis wird abgeraten. Sie wird von (:alteren Kerneln unterst(:utzt, da +-sie gelegentlich n(:utzlich ist. Wird die +-If the +-.B temp +-Flagge nicht angegeben, so werden die erzeugten Eintr(:age nicht dauerhaft +-in den ARP-Cache eingetragen. ++sie gelegentlich n(:utzlich ist. ++Der Eintrag wird permanent im ARP-Cache gespeichert, ++wenn das \fBtemp\fR-Flag nicht angegeben wird. + .br + .B ANMERKUNG: + Ab der Kernelversion 2.2.0 ist es nicht mehr m(:oglich ARP-Eintr(:age f(:ur diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-man-obsolete.patch b/pkgs/core/net-tools/patches/net-tools-1.60-man-obsolete.patch new file mode 100644 index 0000000..5d4bc02 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-man-obsolete.patch @@ -0,0 +1,267 @@ +diff -up net-tools-1.60/man/en_US/arp.8.man-obsolete net-tools-1.60/man/en_US/arp.8 +--- net-tools-1.60/man/en_US/arp.8.man-obsolete 2009-09-01 11:28:22.000000000 +0200 ++++ net-tools-1.60/man/en_US/arp.8 2009-09-01 11:28:22.000000000 +0200 +@@ -1,6 +1,8 @@ + .TH ARP 8 "5 Jan 1999" "net-tools" "Linux Programmer's Manual" ++ + .SH NAME + arp - manipulate the system ARP cache ++ + .SH SYNOPSIS + .B arp + .RB [ -evn ] +@@ -44,6 +46,10 @@ arp - manipulate the system ARP cache + .RB [ "-i if" ] + .B -f [filename] + ++.SH NOTE ++.P ++This program is obsolete. For replacement check \fBip neighbor\fR. ++ + .SH DESCRIPTION + .B Arp + manipulates the kernel's ARP cache in various ways. The primary options +@@ -51,6 +57,7 @@ are clearing an address mapping entry an + debugging purposes, the + .B arp + program also allows a complete dump of the ARP cache. ++ + .SH OPTIONS + .TP + .B "-v, --verbose" +@@ -107,6 +114,7 @@ table. For + entries the specified interface is the interface on which ARP requests will + be answered. + .br ++ + .B NOTE: + This has to be different from the interface to which the IP + datagrams will be routed. +@@ -171,6 +179,7 @@ flag. Permanent entries are marked with + and published entries have the + .B P + flag. ++ + .SH FILES + .I /proc/net/arp, + .br +@@ -179,8 +188,10 @@ flag. + .I /etc/hosts + .br + .I /etc/ethers ++ + .SH SEE ALSO +-rarp(8), route(8), ifconfig(8), netstat(8) ++ip(8) ++ + .SH AUTHORS + Fred N. van Kempen, waltje@uwalt.nl.mugnet.org with a lot of improvements + from net-tools Maintainer Bernd Eckenfels net-tools@lina.inka.de. +diff -up net-tools-1.60/man/en_US/ethers.5.man-obsolete net-tools-1.60/man/en_US/ethers.5 +--- net-tools-1.60/man/en_US/ethers.5.man-obsolete 1999-01-09 16:55:31.000000000 +0100 ++++ net-tools-1.60/man/en_US/ethers.5 2009-09-01 11:28:22.000000000 +0200 +@@ -1,7 +1,9 @@ + .TH ETHERS 5 "April 26th, 1996" "" "File formats" ++ + .SH NAME "{{{roff}}}"{{{ + ethers - Ethernet address to IP number database + ."}}} ++ + .SH DESCRIPTION "{{{ + \fB/etc/ethers\fP contains 48 bit Ethernet addresses and their corresponding + IP numbers, one line for each IP number: +@@ -20,12 +22,11 @@ which represents one byte of the address + order (big-endian). The \fIIP-number\fP may be a hostname which + can be resolved by DNS or a dot separated number. + ."}}} ++ + .SH EXAMPLES "{{{ + 08:00:20:00:61:CA pal + ."}}} ++ + .SH FILES "{{{ + /etc/ethers + ."}}} +-.SH "SEE ALSO" "{{{ +-rarp(8) +-."}}} +diff -up net-tools-1.60/man/en_US/ifconfig.8.man-obsolete net-tools-1.60/man/en_US/ifconfig.8 +--- net-tools-1.60/man/en_US/ifconfig.8.man-obsolete 2009-09-01 11:28:22.000000000 +0200 ++++ net-tools-1.60/man/en_US/ifconfig.8 2009-09-01 11:28:22.000000000 +0200 +@@ -1,10 +1,19 @@ + .TH IFCONFIG 8 "14 August 2000" "net-tools" "Linux Programmer's Manual" ++ + .SH NAME + ifconfig - configure a network interface ++ + .SH SYNOPSIS + .B "ifconfig [interface]" + .br + .B "ifconfig interface [aftype] options | address ..." ++ ++.SH NOTE ++.P ++This program is obsolete! ++For replacement check \fBip addr\fR and \fBip link\fR. ++For statistics use \fBip -s link\fR. ++ + .SH DESCRIPTION + .B Ifconfig + is used to configure the kernel-resident network interfaces. It is +@@ -44,6 +53,7 @@ octal, or hexadecimal, as specified in t + or 0X implies hexadecimal; otherwise, a leading '0' implies octal; otherwise, + the number is interpreted as decimal). Use of hexamedial and octal numbers + is not RFC-compliant and therefore its use is discouraged and may go away. ++ + .SH OPTIONS + .TP + .B interface +@@ -172,6 +182,7 @@ Set the length of the transmit queue of + to small values for slower devices with a high latency (modem links, ISDN) + to prevent fast bulk transfers from disturbing interactive traffic like + telnet too much. ++ + .SH NOTES + Since kernel release 2.2 there are no explicit interface statistics for + alias interfaces anymore. The statistics printed for the original address +@@ -184,17 +195,27 @@ command. + Interrupt problems with Ethernet device drivers fail with EAGAIN. See + .I http://www.scyld.com/expert/irq-conflict.html + for more information. ++ + .SH FILES + .I /proc/net/socket + .br + .I /proc/net/dev + .br + .I /proc/net/if_inet6 ++ + .SH BUGS ++Ifconfig uses obsolete kernel interface. ++It uses the ioctl access method to get the full address information, ++which limits hardware addresses to 8 bytes. ++Since an Infiniband address is 20 bytes, ++only the first 8 bytes of Infiniband address are displayed. ++.LP + While appletalk DDP and IPX addresses will be displayed they cannot be + altered by this command. ++ + .SH SEE ALSO +-route(8), netstat(8), arp(8), rarp(8), ipchains(8) ++ip(8) ++ + .SH AUTHORS + Fred N. van Kempen, waltje@uwalt.nl.mugnet.org + .br +diff -up net-tools-1.60/man/en_US/nameif.8.man-obsolete net-tools-1.60/man/en_US/nameif.8 +--- net-tools-1.60/man/en_US/nameif.8.man-obsolete 2000-10-18 19:26:29.000000000 +0200 ++++ net-tools-1.60/man/en_US/nameif.8 2009-09-01 12:15:24.000000000 +0200 +@@ -1,10 +1,18 @@ + .TH NAMEIF 8 "18 Oct 2000" "net-tools" "Linux's Administrator's Manual" ++ + .SH NAME + nameif - name network interfaces based on MAC addresses ++ + .SH SYNOPSIS + .B "nameif [-c configfile] [-s]" + .br + .B "nameif [-c configfile] [-s] {interface macaddress}" ++ ++.SH NOTE ++.P ++This program is obsolete. For replacement check \fBip link\fR. ++This functionality is also much better provided by udev methods. ++ + .SH DESCRIPTION + .B nameif + renames network interfaces based on mac addresses. When no arguments are +@@ -31,5 +39,9 @@ should be run before the interface is up + + .SH FILES + /etc/mactab ++ ++.SH SEE ALSO ++ip(8), udev(7) ++ + .SH BUGS + Only works for Ethernet currently. +diff -up net-tools-1.60/man/en_US/netstat.8.man-obsolete net-tools-1.60/man/en_US/netstat.8 +--- net-tools-1.60/man/en_US/netstat.8.man-obsolete 2009-09-01 11:28:22.000000000 +0200 ++++ net-tools-1.60/man/en_US/netstat.8 2009-09-01 11:28:22.000000000 +0200 +@@ -92,6 +92,14 @@ netstat - Print network connections, ro + .RB [ --netrom ] + .RB [ --ddp ] + ++.SH NOTE ++.P ++This program is obsolete. ++Replacement for \fBnetstat\fR is \fBss\fR. ++Replacement for \fBnetstat -r\fR is \fBip route\fR. ++Replacement for \fBnetstat -i\fR is \fBip -s link\fR. ++Replacement for \fBnetstat -g\fR is \fBip maddr\fR. ++ + .SH DESCRIPTION + .B Netstat + prints information about the Linux networking subsystem. The type of +@@ -438,13 +446,11 @@ status information via the following fil + -- statistics + .fi + .P ++ + .SH SEE ALSO +-.BR route (8), +-.BR ifconfig (8), +-.BR ipchains (8), +-.BR iptables (8), +-.BR proc (5) ++.BR ss (8), ip(8) + .P ++ + .SH BUGS + Occasionally strange information may appear if a socket changes + as it is viewed. This is unlikely to occur. +diff -up net-tools-1.60/man/en_US/route.8.man-obsolete net-tools-1.60/man/en_US/route.8 +--- net-tools-1.60/man/en_US/route.8.man-obsolete 2000-05-21 20:59:03.000000000 +0200 ++++ net-tools-1.60/man/en_US/route.8 2009-09-01 11:28:22.000000000 +0200 +@@ -1,6 +1,8 @@ + .TH ROUTE 8 "2 January 2000" "net-tools" "Linux Programmer's Manual" ++ + .SH NAME + route - show / manipulate the IP routing table ++ + .SH SYNOPSIS + .B route + .RB [ -CFvnee ] +@@ -52,6 +54,11 @@ If] + .RB [ --version ] + .RB [ -h ] + .RB [ --help ] ++ ++.SH NOTE ++.P ++This program is obsolete. For replacement check \fBip route\fR. ++ + .SH DESCRIPTION + .B Route + manipulates the kernel's IP routing tables. Its primary use is to set +@@ -306,6 +313,7 @@ address is not needed for the interface + .B Arp (cached only) + Whether or not the hardware address for the cached route is up to date. + .LP ++ + .SH FILES + .I /proc/net/ipv6_route + .br +@@ -313,9 +321,11 @@ Whether or not the hardware address for + .br + .I /proc/net/rt_cache + .LP ++ + .SH SEE ALSO +-.I ifconfig(8), netstat(8), arp(8), rarp(8) ++.I ip(8) + .LP ++ + .SH HISTORY + .B Route + for Linux was originally written by Fred N. van Kempen, diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-man.patch b/pkgs/core/net-tools/patches/net-tools-1.60-man.patch new file mode 100644 index 0000000..2deac4a --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-man.patch @@ -0,0 +1,132 @@ +--- net-tools-1.60/man/en_US/ifconfig.8.man 2000-10-28 12:59:42.000000000 +0200 ++++ net-tools-1.60/man/en_US/ifconfig.8 2003-05-22 16:58:41.000000000 +0200 +@@ -177,7 +177,7 @@ + command. + .LP + Interrupt problems with Ethernet device drivers fail with EAGAIN. See +-.I http://cesdis.gsfc.nasa.gov/linux/misc/irq-conflict.html ++.I http://www.scyld.com/expert/irq-conflict.html + for more information. + .SH FILES + .I /proc/net/socket +--- net-tools-1.60/man/en_US/hostname.1.man 1999-02-27 13:11:14.000000000 +0100 ++++ net-tools-1.60/man/en_US/hostname.1 2003-05-22 17:04:30.000000000 +0200 +@@ -10,8 +10,6 @@ + nisdomainname - show or set system's NIS/YP domain name + .br + ypdomainname - show or set the system's NIS/YP domain name +-.br +-nodename - show or set the system's DECnet node name + + .SH SYNOPSIS + .B hostname +@@ -96,12 +94,6 @@ + function. This is also known as the YP/NIS domain name of the system. + + .LP +-.B nodename +-will print the DECnet node name of the system as returned by the +-.BR getnodename (2) +-function. +- +-.LP + .B dnsdomainname + will print the domain part of the FQDN (Fully Qualified Domain Name). The + complete FQDN of the system is returned with +@@ -184,11 +176,6 @@ + .I "-i, --ip-address" + Display the IP address(es) of the host. + .TP +-.I "-n, --node" +-Display the DECnet node name. If a parameter is given (or +-.B --file name +-) the root can also set a new node name. +-.TP + .I "-s, --short" + Display the short host name. This is the host name cut at the first dot. + .TP +--- net-tools-1.60/man/fr_FR/hostname.1.man 1999-04-18 21:23:46.000000000 +0200 ++++ net-tools-1.60/man/fr_FR/hostname.1 2003-05-22 17:05:04.000000000 +0200 +@@ -9,8 +9,6 @@ + nisdomainname - affiche ou définit le nom de domaine NIS/YP du système + .br + ypdomainname - affiche ou définit le nom de domaine NIS/YP du système +-.br +-nodename - affiche ou définit le nom de domaine DECnet du système + + .SH SYNOPSIS + .B hostname +@@ -87,14 +85,6 @@ + .BR getdomainname (2) + . Ceci est connu comme nom de domaine YP/NIS du système. + +- +-.LP +-.B nodename +-fournit le nom de noeud DECnet du système tel qu'il est retourné par la +-fonction +-.BR getnodename (2) +-. +- + .LP + .B dnsdomainname + fournit la partie domaine du nom complètement qualifié - FQDN (Fully +@@ -180,11 +170,6 @@ + .I "-i, --ip-address" + Affiche la (les) adresse(s) IP de l'hôte. + .TP +-.I "-n, --node" +-Affiche le nom de noeud DECnet. Si un paramètre est fourni (ou +-.B --file nom_fichier +-) le super-utilisateur peut également définir un nouveau nom de neud. +-.TP + .I "-s, --short" + Affiche le nom d'hôte en format court. Il s'agit du nom d'hôte coupé au + premier point. +--- net-tools-1.60/man/de_DE/hostname.1.man 1999-03-15 21:31:16.000000000 +0100 ++++ net-tools-1.60/man/de_DE/hostname.1 2003-05-22 17:06:01.000000000 +0200 +@@ -15,8 +15,6 @@ + nisdomainname - den NIS/YP Domainnamen anzeigen oder setzen + .br + ypdomainname - den NIS/YP Domainnamen anzeigen oder setzen +-.br +-nodename - den DECnet-Knotennamen anzeigen oder setzen + + .SH SYNOPSIS + .B hostname +@@ -101,12 +99,6 @@ + des Systems genannt. + + .LP +-.B nodename +-druckt den DECnet-Knotennamen des Systems, wie er von der +-.BR getnodename (2) +-Function ermittelt wird, aus. +- +-.LP + .B dnsdomainname + druckt den Domainteil des FQDN (Fully Qualified Domain Name oder zu deutsch + vollst(:andig spezifizierter Domainname) aus. Der vollst(:andige FQDN +@@ -117,8 +109,8 @@ + .SS "NAME SETZEN" + Wenn mit nur einem Argument oder mit der + .B --file +-Option aufgerufen, dann setzen diese Kommandos den Rechnernamen, den NIS/YP +-Domainnamen oder den DECnet-Knotennamen. ++Option aufgerufen, dann setzen diese Kommandos den Rechnernamen oder den NIS/YP ++Domainnamen. + + .LP + Nur der Superuser darf den Namen (:andern. +@@ -198,11 +190,6 @@ + .I "-i, --ip-address" + Die IP-Adresse(n) des Rechners anzeigen und beenden. + .TP +-.I "-n, --node" +-Den DECnet-Knotennamen anzeigen. Wenn ein Argument oder die +-.B --file name +-Option angegeben wird, dann kann Root auch einen neuen Knotennamen setzen. +-.TP + .I "-s, --short" + Den Kurznamen anzeigen. Dies ist der ab dem ersten Punkt abgeschnittene + Rechnername. diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-manydevs.patch b/pkgs/core/net-tools/patches/net-tools-1.60-manydevs.patch new file mode 100644 index 0000000..d07ffba --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-manydevs.patch @@ -0,0 +1,13 @@ +--- lib/nstrcmp.c.bak Fri Apr 12 00:15:01 2002 ++++ lib/nstrcmp.c Fri Apr 12 00:15:29 2002 +@@ -16,8 +16,8 @@ + b++; + } + if (isdigit(*a)) { +- if (!isdigit(*b)) +- return -1; ++ if (!isdigit(*b)) ++ return 1; + while (a > astr) { + a--; + if (!isdigit(*a)) { diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-masqinfo-raw-ip.patch b/pkgs/core/net-tools/patches/net-tools-1.60-masqinfo-raw-ip.patch new file mode 100644 index 0000000..492e08f --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-masqinfo-raw-ip.patch @@ -0,0 +1,14 @@ +diff -up net-tools-1.60/lib/masq_info.c.masqinfo-raw-ip net-tools-1.60/lib/masq_info.c +--- net-tools-1.60/lib/masq_info.c.masqinfo-raw-ip 2000-10-28 12:59:42.000000000 +0200 ++++ net-tools-1.60/lib/masq_info.c 2009-09-15 17:05:24.000000000 +0200 +@@ -119,7 +119,9 @@ static int read_masqinfo(FILE * f, struc + ms->src.sin_family = AF_INET; + ms->dst.sin_family = AF_INET; + +- if (strcmp("TCP", buf) == 0) ++ if (strcmp("IP", buf) == 0) ++ ms->proto = "ip"; ++ else if (strcmp("TCP", buf) == 0) + ms->proto = "tcp"; + else if (strcmp("UDP", buf) == 0) + ms->proto = "udp"; diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-metric-tunnel-man.patch b/pkgs/core/net-tools/patches/net-tools-1.60-metric-tunnel-man.patch new file mode 100644 index 0000000..b949f87 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-metric-tunnel-man.patch @@ -0,0 +1,21 @@ +diff -up net-tools-1.60/man/en_US/ifconfig.8.metric-tunnel-man net-tools-1.60/man/en_US/ifconfig.8 +--- net-tools-1.60/man/en_US/ifconfig.8.metric-tunnel-man 2008-09-18 09:20:49.000000000 +0200 ++++ net-tools-1.60/man/en_US/ifconfig.8 2008-09-18 09:26:41.000000000 +0200 +@@ -70,7 +70,7 @@ mode. If selected, all multicast packet + received by the interface. + .TP + .B "metric N" +-This parameter sets the interface metric. ++This parameter sets the interface metric. It is not available under GNU/Linux. + .TP + .B "mtu N" + This parameter sets the Maximum Transfer Unit (MTU) of an interface. +@@ -92,7 +92,7 @@ Add an IPv6 address to an interface. + .B "del addr/prefixlen" + Remove an IPv6 address from an interface. + .TP +-.B "tunnel aa.bb.cc.dd" ++.B "tunnel ::aa.bb.cc.dd" + Create a new SIT (IPv6-in-IPv4) device, tunnelling to the given destination. + .TP + .B "irq addr" diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-mii-gigabit.patch b/pkgs/core/net-tools/patches/net-tools-1.60-mii-gigabit.patch new file mode 100644 index 0000000..4c98cf3 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-mii-gigabit.patch @@ -0,0 +1,240 @@ +diff -up net-tools-1.60/mii-tool.c.mii-gigabit net-tools-1.60/mii-tool.c +--- net-tools-1.60/mii-tool.c.mii-gigabit 2010-06-14 15:51:23.000000000 +0200 ++++ net-tools-1.60/mii-tool.c 2010-06-14 16:10:34.000000000 +0200 +@@ -57,7 +57,7 @@ static char version[] = + #define LPA_ABILITY_MASK 0x07e0 + + /* Table of known MII's */ +-static struct { ++static const struct { + u_short id1, id2; + char *name; + } mii_id[] = { +@@ -76,6 +76,9 @@ static struct { + { 0x0181, 0x4410, "Quality QS6612" }, + { 0x0282, 0x1c50, "SMSC 83C180" }, + { 0x0300, 0xe540, "TDK 78Q2120" }, ++ { 0x0141, 0x0c20, "Yukon 88E1011" }, ++ { 0x0141, 0x0cc0, "Yukon-EC 88E1111" }, ++ { 0x0141, 0x0c90, "Yukon-2 88E1112" }, + }; + #define NMII (sizeof(mii_id)/sizeof(mii_id[0])) + +@@ -139,40 +142,47 @@ static void mdio_write(int skfd, int loc + + const struct { + char *name; +- u_short value; ++ u_short value[2]; + } media[] = { + /* The order through 100baseT4 matches bits in the BMSR */ +- { "10baseT-HD", LPA_10HALF }, +- { "10baseT-FD", LPA_10FULL }, +- { "100baseTx-HD", LPA_100HALF }, +- { "100baseTx-FD", LPA_100FULL }, +- { "100baseT4", LPA_100BASE4 }, +- { "100baseTx", LPA_100FULL | LPA_100HALF }, +- { "10baseT", LPA_10FULL | LPA_10HALF }, ++ { "10baseT-HD", {LPA_10HALF} }, ++ { "10baseT-FD", {LPA_10FULL} }, ++ { "100baseTx-HD", {LPA_100HALF} }, ++ { "100baseTx-FD", {LPA_100FULL} }, ++ { "100baseT4", {LPA_100BASE4} }, ++ { "100baseTx", {LPA_100FULL | LPA_100HALF} }, ++ { "10baseT", {LPA_10FULL | LPA_10HALF} }, ++ { "1000baseT-HD", {0, ADVERTISE_1000HALF} }, ++ { "1000baseT-FD", {0, ADVERTISE_1000FULL} }, ++ { "1000baseT", {0, ADVERTISE_1000HALF|ADVERTISE_1000FULL} }, + }; + #define NMEDIA (sizeof(media)/sizeof(media[0])) + + /* Parse an argument list of media types */ +-static int parse_media(char *arg) ++static int parse_media(char *arg, unsigned *bmcr2) + { + int mask, i; + char *s; + mask = strtoul(arg, &s, 16); + if ((*arg != '\0') && (*s == '\0')) { +- if ((mask & LPA_ABILITY_MASK) && +- !(mask & ~LPA_ABILITY_MASK)) +- return mask; +- goto failed; +- } else { +- mask = 0; +- s = strtok(arg, ", "); +- do { +- for (i = 0; i < NMEDIA; i++) +- if (strcasecmp(media[i].name, s) == 0) break; +- if (i == NMEDIA) goto failed; +- mask |= media[i].value; +- } while ((s = strtok(NULL, ", ")) != NULL); +- } ++ if ((mask & LPA_ABILITY_MASK) && ++ !(mask & ~LPA_ABILITY_MASK)) { ++ *bmcr2 = 0; ++ return mask; ++ } ++ goto failed; ++ } ++ mask = 0; ++ *bmcr2 = 0; ++ s = strtok(arg, ", "); ++ do { ++ for (i = 0; i < NMEDIA; i++) ++ if (s && strcasecmp(media[i].name, s) == 0) break; ++ if (i == NMEDIA) goto failed; ++ mask |= media[i].value[0]; ++ *bmcr2 |= media[i].value[1]; ++ } while ((s = strtok(NULL, ", ")) != NULL); ++ + return mask; + failed: + fprintf(stderr, "Invalid media specification '%s'.\n", arg); +@@ -181,11 +191,25 @@ failed: + + /*--------------------------------------------------------------------*/ + +-static char *media_list(int mask, int best) ++static const char *media_list(unsigned mask, unsigned mask2, int best) + { + static char buf[100]; + int i; + *buf = '\0'; ++ ++ if (mask & BMCR_SPEED1000) { ++ if (mask2 & ADVERTISE_1000HALF) { ++ strcat(buf, " "); ++ strcat(buf, "1000baseT-HD"); ++ if (best) goto out; ++ } ++ if (mask2 & ADVERTISE_1000FULL) { ++ strcat(buf, " "); ++ strcat(buf, "1000baseT-FD"); ++ if (best) goto out; ++ } ++ } ++ + mask >>= 5; + for (i = 4; i >= 0; i--) { + if (mask & (1<<i)) { +@@ -194,6 +218,7 @@ static char *media_list(int mask, int be + if (best) break; + } + } ++out: + if (mask & (1<<5)) + strcat(buf, " flow-control"); + return buf; +@@ -203,11 +228,11 @@ int show_basic_mii(int sock, int phy_id) + { + char buf[100]; + int i, mii_val[32]; +- int bmcr, bmsr, advert, lkpar; ++ unsigned bmcr, bmsr, advert, lkpar, bmcr2, lpa2; + /* Some bits in the BMSR are latched, but we can't rely on being + the only reader, so only the current values are meaningful */ + mdio_read(sock, MII_BMSR); +- for (i = 0; i < ((verbose > 1) ? 32 : 8); i++) { ++ for (i = 0; i < ((verbose > 1) ? 32 : (MII_STAT1000+1)); i++) { + if ((i == MII_BMCR) || (i == MII_BMSR) || (i == MII_PHYSID1) || + (i == MII_PHYSID2) || (i == MII_ADVERTISE) || (i == MII_LPA) || + (i == MII_EXPANSION) || (i == MII_CTRL1000) || (i == MII_STAT1000) || +@@ -220,7 +245,7 @@ int show_basic_mii(int sock, int phy_id) + else + mii_val[i] = 0; + } +- if (mii_val[MII_BMCR] == 0xffff) { ++ if (mii_val[MII_BMCR] == 0xffff || mii_val[MII_BMSR] == 0x0000) { + fprintf(stderr, " No MII transceiver present!.\n"); + return -1; + } +@@ -228,6 +253,7 @@ int show_basic_mii(int sock, int phy_id) + /* Descriptive rename. */ + bmcr = mii_val[MII_BMCR]; bmsr = mii_val[MII_BMSR]; + advert = mii_val[MII_ADVERTISE]; lkpar = mii_val[MII_LPA]; ++ bmcr2 = mii_val[MII_CTRL1000]; lpa2 = mii_val[MII_STAT1000]; + + sprintf(buf, "%s: ", ifr.ifr_name); + if (bmcr & BMCR_ANENABLE) { +@@ -235,7 +261,7 @@ int show_basic_mii(int sock, int phy_id) + if (advert & lkpar) { + strcat(buf, (lkpar & LPA_LPACK) ? + "negotiated" : "no autonegotiation,"); +- strcat(buf, media_list(advert & lkpar, 1)); ++ strcat(buf, media_list(advert & lkpar, bmcr2 & lpa2>>2, 1)); + strcat(buf, ", "); + } else { + strcat(buf, "autonegotiation failed, "); +@@ -245,8 +271,10 @@ int show_basic_mii(int sock, int phy_id) + } + } else { + sprintf(buf+strlen(buf), "%s Mbit, %s duplex, ", +- (bmcr & BMCR_SPEED100) ? "100" : "10", +- (bmcr & BMCR_FULLDPLX) ? "full" : "half"); ++ ((bmcr2 & (ADVERTISE_1000HALF | ADVERTISE_1000FULL)) & lpa2 >> 2) ++ ? "1000" ++ : (bmcr & BMCR_SPEED100) ? "100" : "10", ++ (bmcr & BMCR_FULLDPLX) ? "full" : "half"); + } + strcat(buf, (bmsr & BMSR_LSTATUS) ? "link ok" : "no link"); + +@@ -307,10 +335,10 @@ int show_basic_mii(int sock, int phy_id) + if (bmsr & BMSR_RFAULT) + printf("remote fault, "); + printf((bmsr & BMSR_LSTATUS) ? "link ok" : "no link"); +- printf("\n capabilities:%s", media_list(bmsr >> 6, 0)); +- printf("\n advertising: %s", media_list(advert, 0)); ++ printf("\n capabilities:%s", media_list(bmsr >> 6, bmcr2, 0)); ++ printf("\n advertising: %s", media_list(advert, lpa2 >> 2, 0)); + if (lkpar & LPA_ABILITY_MASK) +- printf("\n link partner:%s", media_list(lkpar, 0)); ++ printf("\n link partner:%s", media_list(lkpar, bmcr2, 0)); + printf("\n"); + } + fflush(stdout); +@@ -341,7 +369,7 @@ static int do_one_xcvr(int skfd, char *i + printf("resetting the transceiver...\n"); + mdio_write(skfd, MII_BMCR, BMCR_RESET); + } +- if (nway_advertise) { ++ if (nway_advertise > 0) { + mdio_write(skfd, MII_ADVERTISE, nway_advertise | 1); + opt_restart = 1; + } +@@ -400,18 +428,20 @@ usage: %s [-VvRrwl] [-A media,... | -F m + -l, --log with -w, write events to syslog\n\ + -A, --advertise=media,... advertise only specified media\n\ + -F, --force=media force specified media technology\n\ +-media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,\n\ ++media: 1000baseTx-HD, 1000baseTx-FD,\n\ ++ 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,\n\ + (to advertise both HD and FD) 100baseTx, 10baseT\n"; + + int main(int argc, char **argv) + { + int i, c, ret, errflag = 0; + char s[6]; +- ++ unsigned ctrl1000 = 0; ++ + while ((c = getopt_long(argc, argv, "A:F:p:lrRvVw?", longopts, 0)) != EOF) + switch (c) { +- case 'A': nway_advertise = parse_media(optarg); break; +- case 'F': fixed_speed = parse_media(optarg); break; ++ case 'A': nway_advertise = parse_media(optarg, &ctrl1000); break; ++ case 'F': fixed_speed = parse_media(optarg, &ctrl1000); break; + case 'p': override_phy = atoi(optarg); break; + case 'r': opt_restart++; break; + case 'R': opt_reset++; break; +@@ -423,6 +453,10 @@ int main(int argc, char **argv) + } + /* Check for a few inappropriate option combinations */ + if (opt_watch) verbose = 0; ++ ++ if ((nway_advertise < 0) || (fixed_speed < 0)) ++ return 2; ++ + if (errflag || (fixed_speed & (fixed_speed-1)) || + (fixed_speed && (opt_restart || nway_advertise))) { + fprintf(stderr, usage, argv[0]); diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-mii-refactor.patch b/pkgs/core/net-tools/patches/net-tools-1.60-mii-refactor.patch new file mode 100644 index 0000000..8f5a582 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-mii-refactor.patch @@ -0,0 +1,224 @@ +diff -up net-tools-1.60/mii-tool.c.mii-refactor net-tools-1.60/mii-tool.c +--- net-tools-1.60/mii-tool.c.mii-refactor 2009-10-30 16:25:23.000000000 +0100 ++++ net-tools-1.60/mii-tool.c 2009-10-30 16:45:01.000000000 +0100 +@@ -50,9 +50,11 @@ static char version[] = + #include <linux/if_arp.h> + #include <linux/if_ether.h> + #endif +-#include "mii.h" ++#include <linux/mii.h> ++#include <linux/sockios.h> + + #define MAX_ETH 8 /* Maximum # of interfaces */ ++#define LPA_ABILITY_MASK 0x07e0 + + /* Table of known MII's */ + static struct { +@@ -112,7 +114,7 @@ static struct ifreq ifr; + + static int mdio_read(int skfd, int location) + { +- struct mii_data *mii = (struct mii_data *)&ifr.ifr_data; ++ struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&ifr.ifr_data; + mii->reg_num = location; + if (ioctl(skfd, SIOCGMIIREG, &ifr) < 0) { + fprintf(stderr, "SIOCGMIIREG on %s failed: %s\n", ifr.ifr_name, +@@ -124,7 +126,7 @@ static int mdio_read(int skfd, int locat + + static void mdio_write(int skfd, int location, int value) + { +- struct mii_data *mii = (struct mii_data *)&ifr.ifr_data; ++ struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&ifr.ifr_data; + mii->reg_num = location; + mii->val_in = value; + if (ioctl(skfd, SIOCSMIIREG, &ifr) < 0) { +@@ -140,13 +142,13 @@ const struct { + u_short value; + } media[] = { + /* The order through 100baseT4 matches bits in the BMSR */ +- { "10baseT-HD", MII_AN_10BASET_HD }, +- { "10baseT-FD", MII_AN_10BASET_FD }, +- { "100baseTx-HD", MII_AN_100BASETX_HD }, +- { "100baseTx-FD", MII_AN_100BASETX_FD }, +- { "100baseT4", MII_AN_100BASET4 }, +- { "100baseTx", MII_AN_100BASETX_FD | MII_AN_100BASETX_HD }, +- { "10baseT", MII_AN_10BASET_FD | MII_AN_10BASET_HD }, ++ { "10baseT-HD", LPA_10HALF }, ++ { "10baseT-FD", LPA_10FULL }, ++ { "100baseTx-HD", LPA_100HALF }, ++ { "100baseTx-FD", LPA_100FULL }, ++ { "100baseT4", LPA_100BASE4 }, ++ { "100baseTx", LPA_100FULL | LPA_100HALF }, ++ { "10baseT", LPA_10FULL | LPA_10HALF }, + }; + #define NMEDIA (sizeof(media)/sizeof(media[0])) + +@@ -157,8 +159,8 @@ static int parse_media(char *arg) + char *s; + mask = strtoul(arg, &s, 16); + if ((*arg != '\0') && (*s == '\0')) { +- if ((mask & MII_AN_ABILITY_MASK) && +- !(mask & ~MII_AN_ABILITY_MASK)) ++ if ((mask & LPA_ABILITY_MASK) && ++ !(mask & ~LPA_ABILITY_MASK)) + return mask; + goto failed; + } else { +@@ -202,13 +204,22 @@ int show_basic_mii(int sock, int phy_id) + char buf[100]; + int i, mii_val[32]; + int bmcr, bmsr, advert, lkpar; +- + /* Some bits in the BMSR are latched, but we can't rely on being + the only reader, so only the current values are meaningful */ + mdio_read(sock, MII_BMSR); +- for (i = 0; i < ((verbose > 1) ? 32 : 8); i++) +- mii_val[i] = mdio_read(sock, i); +- ++ for (i = 0; i < ((verbose > 1) ? 32 : 8); i++) { ++ if ((i == MII_BMCR) || (i == MII_BMSR) || (i == MII_PHYSID1) || ++ (i == MII_PHYSID2) || (i == MII_ADVERTISE) || (i == MII_LPA) || ++ (i == MII_EXPANSION) || (i == MII_CTRL1000) || (i == MII_STAT1000) || ++ (i == MII_ESTATUS) || (i == MII_DCOUNTER) || (i == MII_FCSCOUNTER) || ++ (i == MII_NWAYTEST) || (i == MII_RERRCOUNTER) || ++ (i == MII_SREVISION) || (i == MII_RESV1) || (i == MII_LBRERROR) || ++ (i == MII_PHYADDR) || (i == MII_RESV2) || ++ (i == MII_TPISTATUS) || (i == MII_NCONFIG)) ++ mii_val[i] = mdio_read(sock, i); ++ else ++ mii_val[i] = 0; ++ } + if (mii_val[MII_BMCR] == 0xffff) { + fprintf(stderr, " No MII transceiver present!.\n"); + return -1; +@@ -216,28 +227,28 @@ int show_basic_mii(int sock, int phy_id) + + /* Descriptive rename. */ + bmcr = mii_val[MII_BMCR]; bmsr = mii_val[MII_BMSR]; +- advert = mii_val[MII_ANAR]; lkpar = mii_val[MII_ANLPAR]; ++ advert = mii_val[MII_ADVERTISE]; lkpar = mii_val[MII_LPA]; + + sprintf(buf, "%s: ", ifr.ifr_name); +- if (bmcr & MII_BMCR_AN_ENA) { +- if (bmsr & MII_BMSR_AN_COMPLETE) { ++ if (bmcr & BMCR_ANENABLE) { ++ if (bmsr & BMSR_ANEGCOMPLETE) { + if (advert & lkpar) { +- strcat(buf, (lkpar & MII_AN_ACK) ? ++ strcat(buf, (lkpar & LPA_LPACK) ? + "negotiated" : "no autonegotiation,"); + strcat(buf, media_list(advert & lkpar, 1)); + strcat(buf, ", "); + } else { + strcat(buf, "autonegotiation failed, "); + } +- } else if (bmcr & MII_BMCR_RESTART) { ++ } else if (bmcr & BMCR_ANRESTART) { + strcat(buf, "autonegotiation restarted, "); + } + } else { + sprintf(buf+strlen(buf), "%s Mbit, %s duplex, ", +- (bmcr & MII_BMCR_100MBIT) ? "100" : "10", +- (bmcr & MII_BMCR_DUPLEX) ? "full" : "half"); ++ (bmcr & BMCR_SPEED100) ? "100" : "10", ++ (bmcr & BMCR_FULLDPLX) ? "full" : "half"); + } +- strcat(buf, (bmsr & MII_BMSR_LINK_VALID) ? "link ok" : "no link"); ++ strcat(buf, (bmsr & BMSR_LSTATUS) ? "link ok" : "no link"); + + if (opt_watch) { + if (opt_log) { +@@ -273,32 +284,32 @@ int show_basic_mii(int sock, int phy_id) + ((mii_val[2]<<6)|(mii_val[3]>>10))&0xff, + (mii_val[3]>>4)&0x3f, mii_val[3]&0x0f); + printf(" basic mode: "); +- if (bmcr & MII_BMCR_RESET) ++ if (bmcr & BMCR_RESET) + printf("software reset, "); +- if (bmcr & MII_BMCR_LOOPBACK) ++ if (bmcr & BMCR_LOOPBACK) + printf("loopback, "); +- if (bmcr & MII_BMCR_ISOLATE) ++ if (bmcr & BMCR_ISOLATE) + printf("isolate, "); +- if (bmcr & MII_BMCR_COLTEST) ++ if (bmcr & BMCR_CTST) + printf("collision test, "); +- if (bmcr & MII_BMCR_AN_ENA) { ++ if (bmcr & BMCR_ANENABLE) { + printf("autonegotiation enabled\n"); + } else { + printf("%s Mbit, %s duplex\n", +- (bmcr & MII_BMCR_100MBIT) ? "100" : "10", +- (bmcr & MII_BMCR_DUPLEX) ? "full" : "half"); ++ (bmcr & BMCR_SPEED100) ? "100" : "10", ++ (bmcr & BMCR_FULLDPLX) ? "full" : "half"); + } + printf(" basic status: "); +- if (bmsr & MII_BMSR_AN_COMPLETE) ++ if (bmsr & BMSR_ANEGCOMPLETE) + printf("autonegotiation complete, "); +- else if (bmcr & MII_BMCR_RESTART) ++ else if (bmcr & BMCR_ANRESTART) + printf("autonegotiation restarted, "); +- if (bmsr & MII_BMSR_REMOTE_FAULT) ++ if (bmsr & BMSR_RFAULT) + printf("remote fault, "); +- printf((bmsr & MII_BMSR_LINK_VALID) ? "link ok" : "no link"); ++ printf((bmsr & BMSR_LSTATUS) ? "link ok" : "no link"); + printf("\n capabilities:%s", media_list(bmsr >> 6, 0)); + printf("\n advertising: %s", media_list(advert, 0)); +- if (lkpar & MII_AN_ABILITY_MASK) ++ if (lkpar & LPA_ABILITY_MASK) + printf("\n link partner:%s", media_list(lkpar, 0)); + printf("\n"); + } +@@ -310,7 +321,7 @@ int show_basic_mii(int sock, int phy_id) + + static int do_one_xcvr(int skfd, char *ifname, int maybe) + { +- struct mii_data *mii = (struct mii_data *)&ifr.ifr_data; ++ struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&ifr.ifr_data; + + /* Get the vitals from the interface. */ + strncpy(ifr.ifr_name, ifname, IFNAMSIZ); +@@ -328,23 +339,23 @@ static int do_one_xcvr(int skfd, char *i + + if (opt_reset) { + printf("resetting the transceiver...\n"); +- mdio_write(skfd, MII_BMCR, MII_BMCR_RESET); ++ mdio_write(skfd, MII_BMCR, BMCR_RESET); + } + if (nway_advertise) { +- mdio_write(skfd, MII_ANAR, nway_advertise | 1); ++ mdio_write(skfd, MII_ADVERTISE, nway_advertise | 1); + opt_restart = 1; + } + if (opt_restart) { + printf("restarting autonegotiation...\n"); + mdio_write(skfd, MII_BMCR, 0x0000); +- mdio_write(skfd, MII_BMCR, MII_BMCR_AN_ENA|MII_BMCR_RESTART); ++ mdio_write(skfd, MII_BMCR, BMCR_ANENABLE|BMCR_ANRESTART); + } + if (fixed_speed) { + int bmcr = 0; +- if (fixed_speed & (MII_AN_100BASETX_FD|MII_AN_100BASETX_HD)) +- bmcr |= MII_BMCR_100MBIT; +- if (fixed_speed & (MII_AN_100BASETX_FD|MII_AN_10BASET_FD)) +- bmcr |= MII_BMCR_DUPLEX; ++ if (fixed_speed & (LPA_100FULL|LPA_100HALF)) ++ bmcr |= BMCR_SPEED100; ++ if (fixed_speed & (LPA_100FULL|LPA_10FULL)) ++ bmcr |= BMCR_FULLDPLX; + mdio_write(skfd, MII_BMCR, bmcr); + } + +@@ -358,7 +369,7 @@ static int do_one_xcvr(int skfd, char *i + + static void watch_one_xcvr(int skfd, char *ifname, int index) + { +- struct mii_data *mii = (struct mii_data *)&ifr.ifr_data; ++ struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&ifr.ifr_data; + static int status[MAX_ETH] = { 0, /* ... */ }; + int now; + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-mii-tool-obsolete.patch b/pkgs/core/net-tools/patches/net-tools-1.60-mii-tool-obsolete.patch new file mode 100644 index 0000000..efb7f27 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-mii-tool-obsolete.patch @@ -0,0 +1,25 @@ +--- net-tools-1.60/man/en_US/mii-tool.8.obsolete 2000-05-21 16:21:38.000000000 +0200 ++++ net-tools-1.60/man/en_US/mii-tool.8 2004-11-11 10:45:51.155113000 +0100 +@@ -18,6 +18,12 @@ + [\fB-F\fR, \fB--force=\fImedia\fR] + .RI [ "interface\ ..." ] + ++.SH NOTE ++.P ++This program is obsolete. Valid media are only \fB100baseT4\fR, ++\fB100baseTx-FD\fR,\fB100baseTx-HD\fR, \fB10baseT-FD\fR and ++\fB10baseT-HD\fR ethernet cards. For replacement check \fBethtool\fB. ++ + .SH DESCRIPTION + This utility checks or sets the status of a network interface's Media + Independent Interface (MII) unit. Most fast ethernet adapters use an +@@ -72,6 +78,9 @@ + commas. Valid media are \fB100baseT4\fR, \fB100baseTx-FD\fR, + \fB100baseTx-HD\fR, \fB10baseT-FD\fR, and \fB10baseT-HD\fR. + ++.SH SEE ALSO ++ethtool(8) ++ + .SH AUTHORS + David Hinds - dhinds@pcmcia.sourceforge.org + .br diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-miiioctl.patch b/pkgs/core/net-tools/patches/net-tools-1.60-miiioctl.patch new file mode 100644 index 0000000..4859273 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-miiioctl.patch @@ -0,0 +1,17 @@ +--- net-tools-1.60/include/mii.h.bar Tue Jul 31 11:49:39 2001 ++++ net-tools-1.60/include/mii.h Tue Jul 31 11:49:33 2001 +@@ -11,11 +11,9 @@ + + /* network interface ioctl's for MII commands */ + #ifndef SIOCGMIIPHY +-#define SIOCGMIIPHY (SIOCDEVPRIVATE) /* Read from current PHY */ +-#define SIOCGMIIREG (SIOCDEVPRIVATE+1) /* Read any PHY register */ +-#define SIOCSMIIREG (SIOCDEVPRIVATE+2) /* Write any PHY register */ +-#define SIOCGPARAMS (SIOCDEVPRIVATE+3) /* Read operational parameters */ +-#define SIOCSPARAMS (SIOCDEVPRIVATE+4) /* Set operational parameters */ ++#define SIOCGMIIPHY 0x8947 /* Read from current PHY */ ++#define SIOCGMIIREG 0x8948 /* Read any PHY register */ ++#define SIOCSMIIREG 0x8949 /* Write any PHY register */ + #endif + + #include <linux/types.h> diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-nameif.patch b/pkgs/core/net-tools/patches/net-tools-1.60-nameif.patch new file mode 100644 index 0000000..7ba1f00 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-nameif.patch @@ -0,0 +1,67 @@ +--- net-tools-1.60/nameif.c.nameif 2000-10-18 19:26:29.000000000 +0200 ++++ net-tools-1.60/nameif.c 2003-03-19 11:02:01.000000000 +0100 +@@ -3,7 +3,7 @@ + * Writen 2000 by Andi Kleen. + * Subject to the Gnu Public License, version 2. + * TODO: make it support token ring etc. +- * $Id: nameif.c,v 1.1 2000/10/18 17:26:29 ak Exp $ ++ * $Id: nameif.c,v 1.3 2003/03/06 23:26:52 ecki Exp $ + */ + #ifndef _GNU_SOURCE + #define _GNU_SOURCE +@@ -117,7 +117,8 @@ + } + + struct change { +- struct change *next,**pprev; ++ struct change *next; ++ int found; + char ifname[IFNAMSIZ+1]; + unsigned char mac[6]; + }; +@@ -139,10 +140,7 @@ + ch->ifname, pos); + if (parsemac(p,ch->mac) < 0) + complain(_("cannot parse MAC `%s' at %s"), p, pos); +- if (clist) +- clist->pprev = &ch->next; + ch->next = clist; +- ch->pprev = &clist; + clist = ch; + return 0; + } +@@ -200,7 +198,7 @@ + + void usage(void) + { +- fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}")); ++ fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}\n")); + exit(1); + } + +@@ -277,21 +275,21 @@ + ch = lookupmac(mac); + if (!ch) + continue; +- +- *ch->pprev = ch->next; ++ ++ ch->found = 1; + if (strcmp(p, ch->ifname)) { + if (setname(p, ch->ifname) < 0) + complain(_("cannot change name of %s to %s: %s"), + p, ch->ifname, strerror(errno)); + } +- free(ch); + } + fclose(ifh); + + while (clist) { + struct change *ch = clist; + clist = clist->next; +- warning(_("interface '%s' not found"), ch->ifname); ++ if (!ch->found) ++ warning(_("interface '%s' not found"), ch->ifname); + free(ch); + } + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-nameif_strncpy.patch b/pkgs/core/net-tools/patches/net-tools-1.60-nameif_strncpy.patch new file mode 100644 index 0000000..7568e21 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-nameif_strncpy.patch @@ -0,0 +1,13 @@ +--- net-tools-1.60/nameif.c.ncpy 2006-10-03 14:24:21.000000000 +0200 ++++ net-tools-1.60/nameif.c 2006-10-03 14:22:43.000000000 +0200 +@@ -100,8 +100,8 @@ + struct ifreq ifr; + opensock(); + memset(&ifr,0,sizeof(struct ifreq)); +- strcpy(ifr.ifr_name, oldname); +- strcpy(ifr.ifr_newname, newname); ++ strncpy(ifr.ifr_name, oldname, IF_NAMESIZE); ++ strncpy(ifr.ifr_newname, newname, IF_NAMESIZE); + return ioctl(ctl_sk, SIOCSIFNAME, &ifr); + } + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-netdevice.patch b/pkgs/core/net-tools/patches/net-tools-1.60-netdevice.patch new file mode 100644 index 0000000..08bdb58 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-netdevice.patch @@ -0,0 +1,22 @@ +--- net-tools-1.60/lib/fddi.c.netdevice 2000-03-05 12:26:02.000000000 +0100 ++++ net-tools-1.60/lib/fddi.c 2006-05-09 11:19:51.000000000 +0200 +@@ -26,6 +26,8 @@ + #error "No FDDI Support in your current Kernelsource Tree." + #error "Disable HW Type FDDI" + #endif ++#include <linux/netdevice.h> ++#include <asm/byteorder.h> + #if __GLIBC__ >= 2 + #include <netinet/if_fddi.h> + #else +--- net-tools-1.60/lib/x25_sr.c.netdevice 2000-05-20 15:38:10.000000000 +0200 ++++ net-tools-1.60/lib/x25_sr.c 2006-05-09 11:20:15.000000000 +0200 +@@ -77,7 +77,7 @@ + rt.sigdigits=sigdigits; + + /* x25_route_struct.address isn't type struct sockaddr_x25, Why? */ +- memcpy(&rt.address, &sx25.sx25_addr, sizeof(x25_address)); ++ memcpy(&rt.address, &sx25.sx25_addr, sizeof(struct x25_address)); + + while (*args) { + if (!strcmp(*args,"device") || !strcmp(*args,"dev")) { diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-netmask.patch b/pkgs/core/net-tools/patches/net-tools-1.60-netmask.patch new file mode 100644 index 0000000..532898a --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-netmask.patch @@ -0,0 +1,61 @@ +--- net-tools-1.60/ifconfig.c.netmask 2001-04-13 20:25:18.000000000 +0200 ++++ net-tools-1.60/ifconfig.c 2004-11-02 15:31:56.454594456 +0100 +@@ -23,6 +23,7 @@ + * 20001008 - Bernd Eckenfels, Patch from RH for setting mtu + * (default AF was wrong) + * 20010404 - Arnaldo Carvalho de Melo, use setlocale ++ * 20040831 - Florin Malita fmalita@glenayre.com delayed CIDR netmask + */ + + #define DFLT_AF "inet" +@@ -227,13 +228,13 @@ + + int main(int argc, char **argv) + { +- struct sockaddr sa; ++ struct sockaddr sa, sa_netmask; + struct sockaddr_in sin; + char host[128]; + struct aftype *ap; + struct hwtype *hw; + struct ifreq ifr; +- int goterr = 0, didnetmask = 0; ++ int goterr = 0, didnetmask = 0, donetmask = 0; + char **spp; + int fd; + #if HAVE_AFINET6 +@@ -903,16 +904,16 @@ + /* FIXME: sa is too small for INET6 addresses, inet6 should use that too, + broadcast is unexpected */ + if (ap->getmask) { +- switch (ap->getmask(host, &sa, NULL)) { ++ switch (ap->getmask(host, &sa_netmask, NULL)) { + case -1: + usage(); + break; + case 1: + if (didnetmask) + usage(); +- +- goterr = set_netmask(skfd, &ifr, &sa); +- didnetmask++; ++ ++ /* delay setting the CIDR netmask till after setting the addr */ ++ donetmask = 1; + break; + } + } +@@ -960,6 +961,13 @@ + } + } + ++ /* set CIDR netmask */ ++ if (donetmask) { ++ donetmask = 0; ++ goterr = set_netmask(skfd, &ifr, &sa_netmask); ++ didnetmask++; ++ } ++ + /* + * Don't do the set_flag() if the address is an alias with a - at the + * end, since it's deleted already! - Roman diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-netstat-I-fix.patch b/pkgs/core/net-tools/patches/net-tools-1.60-netstat-I-fix.patch new file mode 100644 index 0000000..ab89201 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-netstat-I-fix.patch @@ -0,0 +1,10 @@ +--- net-tools-1.60/netstat.c.old 2006-10-02 12:03:49.000000000 +0200 ++++ net-tools-1.60/netstat.c 2006-10-02 12:02:12.000000000 +0200 +@@ -2233,6 +2233,7 @@ int main + break; + case 'I': + if (optarg && strcmp(optarg, "(null)")) ++ if (optarg[0] == '=') optarg++; + flag_int_name = strdup(optarg); + flag_int++; + break; diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-netstat-interfaces-crash.patch b/pkgs/core/net-tools/patches/net-tools-1.60-netstat-interfaces-crash.patch new file mode 100644 index 0000000..bb99932 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-netstat-interfaces-crash.patch @@ -0,0 +1,25 @@ +--- net-tools-1.60/netstat.c.old 2007-03-27 09:28:28.000000000 +0200 ++++ net-tools-1.60/netstat.c 2007-03-27 09:26:39.000000000 +0200 +@@ -2105,7 +2105,7 @@ + fprintf(stderr, _(" netstat { [-veenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s } [delay]\n\n")); + + fprintf(stderr, _(" -r, --route display routing table\n")); +- fprintf(stderr, _(" -I, --interfaces=[<Iface>] display interface table for <Iface>\n")); ++ fprintf(stderr, _(" -I, --interface=[<Iface>] display interface table for <Iface>\n")); + fprintf(stderr, _(" -i, --interfaces display interface table\n")); + fprintf(stderr, _(" -g, --groups display multicast group memberships\n")); + fprintf(stderr, _(" -s, --statistics display networking statistics (like SNMP)\n")); +@@ -2234,7 +2234,12 @@ + case 'I': + if (optarg && strcmp(optarg, "(null)")) + if (optarg[0] == '=') optarg++; +- flag_int_name = strdup(optarg); ++ if (optarg && strcmp(optarg, "(null)")) ++ flag_int_name = strdup(optarg); ++ else { ++ usage(); ++ exit(1); ++ } + flag_int++; + break; + case 'i': diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-netstat-leak.patch b/pkgs/core/net-tools/patches/net-tools-1.60-netstat-leak.patch new file mode 100644 index 0000000..6417f76 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-netstat-leak.patch @@ -0,0 +1,11 @@ +diff -up net-tools-1.60/netstat.c.netstat-leak net-tools-1.60/netstat.c +--- net-tools-1.60/netstat.c.netstat-leak 2010-09-16 10:49:49.000000000 +0200 ++++ net-tools-1.60/netstat.c 2010-09-16 10:53:47.000000000 +0200 +@@ -558,6 +558,7 @@ static void tcp_node_hash_clear(void) + } + + /* free the bucket itself */ ++ free(tcp_node_hash[i]->socket_pair); + free(tcp_node_hash[i]); + tcp_node_hash[i] = NULL; + } diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-netstat-probe.patch b/pkgs/core/net-tools/patches/net-tools-1.60-netstat-probe.patch new file mode 100644 index 0000000..d6d7342 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-netstat-probe.patch @@ -0,0 +1,15 @@ +diff -up net-tools-1.60/netstat.c.probe net-tools-1.60/netstat.c +--- net-tools-1.60/netstat.c.probe 2008-10-15 12:47:41.000000000 +0200 ++++ net-tools-1.60/netstat.c 2008-10-15 12:49:48.000000000 +0200 +@@ -1061,6 +1061,11 @@ static void tcp_do_one(int lnr, const ch + (double) time_len / HZ, retr, timeout); + break; + ++ case 4: ++ snprintf(timers, sizeof(timers), _("probe (%2.2f/%ld/%d)"), ++ (double) time_len / HZ, retr, timeout); ++ break; ++ + default: + snprintf(timers, sizeof(timers), _("unkn-%d (%2.2f/%ld/%d)"), + timer_run, (double) time_len / HZ, retr, timeout); diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-netstat_inode.patch b/pkgs/core/net-tools/patches/net-tools-1.60-netstat_inode.patch new file mode 100644 index 0000000..4bce9a8 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-netstat_inode.patch @@ -0,0 +1,186 @@ +--- net-tools-1.60/netstat.c.inode 2006-02-23 09:28:23.000000000 +0100 ++++ net-tools-1.60/netstat.c 2006-02-23 09:33:57.000000000 +0100 +@@ -231,7 +231,7 @@ + + static struct prg_node { + struct prg_node *next; +- int inode; ++ unsigned long inode; + char name[PROGNAME_WIDTH]; + char scon[SELINUX_WIDTH]; + } *prg_hash[PRG_HASH_SIZE]; +@@ -268,7 +268,7 @@ + /* NOT working as of glibc-2.0.7: */ + #undef DIRENT_HAVE_D_TYPE_WORKS + +-static void prg_cache_add(int inode, char *name, char *scon) ++static void prg_cache_add(unsigned long inode, char *name, char *scon) + { + unsigned hi = PRG_HASHIT(inode); + struct prg_node **pnp,*pn; +@@ -332,15 +332,16 @@ + prg_cache_loaded=0; + } + +-static void extract_type_1_socket_inode(const char lname[], long * inode_p) { ++static void extract_type_1_socket_inode(const char lname[], unsigned long * inode_p, int * status) { + + /* If lname is of the form "socket:[12345]", extract the "12345" +- as *inode_p. Otherwise, return -1 as *inode_p. ++ as *inode_p. Otherwise, return -1 as *status. + */ + +- if (strlen(lname) < PRG_SOCKET_PFXl+3) *inode_p = -1; +- else if (memcmp(lname, PRG_SOCKET_PFX, PRG_SOCKET_PFXl)) *inode_p = -1; +- else if (lname[strlen(lname)-1] != ']') *inode_p = -1; ++ *status = 0; ++ if (strlen(lname) < PRG_SOCKET_PFXl+3) *status = -1; ++ else if (memcmp(lname, PRG_SOCKET_PFX, PRG_SOCKET_PFXl)) *status = -1; ++ else if (lname[strlen(lname)-1] != ']') *status = -1; + else { + char inode_str[strlen(lname + 1)]; /* e.g. "12345" */ + const int inode_str_len = strlen(lname) - PRG_SOCKET_PFXl - 1; +@@ -348,28 +349,30 @@ + + strncpy(inode_str, lname+PRG_SOCKET_PFXl, inode_str_len); + inode_str[inode_str_len] = '\0'; +- *inode_p = strtol(inode_str,&serr,0); +- if (!serr || *serr || *inode_p < 0 || *inode_p >= INT_MAX) +- *inode_p = -1; ++ errno = 0; ++ *inode_p = strtoul(inode_str,&serr,0); ++ if (!serr || *serr || errno) ++ *status = -1; + } + } + + + +-static void extract_type_2_socket_inode(const char lname[], long * inode_p) { ++static void extract_type_2_socket_inode(const char lname[], unsigned long * inode_p, int * status) { + + /* If lname is of the form "[0000]:12345", extract the "12345" +- as *inode_p. Otherwise, return -1 as *inode_p. ++ as *inode_p. Otherwise, return -1 as *status. + */ + +- if (strlen(lname) < PRG_SOCKET_PFX2l+1) *inode_p = -1; +- else if (memcmp(lname, PRG_SOCKET_PFX2, PRG_SOCKET_PFX2l)) *inode_p = -1; ++ if (strlen(lname) < PRG_SOCKET_PFX2l+1) *status = -1; ++ else if (memcmp(lname, PRG_SOCKET_PFX2, PRG_SOCKET_PFX2l)) *status = -1; + else { + char *serr; + +- *inode_p=strtol(lname + PRG_SOCKET_PFX2l,&serr,0); +- if (!serr || *serr || *inode_p < 0 || *inode_p >= INT_MAX) +- *inode_p = -1; ++ errno = 0; ++ *inode_p=strtoul(lname + PRG_SOCKET_PFX2l,&serr,0); ++ if (!serr || *serr || errno) ++ *status = -1; + } + } + +@@ -380,11 +383,12 @@ + char line[LINE_MAX],eacces=0; + int procfdlen,fd,cmdllen,lnamelen; + char lname[30],cmdlbuf[512],finbuf[PROGNAME_WIDTH]; +- long inode; ++ unsigned long inode; + const char *cs,*cmdlp; + DIR *dirproc=NULL,*dirfd=NULL; + struct dirent *direproc,*direfd; + security_context_t scon=NULL; ++ int status; + + if (prg_cache_loaded || !flag_prg) return; + prg_cache_loaded=1; +@@ -424,11 +428,11 @@ + lnamelen=readlink(line,lname,sizeof(lname)-1); + lname[lnamelen] = '\0'; /*make it a null-terminated string*/ + +- extract_type_1_socket_inode(lname, &inode); ++ extract_type_1_socket_inode(lname, &inode, &status); + +- if (inode < 0) extract_type_2_socket_inode(lname, &inode); ++ if (status < 0) extract_type_2_socket_inode(lname, &inode, &status); + +- if (inode < 0) continue; ++ if (status < 0) continue; + + if (!cmdlp) { + if (procfdlen - PATH_FD_SUFFl + PATH_CMDLINEl >= +@@ -732,7 +736,7 @@ + printf("%-10s ", pw->pw_name); + else + printf("%-10d ", uid); +- printf("%-10ld ",inode); ++ printf("%-10lu ",inode); + } + if (flag_prg) + printf("%-" PROGNAME_WIDTHs "s",prg_cache_get(inode)); +@@ -921,7 +925,7 @@ + return; + + num = sscanf(line, +- "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %ld %512s\n", ++ "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %lu %512s\n", + &d, local_addr, &local_port, rem_addr, &rem_port, &state, + &txq, &rxq, &timer_run, &time_len, &retr, &uid, &timeout, &inode, more); + +@@ -1064,7 +1068,7 @@ + + more[0] = '\0'; + num = sscanf(line, +- "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %ld %512s\n", ++ "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %lu %512s\n", + &d, local_addr, &local_port, + rem_addr, &rem_port, &state, + &txq, &rxq, &timer_run, &time_len, &retr, &uid, &timeout, &inode, more); +@@ -1206,7 +1210,7 @@ + + more[0] = '\0'; + num = sscanf(line, +- "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %ld %512s\n", ++ "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %lu %512s\n", + &d, local_addr, &local_port, rem_addr, &rem_port, &state, + &txq, &rxq, &timer_run, &time_len, &retr, &uid, &timeout, &inode, more); + +@@ -1320,9 +1324,9 @@ + static int has = 0; + char path[MAXPATHLEN], ss_flags[32]; + char *ss_proto, *ss_state, *ss_type; +- int num, state, type, inode; ++ int num, state, type; + void *d; +- unsigned long refcnt, proto, flags; ++ unsigned long refcnt, proto, flags, inode; + + if (nr == 0) { + if (strstr(line, "Inode")) +@@ -1330,14 +1334,14 @@ + return; + } + path[0] = '\0'; +- num = sscanf(line, "%p: %lX %lX %lX %X %X %d %s", ++ num = sscanf(line, "%p: %lX %lX %lX %X %X %lu %s", + &d, &refcnt, &proto, &flags, &type, &state, &inode, path); + if (num < 6) { + fprintf(stderr, _("warning, got bogus unix line.\n")); + return; + } + if (!(has & HAS_INODE)) +- snprintf(path,sizeof(path),"%d",inode); ++ snprintf(path,sizeof(path),"%lu",inode); + + if (!flag_all) { + if ((state == SS_UNCONNECTED) && (flags & SO_ACCEPTCON)) { +@@ -1429,7 +1433,7 @@ + printf("%-5s %-6ld %-11s %-10s %-13s ", + ss_proto, refcnt, ss_flags, ss_type, ss_state); + if (has & HAS_INODE) +- printf("%-6d ",inode); ++ printf("%-6lu ",inode); + else + printf("- "); + if (flag_prg) diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-netstat_stop_trim.patch b/pkgs/core/net-tools/patches/net-tools-1.60-netstat_stop_trim.patch new file mode 100644 index 0000000..fcffcaa --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-netstat_stop_trim.patch @@ -0,0 +1,91 @@ +--- net-tools-1.60/man/en_US/netstat.8.old 2006-02-10 11:18:11.000000000 +0100 ++++ net-tools-1.60/man/en_US/netstat.8 2006-02-10 11:22:19.000000000 +0100 +@@ -176,6 +176,10 @@ + Print routing information from the FIB. (This is the default.) + .SS "-C" + Print routing information from the route cache. ++.SS "-Z --context" ++If SELinux enabled print SELinux context. ++.SS "-T --notrim" ++Stop trimming long addresses. + .SS delay + Netstat will cycle printing through statistics every + .B delay +--- net-tools-1.60/netstat.c.old 2006-02-10 11:18:12.000000000 +0100 ++++ net-tools-1.60/netstat.c 2006-02-10 11:13:50.000000000 +0100 +@@ -157,6 +157,9 @@ + int flag_arg = 0; + int flag_ver = 0; + int flag_selinux = 0; ++int flag_trim = 0; ++ ++ + + FILE *procinfo; + +@@ -980,16 +983,20 @@ + get_sname(htons(local_port), "tcp", + flag_not & FLAG_NUM_PORT)); + +- if ((strlen(local_addr) + strlen(buffer)) >= 27) +- local_addr[27 - strlen(buffer) - 1] = '\0'; ++ if (!flag_trim) { ++ if ((strlen(local_addr) + strlen(buffer)) >= 27) ++ local_addr[27 - strlen(buffer) - 1] = '\0'; ++ } + + strcat(local_addr, ":"); + strncat(local_addr, buffer, sizeof(local_addr)-strlen(local_addr)-1); + snprintf(buffer, sizeof(buffer), "%s", + get_sname(htons(rem_port), "tcp", flag_not & FLAG_NUM_PORT)); +- +- if ((strlen(rem_addr) + strlen(buffer)) >= 27) +- rem_addr[27 - strlen(buffer) - 1] = '\0'; ++ ++ if (!flag_trim) { ++ if ((strlen(rem_addr) + strlen(buffer)) >= 27) ++ rem_addr[27 - strlen(buffer) - 1] = '\0'; ++ } + + strcat(rem_addr, ":"); + strncat(rem_addr, buffer, sizeof(rem_addr)-strlen(rem_addr)-1); +@@ -1776,6 +1783,7 @@ + {"fib", 0, 0, 'F'}, + {"groups", 0, 0, 'g'}, + {"context", 0, 0, 'Z'}, ++ {"notrim", 0, 0, 'T'}, + {NULL, 0, 0, 0} + }; + +@@ -1788,7 +1796,7 @@ + + afname[0] = '\0'; + +- while ((i = getopt_long(argc, argv, "MCFA:acdegphiI::nNorstuVv?wxlZ", longopts, &lop)) != EOF) ++ while ((i = getopt_long(argc, argv, "MCFA:acdegphiI::nNorstuVv?wxlZT", longopts, &lop)) != EOF) + switch (i) { + case -1: + break; +@@ -1904,6 +1912,10 @@ + usage(); + case 's': + flag_sta++; ++ break; ++ case 'T': ++ flag_trim++; ++ break; + } + + if(argc == optind + 1) { +--- net-tools-1.60/netstat.c.trim2 2006-04-06 16:12:02.000000000 +0200 ++++ net-tools-1.60/netstat.c 2006-04-06 16:18:09.000000000 +0200 +@@ -1737,7 +1737,8 @@ + fprintf(stderr, _(" -a, --all, --listening display all sockets (default: connected)\n")); + fprintf(stderr, _(" -o, --timers display timers\n")); + fprintf(stderr, _(" -F, --fib display Forwarding Information Base (default)\n")); +- fprintf(stderr, _(" -C, --cache display routing cache instead of FIB\n\n")); ++ fprintf(stderr, _(" -C, --cache display routing cache instead of FIB\n")); ++ fprintf(stderr, _(" -T, --notrim stop trimming long addresses\n")); + fprintf(stderr, _(" -Z, --context display SELinux security context for sockets\n\n")); + + fprintf(stderr, _(" <Iface>: Name of interface to monitor/list.\n")); diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-netstat_ulong.patch b/pkgs/core/net-tools/patches/net-tools-1.60-netstat_ulong.patch new file mode 100644 index 0000000..56869dc --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-netstat_ulong.patch @@ -0,0 +1,11 @@ +--- net-tools-1.60/netstat.c.netstat_ulong 2004-11-11 14:28:44.000000000 +0100 ++++ net-tools-1.60/netstat.c 2004-11-11 14:31:14.099313000 +0100 +@@ -273,7 +273,7 @@ + strcpy(pn->name,name); + } + +-static const char *prg_cache_get(int inode) ++static const char *prg_cache_get(unsigned long inode) + { + unsigned hi=PRG_HASHIT(inode); + struct prg_node *pn; diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-note.patch b/pkgs/core/net-tools/patches/net-tools-1.60-note.patch new file mode 100644 index 0000000..4853ccd --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-note.patch @@ -0,0 +1,13 @@ +--- net-tools-1.60/man/en_US/hostname.1.note 2004-11-24 12:09:28.000000000 +0100 ++++ net-tools-1.60/man/en_US/hostname.1 2004-11-24 12:16:41.121050760 +0100 +@@ -191,6 +191,10 @@ + ) then root can also set a new NIS domain. + .SH FILES + .B /etc/hosts ++.B /etc/sysconfig/network ++.SH NOTE ++Note that hostname doesn't change anything permanently. After reboot ++original names from \fI/etc/hosts\fR are used again. + .SH AUTHOR + Peter Tobias, tobias@et-inf.fho-emden.de + .br diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-num-ports.patch b/pkgs/core/net-tools/patches/net-tools-1.60-num-ports.patch new file mode 100644 index 0000000..d83cfc5 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-num-ports.patch @@ -0,0 +1,78 @@ +--- net-tools-1.60/netstat.c.num-ports 2004-11-24 12:19:24.000000000 +0100 ++++ net-tools-1.60/netstat.c 2004-11-25 16:00:45.208367104 +0100 +@@ -765,8 +765,8 @@ + txq = 0L; + } + safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, +- flag_not), sizeof(local_addr)); +- safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, flag_not), ++ flag_not & FLAG_NUM_HOST), sizeof(local_addr)); ++ safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, flag_not & FLAG_NUM_HOST), + sizeof(rem_addr)); + if (flag_all || (flag_lst && !rem_port) || (!flag_lst && rem_port)) { + snprintf(buffer, sizeof(buffer), "%s", +@@ -921,11 +921,11 @@ + if (flag_all || (notnull(remaddr) && !flag_lst) || (!notnull(remaddr) && flag_lst)) + { + safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, +- flag_not), sizeof(local_addr)); ++ flag_not & FLAG_NUM_HOST), sizeof(local_addr)); + snprintf(buffer, sizeof(buffer), "%s", + get_sname(htons(local_port), "udp", + flag_not & FLAG_NUM_PORT)); +- if ((strlen(local_addr) + strlen(buffer)) > 22) ++ if ((strlen(local_addr) + strlen(buffer)) >= 27) + local_addr[22 - strlen(buffer)] = '\0'; + strcat(local_addr, ":"); + strncat(local_addr, buffer, sizeof(local_addr)-strlen(local_addr)-1); +@@ -934,8 +934,8 @@ + snprintf(buffer, sizeof(buffer), "%s", + get_sname(htons(rem_port), "udp", flag_not & FLAG_NUM_PORT)); + safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, +- flag_not), sizeof(rem_addr)); +- if ((strlen(rem_addr) + strlen(buffer)) > 22) ++ flag_not & FLAG_NUM_HOST), sizeof(rem_addr)); ++ if ((strlen(rem_addr) + strlen(buffer)) >= 27) + rem_addr[22 - strlen(buffer)] = '\0'; + strcat(rem_addr, ":"); + strncat(rem_addr, buffer, sizeof(rem_addr)-strlen(rem_addr)-1); +@@ -958,7 +958,7 @@ + retr, timeout); + break; + } +- printf("udp %6ld %6ld %-23s %-23s %-12s", ++ printf("udp %6ld %6ld %-27s %-27s %-12s", + rxq, txq, local_addr, rem_addr, udp_state); + + finish_this_one(uid,inode,timers); +@@ -1045,8 +1045,8 @@ + get_sname(htons(local_port), "raw", + flag_not & FLAG_NUM_PORT)); + safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, +- flag_not), sizeof(local_addr)); +- if ((strlen(local_addr) + strlen(buffer)) > 22) ++ flag_not & FLAG_NUM_HOST), sizeof(local_addr)); ++ if ((strlen(local_addr) + strlen(buffer)) >= 27) + local_addr[22 - strlen(buffer)] = '\0'; + strcat(local_addr, ":"); + strncat(local_addr, buffer, sizeof(local_addr)-strlen(local_addr)-1); +@@ -1055,8 +1055,8 @@ + snprintf(buffer, sizeof(buffer), "%s", + get_sname(htons(rem_port), "raw", flag_not & FLAG_NUM_PORT)); + safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, +- flag_not), sizeof(rem_addr)); +- if ((strlen(rem_addr) + strlen(buffer)) > 22) ++ flag_not & FLAG_NUM_HOST), sizeof(rem_addr)); ++ if ((strlen(rem_addr) + strlen(buffer)) >= 27) + rem_addr[22 - strlen(buffer)] = '\0'; + strcat(rem_addr, ":"); + strncat(rem_addr, buffer, sizeof(rem_addr)-strlen(rem_addr)-1); +@@ -1081,7 +1081,7 @@ + retr, timeout); + break; + } +- printf("raw %6ld %6ld %-23s %-23s %-12d", ++ printf("raw %6ld %6ld %-27s %-27s %-12d", + rxq, txq, local_addr, rem_addr, state); + + finish_this_one(uid,inode,timers); diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-overflow.patch b/pkgs/core/net-tools/patches/net-tools-1.60-overflow.patch new file mode 100644 index 0000000..d7b82b1 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-overflow.patch @@ -0,0 +1,57 @@ +diff -up net-tools-1.60/netstat.c.overflow net-tools-1.60/netstat.c +--- net-tools-1.60/netstat.c.overflow 2010-01-02 10:45:45.000000000 +0100 ++++ net-tools-1.60/netstat.c 2010-01-02 10:50:50.000000000 +0100 +@@ -777,7 +777,7 @@ static void tcp_do_one(int lnr, const ch + local_addr[22 - strlen(buffer)] = '\0'; + + strcat(local_addr, ":"); +- strcat(local_addr, buffer); ++ strncat(local_addr, buffer, sizeof(local_addr)-strlen(local_addr)-1); + snprintf(buffer, sizeof(buffer), "%s", + get_sname(htons(rem_port), "tcp", flag_not & FLAG_NUM_PORT)); + +@@ -785,7 +785,7 @@ static void tcp_do_one(int lnr, const ch + rem_addr[22 - strlen(buffer)] = '\0'; + + strcat(rem_addr, ":"); +- strcat(rem_addr, buffer); ++ strncat(rem_addr, buffer, sizeof(rem_addr)-strlen(rem_addr)-1); + timers[0] = '\0'; + + if (flag_opt) +@@ -926,7 +926,7 @@ static void udp_do_one(int lnr, const ch + if ((strlen(local_addr) + strlen(buffer)) > 22) + local_addr[22 - strlen(buffer)] = '\0'; + strcat(local_addr, ":"); +- strcat(local_addr, buffer); ++ strncat(local_addr, buffer, sizeof(local_addr)-strlen(local_addr)-1); + + snprintf(buffer, sizeof(buffer), "%s", + get_sname(htons(rem_port), "udp", flag_not & FLAG_NUM_PORT)); +@@ -935,7 +935,7 @@ static void udp_do_one(int lnr, const ch + if ((strlen(rem_addr) + strlen(buffer)) > 22) + rem_addr[22 - strlen(buffer)] = '\0'; + strcat(rem_addr, ":"); +- strcat(rem_addr, buffer); ++ strncat(rem_addr, buffer, sizeof(rem_addr)-strlen(rem_addr)-1); + + timers[0] = '\0'; + if (flag_opt) +@@ -1045,7 +1045,7 @@ static void raw_do_one(int lnr, const ch + if ((strlen(local_addr) + strlen(buffer)) > 22) + local_addr[22 - strlen(buffer)] = '\0'; + strcat(local_addr, ":"); +- strcat(local_addr, buffer); ++ strncat(local_addr, buffer, sizeof(local_addr)-strlen(local_addr)-1); + + snprintf(buffer, sizeof(buffer), "%s", + get_sname(htons(rem_port), "raw", flag_not & FLAG_NUM_PORT)); +@@ -1054,7 +1054,7 @@ static void raw_do_one(int lnr, const ch + if ((strlen(rem_addr) + strlen(buffer)) > 22) + rem_addr[22 - strlen(buffer)] = '\0'; + strcat(rem_addr, ":"); +- strcat(rem_addr, buffer); ++ strncat(rem_addr, buffer, sizeof(rem_addr)-strlen(rem_addr)-1); + + timers[0] = '\0'; + if (flag_opt) diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-parse.patch b/pkgs/core/net-tools/patches/net-tools-1.60-parse.patch new file mode 100644 index 0000000..25890f1 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-parse.patch @@ -0,0 +1,70 @@ +--- net-tools-1.60/statistics.c.parse 2004-09-06 10:45:35.595130240 +0200 ++++ net-tools-1.60/statistics.c 2004-09-06 10:43:11.000000000 +0200 +@@ -289,7 +289,7 @@ + return &dummytab; + } + +-void process_fd(FILE *f) ++void process_fd(FILE *f,int file_desc) // added file_desc to show propriate error mesg + { + char buf1[1024], buf2[1024]; + char *sp, *np, *p; +@@ -297,12 +297,16 @@ + int endflag; + struct tabtab *tab; + ++ if (strcmp(buf1,"\n") == 0) // cut leading break ++ if (!fgets(buf1, sizeof buf1, f)) ++ break; + if (!fgets(buf2, sizeof buf2, f)) + break; ++ + sp = strchr(buf1, ':'); +- np = strchr(buf2, ':'); +- if (!np || !sp) +- goto formaterr; ++ np = strchr(buf2, ':'); ++ if (!np || !sp) ++ goto formaterr; + *sp = '\0'; + + tab = newtable(snmptabs, buf1); +@@ -333,7 +337,12 @@ + return; + + formaterr: +- perror(_("error parsing /proc/net/snmp")); ++ switch(file_desc) { ++ case 0: perror(_("error parsing /proc/net/snmp")); ++ break; ++ case 1: perror(_("error parsing /proc/net/netstat")); ++ break; ++ } + return; + } + +@@ -343,13 +352,13 @@ + FILE *f; + + f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp; +- ++ + f = fopen("/proc/net/snmp", "r"); + if (!f) { + perror(_("cannot open /proc/net/snmp")); + return(1); + } +- process_fd(f); ++ process_fd(f,0); + + if (ferror(f)) { + perror("/proc/net/snmp"); +@@ -361,7 +370,7 @@ + f = fopen("/proc/net/netstat", "r"); + + if (f) { +- process_fd(f); ++ process_fd(f,1); + + if (ferror(f)) { + perror("/proc/net/netstat"); diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-pie.patch b/pkgs/core/net-tools/patches/net-tools-1.60-pie.patch new file mode 100644 index 0000000..d4496ff --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-pie.patch @@ -0,0 +1,13 @@ +--- net-tools-1.60/Makefile.pie 2001-04-15 16:34:31.000000000 +0200 ++++ net-tools-1.60/Makefile 2005-02-28 12:41:15.337127680 +0100 +@@ -113,8 +113,8 @@ + + NET_LIB = $(NET_LIB_PATH)/lib$(NET_LIB_NAME).a + +-CFLAGS = $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH) +-LDFLAGS = $(LOPTS) -L$(NET_LIB_PATH) ++CFLAGS += $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH) ++LDFLAGS += $(LOPTS) -L$(NET_LIB_PATH) + + SUBDIRS = man/ $(NET_LIB_PATH)/ + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-remove_node.patch b/pkgs/core/net-tools/patches/net-tools-1.60-remove_node.patch new file mode 100644 index 0000000..8fbfe65 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-remove_node.patch @@ -0,0 +1,24 @@ +--- net-tools-1.60/man/en_US/hostname.1.old 2007-03-15 13:45:55.000000000 +0100 ++++ net-tools-1.60/man/en_US/hostname.1 2007-03-15 13:49:12.000000000 +0100 +@@ -28,8 +28,6 @@ + .RB [ -y ] + .RB [ --yp ] + .RB [ --nis ] +-.RB [ -n ] +-.RB [ --node ] + + .PP + .B hostname +--- net-tools-1.60/hostname.c.old 2007-03-15 13:45:55.000000000 +0100 ++++ net-tools-1.60/hostname.c 2007-03-15 13:47:27.000000000 +0100 +@@ -234,8 +234,9 @@ + fprintf(stderr, _(" domainname [-v] {nisdomain|-F file} set NIS domainname (from file)\n")); + #if HAVE_AFDECnet + fprintf(stderr, _(" nodename [-v] {nodename|-F file} set DECnet node name (from file)\n")); ++ fprintf(stderr, _(" hostname [-n] DECnet domain name\n")); + #endif +- fprintf(stderr, _(" hostname [-v] [-d|-f|-s|-a|-i|-y|-n] display formatted name\n")); ++ fprintf(stderr, _(" hostname [-v] [-d|-f|-s|-a|-i|-y] display formatted name\n")); + fprintf(stderr, _(" hostname [-v] display hostname\n\n")); + fprintf(stderr, _(" hostname -V|--version|-h|--help print info and exit\n\n")); + fprintf(stderr, _(" dnsdomainname=hostname -d, {yp,nis,}domainname=hostname -y\n\n")); diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-return.patch b/pkgs/core/net-tools/patches/net-tools-1.60-return.patch new file mode 100644 index 0000000..8ef10f5 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-return.patch @@ -0,0 +1,28 @@ +--- net-tools-1.60/nameif.c.return 2004-08-03 18:01:37.000000000 +0900 ++++ net-tools-1.60/nameif.c 2004-08-03 18:03:37.000000000 +0900 +@@ -27,6 +27,7 @@ + const char *fname = default_conf; + int use_syslog; + int ctl_sk = -1; ++int frag = 0; + + void err(char *msg) + { +@@ -288,13 +289,15 @@ + while (clist) { + struct change *ch = clist; + clist = clist->next; +- if (!ch->found) ++ if (!ch->found){ + warning(_("interface '%s' not found"), ch->ifname); ++ frag = 1; ++ } + free(ch); + } + + if (use_syslog) + closelog(); +- return 0; ++ return frag; + } + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-scanf-format.patch b/pkgs/core/net-tools/patches/net-tools-1.60-scanf-format.patch new file mode 100644 index 0000000..79d917b --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-scanf-format.patch @@ -0,0 +1,140 @@ +diff -up net-tools-1.60/arp.c.scanf-format net-tools-1.60/arp.c +--- net-tools-1.60/arp.c.scanf-format 2009-07-08 11:17:09.000000000 +0200 ++++ net-tools-1.60/arp.c 2009-07-08 11:43:39.000000000 +0200 +@@ -557,7 +557,7 @@ static int arp_show(char *name) + /* Read the ARP cache entries. */ + for (num = 0; num < entries; num++) { + fgets(line, sizeof(line), fp); +- if (sscanf(line, "%s 0x%x 0x%x %100s %100s %100s\n", ++ if (sscanf(line, "%s 0x%x 0x%x %99s %99s %99s\n", + ip, &type, &flags, hwa, mask, dev) < 4) + break; + +diff -up net-tools-1.60/lib/inet_gr.c.scanf-format net-tools-1.60/lib/inet_gr.c +--- net-tools-1.60/lib/inet_gr.c.scanf-format 2000-10-28 12:59:42.000000000 +0200 ++++ net-tools-1.60/lib/inet_gr.c 2009-07-08 11:49:59.000000000 +0200 +@@ -38,7 +38,7 @@ extern char *INET_sprintmask(struct sock + + int rprint_fib(int ext, int numeric) + { +- char buff[1024], iface[16], flags[64]; ++ char buff[1024], iface[17], flags[64]; + char gate_addr[128], net_addr[128]; + char mask_addr[128]; + int num, iflags, metric, refcnt, use, mss, window, irtt; +@@ -69,18 +69,18 @@ int rprint_fib(int ext, int numeric) + + fmt = proc_gen_fmt(_PATH_PROCNET_ROUTE, 0, fp, + "Iface", "%16s", +- "Destination", "%128s", +- "Gateway", "%128s", ++ "Destination", "%127s", ++ "Gateway", "%127s", + "Flags", "%X", + "RefCnt", "%d", + "Use", "%d", + "Metric", "%d", +- "Mask", "%128s", ++ "Mask", "%127s", + "MTU", "%d", + "Window", "%d", + "IRTT", "%d", + NULL); +- /* "%16s %128s %128s %X %d %d %d %128s %d %d %d\n" */ ++ /* "%16s %127s %127s %X %d %d %d %127s %d %d %d\n" */ + + if (!fmt) + return 1; +@@ -205,7 +205,7 @@ int rprint_fib(int ext, int numeric) + + int rprint_cache(int ext, int numeric) + { +- char buff[1024], iface[16], flags[64]; ++ char buff[1024], iface[17], flags[64]; + char gate_addr[128], dest_addr[128], specdst[128]; + char src_addr[128]; + struct sockaddr snet; +@@ -269,20 +269,20 @@ int rprint_cache(int ext, int numeric) + + fmt = proc_gen_fmt(_PATH_PROCNET_RTCACHE, 0, fp, + "Iface", "%16s", +- "Destination", "%128s", +- "Gateway", "%128s", ++ "Destination", "%127s", ++ "Gateway", "%127s", + "Flags", "%X", + "RefCnt", "%d", + "Use", "%d", + "Metric", "%d", +- "Source", "%128s", ++ "Source", "%127s", + "MTU", "%d", + "Window", "%d", + "IRTT", "%d", + "HH", "%d", + "ARP", "%d", + NULL); +- /* "%16s %128s %128s %X %d %d %d %128s %d %d %d %d %d\n" */ ++ /* "%16s %127s %127s %X %d %d %d %127s %d %d %d %d %d\n" */ + } + + if (format == 2) { +@@ -292,13 +292,13 @@ int rprint_cache(int ext, int numeric) + "MSS Window irtt TOS HHRef HHUptod SpecDst\n")); + fmt = proc_gen_fmt(_PATH_PROCNET_RTCACHE, 0, fp, + "Iface", "%16s", +- "Destination", "%128s", +- "Gateway", "%128s", ++ "Destination", "%127s", ++ "Gateway", "%127s", + "Flags", "%X", + "RefCnt", "%d", + "Use", "%d", + "Metric", "%d", +- "Source", "%128s", ++ "Source", "%127s", + "MTU", "%d", + "Window", "%d", + "IRTT", "%d", +@@ -307,7 +307,7 @@ int rprint_cache(int ext, int numeric) + "HHUptod", "%d", + "SpecDst", "%128s", + NULL); +- /* "%16s %128s %128s %X %d %d %d %128s %d %d %d %d %d %128s\n" */ ++ /* "%16s %127s %127s %X %d %d %d %127s %d %d %d %d %d %128s\n" */ + } + + +diff -up net-tools-1.60/lib/interface.c.scanf-format net-tools-1.60/lib/interface.c +--- net-tools-1.60/lib/interface.c.scanf-format 2009-07-08 11:17:09.000000000 +0200 ++++ net-tools-1.60/lib/interface.c 2009-07-08 11:45:44.000000000 +0200 +@@ -713,7 +713,7 @@ void ife_print_long(struct interface *pt + #endif + #if HAVE_AFINET6 + FILE *f; +- char addr6[40], devname[20]; ++ char addr6[40], devname[21]; + struct sockaddr_in6 sap; + int plen, scope, dad_status, if_idx; + extern struct aftype inet6_aftype; +diff -up net-tools-1.60/netstat.c.scanf-format net-tools-1.60/netstat.c +--- net-tools-1.60/netstat.c.scanf-format 2009-07-08 11:17:09.000000000 +0200 ++++ net-tools-1.60/netstat.c 2009-07-08 11:42:12.000000000 +0200 +@@ -1105,7 +1105,7 @@ static void udp_do_one(int lnr, const ch + + more[0] = '\0'; + num = sscanf(line, +- "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %lu %512s\n", ++ "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %lu %511s\n", + &d, local_addr, &local_port, + rem_addr, &rem_port, &state, + &txq, &rxq, &timer_run, &time_len, &retr, &uid, &timeout, &inode, more); +@@ -1540,7 +1540,7 @@ static void raw_do_one(int lnr, const ch + + more[0] = '\0'; + num = sscanf(line, +- "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %lu %512s\n", ++ "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %lu %511s\n", + &d, local_addr, &local_port, rem_addr, &rem_port, &state, + &txq, &rxq, &timer_run, &time_len, &retr, &uid, &timeout, &inode, more); + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-sctp-addrs.patch b/pkgs/core/net-tools/patches/net-tools-1.60-sctp-addrs.patch new file mode 100644 index 0000000..ff1c062 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-sctp-addrs.patch @@ -0,0 +1,346 @@ +--- net-tools-1.60/netstat.c.sctp-addrs 2008-06-18 14:41:29.000000000 +0200 ++++ net-tools-1.60/netstat.c 2008-06-18 14:12:03.000000000 +0200 +@@ -1299,23 +1299,21 @@ static void sctp_eps_do_one(int lnr, cha + const char *lport_str; + const char *uid_str; + const char *inode_str; +- const char *pladdr_str; + char *laddrs_str; + + if(lnr == 0) { +- /* ENDPT SOCK STY SST HBKT LPORT uid inode pladdr LADDRS*/ ++ /* ENDPT SOCK STY SST HBKT LPORT UID INODE LADDRS */ + return; + } + +- strtok(line," \t\n"); /*skip ptr*/ +- strtok(0," \t\n"); /*skip ptr*/ ++ strtok(line," \t\n"); /*skip endpt*/ ++ strtok(0," \t\n"); /*skip sock*/ + sty_str = strtok(0," \t\n"); + sst_str = strtok(0," \t\n"); + strtok(0," \t\n"); /*skip hash bucket*/ + lport_str=strtok(0," \t\n"); + uid_str = strtok(0," \t\n"); + inode_str = strtok(0," \t\n"); +- pladdr_str = strtok(0," \t\n"); + laddrs_str=strtok(0,"\t\n"); + + type = atoi(sty_str); +@@ -1323,61 +1321,35 @@ static void sctp_eps_do_one(int lnr, cha + port = atoi(lport_str); + uid = atoi(uid_str); + inode = strtoul(inode_str,0,0); +- +- if(flag_sctp<=1) { +- /* only print the primary address */ +- char local_addr[64]; +- char local_port[16]; +- +- ap = process_sctp_addr_str(pladdr_str, (struct sockaddr*)&localaddr); +- if(ap) +- safe_strncpy(local_addr, +- ap->sprint((struct sockaddr *) &localaddr, flag_not), +- sizeof(local_addr)); +- else +- sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); +- +- snprintf(local_port, sizeof(local_port), "%s", +- get_sname(htons(port), "sctp", +- flag_not & FLAG_NUM_PORT)); +- +- printf("sctp "); +- sprintf(buffer,"%s:%s", local_addr, local_port); +- printf("%-47s", buffer); +- printf(" %-12s", sctp_socket_state_str(state)); +- } else { +- /*print all addresses*/ +- const char *this_local_addr; +- int first=1; +- char local_port[16]; +- snprintf(local_port, sizeof(local_port), "%s", +- get_sname(htons(port), "sctp", +- flag_not & FLAG_NUM_PORT)); +- for(this_local_addr=strtok(laddrs_str," \t\n"); +- this_local_addr; +- this_local_addr=strtok(0," \t\n")) +- { +- char local_addr[64]; +- ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr); +- if(ap) +- safe_strncpy(local_addr, +- ap->sprint((struct sockaddr *) &localaddr, flag_not), +- sizeof(local_addr)); +- else +- sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); + +- if(!first) printf("\n"); +- if(first) +- printf("sctp "); +- else +- printf(" "); +- sprintf(buffer,"%s:%s", local_addr, local_port); +- printf("%-47s", buffer); +- printf(" %-12s", first?sctp_socket_state_str(state):""); +- first = 0; +- } ++ const char *this_local_addr; ++ int first=1; ++ char local_port[16]; ++ snprintf(local_port, sizeof(local_port), "%s", ++ get_sname(htons(port), "sctp", flag_not & FLAG_NUM_PORT)); ++ for(this_local_addr=strtok(laddrs_str," \t\n"); ++ this_local_addr; ++ this_local_addr=strtok(0," \t\n")) ++ { ++ char local_addr[64]; ++ ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr); ++ if(ap) ++ safe_strncpy(local_addr, ++ ap->sprint((struct sockaddr *) &localaddr, flag_not), ++ sizeof(local_addr)); ++ else ++ sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); ++ ++ if(!first) printf("\n"); ++ if(first) ++ printf("sctp "); ++ else ++ printf(" "); ++ sprintf(buffer,"%s:%s", local_addr, local_port); ++ printf("%-55s", buffer); ++ printf(" %-12s", first?sctp_socket_state_str(state):""); ++ first = 0; + } +- + finish_this_one(uid,inode,""); + } + +@@ -1403,32 +1375,29 @@ static void sctp_assoc_do_one(int lnr, c + const char *lport_str,*rport_str; + const char *uid_str; + const char *inode_str; +- const char *pladdr_str; + char *laddrs_str; +- const char *praddr_str; + char *raddrs_str; +- ++ + if(lnr == 0) { +- /* ASSOC SOCK STY SST ST HBKT tx_queue rx_queue uid inode LPORT RPORT pladdr praddr LADDRS <-> RADDRS*/ ++ /* ASSOC SOCK STY SST ST HBKT ASSOC-ID TX_QUEUE RX_QUEUE UID INODE LPORT RPORT LADDRS <-> RADDRS */ + return; + } +- +- strtok(line," \t\n"); /*skip ptr*/ +- strtok(0," \t\n"); /*skip ptr*/ ++ ++ strtok(line," \t\n"); /*skip assoc*/ ++ strtok(0," \t\n"); /*skip sock*/ + sty_str = strtok(0," \t\n"); + sst_str = strtok(0," \t\n"); + st_str = strtok(0," \t\n"); + strtok(0," \t\n"); /*skip hash bucket*/ ++ strtok(0," \t\n"); /*skip hash assoc-id*/ + txqueue_str = strtok(0," \t\n"); + rxqueue_str = strtok(0," \t\n"); + uid_str = strtok(0," \t\n"); + inode_str = strtok(0," \t\n"); + lport_str=strtok(0," \t\n"); + rport_str=strtok(0," \t\n"); +- pladdr_str = strtok(0," \t\n"); +- praddr_str = strtok(0," \t\n"); +- laddrs_str=strtok(0,"<->\t\n"); +- raddrs_str=strtok(0,"<->\t\n"); ++ laddrs_str = strtok(0,"<->\t\n"); ++ raddrs_str = strtok(0,"<->\t\n"); + + type = atoi(sty_str); + state = atoi(sst_str); +@@ -1439,116 +1408,81 @@ static void sctp_assoc_do_one(int lnr, c + inode = strtoul(inode_str,0,0); + lport = atoi(lport_str); + rport = atoi(rport_str); +- +- if(flag_sctp<=1) { +- /* only print the primary addresses */ +- char local_addr[64]; +- char local_port[16]; +- char remote_addr[64]; +- char remote_port[16]; +- +- ap = process_sctp_addr_str(pladdr_str, (struct sockaddr*)&localaddr); +- if(ap) +- safe_strncpy(local_addr, +- ap->sprint((struct sockaddr *) &localaddr, flag_not), +- sizeof(local_addr)); +- else +- sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); +- +- snprintf(local_port, sizeof(local_port), "%s", +- get_sname(htons(lport), "sctp", +- flag_not & FLAG_NUM_PORT)); +- +- ap = process_sctp_addr_str(praddr_str, (struct sockaddr*)&remoteaddr); +- if(ap) +- safe_strncpy(remote_addr, +- ap->sprint((struct sockaddr *) &remoteaddr, flag_not), +- sizeof(remote_addr)); +- else +- sprintf(remote_addr,_("unsupported address family %d"), ((struct sockaddr*)&remoteaddr)->sa_family); +- +- snprintf(remote_port, sizeof(remote_port), "%s", +- get_sname(htons(rport), "sctp", +- flag_not & FLAG_NUM_PORT)); +- +- printf("sctp"); +- printf(" %6u %6u ", rxqueue, txqueue); +- sprintf(buffer,"%s:%s", local_addr, local_port); +- printf("%-23s", buffer); +- printf(" "); +- sprintf(buffer,"%s:%s", remote_addr, remote_port); +- printf("%-23s", buffer); +- printf(" %-12s", sctp_socket_state_str(state)); +- } else { +- /*print all addresses*/ +- const char *this_local_addr; +- const char *this_remote_addr; +- char *ss1,*ss2; +- int first=1; +- char local_port[16]; +- char remote_port[16]; +- snprintf(local_port, sizeof(local_port), "%s", +- get_sname(htons(lport), "sctp", +- flag_not & FLAG_NUM_PORT)); +- snprintf(remote_port, sizeof(remote_port), "%s", +- get_sname(htons(rport), "sctp", +- flag_not & FLAG_NUM_PORT)); +- +- this_local_addr=strtok_r(laddrs_str," \t\n",&ss1); +- this_remote_addr=strtok_r(raddrs_str," \t\n",&ss2); +- while(this_local_addr || this_remote_addr) { +- char local_addr[64]; +- char remote_addr[64]; +- if(this_local_addr) { +- ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr); +- if(ap) +- safe_strncpy(local_addr, +- ap->sprint((struct sockaddr *) &localaddr, flag_not), +- sizeof(local_addr)); +- else +- sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); +- } +- if(this_remote_addr) { +- ap = process_sctp_addr_str(this_remote_addr, (struct sockaddr*)&remoteaddr); +- if(ap) +- safe_strncpy(remote_addr, +- ap->sprint((struct sockaddr *) &remoteaddr, flag_not), +- sizeof(remote_addr)); +- else +- sprintf(remote_addr,_("unsupported address family %d"), ((struct sockaddr*)&remoteaddr)->sa_family); +- } + +- if(!first) printf("\n"); +- if(first) +- printf("sctp %6u %6u ", rxqueue, txqueue); +- else +- printf(" "); +- if(this_local_addr) { +- if(first) +- sprintf(buffer,"%s:%s", local_addr, local_port); ++ /*print all addresses*/ ++ const char *this_local_addr; ++ const char *this_remote_addr; ++ char *ss1,*ss2; ++ int first=1; ++ char local_port[16]; ++ char remote_port[16]; ++ snprintf(local_port, sizeof(local_port), "%s", ++ get_sname(htons(lport), "sctp", ++ flag_not & FLAG_NUM_PORT)); ++ snprintf(remote_port, sizeof(remote_port), "%s", ++ get_sname(htons(rport), "sctp", ++ flag_not & FLAG_NUM_PORT)); ++ ++ this_local_addr=strtok_r(laddrs_str," \t\n",&ss1); ++ this_remote_addr=strtok_r(raddrs_str," \t\n",&ss2); ++ while(this_local_addr || this_remote_addr) { ++ char local_addr[64]; ++ char remote_addr[64]; ++ ++ if(this_local_addr) { ++ if (this_local_addr[0] == '*') { ++ /* skip * */ ++ this_local_addr++; ++ } ++ ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr); ++ if(ap) ++ safe_strncpy(local_addr, ++ ap->sprint((struct sockaddr *) &localaddr, flag_not), sizeof(local_addr)); + else +- sprintf(buffer,"%s", local_addr); +- printf("%-23s", buffer); +- } else +- printf("%-23s", ""); +- printf(" "); +- if(this_remote_addr) { +- if(first) +- sprintf(buffer,"%s:%s", remote_addr, remote_port); ++ sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); ++ } ++ if(this_remote_addr) { ++ if (this_remote_addr[0] == '*') { ++ /* skip * */ ++ this_remote_addr++; ++ } ++ ap = process_sctp_addr_str(this_remote_addr, (struct sockaddr*)&remoteaddr); ++ if(ap) ++ safe_strncpy(remote_addr, ++ ap->sprint((struct sockaddr *) &remoteaddr, flag_not), sizeof(remote_addr)); + else +- sprintf(buffer,"%s", remote_addr); +- printf("%-23s", buffer); +- } else +- printf("%-23s", ""); +- +- printf(" %-12s", first?sctp_socket_state_str(state):""); ++ sprintf(remote_addr,_("unsupported address family %d"), ((struct sockaddr*)&remoteaddr)->sa_family); ++ } + +- first = 0; +- this_local_addr=strtok_r(0," \t\n",&ss1); +- this_remote_addr=strtok_r(0," \t\n",&ss2); +- } ++ if(!first) printf("\n"); ++ if(first) ++ printf("sctp %6u %6u ", rxqueue, txqueue); ++ else ++ printf(" "); ++ if(this_local_addr) { ++ if(first) ++ sprintf(buffer,"%s:%s", local_addr, local_port); ++ else ++ sprintf(buffer,"%s", local_addr); ++ printf("%-27s", buffer); ++ } else ++ printf("%-27s", ""); ++ printf(" "); ++ if(this_remote_addr) { ++ if(first) ++ sprintf(buffer,"%s:%s", remote_addr, remote_port); ++ else ++ sprintf(buffer,"%s", remote_addr); ++ printf("%-27s", buffer); ++ } else ++ printf("%-27s", ""); ++ ++ printf(" %-12s", first?sctp_socket_state_str(state):""); ++ ++ first = 0; ++ this_local_addr=strtok_r(0," \t\n",&ss1); ++ this_remote_addr=strtok_r(0," \t\n",&ss2); + } +- + finish_this_one(uid,inode,""); + } + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-sctp-quiet.patch b/pkgs/core/net-tools/patches/net-tools-1.60-sctp-quiet.patch new file mode 100644 index 0000000..f04c4ca --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-sctp-quiet.patch @@ -0,0 +1,11 @@ +--- net-tools-1.60/netstat.c.old 2007-02-22 14:39:39.000000000 +0100 ++++ net-tools-1.60/netstat.c 2007-02-22 14:44:22.000000000 +0100 +@@ -2325,7 +2325,7 @@ + usage(); + + if ((flag_inet || flag_inet6 || flag_sta) && !(flag_tcp || flag_udp || flag_sctp || flag_raw)) +- flag_tcp = flag_udp = flag_sctp = flag_raw = 1; ++ flag_tcp = flag_udp = flag_raw = 1; + + if ((flag_tcp || flag_udp || flag_sctp || flag_raw || flag_igmp) && !(flag_inet || flag_inet6)) + flag_inet = flag_inet6 = 1; diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-sctp.patch b/pkgs/core/net-tools/patches/net-tools-1.60-sctp.patch new file mode 100644 index 0000000..6292999 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-sctp.patch @@ -0,0 +1,617 @@ +--- net-tools-1.60/statistics.c.sctp 2006-04-13 10:06:45.000000000 -0400 ++++ net-tools-1.60/statistics.c 2006-04-13 10:06:45.000000000 -0400 +@@ -20,7 +20,7 @@ + #define UFWARN(x) + #endif + +-int print_static,f_raw,f_tcp,f_udp,f_unknown = 1; ++int print_static,f_raw,f_tcp,f_udp,f_sctp,f_unknown = 1; + + enum State { + number = 0, opt_number, i_forward, i_inp_icmp, i_outp_icmp, i_rto_alg, +@@ -225,6 +225,27 @@ + { "TCPLoss", N_("%u TCP data loss events") }, + }; + ++struct entry Sctptab[] = ++{ ++ {"SctpCurrEstab", N_("%u Current Associations"), number}, ++ {"SctpActiveEstabs", N_("%u Active Associations"), number}, ++ {"SctpPassiveEstabs", N_("%u Passive Associations"), number}, ++ {"SctpAborteds", N_("%u Number of Aborteds "), number}, ++ {"SctpShutdowns", N_("%u Number of Graceful Terminations"), number}, ++ {"SctpOutOfBlues", N_("%u Number of Out of Blue packets"), number}, ++ {"SctpChecksumErrors", N_("%u Number of Packets with invalid Checksum"), number}, ++ {"SctpOutCtrlChunks", N_("%u Number of control chunks sent"), number}, ++ {"SctpOutOrderChunks", N_("%u Number of ordered chunks sent"), number}, ++ {"SctpOutUnorderChunks", N_("%u Number of Unordered chunks sent"), number}, ++ {"SctpInCtrlChunks", N_("%u Number of control chunks received"), number}, ++ {"SctpInOrderChunks", N_("%u Number of ordered chunks received"), number}, ++ {"SctpInUnorderChunks", N_("%u Number of Unordered chunks received"), number}, ++ {"SctpFragUsrMsgs", N_("%u Number of messages fragmented"), number}, ++ {"SctpReasmUsrMsgs", N_("%u Number of messages reassembled "), number}, ++ {"SctpOutSCTPPacks", N_("%u Number of SCTP packets sent"), number}, ++ {"SctpInSCTPPacks", N_("%u Number of SCTP packets received"), number}, ++}; ++ + struct tabtab { + char *title; + struct entry *tab; +@@ -238,6 +259,7 @@ + {"Icmp", Icmptab, sizeof(Icmptab), &f_raw}, + {"Tcp", Tcptab, sizeof(Tcptab), &f_tcp}, + {"Udp", Udptab, sizeof(Udptab), &f_udp}, ++ {"Sctp", Sctptab, sizeof(Sctptab), &f_sctp}, + {"TcpExt", Tcpexttab, sizeof(Tcpexttab), &f_tcp}, + {NULL} + }; +@@ -385,12 +407,39 @@ + return; + } + ++/* Process a file with name-value lines (like /proc/net/sctp/snmp) */ ++void process_fd2(FILE *f, const char *filename) ++{ ++ char buf1[1024]; ++ char *sp; ++ struct tabtab *tab; ++ ++ tab = newtable(snmptabs, "Sctp"); ++ ++ while (fgets(buf1, sizeof buf1, f)) { ++ sp = buf1 + strcspn(buf1, " \t\n"); ++ if (!sp) ++ goto formaterr; ++ *sp = '\0'; ++ sp++; ++ ++ sp += strspn(sp, " \t\n"); + +-int parsesnmp(int flag_raw, int flag_tcp, int flag_udp) ++ if (*sp != '\0' && *(tab->flag)) ++ printval(tab, buf1, strtoul(sp, 0, 10)); ++ } ++ return; ++ ++formaterr: ++ fprintf(stderr,_("error parsing %s\n"), filename); ++ return; ++} ++ ++int parsesnmp(int flag_raw, int flag_tcp, int flag_udp, int flag_sctp) + { + FILE *f; + +- f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp; ++ f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp; f_sctp = flag_sctp; + + f = fopen("/proc/net/snmp", "r"); + if (!f) { +@@ -418,6 +467,16 @@ + + fclose(f); + } ++ ++ f = fopen("/proc/net/sctp/snmp", "r"); ++ if (f) { ++ process_fd2(f,"/proc/net/sctp/snmp"); ++ if (ferror(f)) ++ perror("/proc/net/sctp/snmp"); ++ ++ fclose(f); ++ } ++ + return(0); + } + +--- net-tools-1.60/netstat.c.sctp 2006-04-13 10:06:45.000000000 -0400 ++++ net-tools-1.60/netstat.c 2006-04-13 10:10:23.000000000 -0400 +@@ -58,6 +58,7 @@ + * + *990420 {1.38} Tuan Hoang removed a useless assignment from igmp_do_one() + *20010404 {1.39} Arnaldo Carvalho de Melo - use setlocale ++ *20050516 {1.40} Ivan Skytte Joergensen:Added SCTP support + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General +@@ -108,7 +109,7 @@ + #endif + + /* prototypes for statistics.c */ +-int parsesnmp(int, int, int); ++int parsesnmp(int, int, int, int); + void inittab(void); + + typedef enum { +@@ -119,6 +120,29 @@ + SS_DISCONNECTING /* in process of disconnecting */ + } socket_state; + ++ ++#define SCTP_NSTATES 9 /* The number of states in array*/ ++ ++static const char *sctp_state[] = { ++ N_("EMPTY"), ++ N_("CLOSED"), ++ N_("COOKIE_WAIT"), ++ N_("COOKIE_ECHOED"), ++ N_("ESTABLISHED"), ++ N_("SHUTDOWN_PENDING"), ++ N_("SHUTDOWN_SENT"), ++ N_("SHUTDOWN_RECEIVED"), ++ N_("SHUTDOWN_ACK_SENT") ++}; ++ ++#define SCTP_NTYPES 3 /* The number of types in array */ ++ ++static const char *sctp_type[] = { ++ N_("udp"), ++ N_("udp-high-bw"), ++ N_("tcp") ++}; ++ + #define SO_ACCEPTCON (1<<16) /* performed a listen */ + #define SO_WAITDATA (1<<17) /* wait data to read */ + #define SO_NOSPACE (1<<18) /* no space to write */ +@@ -150,6 +174,7 @@ + int flag_raw = 0; + int flag_tcp = 0; + int flag_udp = 0; ++int flag_sctp= 0; + int flag_igmp= 0; + int flag_rom = 0; + int flag_exp = 1; +@@ -1189,6 +1214,365 @@ + udp_do_one); + } + ++static const char *sctp_socket_type_str(int type) { ++ if(type>=0 && type<SCTP_NTYPES) ++ return sctp_type[type]; ++ else { ++ static char type_str_buf[64]; ++ sprintf(type_str_buf,"UNKNOWN(%d)",type); ++ return type_str_buf; ++ } ++} ++ ++static const char *sctp_state_str(int state) ++{ ++ if(state>=0 && state<SCTP_NSTATES) ++ return sctp_state[state]; ++ else { ++ static char state_str_buf[64]; ++ sprintf(state_str_buf,"UNKNOWN(%d)",state); ++ return state_str_buf; ++ } ++} ++ ++static const char *sctp_socket_state_str(int state) ++{ ++ if(state>=0 && state<=10) ++ return tcp_state[state]; ++ else { ++ static char state_str_buf[64]; ++ sprintf(state_str_buf,"UNKNOWN(%d)",state); ++ return state_str_buf; ++ } ++} ++ ++static struct aftype *process_sctp_addr_str(const char *addr_str, struct sockaddr *sa) ++{ ++ if (strchr(addr_str,':')) { ++#if HAVE_AFINET6 ++ extern struct aftype inet6_aftype; ++ /* Demangle what the kernel gives us */ ++ struct in6_addr in6; ++ char addr6_str[INET6_ADDRSTRLEN]; ++ unsigned u0,u1,u2,u3,u4,u5,u6,u7; ++ sscanf(addr_str, "%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X", ++ &u0, &u1, &u2, &u3, &u4, &u5, &u6, &u7); ++ in6.s6_addr16[0] = htons(u0); ++ in6.s6_addr16[1] = htons(u1); ++ in6.s6_addr16[2] = htons(u2); ++ in6.s6_addr16[3] = htons(u3); ++ in6.s6_addr16[4] = htons(u4); ++ in6.s6_addr16[5] = htons(u5); ++ in6.s6_addr16[6] = htons(u6); ++ in6.s6_addr16[7] = htons(u7); ++ ++ inet_ntop(AF_INET6, &in6, addr6_str, sizeof(addr6_str)); ++ inet6_aftype.input(1, addr6_str, sa); ++ sa->sa_family = AF_INET6; ++#endif ++ } else { ++ ((struct sockaddr_in*)sa)->sin_addr.s_addr = inet_addr(addr_str); ++ sa->sa_family = AF_INET; ++ } ++ return get_afntype(sa->sa_family); ++} ++ ++static void sctp_eps_do_one(int lnr, char *line) ++{ ++ char buffer[1024]; ++ int type, state, port; ++ int uid; ++ unsigned long inode; ++ ++ struct aftype *ap; ++#if HAVE_AFINET6 ++ struct sockaddr_in6 localaddr; ++#else ++ struct sockaddr_in localaddr; ++#endif ++ const char *sty_str; ++ const char *sst_str; ++ const char *lport_str; ++ const char *uid_str; ++ const char *inode_str; ++ const char *pladdr_str; ++ char *laddrs_str; ++ ++ if(lnr == 0) { ++ /* ENDPT SOCK STY SST HBKT LPORT uid inode pladdr LADDRS*/ ++ return; ++ } ++ ++ strtok(line," \t\n"); /*skip ptr*/ ++ strtok(0," \t\n"); /*skip ptr*/ ++ sty_str = strtok(0," \t\n"); ++ sst_str = strtok(0," \t\n"); ++ strtok(0," \t\n"); /*skip hash bucket*/ ++ lport_str=strtok(0," \t\n"); ++ uid_str = strtok(0," \t\n"); ++ inode_str = strtok(0," \t\n"); ++ pladdr_str = strtok(0," \t\n"); ++ laddrs_str=strtok(0,"\t\n"); ++ ++ type = atoi(sty_str); ++ state = atoi(sst_str); ++ port = atoi(lport_str); ++ uid = atoi(uid_str); ++ inode = strtoul(inode_str,0,0); ++ ++ if(flag_sctp<=1) { ++ /* only print the primary address */ ++ char local_addr[64]; ++ char local_port[16]; ++ ++ ap = process_sctp_addr_str(pladdr_str, (struct sockaddr*)&localaddr); ++ if(ap) ++ safe_strncpy(local_addr, ++ ap->sprint((struct sockaddr *) &localaddr, flag_not), ++ sizeof(local_addr)); ++ else ++ sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); ++ ++ snprintf(local_port, sizeof(local_port), "%s", ++ get_sname(htons(port), "sctp", ++ flag_not & FLAG_NUM_PORT)); ++ ++ printf("sctp "); ++ sprintf(buffer,"%s:%s", local_addr, local_port); ++ printf("%-47s", buffer); ++ printf(" %-12s", sctp_socket_state_str(state)); ++ } else { ++ /*print all addresses*/ ++ const char *this_local_addr; ++ int first=1; ++ char local_port[16]; ++ snprintf(local_port, sizeof(local_port), "%s", ++ get_sname(htons(port), "sctp", ++ flag_not & FLAG_NUM_PORT)); ++ for(this_local_addr=strtok(laddrs_str," \t\n"); ++ this_local_addr; ++ this_local_addr=strtok(0," \t\n")) ++ { ++ char local_addr[64]; ++ ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr); ++ if(ap) ++ safe_strncpy(local_addr, ++ ap->sprint((struct sockaddr *) &localaddr, flag_not), ++ sizeof(local_addr)); ++ else ++ sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); ++ ++ if(!first) printf("\n"); ++ if(first) ++ printf("sctp "); ++ else ++ printf(" "); ++ sprintf(buffer,"%s:%s", local_addr, local_port); ++ printf("%-47s", buffer); ++ printf(" %-12s", first?sctp_socket_state_str(state):""); ++ first = 0; ++ } ++ } ++ ++ finish_this_one(uid,inode,""); ++} ++ ++static void sctp_assoc_do_one(int lnr, char *line) ++{ ++ char buffer[1024]; ++ int type, state, state2, lport,rport; ++ int uid; ++ unsigned rxqueue,txqueue; ++ unsigned long inode; ++ ++ struct aftype *ap; ++#if HAVE_AFINET6 ++ struct sockaddr_in6 localaddr,remoteaddr; ++#else ++ struct sockaddr_in localaddr,remoteaddr; ++#endif ++ const char *sty_str; ++ const char *sst_str; ++ const char *st_str; ++ const char *txqueue_str; ++ const char *rxqueue_str; ++ const char *lport_str,*rport_str; ++ const char *uid_str; ++ const char *inode_str; ++ const char *pladdr_str; ++ char *laddrs_str; ++ const char *praddr_str; ++ char *raddrs_str; ++ ++ if(lnr == 0) { ++ /* ASSOC SOCK STY SST ST HBKT tx_queue rx_queue uid inode LPORT RPORT pladdr praddr LADDRS <-> RADDRS*/ ++ return; ++ } ++ ++ strtok(line," \t\n"); /*skip ptr*/ ++ strtok(0," \t\n"); /*skip ptr*/ ++ sty_str = strtok(0," \t\n"); ++ sst_str = strtok(0," \t\n"); ++ st_str = strtok(0," \t\n"); ++ strtok(0," \t\n"); /*skip hash bucket*/ ++ txqueue_str = strtok(0," \t\n"); ++ rxqueue_str = strtok(0," \t\n"); ++ uid_str = strtok(0," \t\n"); ++ inode_str = strtok(0," \t\n"); ++ lport_str=strtok(0," \t\n"); ++ rport_str=strtok(0," \t\n"); ++ pladdr_str = strtok(0," \t\n"); ++ praddr_str = strtok(0," \t\n"); ++ laddrs_str=strtok(0,"<->\t\n"); ++ raddrs_str=strtok(0,"<->\t\n"); ++ ++ type = atoi(sty_str); ++ state = atoi(sst_str); ++ state2 = atoi(st_str); ++ txqueue = atoi(txqueue_str); ++ rxqueue = atoi(rxqueue_str); ++ uid = atoi(uid_str); ++ inode = strtoul(inode_str,0,0); ++ lport = atoi(lport_str); ++ rport = atoi(rport_str); ++ ++ if(flag_sctp<=1) { ++ /* only print the primary addresses */ ++ char local_addr[64]; ++ char local_port[16]; ++ char remote_addr[64]; ++ char remote_port[16]; ++ ++ ap = process_sctp_addr_str(pladdr_str, (struct sockaddr*)&localaddr); ++ if(ap) ++ safe_strncpy(local_addr, ++ ap->sprint((struct sockaddr *) &localaddr, flag_not), ++ sizeof(local_addr)); ++ else ++ sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); ++ ++ snprintf(local_port, sizeof(local_port), "%s", ++ get_sname(htons(lport), "sctp", ++ flag_not & FLAG_NUM_PORT)); ++ ++ ap = process_sctp_addr_str(praddr_str, (struct sockaddr*)&remoteaddr); ++ if(ap) ++ safe_strncpy(remote_addr, ++ ap->sprint((struct sockaddr *) &remoteaddr, flag_not), ++ sizeof(remote_addr)); ++ else ++ sprintf(remote_addr,_("unsupported address family %d"), ((struct sockaddr*)&remoteaddr)->sa_family); ++ ++ snprintf(remote_port, sizeof(remote_port), "%s", ++ get_sname(htons(rport), "sctp", ++ flag_not & FLAG_NUM_PORT)); ++ ++ printf("sctp"); ++ printf(" %6u %6u ", rxqueue, txqueue); ++ sprintf(buffer,"%s:%s", local_addr, local_port); ++ printf("%-23s", buffer); ++ printf(" "); ++ sprintf(buffer,"%s:%s", remote_addr, remote_port); ++ printf("%-23s", buffer); ++ printf(" %-12s", sctp_socket_state_str(state)); ++ } else { ++ /*print all addresses*/ ++ const char *this_local_addr; ++ const char *this_remote_addr; ++ char *ss1,*ss2; ++ int first=1; ++ char local_port[16]; ++ char remote_port[16]; ++ snprintf(local_port, sizeof(local_port), "%s", ++ get_sname(htons(lport), "sctp", ++ flag_not & FLAG_NUM_PORT)); ++ snprintf(remote_port, sizeof(remote_port), "%s", ++ get_sname(htons(rport), "sctp", ++ flag_not & FLAG_NUM_PORT)); ++ ++ this_local_addr=strtok_r(laddrs_str," \t\n",&ss1); ++ this_remote_addr=strtok_r(raddrs_str," \t\n",&ss2); ++ while(this_local_addr || this_remote_addr) { ++ char local_addr[64]; ++ char remote_addr[64]; ++ if(this_local_addr) { ++ ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr); ++ if(ap) ++ safe_strncpy(local_addr, ++ ap->sprint((struct sockaddr *) &localaddr, flag_not), ++ sizeof(local_addr)); ++ else ++ sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); ++ } ++ if(this_remote_addr) { ++ ap = process_sctp_addr_str(this_remote_addr, (struct sockaddr*)&remoteaddr); ++ if(ap) ++ safe_strncpy(remote_addr, ++ ap->sprint((struct sockaddr *) &remoteaddr, flag_not), ++ sizeof(remote_addr)); ++ else ++ sprintf(remote_addr,_("unsupported address family %d"), ((struct sockaddr*)&remoteaddr)->sa_family); ++ } ++ ++ if(!first) printf("\n"); ++ if(first) ++ printf("sctp %6u %6u ", rxqueue, txqueue); ++ else ++ printf(" "); ++ if(this_local_addr) { ++ if(first) ++ sprintf(buffer,"%s:%s", local_addr, local_port); ++ else ++ sprintf(buffer,"%s", local_addr); ++ printf("%-23s", buffer); ++ } else ++ printf("%-23s", ""); ++ printf(" "); ++ if(this_remote_addr) { ++ if(first) ++ sprintf(buffer,"%s:%s", remote_addr, remote_port); ++ else ++ sprintf(buffer,"%s", remote_addr); ++ printf("%-23s", buffer); ++ } else ++ printf("%-23s", ""); ++ ++ printf(" %-12s", first?sctp_socket_state_str(state):""); ++ ++ first = 0; ++ this_local_addr=strtok_r(0," \t\n",&ss1); ++ this_remote_addr=strtok_r(0," \t\n",&ss2); ++ } ++ } ++ ++ finish_this_one(uid,inode,""); ++} ++ ++static int sctp_info_eps(void) ++{ ++#if !defined(_PATH_PROCNET_SCTP_EPS) ++#define _PATH_PROCNET_SCTP_EPS "/proc/net/sctp/eps" ++#endif ++ INFO_GUTS(_PATH_PROCNET_SCTP_EPS, "AF INET (sctp)", ++ sctp_eps_do_one); ++} ++ ++static int sctp_info_assocs(void) ++{ ++#if !defined(_PATH_PROCNET_SCTP_ASSOCS) ++#define _PATH_PROCNET_SCTP_ASSOCS "/proc/net/sctp/assocs" ++#endif ++ INFO_GUTS(_PATH_PROCNET_SCTP_ASSOCS, "AF INET (sctp)", ++ sctp_assoc_do_one); ++} ++ ++static int sctp_info(void) ++{ ++ if(flag_all) ++ sctp_info_eps(); ++ return sctp_info_assocs(); ++} ++ + static void raw_do_one(int lnr, const char *line) + { + char buffer[8192], local_addr[64], rem_addr[64]; +@@ -1742,7 +2126,7 @@ + fprintf(stderr, _(" -Z, --context display SELinux security context for sockets\n\n")); + + fprintf(stderr, _(" <Iface>: Name of interface to monitor/list.\n")); +- fprintf(stderr, _(" <Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom\n")); ++ fprintf(stderr, _(" <Socket>={-t|--tcp} {-u|--udp} {-S|--sctp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom\n")); + fprintf(stderr, _(" <AF>=Use '-A <af>' or '--<af>'; default: %s\n"), DFLT_AF); + fprintf(stderr, _(" List of possible address families (which support routing):\n")); + print_aflist(1); /* 1 = routeable */ +@@ -1769,6 +2153,7 @@ + {"protocol", 1, 0, 'A'}, + {"tcp", 0, 0, 't'}, + {"udp", 0, 0, 'u'}, ++ {"sctp", 0, 0, 'S' }, + {"raw", 0, 0, 'w'}, + {"unix", 0, 0, 'x'}, + {"listening", 0, 0, 'l'}, +@@ -1801,7 +2186,7 @@ + + afname[0] = '\0'; + +- while ((i = getopt_long(argc, argv, "MCFA:acdegphiI::nNorstuVv?wxlZT", longopts, &lop)) != EOF) ++ while ((i = getopt_long(argc, argv, "MCFA:acdegphiI::nNorstuSVv?wxlZT", longopts, &lop)) != EOF) + switch (i) { + case -1: + break; +@@ -1887,10 +2272,12 @@ + case 't': + flag_tcp++; + break; +- + case 'u': + flag_udp++; + break; ++ case 'S': ++ flag_sctp++; ++ break; + case 'w': + flag_raw++; + break; +@@ -1932,13 +2319,13 @@ + if (flag_int + flag_rou + flag_mas + flag_sta > 1) + usage(); + +- if ((flag_inet || flag_inet6 || flag_sta) && !(flag_tcp || flag_udp || flag_raw)) +- flag_tcp = flag_udp = flag_raw = 1; ++ if ((flag_inet || flag_inet6 || flag_sta) && !(flag_tcp || flag_udp || flag_sctp || flag_raw)) ++ flag_tcp = flag_udp = flag_sctp = flag_raw = 1; + +- if ((flag_tcp || flag_udp || flag_raw || flag_igmp) && !(flag_inet || flag_inet6)) ++ if ((flag_tcp || flag_udp || flag_sctp || flag_raw || flag_igmp) && !(flag_inet || flag_inet6)) + flag_inet = flag_inet6 = 1; + +- flag_arg = flag_tcp + flag_udp + flag_raw + flag_unx + flag_ipx ++ flag_arg = flag_tcp + flag_udp + flag_sctp + flag_raw + flag_unx + flag_ipx + + flag_ax25 + flag_netrom + flag_igmp + flag_x25; + + if (flag_mas) { +@@ -1964,7 +2351,7 @@ + if (flag_sta) { + for(;;) { + inittab(); +- i = parsesnmp(flag_raw, flag_tcp, flag_udp); ++ i = parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp); + + if(i || !flag_cnt) + break; +@@ -2006,7 +2393,7 @@ + return (i); + } + for (;;) { +- if (!flag_arg || flag_tcp || flag_udp || flag_raw) { ++ if (!flag_arg || flag_tcp || flag_udp || flag_sctp || flag_raw) { + #if HAVE_AFINET + prg_cache_load(); + printf(_("Active Internet connections ")); /* xxx */ +@@ -2044,6 +2431,11 @@ + if (i) + return (i); + } ++ if (!flag_arg || flag_sctp) { ++ i = sctp_info(); ++ if (i) ++ return (i); ++ } + if (!flag_arg || flag_raw) { + i = raw_info(); + if (i) diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-selinux.patch b/pkgs/core/net-tools/patches/net-tools-1.60-selinux.patch new file mode 100644 index 0000000..811893a --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-selinux.patch @@ -0,0 +1,225 @@ +--- net-tools-1.60/Makefile~ 2005-12-24 06:56:57.000000000 -0500 ++++ net-tools-1.60/Makefile 2005-12-29 16:54:06.000000000 -0500 +@@ -113,6 +113,12 @@ + + NET_LIB = $(NET_LIB_PATH)/lib$(NET_LIB_NAME).a + ++ifeq ($(HAVE_SELINUX),1) ++LDFLAGS += -lselinux ++CFLAGS += -DHAVE_SELINUX ++else ++endif ++ + CFLAGS += $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH) + LDFLAGS += $(LOPTS) -L$(NET_LIB_PATH) + +--- net-tools-1.60/netstat.c~ 2005-12-24 06:56:57.000000000 -0500 ++++ net-tools-1.60/netstat.c 2005-12-29 16:54:07.000000000 -0500 +@@ -86,6 +86,11 @@ + #include <net/if.h> + #include <dirent.h> + ++#if HAVE_SELINUX ++#include <selinux/selinux.h> ++#else ++#define security_context_t char* ++#endif + #include "net-support.h" + #include "pathnames.h" + #include "version.h" +@@ -96,6 +101,7 @@ + #include "util.h" + + #define PROGNAME_WIDTH 20 ++#define SELINUX_WIDTH 50 + + #if !defined(s6_addr32) && defined(in6a_words) + #define s6_addr32 in6a_words /* libinet6 */ +@@ -150,6 +156,7 @@ + int flag_prg = 0; + int flag_arg = 0; + int flag_ver = 0; ++int flag_selinux = 0; + + FILE *procinfo; + +@@ -213,12 +220,17 @@ + #define PROGNAME_WIDTH1(s) PROGNAME_WIDTH2(s) + #define PROGNAME_WIDTH2(s) #s + ++#define SELINUX_WIDTHs SELINUX_WIDTH1(SELINUX_WIDTH) ++#define SELINUX_WIDTH1(s) SELINUX_WIDTH2(s) ++#define SELINUX_WIDTH2(s) #s ++ + #define PRG_HASH_SIZE 211 + + static struct prg_node { + struct prg_node *next; + int inode; + char name[PROGNAME_WIDTH]; ++ char scon[SELINUX_WIDTH]; + } *prg_hash[PRG_HASH_SIZE]; + + static char prg_cache_loaded = 0; +@@ -226,9 +238,12 @@ + #define PRG_HASHIT(x) ((x) % PRG_HASH_SIZE) + + #define PROGNAME_BANNER "PID/Program name" ++#define SELINUX_BANNER "Security Context" + + #define print_progname_banner() do { if (flag_prg) printf("%-" PROGNAME_WIDTHs "s"," " PROGNAME_BANNER); } while (0) + ++#define print_selinux_banner() do { if (flag_selinux) printf("%-" SELINUX_WIDTHs "s"," " SELINUX_BANNER); } while (0) ++ + #define PRG_LOCAL_ADDRESS "local_address" + #define PRG_INODE "inode" + #define PRG_SOCKET_PFX "socket:[" +@@ -250,7 +265,7 @@ + /* NOT working as of glibc-2.0.7: */ + #undef DIRENT_HAVE_D_TYPE_WORKS + +-static void prg_cache_add(int inode, char *name) ++static void prg_cache_add(int inode, char *name, char *scon) + { + unsigned hi = PRG_HASHIT(inode); + struct prg_node **pnp,*pn; +@@ -271,6 +286,14 @@ + if (strlen(name)>sizeof(pn->name)-1) + name[sizeof(pn->name)-1]='\0'; + strcpy(pn->name,name); ++ ++ { ++ int len=(strlen(scon)-sizeof(pn->scon))+1; ++ if (len > 0) ++ strcpy(pn->scon,&scon[len+1]); ++ else ++ strcpy(pn->scon,scon); ++ } + } + + static const char *prg_cache_get(unsigned long inode) +@@ -283,6 +306,16 @@ + return("-"); + } + ++static const char *prg_cache_get_con(unsigned long inode) ++{ ++ unsigned hi=PRG_HASHIT(inode); ++ struct prg_node *pn; ++ ++ for (pn=prg_hash[hi];pn;pn=pn->next) ++ if (pn->inode==inode) return(pn->scon); ++ return("-"); ++} ++ + static void prg_cache_clear(void) + { + struct prg_node **pnp,*pn; +@@ -348,6 +381,7 @@ + const char *cs,*cmdlp; + DIR *dirproc=NULL,*dirfd=NULL; + struct dirent *direproc,*direfd; ++ security_context_t scon=NULL; + + if (prg_cache_loaded || !flag_prg) return; + prg_cache_loaded=1; +@@ -415,7 +449,15 @@ + } + + snprintf(finbuf, sizeof(finbuf), "%s/%s", direproc->d_name, cmdlp); +- prg_cache_add(inode, finbuf); ++#if HAVE_SELINUX ++ if (getpidcon(atoi(direproc->d_name), &scon) == -1) { ++ scon=strdup("-"); ++ } ++ prg_cache_add(inode, finbuf, scon); ++ freecon(scon); ++#else ++ prg_cache_add(inode, finbuf, "-"); ++#endif + } + closedir(dirfd); + dirfd = NULL; +@@ -1385,6 +1428,8 @@ + printf("- "); + if (flag_prg) + printf("%-" PROGNAME_WIDTHs "s",(has & HAS_INODE?prg_cache_get(inode):"-")); ++ if (flag_selinux) ++ printf("%-" SELINUX_WIDTHs "s",(has & HAS_INODE?prg_cache_get_con(inode):"-")); + puts(path); + } + +@@ -1403,6 +1448,7 @@ + + printf(_("\nProto RefCnt Flags Type State I-Node")); + print_progname_banner(); ++ print_selinux_banner(); + printf(_(" Path\n")); /* xxx */ + + { +@@ -1682,6 +1728,7 @@ + fprintf(stderr, _(" -o, --timers display timers\n")); + fprintf(stderr, _(" -F, --fib display Forwarding Information Base (default)\n")); + fprintf(stderr, _(" -C, --cache display routing cache instead of FIB\n\n")); ++ fprintf(stderr, _(" -Z, --context display SELinux security context for sockets\n\n")); + + fprintf(stderr, _(" <Iface>: Name of interface to monitor/list.\n")); + fprintf(stderr, _(" <Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom\n")); +@@ -1729,6 +1776,7 @@ + {"cache", 0, 0, 'C'}, + {"fib", 0, 0, 'F'}, + {"groups", 0, 0, 'g'}, ++ {"context", 0, 0, 'Z'}, + {NULL, 0, 0, 0} + }; + +@@ -1741,7 +1789,7 @@ + + afname[0] = '\0'; + +- while ((i = getopt_long(argc, argv, "MCFA:acdegphiI::nNorstuVv?wxl", longopts, &lop)) != EOF) ++ while ((i = getopt_long(argc, argv, "MCFA:acdegphiI::nNorstuVv?wxlZ", longopts, &lop)) != EOF) + switch (i) { + case -1: + break; +@@ -1838,6 +1886,20 @@ + if (aftrans_opt("unix")) + exit(1); + break; ++ case 'Z': ++#if HAVE_SELINUX ++ if (is_selinux_enabled() <= 0) { ++ fprintf(stderr, _("SELinux is not enabled on this machine.\n")); ++ exit(1); ++ } ++ flag_prg++; ++ flag_selinux++; ++#else ++ fprintf(stderr, _("SELinux is not enabled for this application.\n")); ++ exit(1); ++#endif ++ ++ break; + case '?': + case 'h': + usage(); +--- net-tools-1.60/netstat.c.sel 2007-05-21 14:02:08.000000000 -0400 ++++ net-tools-1.60/netstat.c 2007-05-21 14:03:23.000000000 -0400 +@@ -769,6 +769,9 @@ static void finish_this_one(int uid, uns + } + if (flag_prg) + printf("%-" PROGNAME_WIDTHs "s",prg_cache_get(inode)); ++ if (flag_selinux) ++ printf("%-" SELINUX_WIDTHs "s",prg_cache_get_con(inode)); ++ + if (flag_opt) + printf("%s", timers); + putchar('\n'); +@@ -2420,6 +2423,7 @@ int main + if (flag_exp > 1) + printf(_(" User Inode ")); + print_progname_banner(); ++ print_selinux_banner(); + if (flag_opt) + printf(_(" Timer")); /* xxx */ + printf("\n"); diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-siunits.patch b/pkgs/core/net-tools/patches/net-tools-1.60-siunits.patch new file mode 100644 index 0000000..cf6d89c --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-siunits.patch @@ -0,0 +1,80 @@ +--- net-tools-1.60/lib/interface.c.siunits 2004-03-14 12:11:22.000000000 -0600 ++++ net-tools-1.60/lib/interface.c 2004-03-14 12:27:31.990679464 -0600 +@@ -262,7 +262,7 @@ + &ife->stats.tx_compressed); + break; + case 2: +- sscanf(bp, "%llu %llu %lu %lu %lu %lu %llu %llu %lu %lu %lu %lu %lu", ++ sscanf(bp, "%Lu %llu %lu %lu %lu %lu %Lu %Lu %lu %lu %lu %lu %lu", + &ife->stats.rx_bytes, + &ife->stats.rx_packets, + &ife->stats.rx_errors, +@@ -280,7 +280,7 @@ + ife->stats.rx_multicast = 0; + break; + case 1: +- sscanf(bp, "%llu %lu %lu %lu %lu %llu %lu %lu %lu %lu %lu", ++ sscanf(bp, "%Lu %lu %lu %lu %lu %Lu %lu %lu %lu %lu %lu", + &ife->stats.rx_packets, + &ife->stats.rx_errors, + &ife->stats.rx_dropped, +@@ -675,8 +675,8 @@ + int hf; + int can_compress = 0; + unsigned long long rx, tx, short_rx, short_tx; +- char Rext[5]="b"; +- char Text[5]="b"; ++ const char *Rext = "b"; ++ const char *Text = "b"; + + #if HAVE_AFIPX + static struct aftype *ipxtype = NULL; +@@ -882,10 +882,44 @@ + tx = ptr->stats.tx_bytes; + short_rx = rx * 10; + short_tx = tx * 10; +- if (rx > 1048576) { short_rx /= 1048576; strcpy(Rext, "Mb"); } +- else if (rx > 1024) { short_rx /= 1024; strcpy(Rext, "Kb"); } +- if (tx > 1048576) { short_tx /= 1048576; strcpy(Text, "Mb"); } +- else if (tx > 1024) { short_tx /= 1024; strcpy(Text, "Kb"); } ++ if (rx > 1152921504606846976ull) { ++ short_rx /= 1152921504606846976ull; ++ Rext = "EiB"; ++ } else if (rx > 1125899906842624ull) { ++ short_rx /= 1125899906842624ull; ++ Rext = "PiB"; ++ } else if (rx > 1099511627776ull) { ++ short_rx /= 1099511627776ull; ++ Rext = "TiB"; ++ } else if (rx > 1073741824ull) { ++ short_rx /= 1073741824ull; ++ Rext = "GiB"; ++ } else if (rx > 1048576) { ++ short_rx /= 1048576; ++ Rext = "MiB"; ++ } else if (rx > 1024) { ++ short_rx /= 1024; ++ Rext = "KiB"; ++ } ++ if (tx > 1152921504606846976ull) { ++ short_tx /= 1152921504606846976ull; ++ Text = "EiB"; ++ } else if (tx > 1125899906842624ull) { ++ short_tx /= 1125899906842624ull; ++ Text = "PiB"; ++ } else if (tx > 1099511627776ull) { ++ short_tx /= 1099511627776ull; ++ Text = "TiB"; ++ } else if (tx > 1073741824ull) { ++ short_tx /= 1073741824ull; ++ Text = "GiB"; ++ } else if (tx > 1048576) { ++ short_tx /= 1048576; ++ Text = "MiB"; ++ } else if (tx > 1024) { ++ short_tx /= 1024; ++ Text = "KiB"; ++ } + + printf(" "); + printf(_("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"), diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-skip.patch b/pkgs/core/net-tools/patches/net-tools-1.60-skip.patch new file mode 100644 index 0000000..a634f43 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-skip.patch @@ -0,0 +1,13 @@ +--- net-tools-1.60/netstat.c.skip 2006-08-07 10:45:25.000000000 +0200 ++++ net-tools-1.60/netstat.c 2006-08-07 11:17:37.000000000 +0200 +@@ -444,6 +444,10 @@ + #ifdef DIRENT_HAVE_D_TYPE_WORKS + if (direfd->d_type!=DT_LNK) + continue; ++#else ++ /* Skip . and .. */ ++ if (!isdigit(direfd->d_name[0])) ++ continue; + #endif + if (procfdlen+1+strlen(direfd->d_name)+1>sizeof(line)) + continue; diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-slattach-fchown.patch b/pkgs/core/net-tools/patches/net-tools-1.60-slattach-fchown.patch new file mode 100644 index 0000000..50edf85 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-slattach-fchown.patch @@ -0,0 +1,24 @@ +diff -up net-tools-1.60/slattach.c.slattach-fchown net-tools-1.60/slattach.c +--- net-tools-1.60/slattach.c.slattach-fchown 2000-10-28 12:59:41.000000000 +0200 ++++ net-tools-1.60/slattach.c 2009-09-15 18:17:01.000000000 +0200 +@@ -195,15 +195,17 @@ tty_lock(char *path, int mode) + return(-1); + } + +- (void) close(fd); +- + /* Make sure UUCP owns the lockfile. Required by some packages. */ + if ((pw = getpwnam(_UID_UUCP)) == NULL) { + if (opt_q == 0) fprintf(stderr, _("slattach: tty_lock: UUCP user %s unknown!\n"), + _UID_UUCP); ++ (void) close(fd); + return(0); /* keep the lock anyway */ + } +- (void) chown(saved_path, pw->pw_uid, pw->pw_gid); ++ (void) fchown(fd, pw->pw_uid, pw->pw_gid); ++ ++ (void) close(fd); ++ + saved_lock = 1; + } else { /* unlock */ + if (saved_lock != 1) return(0); diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-statalias.patch b/pkgs/core/net-tools/patches/net-tools-1.60-statalias.patch new file mode 100644 index 0000000..7c74f74 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-statalias.patch @@ -0,0 +1,15 @@ +--- net-tools-1.60/lib/interface.c.statalias 2005-01-07 12:49:14.084104032 +0100 ++++ net-tools-1.60/lib/interface.c 2005-01-07 12:49:38.527388088 +0100 +@@ -395,9 +395,11 @@ + char *s, name[IFNAMSIZ]; + s = get_name(name, buf); + get_dev_fields(s, ife); +- ife->statistics_valid = 1; + if (target && !strcmp(target,name)) ++ { ++ ife->statistics_valid = 1; + break; ++ } + } + if (ferror(fh)) { + perror(_PATH_PROCNET_DEV); diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-statistics-doubleword.patch b/pkgs/core/net-tools/patches/net-tools-1.60-statistics-doubleword.patch new file mode 100644 index 0000000..a6b2b29 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-statistics-doubleword.patch @@ -0,0 +1,366 @@ +diff -up net-tools-1.60/statistics.c.doubleword net-tools-1.60/statistics.c +--- net-tools-1.60/statistics.c.doubleword 2010-08-10 15:20:11.000000000 +0200 ++++ net-tools-1.60/statistics.c 2010-08-10 15:21:24.000000000 +0200 +@@ -63,54 +63,54 @@ static enum State state; + struct entry Iptab[] = + { + {"Forwarding", N_("Forwarding is %s"), i_forward | I_STATIC}, +- {"DefaultTTL", N_("Default TTL is %lu"), number | I_STATIC}, +- {"InReceives", N_("%lu total packets received"), number}, +- {"InHdrErrors", N_("%lu with invalid headers"), opt_number}, +- {"InAddrErrors", N_("%lu with invalid addresses"), opt_number}, +- {"ForwDatagrams", N_("%lu forwarded"), number}, +- {"InUnknownProtos", N_("%lu with unknown protocol"), opt_number}, +- {"InDiscards", N_("%lu incoming packets discarded"), number}, +- {"InDelivers", N_("%lu incoming packets delivered"), number}, +- {"OutRequests", N_("%lu requests sent out"), number}, /*? */ +- {"OutDiscards", N_("%lu outgoing packets dropped"), opt_number}, +- {"OutNoRoutes", N_("%lu dropped because of missing route"), opt_number}, +- {"ReasmTimeout", N_("%lu fragments dropped after timeout"), opt_number}, +- {"ReasmReqds", N_("%lu reassemblies required"), opt_number}, /* ? */ +- {"ReasmOKs", N_("%lu packets reassembled ok"), opt_number}, +- {"ReasmFails", N_("%lu packet reassembles failed"), opt_number}, +- {"FragOKs", N_("%lu fragments received ok"), opt_number}, +- {"FragFails", N_("%lu fragments failed"), opt_number}, +- {"FragCreates", N_("%lu fragments created"), opt_number} ++ {"DefaultTTL", N_("Default TTL is %llu"), number | I_STATIC}, ++ {"InReceives", N_("%llu total packets received"), number}, ++ {"InHdrErrors", N_("%llu with invalid headers"), opt_number}, ++ {"InAddrErrors", N_("%llu with invalid addresses"), opt_number}, ++ {"ForwDatagrams", N_("%llu forwarded"), number}, ++ {"InUnknownProtos", N_("%llu with unknown protocol"), opt_number}, ++ {"InDiscards", N_("%llu incoming packets discarded"), number}, ++ {"InDelivers", N_("%llu incoming packets delivered"), number}, ++ {"OutRequests", N_("%llu requests sent out"), number}, /*? */ ++ {"OutDiscards", N_("%llu outgoing packets dropped"), opt_number}, ++ {"OutNoRoutes", N_("%llu dropped because of missing route"), opt_number}, ++ {"ReasmTimeout", N_("%llu fragments dropped after timeout"), opt_number}, ++ {"ReasmReqds", N_("%llu reassemblies required"), opt_number}, /* ? */ ++ {"ReasmOKs", N_("%llu packets reassembled ok"), opt_number}, ++ {"ReasmFails", N_("%llu packet reassembles failed"), opt_number}, ++ {"FragOKs", N_("%llu fragments received ok"), opt_number}, ++ {"FragFails", N_("%llu fragments failed"), opt_number}, ++ {"FragCreates", N_("%llu fragments created"), opt_number} + }; + + struct entry Icmptab[] = + { +- {"InMsgs", N_("%lu ICMP messages received"), number}, +- {"InErrors", N_("%lu input ICMP message failed."), number}, +- {"InDestUnreachs", N_("destination unreachable: %lu"), i_inp_icmp | I_TITLE}, +- {"InTimeExcds", N_("timeout in transit: %lu"), i_inp_icmp | I_TITLE}, +- {"InParmProbs", N_("wrong parameters: %lu"), i_inp_icmp | I_TITLE}, /*? */ +- {"InSrcQuenchs", N_("source quenches: %lu"), i_inp_icmp | I_TITLE}, +- {"InRedirects", N_("redirects: %lu"), i_inp_icmp | I_TITLE}, +- {"InEchos", N_("echo requests: %lu"), i_inp_icmp | I_TITLE}, +- {"InEchoReps", N_("echo replies: %lu"), i_inp_icmp | I_TITLE}, +- {"InTimestamps", N_("timestamp request: %lu"), i_inp_icmp | I_TITLE}, +- {"InTimestampReps", N_("timestamp reply: %lu"), i_inp_icmp | I_TITLE}, +- {"InAddrMasks", N_("address mask request: %lu"), i_inp_icmp | I_TITLE}, /*? */ +- {"InAddrMaskReps", N_("address mask replies: %lu"), i_inp_icmp | I_TITLE}, /*? */ +- {"OutMsgs", N_("%lu ICMP messages sent"), number}, +- {"OutErrors", N_("%lu ICMP messages failed"), number}, +- {"OutDestUnreachs", N_("destination unreachable: %lu"), i_outp_icmp | I_TITLE}, +- {"OutTimeExcds", N_("time exceeded: %lu"), i_outp_icmp | I_TITLE}, +- {"OutParmProbs", N_("wrong parameters: %lu"), i_outp_icmp | I_TITLE}, /*? */ +- {"OutSrcQuenchs", N_("source quench: %lu"), i_outp_icmp | I_TITLE}, +- {"OutRedirects", N_("redirect: %lu"), i_outp_icmp | I_TITLE}, +- {"OutEchos", N_("echo request: %lu"), i_outp_icmp | I_TITLE}, +- {"OutEchoReps", N_("echo replies: %lu"), i_outp_icmp | I_TITLE}, +- {"OutTimestamps", N_("timestamp requests: %lu"), i_outp_icmp | I_TITLE}, +- {"OutTimestampReps", N_("timestamp replies: %lu"), i_outp_icmp | I_TITLE}, +- {"OutAddrMasks", N_("address mask requests: %lu"), i_outp_icmp | I_TITLE}, +- {"OutAddrMaskReps", N_("address mask replies: %lu"), i_outp_icmp | I_TITLE}, ++ {"InMsgs", N_("%llu ICMP messages received"), number}, ++ {"InErrors", N_("%llu input ICMP message failed."), number}, ++ {"InDestUnreachs", N_("destination unreachable: %llu"), i_inp_icmp | I_TITLE}, ++ {"InTimeExcds", N_("timeout in transit: %llu"), i_inp_icmp | I_TITLE}, ++ {"InParmProbs", N_("wrong parameters: %llu"), i_inp_icmp | I_TITLE}, /*? */ ++ {"InSrcQuenchs", N_("source quenches: %llu"), i_inp_icmp | I_TITLE}, ++ {"InRedirects", N_("redirects: %llu"), i_inp_icmp | I_TITLE}, ++ {"InEchos", N_("echo requests: %llu"), i_inp_icmp | I_TITLE}, ++ {"InEchoReps", N_("echo replies: %llu"), i_inp_icmp | I_TITLE}, ++ {"InTimestamps", N_("timestamp request: %llu"), i_inp_icmp | I_TITLE}, ++ {"InTimestampReps", N_("timestamp reply: %llu"), i_inp_icmp | I_TITLE}, ++ {"InAddrMasks", N_("address mask request: %llu"), i_inp_icmp | I_TITLE}, /*? */ ++ {"InAddrMaskReps", N_("address mask replies: %llu"), i_inp_icmp | I_TITLE}, /*? */ ++ {"OutMsgs", N_("%llu ICMP messages sent"), number}, ++ {"OutErrors", N_("%llu ICMP messages failed"), number}, ++ {"OutDestUnreachs", N_("destination unreachable: %llu"), i_outp_icmp | I_TITLE}, ++ {"OutTimeExcds", N_("time exceeded: %llu"), i_outp_icmp | I_TITLE}, ++ {"OutParmProbs", N_("wrong parameters: %llu"), i_outp_icmp | I_TITLE}, /*? */ ++ {"OutSrcQuenchs", N_("source quench: %llu"), i_outp_icmp | I_TITLE}, ++ {"OutRedirects", N_("redirect: %llu"), i_outp_icmp | I_TITLE}, ++ {"OutEchos", N_("echo request: %llu"), i_outp_icmp | I_TITLE}, ++ {"OutEchoReps", N_("echo replies: %llu"), i_outp_icmp | I_TITLE}, ++ {"OutTimestamps", N_("timestamp requests: %llu"), i_outp_icmp | I_TITLE}, ++ {"OutTimestampReps", N_("timestamp replies: %llu"), i_outp_icmp | I_TITLE}, ++ {"OutAddrMasks", N_("address mask requests: %llu"), i_outp_icmp | I_TITLE}, ++ {"OutAddrMaskReps", N_("address mask replies: %llu"), i_outp_icmp | I_TITLE}, + }; + + struct entry Tcptab[] = +@@ -119,131 +119,131 @@ struct entry Tcptab[] = + {"RtoMin", "", number}, + {"RtoMax", "", number}, + {"MaxConn", "", number}, +- {"ActiveOpens", N_("%lu active connections openings"), number}, +- {"PassiveOpens", N_("%lu passive connection openings"), number}, +- {"AttemptFails", N_("%lu failed connection attempts"), number}, +- {"EstabResets", N_("%lu connection resets received"), number}, +- {"CurrEstab", N_("%lu connections established"), number}, +- {"InSegs", N_("%lu segments received"), number}, +- {"OutSegs", N_("%lu segments send out"), number}, +- {"RetransSegs", N_("%lu segments retransmited"), number}, +- {"InErrs", N_("%lu bad segments received."), number}, +- {"OutRsts", N_("%lu resets sent"), number}, ++ {"ActiveOpens", N_("%llu active connections openings"), number}, ++ {"PassiveOpens", N_("%llu passive connection openings"), number}, ++ {"AttemptFails", N_("%llu failed connection attempts"), number}, ++ {"EstabResets", N_("%llu connection resets received"), number}, ++ {"CurrEstab", N_("%llu connections established"), number}, ++ {"InSegs", N_("%llu segments received"), number}, ++ {"OutSegs", N_("%llu segments send out"), number}, ++ {"RetransSegs", N_("%llu segments retransmited"), number}, ++ {"InErrs", N_("%llu bad segments received."), number}, ++ {"OutRsts", N_("%llu resets sent"), number}, + }; + + struct entry Udptab[] = + { +- {"InDatagrams", N_("%lu packets received"), number}, +- {"NoPorts", N_("%lu packets to unknown port received."), number}, +- {"InErrors", N_("%lu packet receive errors"), number}, +- {"OutDatagrams", N_("%lu packets sent"), number}, ++ {"InDatagrams", N_("%llu packets received"), number}, ++ {"NoPorts", N_("%llu packets to unknown port received."), number}, ++ {"InErrors", N_("%llu packet receive errors"), number}, ++ {"OutDatagrams", N_("%llu packets sent"), number}, + }; + + struct entry Tcpexttab[] = + { +- {"SyncookiesSent", N_("%lu SYN cookies sent"), opt_number}, +- {"SyncookiesRecv", N_("%lu SYN cookies received"), opt_number}, +- {"SyncookiesFailed", N_("%lu invalid SYN cookies received"), opt_number}, ++ {"SyncookiesSent", N_("%llu SYN cookies sent"), opt_number}, ++ {"SyncookiesRecv", N_("%llu SYN cookies received"), opt_number}, ++ {"SyncookiesFailed", N_("%llu invalid SYN cookies received"), opt_number}, + +- { "EmbryonicRsts", N_("%lu resets received for embryonic SYN_RECV sockets"), ++ { "EmbryonicRsts", N_("%llu resets received for embryonic SYN_RECV sockets"), + opt_number }, +- { "PruneCalled", N_("%lu packets pruned from receive queue because of socket" ++ { "PruneCalled", N_("%llu packets pruned from receive queue because of socket" + " buffer overrun"), opt_number }, + /* obsolete: 2.2.0 doesn't do that anymore */ +- { "RcvPruned", N_("%lu packets pruned from receive queue"), opt_number }, +- { "OfoPruned", N_("%lu packets dropped from out-of-order queue because of" ++ { "RcvPruned", N_("%llu packets pruned from receive queue"), opt_number }, ++ { "OfoPruned", N_("%llu packets dropped from out-of-order queue because of" + " socket buffer overrun"), opt_number }, +- { "OutOfWindowIcmps", N_("%lu ICMP packets dropped because they were " ++ { "OutOfWindowIcmps", N_("%llu ICMP packets dropped because they were " + "out-of-window"), opt_number }, +- { "LockDroppedIcmps", N_("%lu ICMP packets dropped because" ++ { "LockDroppedIcmps", N_("%llu ICMP packets dropped because" + " socket was locked"), opt_number }, +- { "TW", N_("%lu TCP sockets finished time wait in fast timer"), opt_number }, +- { "TWRecycled", N_("%lu time wait sockets recycled by time stamp"), opt_number }, +- { "TWKilled", N_("%lu TCP sockets finished time wait in slow timer"), opt_number }, +- { "PAWSPassive", N_("%lu passive connections rejected because of" ++ { "TW", N_("%llu TCP sockets finished time wait in fast timer"), opt_number }, ++ { "TWRecycled", N_("%llu time wait sockets recycled by time stamp"), opt_number }, ++ { "TWKilled", N_("%llu TCP sockets finished time wait in slow timer"), opt_number }, ++ { "PAWSPassive", N_("%llu passive connections rejected because of" + " time stamp"), opt_number }, +- { "PAWSActive", N_("%lu active connections rejected because of " ++ { "PAWSActive", N_("%llu active connections rejected because of " + "time stamp"), opt_number }, +- { "PAWSEstab", N_("%lu packets rejects in established connections because of" ++ { "PAWSEstab", N_("%llu packets rejects in established connections because of" + " timestamp"), opt_number }, +- { "DelayedACKs", N_("%lu delayed acks sent"), opt_number }, +- { "DelayedACKLocked", N_("%lu delayed acks further delayed because of" ++ { "DelayedACKs", N_("%llu delayed acks sent"), opt_number }, ++ { "DelayedACKLocked", N_("%llu delayed acks further delayed because of" + " locked socket"), opt_number }, +- { "DelayedACKLost", N_("Quick ack mode was activated %lu times"), opt_number }, +- { "ListenOverflows", N_("%lu times the listen queue of a socket overflowed"), ++ { "DelayedACKLost", N_("Quick ack mode was activated %llu times"), opt_number }, ++ { "ListenOverflows", N_("%llu times the listen queue of a socket overflowed"), + opt_number }, +- { "ListenDrops", N_("%lu SYNs to LISTEN sockets ignored"), opt_number }, +- { "TCPPrequeued", N_("%lu packets directly queued to recvmsg prequeue."), ++ { "ListenDrops", N_("%llu SYNs to LISTEN sockets ignored"), opt_number }, ++ { "TCPPrequeued", N_("%llu packets directly queued to recvmsg prequeue."), + opt_number }, +- { "TCPDirectCopyFromBacklog", N_("%lu packets directly received" ++ { "TCPDirectCopyFromBacklog", N_("%llu packets directly received" + " from backlog"), opt_number }, +- { "TCPDirectCopyFromPrequeue", N_("%lu packets directly received" ++ { "TCPDirectCopyFromPrequeue", N_("%llu packets directly received" + " from prequeue"), opt_number }, +- { "TCPPrequeueDropped", N_("%lu packets dropped from prequeue"), opt_number }, +- { "TCPHPHits", N_("%lu packets header predicted"), number }, +- { "TCPHPHitsToUser", N_("%lu packets header predicted and " ++ { "TCPPrequeueDropped", N_("%llu packets dropped from prequeue"), opt_number }, ++ { "TCPHPHits", N_("%llu packets header predicted"), number }, ++ { "TCPHPHitsToUser", N_("%llu packets header predicted and " + "directly queued to user"), opt_number }, +- { "SockMallocOOM", N_("Ran %lu times out of system memory during " ++ { "SockMallocOOM", N_("Ran %llu times out of system memory during " + "packet sending"), opt_number }, +- { "TCPPureAcks", N_("%u acknowledgments not containing data received"), opt_number }, +- { "TCPHPAcks", N_("%u predicted acknowledgments"), opt_number }, +- { "TCPRenoRecovery", N_("%u times recovered from packet loss due to fast retransmit"), opt_number }, +- { "TCPSackRecovery", N_("%u times recovered from packet loss due to SACK data"), opt_number }, +- { "TCPSACKReneging", N_("%u bad SACKs received"), opt_number }, +- { "TCPFACKReorder", N_("Detected reordering %u times using FACK"), opt_number }, +- { "TCPSACKReorder", N_("Detected reordering %u times using SACK"), opt_number }, +- { "TCPTSReorder", N_("Detected reordering %u times using time stamp"), opt_number }, +- { "TCPRenoReorder", N_("Detected reordering %u times using reno fast retransmit"), opt_number }, +- { "TCPFullUndo", N_("%u congestion windows fully recovered"), opt_number }, +- { "TCPPartialUndo", N_("%u congestion windows partially recovered using Hoe heuristic"), opt_number }, +- { "TCPDSackUndo", N_("%u congestion window recovered using DSACK"), opt_number }, +- { "TCPLossUndo", N_("%u congestion windows recovered after partial ack"), opt_number }, +- { "TCPLostRetransmits", N_("%u retransmits lost"), opt_number }, +- { "TCPRenoFailures", N_("%u timeouts after reno fast retransmit"), opt_number }, +- { "TCPSackFailures", N_("%u timeouts after SACK recovery"), opt_number }, +- { "TCPLossFailures", N_("%u timeouts in loss state"), opt_number }, +- { "TCPFastRetrans", N_("%u fast retransmits"), opt_number }, +- { "TCPForwardRetrans", N_("%u forward retransmits"), opt_number }, +- { "TCPSlowStartRetrans", N_("%u retransmits in slow start"), opt_number }, +- { "TCPTimeouts", N_("%u other TCP timeouts"), opt_number }, +- { "TCPRenoRecoveryFailed", N_("%u reno fast retransmits failed"), opt_number }, +- { "TCPSackRecoveryFail", N_("%u sack retransmits failed"), opt_number }, +- { "TCPSchedulerFailed", N_("%u times receiver scheduled too late for direct processing"), opt_number }, +- { "TCPRcvCollapsed", N_("%u packets collapsed in receive queue due to low socket buffer"), opt_number }, +- { "TCPDSACKOldSent", N_("%u DSACKs sent for old packets"), opt_number }, +- { "TCPDSACKOfoSent", N_("%u DSACKs sent for out of order packets"), opt_number }, +- { "TCPDSACKRecv", N_("%u DSACKs received"), opt_number }, +- { "TCPDSACKOfoRecv", N_("%u DSACKs for out of order packets received"), opt_number }, +- { "TCPAbortOnSyn", N_("%u connections reset due to unexpected SYN"), opt_number }, +- { "TCPAbortOnData", N_("%u connections reset due to unexpected data"), opt_number }, +- { "TCPAbortOnClose", N_("%u connections reset due to early user close"), opt_number }, +- { "TCPAbortOnMemory", N_("%u connections aborted due to memory pressure"), opt_number }, +- { "TCPAbortOnTimeout", N_("%u connections aborted due to timeout"), opt_number }, +- { "TCPAbortOnLinger", N_("%u connections aborted after user close in linger timeout"), opt_number }, +- { "TCPAbortFailed", N_("%u times unable to send RST due to no memory"), opt_number }, +- { "TCPMemoryPressures", N_("TCP ran low on memory %u times"), opt_number }, +- { "TCPLoss", N_("%u TCP data loss events") }, ++ { "TCPPureAcks", N_("%llu acknowledgments not containing data received"), opt_number }, ++ { "TCPHPAcks", N_("%llu predicted acknowledgments"), opt_number }, ++ { "TCPRenoRecovery", N_("%llu times recovered from packet loss due to fast retransmit"), opt_number }, ++ { "TCPSackRecovery", N_("%llu times recovered from packet loss due to SACK data"), opt_number }, ++ { "TCPSACKReneging", N_("%llu bad SACKs received"), opt_number }, ++ { "TCPFACKReorder", N_("Detected reordering %llu times using FACK"), opt_number }, ++ { "TCPSACKReorder", N_("Detected reordering %llu times using SACK"), opt_number }, ++ { "TCPTSReorder", N_("Detected reordering %llu times using time stamp"), opt_number }, ++ { "TCPRenoReorder", N_("Detected reordering %llu times using reno fast retransmit"), opt_number }, ++ { "TCPFullUndo", N_("%llu congestion windows fully recovered"), opt_number }, ++ { "TCPPartialUndo", N_("%llu congestion windows partially recovered using Hoe heuristic"), opt_number }, ++ { "TCPDSackUndo", N_("%llu congestion window recovered using DSACK"), opt_number }, ++ { "TCPLossUndo", N_("%llu congestion windows recovered after partial ack"), opt_number }, ++ { "TCPLostRetransmits", N_("%llu retransmits lost"), opt_number }, ++ { "TCPRenoFailures", N_("%llu timeouts after reno fast retransmit"), opt_number }, ++ { "TCPSackFailures", N_("%llu timeouts after SACK recovery"), opt_number }, ++ { "TCPLossFailures", N_("%llu timeouts in loss state"), opt_number }, ++ { "TCPFastRetrans", N_("%llu fast retransmits"), opt_number }, ++ { "TCPForwardRetrans", N_("%llu forward retransmits"), opt_number }, ++ { "TCPSlowStartRetrans", N_("%llu retransmits in slow start"), opt_number }, ++ { "TCPTimeouts", N_("%llu other TCP timeouts"), opt_number }, ++ { "TCPRenoRecoveryFailed", N_("%llu reno fast retransmits failed"), opt_number }, ++ { "TCPSackRecoveryFail", N_("%llu sack retransmits failed"), opt_number }, ++ { "TCPSchedulerFailed", N_("%llu times receiver scheduled too late for direct processing"), opt_number }, ++ { "TCPRcvCollapsed", N_("%llu packets collapsed in receive queue due to low socket buffer"), opt_number }, ++ { "TCPDSACKOldSent", N_("%llu DSACKs sent for old packets"), opt_number }, ++ { "TCPDSACKOfoSent", N_("%llu DSACKs sent for out of order packets"), opt_number }, ++ { "TCPDSACKRecv", N_("%llu DSACKs received"), opt_number }, ++ { "TCPDSACKOfoRecv", N_("%llu DSACKs for out of order packets received"), opt_number }, ++ { "TCPAbortOnSyn", N_("%llu connections reset due to unexpected SYN"), opt_number }, ++ { "TCPAbortOnData", N_("%llu connections reset due to unexpected data"), opt_number }, ++ { "TCPAbortOnClose", N_("%llu connections reset due to early user close"), opt_number }, ++ { "TCPAbortOnMemory", N_("%llu connections aborted due to memory pressure"), opt_number }, ++ { "TCPAbortOnTimeout", N_("%llu connections aborted due to timeout"), opt_number }, ++ { "TCPAbortOnLinger", N_("%llu connections aborted after user close in linger timeout"), opt_number }, ++ { "TCPAbortFailed", N_("%llu times unable to send RST due to no memory"), opt_number }, ++ { "TCPMemoryPressures", N_("TCP ran low on memory %llu times"), opt_number }, ++ { "TCPLoss", N_("%llu TCP data loss events") }, + }; + + struct entry Sctptab[] = + { +- {"SctpCurrEstab", N_("%u Current Associations"), number}, +- {"SctpActiveEstabs", N_("%u Active Associations"), number}, +- {"SctpPassiveEstabs", N_("%u Passive Associations"), number}, +- {"SctpAborteds", N_("%u Number of Aborteds "), number}, +- {"SctpShutdowns", N_("%u Number of Graceful Terminations"), number}, +- {"SctpOutOfBlues", N_("%u Number of Out of Blue packets"), number}, +- {"SctpChecksumErrors", N_("%u Number of Packets with invalid Checksum"), number}, +- {"SctpOutCtrlChunks", N_("%u Number of control chunks sent"), number}, +- {"SctpOutOrderChunks", N_("%u Number of ordered chunks sent"), number}, +- {"SctpOutUnorderChunks", N_("%u Number of Unordered chunks sent"), number}, +- {"SctpInCtrlChunks", N_("%u Number of control chunks received"), number}, +- {"SctpInOrderChunks", N_("%u Number of ordered chunks received"), number}, +- {"SctpInUnorderChunks", N_("%u Number of Unordered chunks received"), number}, +- {"SctpFragUsrMsgs", N_("%u Number of messages fragmented"), number}, +- {"SctpReasmUsrMsgs", N_("%u Number of messages reassembled "), number}, +- {"SctpOutSCTPPacks", N_("%u Number of SCTP packets sent"), number}, +- {"SctpInSCTPPacks", N_("%u Number of SCTP packets received"), number}, ++ {"SctpCurrEstab", N_("%llu Current Associations"), number}, ++ {"SctpActiveEstabs", N_("%llu Active Associations"), number}, ++ {"SctpPassiveEstabs", N_("%llu Passive Associations"), number}, ++ {"SctpAborteds", N_("%llu Number of Aborteds "), number}, ++ {"SctpShutdowns", N_("%llu Number of Graceful Terminations"), number}, ++ {"SctpOutOfBlues", N_("%llu Number of Out of Blue packets"), number}, ++ {"SctpChecksumErrors", N_("%llu Number of Packets with invalid Checksum"), number}, ++ {"SctpOutCtrlChunks", N_("%llu Number of control chunks sent"), number}, ++ {"SctpOutOrderChunks", N_("%llu Number of ordered chunks sent"), number}, ++ {"SctpOutUnorderChunks", N_("%llu Number of Unordered chunks sent"), number}, ++ {"SctpInCtrlChunks", N_("%llu Number of control chunks received"), number}, ++ {"SctpInOrderChunks", N_("%llu Number of ordered chunks received"), number}, ++ {"SctpInUnorderChunks", N_("%llu Number of Unordered chunks received"), number}, ++ {"SctpFragUsrMsgs", N_("%llu Number of messages fragmented"), number}, ++ {"SctpReasmUsrMsgs", N_("%llu Number of messages reassembled "), number}, ++ {"SctpOutSCTPPacks", N_("%llu Number of SCTP packets sent"), number}, ++ {"SctpInSCTPPacks", N_("%llu Number of SCTP packets received"), number}, + }; + + struct tabtab { +@@ -271,7 +271,7 @@ int cmpentries(const void *a, const void + return strcmp(((struct entry *) a)->title, ((struct entry *) b)->title); + } + +-void printval(struct tabtab *tab, char *title, int val) ++void printval(struct tabtab *tab, char *title, unsigned long long val) + { + struct entry *ent = NULL, key; + int type; +@@ -283,7 +283,7 @@ void printval(struct tabtab *tab, char * + sizeof(struct entry), cmpentries); + if (!ent) { /* try our best */ + if (val) +- printf("%*s%s: %d\n", states[state].indent, "", title, val); ++ printf("%*s%s: %llu\n", states[state].indent, "", title, val); + return; + } + type = ent->type; +@@ -390,7 +390,7 @@ void process_fd(FILE *f,int file_desc) + *p = '\0'; + + if (*sp != '\0' && *(tab->flag)) +- printval(tab, sp, strtoul(np, &np, 10)); ++ printval(tab, sp, strtoull(np, &np, 10)); + + sp = p + 1; + } +@@ -426,7 +426,7 @@ void process_fd2(FILE *f, const char *fi + sp += strspn(sp, " \t\n"); + + if (*sp != '\0' && *(tab->flag)) +- printval(tab, buf1, strtoul(sp, 0, 10)); ++ printval(tab, buf1, strtoull(sp, 0, 10)); + } + return; + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-statistics.patch b/pkgs/core/net-tools/patches/net-tools-1.60-statistics.patch new file mode 100644 index 0000000..3972e37 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-statistics.patch @@ -0,0 +1,65 @@ +--- net-tools-1.60/statistics.c.tcpdata 2005-04-26 10:38:10.000000000 +0200 ++++ net-tools-1.60/statistics.c 2005-04-26 10:36:19.000000000 +0200 +@@ -1,6 +1,6 @@ + /* + * Copyright 1997,1999,2000 Andi Kleen. Subject to the GPL. +- * $Id: statistics.c,v 1.14 2001/02/02 18:01:23 pb Exp $ ++ * $Id: statistics.c,v 1.17 2002/04/28 15:41:01 ak Exp $ + * 19980630 - i18n - Arnaldo Carvalho de Melo acme@conectiva.com.br + * 19981113 - i18n fixes - Arnaldo Carvalho de Melo acme@conectiva.com.br + * 19990101 - added net/netstat, -t, -u, -w supprt - Bernd Eckenfels +@@ -185,6 +185,44 @@ + "directly queued to user"), opt_number }, + { "SockMallocOOM", N_("Ran %lu times out of system memory during " + "packet sending"), opt_number }, ++ { "TCPPureAcks", N_("%u acknowledgments not containing data received"), opt_number }, ++ { "TCPHPAcks", N_("%u predicted acknowledgments"), opt_number }, ++ { "TCPRenoRecovery", N_("%u times recovered from packet loss due to fast retransmit"), opt_number }, ++ { "TCPSackRecovery", N_("%u times recovered from packet loss due to SACK data"), opt_number }, ++ { "TCPSACKReneging", N_("%u bad SACKs received"), opt_number }, ++ { "TCPFACKReorder", N_("Detected reordering %u times using FACK"), opt_number }, ++ { "TCPSACKReorder", N_("Detected reordering %u times using SACK"), opt_number }, ++ { "TCPTSReorder", N_("Detected reordering %u times using time stamp"), opt_number }, ++ { "TCPRenoReorder", N_("Detected reordering %u times using reno fast retransmit"), opt_number }, ++ { "TCPFullUndo", N_("%u congestion windows fully recovered"), opt_number }, ++ { "TCPPartialUndo", N_("%u congestion windows partially recovered using Hoe heuristic"), opt_number }, ++ { "TCPDSackUndo", N_("%u congestion window recovered using DSACK"), opt_number }, ++ { "TCPLossUndo", N_("%u congestion windows recovered after partial ack"), opt_number }, ++ { "TCPLostRetransmits", N_("%u retransmits lost"), opt_number }, ++ { "TCPRenoFailures", N_("%u timeouts after reno fast retransmit"), opt_number }, ++ { "TCPSackFailures", N_("%u timeouts after SACK recovery"), opt_number }, ++ { "TCPLossFailures", N_("%u timeouts in loss state"), opt_number }, ++ { "TCPFastRetrans", N_("%u fast retransmits"), opt_number }, ++ { "TCPForwardRetrans", N_("%u forward retransmits"), opt_number }, ++ { "TCPSlowStartRetrans", N_("%u retransmits in slow start"), opt_number }, ++ { "TCPTimeouts", N_("%u other TCP timeouts"), opt_number }, ++ { "TCPRenoRecoveryFailed", N_("%u reno fast retransmits failed"), opt_number }, ++ { "TCPSackRecoveryFail", N_("%u sack retransmits failed"), opt_number }, ++ { "TCPSchedulerFailed", N_("%u times receiver scheduled too late for direct processing"), opt_number }, ++ { "TCPRcvCollapsed", N_("%u packets collapsed in receive queue due to low socket buffer"), opt_number }, ++ { "TCPDSACKOldSent", N_("%u DSACKs sent for old packets"), opt_number }, ++ { "TCPDSACKOfoSent", N_("%u DSACKs sent for out of order packets"), opt_number }, ++ { "TCPDSACKRecv", N_("%u DSACKs received"), opt_number }, ++ { "TCPDSACKOfoRecv", N_("%u DSACKs for out of order packets received"), opt_number }, ++ { "TCPAbortOnSyn", N_("%u connections reset due to unexpected SYN"), opt_number }, ++ { "TCPAbortOnData", N_("%u connections reset due to unexpected data"), opt_number }, ++ { "TCPAbortOnClose", N_("%u connections reset due to early user close"), opt_number }, ++ { "TCPAbortOnMemory", N_("%u connections aborted due to memory pressure"), opt_number }, ++ { "TCPAbortOnTimeout", N_("%u connections aborted due to timeout"), opt_number }, ++ { "TCPAbortOnLinger", N_("%u connections aborted after user close in linger timeout"), opt_number }, ++ { "TCPAbortFailed", N_("%u times unable to send RST due to no memory"), opt_number }, ++ { "TCPMemoryPressures", N_("TCP ran low on memory %u times"), opt_number }, ++ { "TCPLoss", N_("%u TCP data loss events") }, + }; + + struct tabtab { +@@ -222,7 +260,8 @@ + ent = bsearch(&key, tab->tab, tab->size / sizeof(struct entry), + sizeof(struct entry), cmpentries); + if (!ent) { /* try our best */ +- printf("%*s%s: %d\n", states[state].indent, "", title, val); ++ if (val) ++ printf("%*s%s: %d\n", states[state].indent, "", title, val); + return; + } + type = ent->type; diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-statistics_buffer.patch b/pkgs/core/net-tools/patches/net-tools-1.60-statistics_buffer.patch new file mode 100644 index 0000000..526c490 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-statistics_buffer.patch @@ -0,0 +1,12 @@ +diff -up net-tools-1.60/statistics.c.old net-tools-1.60/statistics.c +--- net-tools-1.60/statistics.c.old 2008-03-04 10:44:41.000000000 +0100 ++++ net-tools-1.60/statistics.c 2008-03-04 10:44:11.000000000 +0100 +@@ -352,7 +352,7 @@ struct tabtab *newtable(struct tabtab *t + + void process_fd(FILE *f,int file_desc) // added file_desc to show propriate error mesg + { +- char buf1[1024], buf2[1024]; ++ char buf1[2048], buf2[2048]; + char *sp, *np, *p; + while (fgets(buf1, sizeof buf1, f)) { + int endflag; diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-stdo.patch b/pkgs/core/net-tools/patches/net-tools-1.60-stdo.patch new file mode 100644 index 0000000..4c9d93e --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-stdo.patch @@ -0,0 +1,11 @@ +diff -urN net-tools-1.60/mii-tool.c net-tools-1.60.new/mii-tool.c +--- net-tools-1.60/mii-tool.c 2000-05-21 16:31:17.000000000 +0200 ++++ net-tools-1.60.new/mii-tool.c 2005-03-29 13:00:18.000000000 +0200 +@@ -302,6 +302,7 @@ + printf("\n link partner:%s", media_list(lkpar, 0)); + printf("\n"); + } ++ fflush(stdout); + return 0; + } + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-trailingblank.patch b/pkgs/core/net-tools/patches/net-tools-1.60-trailingblank.patch new file mode 100644 index 0000000..8c75228 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-trailingblank.patch @@ -0,0 +1,26 @@ +--- net-tools-1.60/hostname.c.trailingblank 2001-04-08 19:04:23.000000000 +0200 ++++ net-tools-1.60/hostname.c 2003-08-19 14:21:17.000000000 +0200 +@@ -153,13 +153,19 @@ + + switch (c) { + case 'a': +- while (hp->h_aliases[0]) +- printf("%s ", *hp->h_aliases++); ++ while (hp->h_aliases[0]) { ++ printf("%s", *hp->h_aliases++); ++ if (hp->h_aliases[0]) ++ printf(" "); ++ } + printf("\n"); + break; + case 'i': +- while (hp->h_addr_list[0]) +- printf("%s ", inet_ntoa(*(struct in_addr *) *hp->h_addr_list++)); ++ while (hp->h_addr_list[0]) { ++ printf("%s", inet_ntoa(*(struct in_addr *) *hp->h_addr_list++)); ++ if (hp->h_addr_list[0]) ++ printf(" "); ++ } + printf("\n"); + break; + case 'd': diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-trim_iface.patch b/pkgs/core/net-tools/patches/net-tools-1.60-trim_iface.patch new file mode 100644 index 0000000..150722c --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-trim_iface.patch @@ -0,0 +1,31 @@ +--- net-tools-1.60/ifconfig.c.old 2005-03-30 10:14:03.000000000 +0200 ++++ net-tools-1.60/ifconfig.c 2005-03-30 10:40:50.000000000 +0200 +@@ -177,7 +177,7 @@ + + static void usage(void) + { +- fprintf(stderr, _("Usage:\n ifconfig [-a] [-i] [-v] [-s] <interface> [[<AF>] <address>]\n")); ++ fprintf(stderr, _("Usage:\n ifconfig [-a] [-v] [-s] <interface> [[<AF>] <address>]\n")); + #if HAVE_AFINET + fprintf(stderr, _(" [add <address>[/<prefixlen>]]\n")); + fprintf(stderr, _(" [del <address>[/<prefixlen>]]\n")); +--- net-tools-1.60/lib/interface.c.old 2005-03-30 10:14:03.000000000 +0200 ++++ net-tools-1.60/lib/interface.c 2005-03-30 11:05:38.000000000 +0200 +@@ -620,7 +620,7 @@ + + void ife_print_short(struct interface *ptr) + { +- printf("%-9.9s ", ptr->name); ++ printf("%-9s ", ptr->name); + printf("%5d %3d ", ptr->mtu, ptr->metric); + /* If needed, display the interface statistics. */ + if (ptr->statistics_valid) { +@@ -711,7 +711,7 @@ + if (hw == NULL) + hw = get_hwntype(-1); + +- printf(_("%-9.9s Link encap:%s "), ptr->name, hw->title); ++ printf(_("%-9s Link encap:%s "), ptr->name, hw->title); + /* For some hardware types (eg Ash, ATM) we don't print the + hardware address if it's null. */ + if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) && diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-trunc.patch b/pkgs/core/net-tools/patches/net-tools-1.60-trunc.patch new file mode 100644 index 0000000..8076089 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-trunc.patch @@ -0,0 +1,42 @@ +--- net-tools-1.60/netstat.c.trunc 2004-08-31 12:42:08.595426960 +0200 ++++ net-tools-1.60/netstat.c 2004-08-31 12:59:55.766192344 +0200 +@@ -773,8 +773,8 @@ + get_sname(htons(local_port), "tcp", + flag_not & FLAG_NUM_PORT)); + +- if ((strlen(local_addr) + strlen(buffer)) > 22) +- local_addr[22 - strlen(buffer)] = '\0'; ++ if ((strlen(local_addr) + strlen(buffer)) >= 27) ++ local_addr[27 - strlen(buffer) - 1] = '\0'; + + strcat(local_addr, ":"); + strncat(local_addr, buffer, sizeof(local_addr)-strlen(local_addr)-1); +@@ -782,8 +782,8 @@ + snprintf(buffer, sizeof(buffer), "%s", + get_sname(htons(rem_port), "tcp", flag_not & FLAG_NUM_PORT)); + +- if ((strlen(rem_addr) + strlen(buffer)) > 22) +- rem_addr[22 - strlen(buffer)] = '\0'; ++ if ((strlen(rem_addr) + strlen(buffer)) >= 27) ++ rem_addr[27 - strlen(buffer) - 1] = '\0'; + + strcat(rem_addr, ":"); + strncat(rem_addr, buffer, sizeof(rem_addr)-strlen(rem_addr)-1); +@@ -816,7 +816,7 @@ + timer_run, (double) time_len / HZ, retr, timeout); + break; + } +- printf("tcp %6ld %6ld %-23s %-23s %-12s", ++ printf("tcp %6ld %6ld %-27s %-27s %-12s", + rxq, txq, local_addr, rem_addr, _(tcp_state[state])); + + finish_this_one(uid,inode,timers); +@@ -1770,7 +1770,7 @@ + else + printf(_("(w/o servers)")); + } +- printf(_("\nProto Recv-Q Send-Q Local Address Foreign Address State ")); /* xxx */ ++ printf(_("\nProto Recv-Q Send-Q Local Address Foreign Address State ")); /* xxx */ + if (flag_exp > 1) + printf(_(" User Inode ")); + print_progname_banner(); diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-ulong.patch b/pkgs/core/net-tools/patches/net-tools-1.60-ulong.patch new file mode 100644 index 0000000..bc7df29 --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-ulong.patch @@ -0,0 +1,215 @@ +diff -urN net-tools-1.60/statistics.c net-tools-1.60-patch/statistics.c +--- net-tools-1.60/statistics.c 2001-02-02 10:01:23.000000000 -0800 ++++ net-tools-1.60-patch/statistics.c 2004-06-15 11:09:44.000000000 -0700 +@@ -63,54 +63,54 @@ + struct entry Iptab[] = + { + {"Forwarding", N_("Forwarding is %s"), i_forward | I_STATIC}, +- {"DefaultTTL", N_("Default TTL is %u"), number | I_STATIC}, +- {"InReceives", N_("%u total packets received"), number}, +- {"InHdrErrors", N_("%u with invalid headers"), opt_number}, +- {"InAddrErrors", N_("%u with invalid addresses"), opt_number}, +- {"ForwDatagrams", N_("%u forwarded"), number}, +- {"InUnknownProtos", N_("%u with unknown protocol"), opt_number}, +- {"InDiscards", N_("%u incoming packets discarded"), number}, +- {"InDelivers", N_("%u incoming packets delivered"), number}, +- {"OutRequests", N_("%u requests sent out"), number}, /*? */ +- {"OutDiscards", N_("%u outgoing packets dropped"), opt_number}, +- {"OutNoRoutes", N_("%u dropped because of missing route"), opt_number}, +- {"ReasmTimeout", N_("%u fragments dropped after timeout"), opt_number}, +- {"ReasmReqds", N_("%u reassemblies required"), opt_number}, /* ? */ +- {"ReasmOKs", N_("%u packets reassembled ok"), opt_number}, +- {"ReasmFails", N_("%u packet reassembles failed"), opt_number}, +- {"FragOKs", N_("%u fragments received ok"), opt_number}, +- {"FragFails", N_("%u fragments failed"), opt_number}, +- {"FragCreates", N_("%u fragments created"), opt_number} ++ {"DefaultTTL", N_("Default TTL is %lu"), number | I_STATIC}, ++ {"InReceives", N_("%lu total packets received"), number}, ++ {"InHdrErrors", N_("%lu with invalid headers"), opt_number}, ++ {"InAddrErrors", N_("%lu with invalid addresses"), opt_number}, ++ {"ForwDatagrams", N_("%lu forwarded"), number}, ++ {"InUnknownProtos", N_("%lu with unknown protocol"), opt_number}, ++ {"InDiscards", N_("%lu incoming packets discarded"), number}, ++ {"InDelivers", N_("%lu incoming packets delivered"), number}, ++ {"OutRequests", N_("%lu requests sent out"), number}, /*? */ ++ {"OutDiscards", N_("%lu outgoing packets dropped"), opt_number}, ++ {"OutNoRoutes", N_("%lu dropped because of missing route"), opt_number}, ++ {"ReasmTimeout", N_("%lu fragments dropped after timeout"), opt_number}, ++ {"ReasmReqds", N_("%lu reassemblies required"), opt_number}, /* ? */ ++ {"ReasmOKs", N_("%lu packets reassembled ok"), opt_number}, ++ {"ReasmFails", N_("%lu packet reassembles failed"), opt_number}, ++ {"FragOKs", N_("%lu fragments received ok"), opt_number}, ++ {"FragFails", N_("%lu fragments failed"), opt_number}, ++ {"FragCreates", N_("%lu fragments created"), opt_number} + }; + + struct entry Icmptab[] = + { +- {"InMsgs", N_("%u ICMP messages received"), number}, +- {"InErrors", N_("%u input ICMP message failed."), number}, +- {"InDestUnreachs", N_("destination unreachable: %u"), i_inp_icmp | I_TITLE}, +- {"InTimeExcds", N_("timeout in transit: %u"), i_inp_icmp | I_TITLE}, +- {"InParmProbs", N_("wrong parameters: %u"), i_inp_icmp | I_TITLE}, /*? */ +- {"InSrcQuenchs", N_("source quenches: %u"), i_inp_icmp | I_TITLE}, +- {"InRedirects", N_("redirects: %u"), i_inp_icmp | I_TITLE}, +- {"InEchos", N_("echo requests: %u"), i_inp_icmp | I_TITLE}, +- {"InEchoReps", N_("echo replies: %u"), i_inp_icmp | I_TITLE}, +- {"InTimestamps", N_("timestamp request: %u"), i_inp_icmp | I_TITLE}, +- {"InTimestampReps", N_("timestamp reply: %u"), i_inp_icmp | I_TITLE}, +- {"InAddrMasks", N_("address mask request: %u"), i_inp_icmp | I_TITLE}, /*? */ +- {"InAddrMaskReps", N_("address mask replies: %u"), i_inp_icmp | I_TITLE}, /*? */ +- {"OutMsgs", N_("%u ICMP messages sent"), number}, +- {"OutErrors", N_("%u ICMP messages failed"), number}, +- {"OutDestUnreachs", N_("destination unreachable: %u"), i_outp_icmp | I_TITLE}, +- {"OutTimeExcds", N_("time exceeded: %u"), i_outp_icmp | I_TITLE}, +- {"OutParmProbs", N_("wrong parameters: %u"), i_outp_icmp | I_TITLE}, /*? */ +- {"OutSrcQuenchs", N_("source quench: %u"), i_outp_icmp | I_TITLE}, +- {"OutRedirects", N_("redirect: %u"), i_outp_icmp | I_TITLE}, +- {"OutEchos", N_("echo request: %u"), i_outp_icmp | I_TITLE}, +- {"OutEchoReps", N_("echo replies: %u"), i_outp_icmp | I_TITLE}, +- {"OutTimestamps", N_("timestamp requests: %u"), i_outp_icmp | I_TITLE}, +- {"OutTimestampReps", N_("timestamp replies: %u"), i_outp_icmp | I_TITLE}, +- {"OutAddrMasks", N_("address mask requests: %u"), i_outp_icmp | I_TITLE}, +- {"OutAddrMaskReps", N_("address mask replies: %u"), i_outp_icmp | I_TITLE}, ++ {"InMsgs", N_("%lu ICMP messages received"), number}, ++ {"InErrors", N_("%lu input ICMP message failed."), number}, ++ {"InDestUnreachs", N_("destination unreachable: %lu"), i_inp_icmp | I_TITLE}, ++ {"InTimeExcds", N_("timeout in transit: %lu"), i_inp_icmp | I_TITLE}, ++ {"InParmProbs", N_("wrong parameters: %lu"), i_inp_icmp | I_TITLE}, /*? */ ++ {"InSrcQuenchs", N_("source quenches: %lu"), i_inp_icmp | I_TITLE}, ++ {"InRedirects", N_("redirects: %lu"), i_inp_icmp | I_TITLE}, ++ {"InEchos", N_("echo requests: %lu"), i_inp_icmp | I_TITLE}, ++ {"InEchoReps", N_("echo replies: %lu"), i_inp_icmp | I_TITLE}, ++ {"InTimestamps", N_("timestamp request: %lu"), i_inp_icmp | I_TITLE}, ++ {"InTimestampReps", N_("timestamp reply: %lu"), i_inp_icmp | I_TITLE}, ++ {"InAddrMasks", N_("address mask request: %lu"), i_inp_icmp | I_TITLE}, /*? */ ++ {"InAddrMaskReps", N_("address mask replies: %lu"), i_inp_icmp | I_TITLE}, /*? */ ++ {"OutMsgs", N_("%lu ICMP messages sent"), number}, ++ {"OutErrors", N_("%lu ICMP messages failed"), number}, ++ {"OutDestUnreachs", N_("destination unreachable: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutTimeExcds", N_("time exceeded: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutParmProbs", N_("wrong parameters: %lu"), i_outp_icmp | I_TITLE}, /*? */ ++ {"OutSrcQuenchs", N_("source quench: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutRedirects", N_("redirect: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutEchos", N_("echo request: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutEchoReps", N_("echo replies: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutTimestamps", N_("timestamp requests: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutTimestampReps", N_("timestamp replies: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutAddrMasks", N_("address mask requests: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutAddrMaskReps", N_("address mask replies: %lu"), i_outp_icmp | I_TITLE}, + }; + + struct entry Tcptab[] = +@@ -119,71 +119,71 @@ + {"RtoMin", "", number}, + {"RtoMax", "", number}, + {"MaxConn", "", number}, +- {"ActiveOpens", N_("%u active connections openings"), number}, +- {"PassiveOpens", N_("%u passive connection openings"), number}, +- {"AttemptFails", N_("%u failed connection attempts"), number}, +- {"EstabResets", N_("%u connection resets received"), number}, +- {"CurrEstab", N_("%u connections established"), number}, +- {"InSegs", N_("%u segments received"), number}, +- {"OutSegs", N_("%u segments send out"), number}, +- {"RetransSegs", N_("%u segments retransmited"), number}, +- {"InErrs", N_("%u bad segments received."), number}, +- {"OutRsts", N_("%u resets sent"), number}, ++ {"ActiveOpens", N_("%lu active connections openings"), number}, ++ {"PassiveOpens", N_("%lu passive connection openings"), number}, ++ {"AttemptFails", N_("%lu failed connection attempts"), number}, ++ {"EstabResets", N_("%lu connection resets received"), number}, ++ {"CurrEstab", N_("%lu connections established"), number}, ++ {"InSegs", N_("%lu segments received"), number}, ++ {"OutSegs", N_("%lu segments send out"), number}, ++ {"RetransSegs", N_("%lu segments retransmited"), number}, ++ {"InErrs", N_("%lu bad segments received."), number}, ++ {"OutRsts", N_("%lu resets sent"), number}, + }; + + struct entry Udptab[] = + { +- {"InDatagrams", N_("%u packets received"), number}, +- {"NoPorts", N_("%u packets to unknown port received."), number}, +- {"InErrors", N_("%u packet receive errors"), number}, +- {"OutDatagrams", N_("%u packets sent"), number}, ++ {"InDatagrams", N_("%lu packets received"), number}, ++ {"NoPorts", N_("%lu packets to unknown port received."), number}, ++ {"InErrors", N_("%lu packet receive errors"), number}, ++ {"OutDatagrams", N_("%lu packets sent"), number}, + }; + + struct entry Tcpexttab[] = + { +- {"SyncookiesSent", N_("%u SYN cookies sent"), opt_number}, +- {"SyncookiesRecv", N_("%u SYN cookies received"), opt_number}, +- {"SyncookiesFailed", N_("%u invalid SYN cookies received"), opt_number}, ++ {"SyncookiesSent", N_("%lu SYN cookies sent"), opt_number}, ++ {"SyncookiesRecv", N_("%lu SYN cookies received"), opt_number}, ++ {"SyncookiesFailed", N_("%lu invalid SYN cookies received"), opt_number}, + +- { "EmbryonicRsts", N_("%u resets received for embryonic SYN_RECV sockets"), ++ { "EmbryonicRsts", N_("%lu resets received for embryonic SYN_RECV sockets"), + opt_number }, +- { "PruneCalled", N_("%u packets pruned from receive queue because of socket" ++ { "PruneCalled", N_("%lu packets pruned from receive queue because of socket" + " buffer overrun"), opt_number }, + /* obsolete: 2.2.0 doesn't do that anymore */ +- { "RcvPruned", N_("%u packets pruned from receive queue"), opt_number }, +- { "OfoPruned", N_("%u packets dropped from out-of-order queue because of" ++ { "RcvPruned", N_("%lu packets pruned from receive queue"), opt_number }, ++ { "OfoPruned", N_("%lu packets dropped from out-of-order queue because of" + " socket buffer overrun"), opt_number }, +- { "OutOfWindowIcmps", N_("%u ICMP packets dropped because they were " ++ { "OutOfWindowIcmps", N_("%lu ICMP packets dropped because they were " + "out-of-window"), opt_number }, +- { "LockDroppedIcmps", N_("%u ICMP packets dropped because" ++ { "LockDroppedIcmps", N_("%lu ICMP packets dropped because" + " socket was locked"), opt_number }, +- { "TW", N_("%u TCP sockets finished time wait in fast timer"), opt_number }, +- { "TWRecycled", N_("%u time wait sockets recycled by time stamp"), opt_number }, +- { "TWKilled", N_("%u TCP sockets finished time wait in slow timer"), opt_number }, +- { "PAWSPassive", N_("%u passive connections rejected because of" ++ { "TW", N_("%lu TCP sockets finished time wait in fast timer"), opt_number }, ++ { "TWRecycled", N_("%lu time wait sockets recycled by time stamp"), opt_number }, ++ { "TWKilled", N_("%lu TCP sockets finished time wait in slow timer"), opt_number }, ++ { "PAWSPassive", N_("%lu passive connections rejected because of" + " time stamp"), opt_number }, +- { "PAWSActive", N_("%u active connections rejected because of " ++ { "PAWSActive", N_("%lu active connections rejected because of " + "time stamp"), opt_number }, +- { "PAWSEstab", N_("%u packets rejects in established connections because of" ++ { "PAWSEstab", N_("%lu packets rejects in established connections because of" + " timestamp"), opt_number }, +- { "DelayedACKs", N_("%u delayed acks sent"), opt_number }, +- { "DelayedACKLocked", N_("%u delayed acks further delayed because of" ++ { "DelayedACKs", N_("%lu delayed acks sent"), opt_number }, ++ { "DelayedACKLocked", N_("%lu delayed acks further delayed because of" + " locked socket"), opt_number }, +- { "DelayedACKLost", N_("Quick ack mode was activated %u times"), opt_number }, +- { "ListenOverflows", N_("%u times the listen queue of a socket overflowed"), ++ { "DelayedACKLost", N_("Quick ack mode was activated %lu times"), opt_number }, ++ { "ListenOverflows", N_("%lu times the listen queue of a socket overflowed"), + opt_number }, +- { "ListenDrops", N_("%u SYNs to LISTEN sockets ignored"), opt_number }, +- { "TCPPrequeued", N_("%u packets directly queued to recvmsg prequeue."), ++ { "ListenDrops", N_("%lu SYNs to LISTEN sockets ignored"), opt_number }, ++ { "TCPPrequeued", N_("%lu packets directly queued to recvmsg prequeue."), + opt_number }, +- { "TCPDirectCopyFromBacklog", N_("%u packets directly received" ++ { "TCPDirectCopyFromBacklog", N_("%lu packets directly received" + " from backlog"), opt_number }, +- { "TCPDirectCopyFromPrequeue", N_("%u packets directly received" ++ { "TCPDirectCopyFromPrequeue", N_("%lu packets directly received" + " from prequeue"), opt_number }, +- { "TCPPrequeueDropped", N_("%u packets dropped from prequeue"), opt_number }, +- { "TCPHPHits", N_("%u packets header predicted"), number }, +- { "TCPHPHitsToUser", N_("%u packets header predicted and " ++ { "TCPPrequeueDropped", N_("%lu packets dropped from prequeue"), opt_number }, ++ { "TCPHPHits", N_("%lu packets header predicted"), number }, ++ { "TCPHPHitsToUser", N_("%lu packets header predicted and " + "directly queued to user"), opt_number }, +- { "SockMallocOOM", N_("Ran %u times out of system memory during " ++ { "SockMallocOOM", N_("Ran %lu times out of system memory during " + "packet sending"), opt_number }, + }; + diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-virtualname.patch b/pkgs/core/net-tools/patches/net-tools-1.60-virtualname.patch new file mode 100644 index 0000000..326df1d --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-virtualname.patch @@ -0,0 +1,36 @@ +--- net-tools-1.60/lib/interface.c.virtualname 2001-02-10 20:31:15.000000000 +0100 ++++ net-tools-1.60/lib/interface.c 2003-08-19 13:18:01.000000000 +0200 +@@ -579,18 +579,18 @@ + + void ife_print_short(struct interface *ptr) + { +- printf("%-5.5s ", ptr->name); +- printf("%5d %3d", ptr->mtu, ptr->metric); ++ printf("%-9.9s ", ptr->name); ++ printf("%5d %3d ", ptr->mtu, ptr->metric); + /* If needed, display the interface statistics. */ + if (ptr->statistics_valid) { +- printf("%8llu %6lu %6lu %6lu", ++ printf("%8llu %6lu %6lu %6lu ", + ptr->stats.rx_packets, ptr->stats.rx_errors, + ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors); + printf("%8llu %6lu %6lu %6lu ", + ptr->stats.tx_packets, ptr->stats.tx_errors, + ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors); + } else { +- printf("%-56s", _(" - no statistics available -")); ++ printf("%-60s", _(" - no statistics available -")); + } + /* DONT FORGET TO ADD THE FLAGS IN ife_print_long, too */ + if (ptr->flags == 0) +--- net-tools-1.60/netstat.c.virtualname 2001-04-15 16:41:17.000000000 +0200 ++++ net-tools-1.60/netstat.c 2003-08-19 13:18:34.000000000 +0200 +@@ -1449,7 +1449,7 @@ + } + if (flag_exp < 2) { + ife_short = 1; +- printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n")); ++ printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n")); + } + + if (for_all_interfaces(do_if_print, &flag_all) < 0) { diff --git a/pkgs/core/net-tools/patches/net-tools-1.60-x25-proc.patch b/pkgs/core/net-tools/patches/net-tools-1.60-x25-proc.patch new file mode 100644 index 0000000..0495caa --- /dev/null +++ b/pkgs/core/net-tools/patches/net-tools-1.60-x25-proc.patch @@ -0,0 +1,13 @@ +--- net-tools-1.60/lib/pathnames.h.orig 2006-04-12 22:14:07.943885000 -0400 ++++ net-tools-1.60/lib/pathnames.h 2006-04-12 22:19:34.072430000 -0400 +@@ -42,8 +42,8 @@ + #define _PATH_PROCNET_RARP "/proc/net/rarp" + #define _PATH_ETHERS "/etc/ethers" + #define _PATH_PROCNET_ROSE_ROUTE "/proc/net/rose_routes" +-#define _PATH_PROCNET_X25 "/proc/net/x25" +-#define _PATH_PROCNET_X25_ROUTE "/proc/net/x25_routes" ++#define _PATH_PROCNET_X25 "/proc/net/x25" ++#define _PATH_PROCNET_X25_ROUTE "/proc/net/x25/route" + #define _PATH_PROCNET_DEV_MCAST "/proc/net/dev_mcast" + + /* pathname for the netlink device */ diff --git a/pkgs/core/strongswan/strongswan.nm b/pkgs/core/strongswan/strongswan.nm index c7272c3..1a6869c 100644 --- a/pkgs/core/strongswan/strongswan.nm +++ b/pkgs/core/strongswan/strongswan.nm @@ -25,7 +25,7 @@ include $(PKGROOT)/Include
PKG_NAME = strongswan -PKG_VER = 4.4.0 +PKG_VER = 4.5.0 PKG_REL = 0
PKG_MAINTAINER = diff --git a/pkgs/core/xz/xz.nm b/pkgs/core/xz/xz.nm index 437c727..ca859e4 100644 --- a/pkgs/core/xz/xz.nm +++ b/pkgs/core/xz/xz.nm @@ -25,7 +25,7 @@ include $(PKGROOT)/Include
PKG_NAME = xz -PKG_VER = 4.999.8beta +PKG_VER = 5.0.0 PKG_REL = 0
PKG_MAINTAINER =
hooks/post-receive -- IPFire 3.x development tree