From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH] net-tools: Drop package Date: Mon, 20 Feb 2023 18:49:39 +0100 Message-ID: <20230220174939.280410-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4810836443433530012==" List-Id: --===============4810836443433530012== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The net-tools package is deprecated and was used by us to ship the "netstat" binary. The successor of "netstat" is the "ss" command from the iproute2. Signed-off-by: Stefan Schantl --- net-tools/config.h | 75 -- net-tools/config.make | 37 - net-tools/mii-diag.8 | 160 ----- net-tools/mii-diag.c | 653 ------------------ net-tools/net-tools.nm | 84 --- net-tools/patches/001-net-tools-cycle.patch | 375 ---------- net-tools/patches/002-net-tools-ipx.patch | 31 - net-tools/patches/003-net-tools-man.patch | 149 ---- .../patches/004-net-tools-interface.patch | 102 --- .../patches/005-net-tools-duplicate-tcp.patch | 146 ---- .../patches/006-net-tools-statalias.patch | 16 - .../007-net-tools-interface_stack.patch | 119 ---- .../008-net-tools-sctp-statistics.patch | 534 -------------- ...et-tools-ifconfig-long-iface-crasher.patch | 36 - 14 files changed, 2517 deletions(-) delete mode 100644 net-tools/config.h delete mode 100644 net-tools/config.make delete mode 100644 net-tools/mii-diag.8 delete mode 100644 net-tools/mii-diag.c delete mode 100644 net-tools/net-tools.nm delete mode 100644 net-tools/patches/001-net-tools-cycle.patch delete mode 100644 net-tools/patches/002-net-tools-ipx.patch delete mode 100644 net-tools/patches/003-net-tools-man.patch delete mode 100644 net-tools/patches/004-net-tools-interface.patch delete mode 100644 net-tools/patches/005-net-tools-duplicate-tcp.patch delete mode 100644 net-tools/patches/006-net-tools-statalias.patch delete mode 100644 net-tools/patches/007-net-tools-interface_stack.patch delete mode 100644 net-tools/patches/008-net-tools-sctp-statistics.patch delete mode 100644 net-tools/patches/009-net-tools-ifconfig-long-iface-crash= er.patch diff --git a/net-tools/config.h b/net-tools/config.h deleted file mode 100644 index f63aecbfc..000000000 --- a/net-tools/config.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -* 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 -* -*/ - -/*=20 - *=20 - * Internationalization - *=20 - * 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. - *=20 - */ -#define I18N 1 - -/*=20 - *=20 - * Protocol Families. - *=20 - */ -#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 - -/*=20 - *=20 - * Device Hardware types. - *=20 - */ -#define HAVE_HWETHER 1 -#define HAVE_HWARC 1 -#define HAVE_HWSLIP 0 -#define HAVE_HWPPP 1 -#define HAVE_HWTUNNEL 1 -#define HAVE_HWSTRIP 0 -#define HAVE_HWTR 0 -#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 - -/*=20 - *=20 - * Other Features. - *=20 - */ -#define HAVE_FW_MASQUERADE 1 -#define HAVE_IP_TOOLS 1 -#define HAVE_MII 1 diff --git a/net-tools/config.make b/net-tools/config.make deleted file mode 100644 index 18907a595..000000000 --- a/net-tools/config.make +++ /dev/null @@ -1,37 +0,0 @@ -I18N=3D1 -HAVE_AFUNIX=3D1 -HAVE_AFINET=3D1 -HAVE_AFINET6=3D1 -HAVE_AFIPX=3D1 -HAVE_AFATALK=3D1 -HAVE_AFAX25=3D1 -HAVE_AFNETROM=3D1 -HAVE_AFROSE=3D1 -HAVE_AFX25=3D1 -HAVE_AFECONET=3D1 -# HAVE_AFDECnet=3D0 -HAVE_AFASH=3D1 -HAVE_HWETHER=3D1 -HAVE_HWARC=3D1 -HAVE_HWSLIP=3D1 -HAVE_HWPPP=3D1 -HAVE_HWTUNNEL=3D1 -HAVE_HWSTRIP=3D0 -HAVE_HWTR=3D0 -HAVE_HWAX25=3D1 -HAVE_HWROSE=3D1 -HAVE_HWNETROM=3D1 -HAVE_HWX25=3D1 -HAVE_HWFR=3D1 -HAVE_HWSIT=3D1 -HAVE_HWFDDI=3D1 -HAVE_HWHIPPI=3D1 -HAVE_HWASH=3D1 -HAVE_HWHDLCLAPB=3D1 -HAVE_HWIRDA=3D1 -HAVE_HWEC=3D1 -HAVE_HWIB=3D1 -HAVE_FW_MASQUERADE=3D1 -HAVE_IP_TOOLS=3D1 -HAVE_MII=3D1 -HAVE_SELINUX=3D0 diff --git a/net-tools/mii-diag.8 b/net-tools/mii-diag.8 deleted file mode 100644 index aa0dc0be1..000000000 --- a/net-tools/mii-diag.8 +++ /dev/null @@ -1,160 +0,0 @@ -.\" 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 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 ] -.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\fP and -.\" \fI\fP escape sequences to invoke bold face and italics,=20 -.\" 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 (=C2=B4-=C2=B4) in front of t= he option -character. For options without parameters, multiple options may be -concatenated after a single dash. Long options are prefixed by two -dashes (=C2=B4--=C2=B4), and may be abbreviated with a unique prefix. -A long option may take a parameter of the form --arg=3Dparam or --arg param. - -.PP -A summary of options is as follows. - -.TP -.B \-A, --advertise -.BR -.B \-F, --fixed-speed - -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 - -.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=3D"-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/net-tools/mii-diag.c b/net-tools/mii-diag.c deleted file mode 100644 index 69ebd0bff..000000000 --- a/net-tools/mii-diag.c +++ /dev/null @@ -1,653 +0,0 @@ -/* 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 - - 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(a)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[] =3D -"mii-diag.c:v2.11 3/21/2005 Donald Becker (becker(a)scyld.com)\n" -" http://www.scyld.com/diag/index.html\n"; - -static const char usage_msg[] =3D -"Usage: %s [--help] [-aDfrRvVw] [-AF ] [--watch] \n= "; -static const char long_usage_msg[] =3D -"Usage: %s [-aDfrRvVw] [-AF ] [--watch] \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\ - Frequently used options are\n\ - -A --advertise \n\ - -F --fixed-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef use_linux_libc5 -#include -#include -#endif - -typedef u_int32_t u32; -typedef u_int16_t u16; -typedef u_int8_t u8; - -#if defined(SIOCGPARAMS) && SIOCGPARAMS !=3D 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[] =3D "aA:C:DfF:gG:hmM:p:rRsvVw?"; -struct option longopts[] =3D { - /* { 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 =3D 0, /* Show-all-interfaces flag. */ - opt_f =3D 0, /* Force the operation. */ - opt_g =3D 0, - opt_G =3D 0, - verbose =3D 0, /* Verbose flag. */ - debug =3D 0, - opt_version =3D 0, - opt_restart =3D 0, - opt_reset =3D 0, - opt_status =3D 0, - opt_watch =3D 0; -static int msg_level =3D -1; -static int set_BMCR =3D -1; -static int nway_advertise =3D 0; -static int fixed_speed =3D -1; -static int override_phy =3D -1; -char *opt_G_string =3D NULL; - -/* Internal values. */ -int new_ioctl_nums; -int skfd =3D -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 =3D 0; - char **spp, *ifname; - char *progname =3D rindex(argv[0], '/') ? rindex(argv[0], '/')+1 : argv[= 0]; - - while ((c =3D getopt_long(argc, argv, shortopts, longopts, 0)) !=3D EOF) - switch (c) { - case 'a': opt_a++; break; - case 'A': nway_advertise |=3D parse_advertise(optarg); - if (nway_advertise =3D=3D -1) errflag++; - break; - case 'C': set_BMCR =3D strtoul(optarg, NULL, 16); break; - case 'D': debug++; break; - case 'f': opt_f++; break; - case 'F': fixed_speed =3D parse_advertise(optarg); - if (fixed_speed =3D=3D -1) errflag++; - break; - case 'g': opt_g++; break; - case 'G': opt_G++; opt_G_string =3D strdup(optarg); break; - case 'm': opt_watch++; opt_status++; break; - case 'M': msg_level =3D strtoul(optarg, NULL, 0); break; - case 'h': fprintf(stderr, long_usage_msg, progname); return 0; - case 'p': override_phy =3D 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("%s", version); - - /* Open a basic socket. */ - if ((skfd =3D socket(AF_INET, SOCK_DGRAM,0)) < 0) { - perror("socket"); - return 1; - } - - if (debug) - fprintf(stderr, "DEBUG: argc=3D%d, optind=3D%d and argv[optind] is %s.\n", - argc, optind, argv[optind]); - - /* No remaining args means interface wasn't specified. */ - if (optind =3D=3D argc) { - fprintf(stderr, "No interface specified.\n"); - fprintf(stderr, usage_msg, progname); - (void) close(skfd); - return 2; - } else { - /* Copy the interface name. */ - spp =3D argv + optind; - ifname =3D *spp++; - } - - if (ifname =3D=3D NULL) { - fprintf(stderr, "No ifname.\n"); - (void) close(skfd); - return -1; - } - - /* Verify that the interface supports the ioctl(), and if - it is using the new or old SIOCGMIIPHY value (grrr...). - */ - { - u16 *data =3D (u16 *)(&ifr.ifr_data); - - strncpy(ifr.ifr_name, ifname, IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ-1] =3D '\0'; - data[0] =3D 0; - - if (ioctl(skfd, 0x8947, &ifr) >=3D 0) { - new_ioctl_nums =3D 1; - } else if (ioctl(skfd, SIOCDEVPRIVATE, &ifr) >=3D 0) { - new_ioctl_nums =3D 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 =3D (u16 *)(&ifr.ifr_data); - u32 *data32 =3D (u32 *)(&ifr.ifr_data); - unsigned phy_id =3D data[0]; - - if (override_phy >=3D 0) { - printf("Using the specified MII PHY index %d.\n", override_phy); - phy_id =3D override_phy; - } - - if (opt_g || opt_G || msg_level >=3D 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 =3D 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 =3D opt_G_string; - int i; - for (i =3D 0; str && i < 4; i++) { - char *endstr; - u32 newval =3D strtol(str, &endstr, 0); - if (debug) - printf(" parse string '%s' value %d end '%s'.\n", - str, newval, endstr); - if (str =3D=3D endstr) { - if (endstr[0] =3D=3D ',') /* No parameter */ - str =3D endstr+1; - else { - fprintf(stderr, "Invalid driver parameter '%s'.\n", str); - str =3D index(str, ','); - } - } else if (endstr[0] =3D=3D ',') { - data32[i] =3D newval; - str =3D endstr + 1; - } else if (endstr[0] =3D=3D 0) { - data32[i] =3D newval; - break; - } - } - printf("Setting new driver general parameters:"); - for (i =3D 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 >=3D 0) { - data32[0] =3D 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 >=3D 0) { - int reg0_val =3D 0; - if (fixed_speed & 0x0180) /* 100mpbs */ - reg0_val |=3D 0x2000; - if ((fixed_speed & 0x0140) && /* A full duplex type and */ - ! (fixed_speed & 0x0820)) /* no half duplex types. */ - reg0_val |=3D 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 >=3D 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 =3D 0; mii_reg < 32; mii_reg++) { - mii_val =3D mdio_read(skfd, phy_id, mii_reg); - printf("%s %4.4x", (mii_reg % 8) =3D=3D 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) =3D=3D 0) - exit(2); - return 0; -} - -int mdio_read(int skfd, int phy_id, int location) -{ - u16 *data =3D (u16 *)(&ifr.ifr_data); - - data[0] =3D phy_id; - data[1] =3D 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 =3D (u16 *)(&ifr.ifr_data); - - data[0] =3D phy_id; - data[1] =3D location; - data[2] =3D 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[] =3D { - "100baseT4", "100baseTx", "100baseTx-FD", "100baseTx-HD", - "10baseT", "10baseT-FD", "10baseT-HD", 0, - }; - char *endptr; - int cap_map[] =3D { 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 =3D 0; mtypes[i]; i++) - if (strcasecmp(mtypes[i], capabilities) =3D=3D 0) - return cap_map[i]; - if ((i =3D strtol(capabilities, &endptr, 16)) <=3D 0xffff && endptr[0] = =3D=3D 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 =3D 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[] =3D { - "10baseT", "10baseT-FD", "100baseTx", "100baseTx-FD", "100baseT4", - "Flow-control", 0, -}; -/* Various non-good bits in the command register. */ -static const char *bmcr_bits[] =3D { - " 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 =3D 0; mii_reg < 8; mii_reg++) - mii_val[mii_reg] =3D mdio_read(ioaddr, phy_id, mii_reg); - if ( ! verbose) { - printf("Basic registers of MII PHY #%d: ", phy_id); - for (mii_reg =3D 0; mii_reg < 8; mii_reg++) - printf(" %4.4x", mii_val[mii_reg]); - printf(".\n"); - } - - if (mii_val[0] =3D=3D 0xffff || mii_val[1] =3D=3D 0x0000) { - printf(" No MII transceiver present!.\n"); - if (! opt_f) { - printf(" Use '--force' to view the information anyway.\n"); - return -1; - } - } - /* Descriptive rename. */ - bmcr =3D mii_val[0]; - bmsr =3D mii_val[1]; - nway_advert =3D mii_val[4]; - lkpar =3D mii_val[5]; - - if (lkpar & 0x4000) { - int negotiated =3D nway_advert & lkpar & 0x3e0; - int max_capability =3D 0; - /* Scan for the highest negotiated capability, highest priority - (100baseTx-FDX) to lowest (10baseT-HDX). */ - int media_priority[] =3D {8, 9, 7, 6, 5}; /* media_names[i-5] */ - printf(" The autonegotiated capability is %4.4x.\n", negotiated); - for (i =3D 0; media_priority[i]; i++) - if (negotiated & (1 << media_priority[i])) { - max_capability =3D 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 =3D 0; i < 9; i++) - if (bmcr & (0x0080<=3D 11; i--) - if (bmsr & (1<"); - 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 =3D 5; i >=3D 0; i--) - if (lkpar & (0x20< = # -############################################################################= ### - -name =3D net-tools -version =3D 2.0 -git_rev =3D e5f1be13 -release =3D 2.%{git_rev} - -groups =3D System/Base -url =3D http://net-tools.berlios.de/ -license =3D GPL+ -summary =3D Basic networking tools. - -description - The net-tools package contains basic networking tools, - including ifconfig, netstat, route, and others. -end - -source_dl =3D -sources =3D %{thisapp}-%{git_rev}.tar.xz - -build - requires - gettext - end - - prepare_cmds - # Copy config files - cp %{DIR_SOURCE}/config.h %{DIR_APP} - cp %{DIR_SOURCE}/config.make %{DIR_APP} - - # Copy additional man pages - mkdir -pv %{DIR_APP}/man/en_US - cp %{DIR_SOURCE}/*.8 %{DIR_APP}/man/en_US - - # Copy source for mii-diag - cp %{DIR_SOURCE}/mii-diag.c %{DIR_APP} - end - - make_build_targets +=3D \ - CC=3Dgcc - - # Compiling in parallel mode is unsafe for this pkg. - PARALLELISMFLAGS =3D - - build_cmds - # Compile mii-diag - make mii-diag - end - - install - mv man/de_DE man/de - mv man/fr_FR man/fr - mv man/pt_BR man/pt - - make BASEDIR=3D%{BUILDROOT} BINDIR=3D%{bindir} \ - SBINDIR=3D%{sbindir} mandir=3D%{mandir} install - - # Install mii-diag - install -m 755 %{DIR_APP}/mii-diag %{BUILDROOT}%{sbindir} - - # Remove tools we do not want - rm -rvf \ - %{BUILDROOT}%{prefix}/{,*}/{arp,ifconfig,ip,nameif,plipconfig,rarp,route,= slattach}* \ - %{BUILDROOT}%{mandir}/{,*}/man*/{arp,ifconfig,ip,nameif,plipconfig,rarp,r= oute,slattach}* - - # Remove hostname (has its own package) - rm -rvf \ - %{BUILDROOT}%{bindir}/{dnsdomainname,domainname,hostname,nisdomainname,yp= domainname}* \ - %{BUILDROOT}%{mandir}/{,*}/man*/{dnsdomainname,domainname,hostname,nisdom= ainname,ypdomainname}* - end -end - -packages - package %{name} - groups +=3D Base - end - - package %{name}-debuginfo - template DEBUGINFO - end -end diff --git a/net-tools/patches/001-net-tools-cycle.patch b/net-tools/patches/= 001-net-tools-cycle.patch deleted file mode 100644 index 7d58dbbd6..000000000 --- a/net-tools/patches/001-net-tools-cycle.patch +++ /dev/null @@ -1,375 +0,0 @@ -diff -up net-tools-2.0/lib/interface.c.cycle net-tools-2.0/lib/interface.c ---- net-tools-2.0/lib/interface.c.cycle 2014-11-11 14:38:03.000000000 +0100 -+++ net-tools-2.0/lib/interface.c 2014-11-24 14:45:46.128480980 +0100 -@@ -93,6 +93,7 @@ int if_list_all =3D 0; /* do we have reque - static struct interface *int_list, *int_last; -=20 - static int if_readlist_proc(const char *); -+static int if_readlist_rep(const char *, struct interface *); -=20 - static struct interface *if_cache_add(const char *name) - { -@@ -138,11 +139,14 @@ struct interface *lookup_interface(const - int for_all_interfaces(int (*doit) (struct interface *, void *), void *cook= ie) - { - struct interface *ife; -+ int err; -=20 - if (!if_list_all && (if_readlist() < 0)) - return -1; - for (ife =3D int_list; ife; ife =3D ife->next) { -- int err =3D doit(ife, cookie); -+ if_readlist_rep(ife->name, ife); -+ err =3D doit(ife, cookie); -+ - if (err) - return err; - } -@@ -379,6 +383,41 @@ static int if_readlist_proc(const char * - fclose(fh); - return err; - } -+ -+static int if_readlist_rep(const char *target, struct interface *ife) -+{ -+ FILE *fh; -+ char buf[512]; -+ int err; -+ -+ fh =3D fopen(_PATH_PROCNET_DEV, "r"); -+ if (!fh) { -+ fprintf(stderr, _("Warning: cannot open %s (%s). Limited output.\n"), -+ _PATH_PROCNET_DEV, strerror(errno));=20 -+ return if_readconf(); -+ }=09 -+ fgets(buf, sizeof buf, fh); /* eat line */ -+ fgets(buf, sizeof buf, fh); -+ -+ procnetdev_vsn =3D procnetdev_version(buf); -+ -+ err =3D 0; -+ while (fgets(buf, sizeof buf, fh)) { -+ char *s, name[IFNAMSIZ]; -+ s =3D get_name(name, buf); =20 -+ get_dev_fields(s, ife); -+ ife->statistics_valid =3D 1; -+ if (target && !strcmp(target,name)) -+ break; -+ } -+ if (ferror(fh)) { -+ perror(_PATH_PROCNET_DEV); -+ err =3D -1; -+ } -+ -+ fclose(fh); -+ return err; -+} -=20 - int if_readlist(void) - { -diff -up net-tools-2.0/man/en_US/netstat.8.cycle net-tools-2.0/man/en_US/net= stat.8 ---- net-tools-2.0/man/en_US/netstat.8.cycle 2014-11-11 14:38:03.000000000 +0= 100 -+++ net-tools-2.0/man/en_US/netstat.8 2014-11-24 14:47:36.140944944 +0100 -@@ -36,6 +36,7 @@ netstat \- Print network connections, ro - .RB [ \-\-verbose | \-v ] - .RB [ \-\-continuous | \-c] - .RB [ \-\-wide | \-W ] -+.RB [delay] - .P - .B netstat=20 - .RB { \-\-route | \-r } -@@ -45,6 +46,7 @@ netstat \- Print network connections, ro - .RB [ \-\-numeric | \-n ] - .RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ] - .RB [ \-\-continuous | \-c ] -+.RB [delay] - .P - .B netstat - .RB { \-\-interfaces | \-i } -@@ -55,12 +57,14 @@ netstat \- Print network connections, ro - .RB [ \-\-numeric | \-n ] - .RB [ \-\-numeric-hosts "] [" \-\-numeric-ports "] [" \-\-numeric-users ] - .RB [ \-\-continuous | \-c ] -+.RB [delay] - .P - .B netstat - .RB { \-\-groups | \-g } - .RB [ \-\-numeric | \-n ] - .RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ] - .RB [ \-\-continuous | \-c ] -+.RB [delay] - .P - .B netstat - .RB { \-\-masquerade | \-M } -@@ -68,6 +72,7 @@ netstat \- Print network connections, ro - .RB [ \-\-numeric | \-n ] - .RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ] - .RB [ \-\-continuous | \-c ] -+.RB [delay] - .P - .B netstat - .RB { \-\-statistics | -s } -@@ -76,6 +81,7 @@ netstat \- Print network connections, ro - .RB [ \-\-udplite | \-U ] - .RB [ \-\-sctp | \-S ] - .RB [ \-\-raw | \-w ] -+.RB [delay] - .P - .B netstat=20 - .RB { \-\-version | \-V } -@@ -208,6 +214,10 @@ option, show interfaces that are not up - 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=20 -+.B delay=20 -+seconds. - .P - .SH OUTPUT - .P -diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c ---- net-tools-2.0/netstat.c.cycle 2014-11-11 14:38:03.000000000 +0100 -+++ net-tools-2.0/netstat.c 2014-11-24 14:44:24.948614445 +0100 -@@ -115,9 +115,9 @@ - #endif -=20 - /* prototypes for statistics.c */ --void parsesnmp(int, int, int); -+int parsesnmp(int, int, int); - void inittab(void); --void parsesnmp6(int, int, int); -+int parsesnmp6(int, int, int); - void inittab6(void); -=20 - typedef enum { -@@ -342,10 +342,10 @@ static void prg_cache_clear(void) - prg_cache_loaded =3D 0; - } -=20 --static void wait_continous(void) -+static void wait_continous(int reptimer) - { - fflush(stdout); -- sleep(1); -+ sleep(reptimer); - } -=20 - static int extract_type_1_socket_inode(const char lname[], unsigned long * = inode_p) { -@@ -1787,6 +1787,8 @@ static int rfcomm_info(void) -=20 - static int iface_info(void) - { -+ static int count=3D0; -+ - if (skfd < 0) { - if ((skfd =3D sockets_open(0)) < 0) { - perror("socket"); -@@ -1796,20 +1798,21 @@ static int iface_info(void) - } - if (flag_exp < 2) { - ife_short =3D 1; -- printf(_("Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-= DRP TX-OVR Flg\n")); -+ if(!(count % 8)) -+ printf(_("Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR= TX-DRP TX-OVR Flg\n")); - } -=20 - if (for_all_interfaces(do_if_print, &flag_all) < 0) { - perror(_("missing interface information")); - exit(1); - } -- if (flag_cnt) -+ if (!flag_cnt) { - if_cache_free(); -- else { - close(skfd); - skfd =3D -1; - } -=20 -+ count++; - return 0; - } -=20 -@@ -1825,7 +1828,7 @@ static void usage(void) - { - fprintf(stderr, _("usage: netstat [-vWeenNcCF] [] -r netsta= t {-V|--version|-h|--help}\n")); - fprintf(stderr, _(" netstat [-vWnNcaeol] [ ...]\n")); -- fprintf(stderr, _(" netstat { [-vWeenNac] -i | [-cnNe] -M | -s [-= 6tuw] }\n\n")); -+ fprintf(stderr, _(" netstat { [-vWeenNac] -i | [-cnNe] -M | -s [-= 6tuw] } [delay]\n\n")); -=20 - fprintf(stderr, _(" -r, --route display routing tab= le\n")); - fprintf(stderr, _(" -i, --interfaces display interface t= able\n")); -@@ -1867,6 +1870,7 @@ int main - (int argc, char *argv[]) { - int i; - int lop; -+ int reptimer =3D 1; - static struct option longopts[] =3D - { - AFTRANS_OPTS, -@@ -2049,6 +2053,12 @@ int main - flag_sta++; - } -=20 -+ if(argc =3D=3D optind + 1) { -+ if((reptimer =3D atoi(argv[optind])) <=3D 0) -+ usage(); -+ flag_cnt++; -+ } -+ =20 - if (flag_int + flag_rou + flag_mas + flag_sta > 1) - usage(); -=20 -@@ -2078,7 +2088,7 @@ int main - flag_not & FLAG_NUM_PORT, flag_exp); - if (i || !flag_cnt) - break; -- wait_continous(); -+ wait_continous(reptimer); - } - #else - ENOSUPP("netstat", "FW_MASQUERADE"); -@@ -2091,17 +2101,18 @@ int main - if (!afname[0]) - safe_strncpy(afname, DFLT_AF, sizeof(afname)); -=20 -+ for (;;) { - if (!strcmp(afname, "inet")) { - #if HAVE_AFINET - inittab(); -- parsesnmp(flag_raw, flag_tcp, flag_udp); -+ i =3D parsesnmp(flag_raw, flag_tcp, flag_udp); - #else - ENOSUPP("netstat", "AF INET"); - #endif - } else if(!strcmp(afname, "inet6")) { - #if HAVE_AFINET6 - inittab6(); -- parsesnmp6(flag_raw, flag_tcp, flag_udp); -+ i =3D parsesnmp6(flag_raw, flag_tcp, flag_udp); - #else - ENOSUPP("netstat", "AF INET6"); - #endif -@@ -2109,7 +2120,11 @@ int main - printf(_("netstat: No statistics support for specified address fa= mily: %s\n"), afname); - exit(1); - } -- exit(0); -+ if(i || !flag_cnt) -+ break; -+ sleep(reptimer); -+ } -+ return (i); - } -=20 - if (flag_rou) { -@@ -2131,7 +2146,7 @@ int main - i =3D route_info(afname, options); - if (i || !flag_cnt) - break; -- wait_continous(); -+ wait_continous(reptimer); - } - return (i); - } -@@ -2140,7 +2155,7 @@ int main - i =3D iface_info(); - if (!flag_cnt || i) - break; -- wait_continous(); -+ wait_continous(reptimer); - } - return (i); - } -@@ -2327,7 +2342,7 @@ int main -=20 - if (!flag_cnt || i) - break; -- wait_continous(); -+ wait_continous(reptimer); - prg_cache_clear(); - } - return (i); -diff -up net-tools-2.0/statistics.c.cycle net-tools-2.0/statistics.c ---- net-tools-2.0/statistics.c.cycle 2014-11-11 14:38:03.000000000 +0100 -+++ net-tools-2.0/statistics.c 2014-11-24 14:44:24.949614431 +0100 -@@ -502,7 +502,7 @@ void process6_fd(FILE *f) -=20 - } -=20 --void parsesnmp(int flag_raw, int flag_tcp, int flag_udp) -+int parsesnmp(int flag_raw, int flag_tcp, int flag_udp) - { - FILE *f; -=20 -@@ -511,14 +511,17 @@ void parsesnmp(int flag_raw, int flag_tc - f =3D proc_fopen("/proc/net/snmp"); - if (!f) { - perror(_("cannot open /proc/net/snmp")); -- return; -+ return(1); - } -=20 - if (process_fd(f, 1, NULL) < 0) - fprintf(stderr, _("Problem while parsing /proc/net/snmp\n")); -=20 -- if (ferror(f)) -+ if (ferror(f)) { - perror("/proc/net/snmp"); -+ fclose(f); -+ return(1); -+ } -=20 - fclose(f); -=20 -@@ -528,15 +531,18 @@ void parsesnmp(int flag_raw, int flag_tc - if (process_fd(f, 1, NULL) <0) - fprintf(stderr, _("Problem while parsing /proc/net/netstat\n")); -=20 -- if (ferror(f)) -- perror("/proc/net/netstat"); -+ if (ferror(f)) { -+ perror("/proc/net/netstat"); -+ fclose(f); -+ return(1); -+ } -=20 - fclose(f); - } -- return; -+ return(0); - } -=20 --void parsesnmp6(int flag_raw, int flag_tcp, int flag_udp) -+int parsesnmp6(int flag_raw, int flag_tcp, int flag_udp) - { - FILE *f; -=20 -@@ -545,7 +551,7 @@ void parsesnmp6(int flag_raw, int flag_t - f =3D fopen("/proc/net/snmp6", "r"); - if (!f) { - perror(_("cannot open /proc/net/snmp6")); -- return; -+ return(1); - } - process6_fd(f); - if (ferror(f)) -@@ -555,13 +561,16 @@ void parsesnmp6(int flag_raw, int flag_t - f =3D fopen("/proc/net/snmp", "r"); - if (!f) { - perror(_("cannot open /proc/net/snmp")); -- return; -+ return(1); - } - process_fd(f, 0, "Tcp"); -- if (ferror(f)) -+ if (ferror(f)) { - perror("/proc/net/snmp"); -+ return(1); -+ } -=20 - fclose(f); -+ return(0); - } -=20 - void inittab(void) diff --git a/net-tools/patches/002-net-tools-ipx.patch b/net-tools/patches/00= 2-net-tools-ipx.patch deleted file mode 100644 index ec7814587..000000000 --- a/net-tools/patches/002-net-tools-ipx.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff -up net-tools-2.0/lib/ipx_gr.c.ipx net-tools-2.0/lib/ipx_gr.c ---- net-tools-2.0/lib/ipx_gr.c.ipx 2013-09-10 12:33:52.494047907 +0200 -+++ net-tools-2.0/lib/ipx_gr.c 2013-09-10 12:34:28.531561603 +0200 -@@ -72,7 +72,7 @@ int IPX_rprint(int options) - continue; -=20 - /* Fetch and resolve the Destination */ -- (void) ap->input(5, net, &sa); -+ (void) ap->input(1, net, &sa); - safe_strncpy(net, ap->sprint(&sa, numeric), sizeof(net)); -=20 - /* Fetch and resolve the Router Net */ -diff -up net-tools-2.0/netstat.c.ipx net-tools-2.0/netstat.c ---- net-tools-2.0/netstat.c.ipx 2013-09-10 12:33:52.491047948 +0200 -+++ net-tools-2.0/netstat.c 2013-09-10 12:33:52.495047894 +0200 -@@ -1643,13 +1643,13 @@ static int ipx_info(void) - } -=20 - /* 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 & FLAG_NUM_HOST), sizeof(buf)); - snprintf(sad, sizeof(sad), "%s:%04X", buf, sport); -=20 - 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 & FLAG_NUM_HOST), sizeof(bu= f)); - snprintf(dad, sizeof(dad), "%s:%04X", buf, dport); - } else diff --git a/net-tools/patches/003-net-tools-man.patch b/net-tools/patches/00= 3-net-tools-man.patch deleted file mode 100644 index 1a33a1e3a..000000000 --- a/net-tools/patches/003-net-tools-man.patch +++ /dev/null @@ -1,149 +0,0 @@ -diff -up net-tools-2.0/man/en_US/arp.8.man net-tools-2.0/man/en_US/arp.8 ---- net-tools-2.0/man/en_US/arp.8.man 2014-04-26 02:45:16.000000000 +0200 -+++ net-tools-2.0/man/en_US/arp.8 2014-07-07 14:51:31.378459439 +0200 -@@ -63,6 +63,10 @@ arp \- manipulate the system ARP cache - .B \-f - .RI [ filename ] -=20 -+.SH NOTE -+.P -+This program is obsolete. For replacement check \fBip neigh\fR. -+ - .SH DESCRIPTION - .B Arp - manipulates or displays the kernel's IPv4 network neighbour cache. It can a= dd -@@ -219,6 +223,6 @@ published proxy ARP entries and permanen - .br - .I /etc/ethers - .SH SEE ALSO --rarp(8), route(8), ifconfig(8), netstat(8) -+.BR ip(8) - .SH AUTHORS - Fred N. van Kempen , Bernd Eckenfels . -diff -up net-tools-2.0/man/en_US/ethers.5.man net-tools-2.0/man/en_US/ethers= .5 ---- net-tools-2.0/man/en_US/ethers.5.man 2014-04-26 02:45:16.000000000 +0200 -+++ net-tools-2.0/man/en_US/ethers.5 2014-07-07 14:51:31.378459439 +0200 -@@ -26,6 +26,3 @@ can be resolved by DNS or a dot separate - .SH FILES \"{{{ - /etc/ethers - .\"}}} --.SH "SEE ALSO" \"{{{ --rarp(8) --.\"}}} -diff -up net-tools-2.0/man/en_US/ifconfig.8.man net-tools-2.0/man/en_US/ifco= nfig.8 ---- net-tools-2.0/man/en_US/ifconfig.8.man 2014-04-26 02:45:16.000000000 +02= 00 -+++ net-tools-2.0/man/en_US/ifconfig.8 2014-07-07 14:51:31.379459422 +0200 -@@ -5,6 +5,13 @@ ifconfig \- configure a network interfac - .B "ifconfig [-v] [-a] [-s] [interface]" - .br - .B "ifconfig [-v] interface [aftype] options | address ..." -+ -+.SH NOTE -+.P=20 -+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 -@@ -222,7 +229,8 @@ package to display link layer informatio - 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), iptables(8), ifup(8), interfaces(5). -+.BR ip(8), -+.BR iptables(8) - .br - http://physics.nist.gov/cuu/Units/binary.html - Prefixes for binary multipl= es - .SH AUTHORS -diff -up net-tools-2.0/man/en_US/mii-tool.8.man net-tools-2.0/man/en_US/mii-= tool.8 ---- net-tools-2.0/man/en_US/mii-tool.8.man 2014-04-26 02:45:16.000000000 +02= 00 -+++ net-tools-2.0/man/en_US/mii-tool.8 2014-07-07 14:51:31.379459422 +0200 -@@ -18,6 +18,10 @@ mii\-tool \- view, manipulate media-inde - [\fB\-p\fR, \fB\-\-phy=3D\fIaddr\fR] - .RI "interface\ ..." -=20 -+.SH NOTE -+.P=20 -+This program is obsolete. 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 -@@ -93,6 +97,9 @@ SIOCGMIIPHY on 'eth?' failed: Operation - The interface in question does not support MII queries. Most likely, it doe= s not have=20 - MII transceivers, at all. -=20 -+.SH SEE ALSO -+ethtool(8) -+ - .SH AUTHORS - David Hinds \- dhinds(a)pcmcia.sourceforge.org - .br -diff -up net-tools-2.0/man/en_US/nameif.8.man net-tools-2.0/man/en_US/nameif= .8 ---- net-tools-2.0/man/en_US/nameif.8.man 2014-04-26 02:45:16.000000000 +0200 -+++ net-tools-2.0/man/en_US/nameif.8 2014-07-07 14:51:31.379459422 +0200 -@@ -5,6 +5,12 @@ nameif \- name network interfaces based - .B "nameif [\-c configfile] [\-s]" - .br - .B "nameif [\-c configfile] [\-s] {interface macaddress}" -+ -+.SH NOTE -+.P=20 -+This program is obsolete. For replacement check \fBip link\fR. -+This functionality is also much better provided by udev methods. -+ - .SH DESCRIPTION - .B nameif=20 - renames network interfaces based on mac addresses. When no arguments are -@@ -31,5 +37,10 @@ should be run before the interface is up -=20 - .SH FILES - /etc/mactab -+ -+.SH SEE ALSO -+.BR ip(8), -+.BR udev(7) -+ - .SH BUGS - Only works for Ethernet currently. -diff -up net-tools-2.0/man/en_US/netstat.8.man net-tools-2.0/man/en_US/netst= at.8 ---- net-tools-2.0/man/en_US/netstat.8.man 2014-07-07 14:51:31.370459575 +0200 -+++ net-tools-2.0/man/en_US/netstat.8 2014-07-07 14:51:31.380459405 +0200 -@@ -198,7 +198,8 @@ Show the PID and name of the program to - .SS "\-l, \-\-listening" - Show only listening sockets. (These are omitted by default.) - .SS "\-a, \-\-all" --Show both listening and non-listening sockets. With the -+Show both listening and non-listening (for TCP this means established -+connections) sockets. With the - .B \-\-interfaces - option, show interfaces that are not up - .SS "\-F" -diff -up net-tools-2.0/man/en_US/route.8.man net-tools-2.0/man/en_US/route.8 ---- net-tools-2.0/man/en_US/route.8.man 2014-04-26 02:45:16.000000000 +0200 -+++ net-tools-2.0/man/en_US/route.8 2014-07-07 14:52:58.766977905 +0200 -@@ -57,6 +57,11 @@ family - .RB [ \-\-version ] - .RB [ \-h ] - .RB [ \-\-help ] -+ -+.SH NOTE -+.P=20 -+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 -@@ -330,10 +335,6 @@ Whether or not the hardware address for - .I /proc/net/rt_cache - .LP - .SH "SEE ALSO" --.IR ifconfig (8), --.IR netstat (8),=20 --.IR arp (8),=20 --.IR rarp (8), - .IR ip (8) - .LP - .SH HISTORY diff --git a/net-tools/patches/004-net-tools-interface.patch b/net-tools/patc= hes/004-net-tools-interface.patch deleted file mode 100644 index abbc0ba3c..000000000 --- a/net-tools/patches/004-net-tools-interface.patch +++ /dev/null @@ -1,102 +0,0 @@ -diff -up net-tools-2.0/man/en_US/netstat.8.interface net-tools-2.0/man/en_US= /netstat.8 ---- net-tools-2.0/man/en_US/netstat.8.interface 2014-11-24 14:52:45.64862347= 8 +0100 -+++ net-tools-2.0/man/en_US/netstat.8 2014-11-24 14:53:32.294972184 +0100 -@@ -49,9 +49,9 @@ netstat \- Print network connections, ro - .RB [delay] - .P - .B netstat --.RB { \-\-interfaces | \-i } -+.RB { \-\-interfaces | \-I | \-i } - .RB [ \-\-all | \-a ] --.RB [ \-\-extend | \-e [ \-\-extend | \-e] ] -+.RB [ \-\-extend | \-e ] - .RB [ \-\-verbose | \-v ] - .RB [ \-\-program | \-p ] - .RB [ \-\-numeric | \-n ] -@@ -134,8 +134,8 @@ and - produce the same output. - .SS "\-\-groups, \-g" - Display multicast group membership information for IPv4 and IPv6. --.SS "\-\-interfaces, \-i" --Display a table of all network interfaces. -+.SS "\-\-interfaces=3D\fIiface \fR, \fB\-I=3D\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 -up net-tools-2.0/netstat.c.interface net-tools-2.0/netstat.c ---- net-tools-2.0/netstat.c.interface 2014-11-24 14:52:45.644623534 +0100 -+++ net-tools-2.0/netstat.c 2014-11-24 14:52:45.652623422 +0100 -@@ -144,6 +144,7 @@ static char *Release =3D RELEASE, *Signatu - #define E_IOCTL -3 -=20 - int flag_int =3D 0; -+char *flag_int_name =3D NULL; - int flag_rou =3D 0; - int flag_mas =3D 0; - int flag_sta =3D 0; -@@ -1788,6 +1789,7 @@ static int rfcomm_info(void) - static int iface_info(void) - { - static int count=3D0; -+ struct interface *ife =3D NULL; -=20 - if (skfd < 0) { - if ((skfd =3D sockets_open(0)) < 0) { -@@ -1802,7 +1804,11 @@ static int iface_info(void) - printf(_("Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR= TX-DRP TX-OVR Flg\n")); - } -=20 -- if (for_all_interfaces(do_if_print, &flag_all) < 0) { -+ if (flag_int_name) { -+ ife =3D 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); - } -@@ -1828,9 +1834,10 @@ static void usage(void) - { - fprintf(stderr, _("usage: netstat [-vWeenNcCF] [] -r netsta= t {-V|--version|-h|--help}\n")); - fprintf(stderr, _(" netstat [-vWnNcaeol] [ ...]\n")); -- fprintf(stderr, _(" netstat { [-vWeenNac] -i | [-cnNe] -M | -s [-= 6tuw] } [delay]\n\n")); -+ fprintf(stderr, _(" netstat { [-vWeenNac] -I[] | [-veenNac= ] -i | [-cnNe] -M | -s [-6tuw] } [delay]\n\n")); -=20 - fprintf(stderr, _(" -r, --route display routing tab= le\n")); -+ fprintf(stderr, _(" -I, --interfaces=3D display interface= table for \n")); - fprintf(stderr, _(" -i, --interfaces display interface t= able\n")); - fprintf(stderr, _(" -g, --groups display multicast g= roup memberships\n")); - fprintf(stderr, _(" -s, --statistics display networking = statistics (like SNMP)\n")); -@@ -1875,7 +1882,7 @@ int main - { - 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 -@@ -1919,7 +1926,7 @@ int main - getroute_init(); /* Set up AF routing support */ -=20 - afname[0] =3D '\0'; -- while ((i =3D getopt_long(argc, argv, "A:CFMacdeghilnNoprsStuUvVWw2fx64= ?Z", longopts, &lop)) !=3D EOF) -+ while ((i =3D getopt_long(argc, argv, "A:CFMacdeghiI::lnNoprsStuUvVWw2f= x64?Z", longopts, &lop)) !=3D EOF) - switch (i) { - case -1: - break; -@@ -1960,6 +1967,13 @@ int main - case 'p': - flag_prg++; - break; -+ case 'I': -+ if (optarg && strcmp(optarg, "(null)")) -+ if (optarg[0] =3D=3D '=3D') optarg++; -+ if (optarg && strcmp(optarg, "(null)")) -+ flag_int_name =3D strdup(optarg); -+ flag_int++; -+ break; - case 'i': - flag_int++; - break; diff --git a/net-tools/patches/005-net-tools-duplicate-tcp.patch b/net-tools/= patches/005-net-tools-duplicate-tcp.patch deleted file mode 100644 index 393d27235..000000000 --- a/net-tools/patches/005-net-tools-duplicate-tcp.patch +++ /dev/null @@ -1,146 +0,0 @@ -diff -up net-tools-2.0/netstat.c.dup-tcp net-tools-2.0/netstat.c ---- net-tools-2.0/netstat.c.dup-tcp 2012-10-04 11:32:01.437729086 +0200 -+++ net-tools-2.0/netstat.c 2012-10-04 11:32:01.441729032 +0200 -@@ -502,6 +502,121 @@ static void prg_cache_load(void) - " will not be shown, you would have to be root to see it all.)\n")); - } -=20 -+#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 =3D *p; -+ -+ if (h) -+ for (p +=3D 1; *p !=3D '\0'; p++) -+ h =3D (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=3D0; i < TCP_HASH_SIZE; i++) { -+ if (tcp_node_hash[i]) { -+ /* free the children of this hash bucket */ -+ next_node =3D tcp_node_hash[i]->next; -+ while (next_node) { -+ tmp_node =3D next_node; -+ next_node =3D next_node->next; -+ free(tmp_node->socket_pair); -+ free(tmp_node); -+ } -+ -+ /* free the bucket itself */ -+ free(tcp_node_hash[i]->socket_pair); -+ free(tcp_node_hash[i]); -+ tcp_node_hash[i] =3D 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 =3D strlen(local_addr) + strlen(rem_addr) + 32; -+ tmp_string =3D 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 =3D 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] =3D 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 =3D tmp_string; -+ return 0; -+ } -+ -+ /* Try to find the value in the hash bucket. */ -+ tmp_node =3D tcp_node_hash[hash_val]; -+ while (tmp_node) { -+ if (!strcmp(tmp_node->socket_pair, tmp_string)) { -+ free(tmp_string); -+ return -1; -+ } -+ tmp_node =3D 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 =3D tcp_node_hash[hash_val]; -+ -+ tcp_node_hash[hash_val] =3D malloc(sizeof(struct tcp_node)); -+ if (!tcp_node_hash[hash_val]) { -+ free(tmp_string); -+ tcp_node_hash[hash_val] =3D tmp_node; -+ return 0; -+ } -+ -+ tcp_node_hash[hash_val]->socket_pair =3D tmp_string; -+ tcp_node_hash[hash_val]->next =3D tmp_node; -+ -+ return 0; -+} -+ - #if HAVE_AFNETROM - static const char *netrom_state[] =3D - { -@@ -1018,6 +1133,12 @@ static void tcp_do_one(int lnr, const ch - return; - } -=20 -+ /* make sure that we haven't seen this socket pair before */ -+ if (tcp_node_hash_check_and_append(local_addr, local_port, rem_addr, re= m_port) < 0) { -+ /* fprintf(stderr, _("warning, got duplicate tcp line.\n")); */ -+ return; -+ } -+ - addr_do_one(local_addr, sizeof(local_addr), 22, ap, &localaddr, local_port= , "tcp"); - addr_do_one(rem_addr, sizeof(rem_addr), 22, ap, &remaddr, rem_port, "tcp"); -=20 -@@ -2355,6 +2476,7 @@ int main - break; - wait_continous(reptimer); - prg_cache_clear(); -+ tcp_node_hash_clear(); - } - return (i); - } diff --git a/net-tools/patches/006-net-tools-statalias.patch b/net-tools/patc= hes/006-net-tools-statalias.patch deleted file mode 100644 index b544ff409..000000000 --- a/net-tools/patches/006-net-tools-statalias.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -up net-tools-2.0/lib/interface.c.statalias net-tools-2.0/lib/interface= .c ---- net-tools-2.0/lib/interface.c.statalias 2012-10-04 11:33:05.490889090 +0= 200 -+++ net-tools-2.0/lib/interface.c 2012-10-04 11:33:05.513888785 +0200 -@@ -405,9 +405,11 @@ static int if_readlist_rep(char *target, - char *s, name[IFNAMSIZ]; - s =3D get_name(name, buf); =20 - get_dev_fields(s, ife); -- ife->statistics_valid =3D 1; - if (target && !strcmp(target,name)) -+ { -+ ife->statistics_valid =3D 1; - break; -+ } - } - if (ferror(fh)) { - perror(_PATH_PROCNET_DEV); diff --git a/net-tools/patches/007-net-tools-interface_stack.patch b/net-tool= s/patches/007-net-tools-interface_stack.patch deleted file mode 100644 index 6a93e6741..000000000 --- a/net-tools/patches/007-net-tools-interface_stack.patch +++ /dev/null @@ -1,119 +0,0 @@ -diff -up net-tools-2.0/include/interface.h.stack net-tools-2.0/include/inter= face.h -diff -up net-tools-2.0/lib/interface.c.stack net-tools-2.0/lib/interface.c ---- net-tools-2.0/lib/interface.c.stack 2014-11-24 14:54:32.293134466 +0100 -+++ net-tools-2.0/lib/interface.c 2014-11-24 15:07:58.434764441 +0100 -@@ -214,10 +214,11 @@ out: - return err; - } -=20 --static const char *get_name(char *name, const char *p) -+static const char *get_name(char **namep, const char *p) - { - while (isspace(*p)) - p++; -+ char *name =3D *namep =3D p; - while (*p) { - if (isspace(*p)) - break; -@@ -320,9 +321,10 @@ static int get_dev_fields(const char *bp - static int if_readlist_proc(const char *target) - { - FILE *fh; -- char buf[512]; - struct interface *ife; - int err; -+ char *line =3D NULL; -+ size_t linelen =3D 0; =20 -=20 - fh =3D fopen(_PATH_PROCNET_DEV, "r"); - if (!fh) { -@@ -330,10 +332,11 @@ static int if_readlist_proc(const char * - _PATH_PROCNET_DEV, strerror(errno)); - return -2; - } -- if (fgets(buf, sizeof buf, fh)) -- /* eat line */; -- if (fgets(buf, sizeof buf, fh)) -- /* eat line */; -+ if (getline(&line, &linelen, fh) =3D=3D -1 /* eat line */ -+ || getline(&line, &linelen, fh) =3D=3D -1) { /* eat line */ -+ err =3D -1; -+ goto out; -+ } -=20 - #if 0 /* pretty, but can't cope with missing fields */ - fmt =3D proc_gen_fmt(_PATH_PROCNET_DEV, 1, fh, -@@ -358,14 +361,14 @@ static int if_readlist_proc(const char * - if (!fmt) - return -1; - #else -- procnetdev_vsn =3D procnetdev_version(buf); -+ procnetdev_vsn =3D procnetdev_version(line); - #endif -=20 - err =3D 0; -- while (fgets(buf, sizeof buf, fh)) { -+ while (getline(&line, &linelen, fh) !=3D -1) { - const char *s; -- char name[IFNAMSIZ]; -- s =3D get_name(name, buf); -+ char *name; -+ s =3D get_name(&name, line); =20 - ife =3D if_cache_add(name); - get_dev_fields(s, ife); - ife->statistics_valid =3D 1; -@@ -380,6 +383,8 @@ static int if_readlist_proc(const char * - #if 0 - free(fmt); - #endif -+ out: -+ free(line); - fclose(fh); - return err; - } -@@ -387,24 +392,28 @@ static int if_readlist_proc(const char * - static int if_readlist_rep(const char *target, struct interface *ife) - { - FILE *fh; -- char buf[512]; - int err; -+ char *line =3D NULL; -+ size_t linelen =3D 0; -=20 - fh =3D fopen(_PATH_PROCNET_DEV, "r"); - if (!fh) { - fprintf(stderr, _("Warning: cannot open %s (%s). Limited output.\n"), - _PATH_PROCNET_DEV, strerror(errno));=20 - return if_readconf(); -- }=09 -- fgets(buf, sizeof buf, fh); /* eat line */ -- fgets(buf, sizeof buf, fh); -+ } -+ if (getline(&line, &linelen, fh) =3D=3D -1 /* eat line */ -+ || getline(&line, &linelen, fh) =3D=3D -1) { /* eat line */ -+ err =3D -1; -+ goto out; -+ } -=20 -- procnetdev_vsn =3D procnetdev_version(buf); -+ procnetdev_vsn =3D procnetdev_version(line); -=20 - err =3D 0; -- while (fgets(buf, sizeof buf, fh)) { -- char *s, name[IFNAMSIZ]; -- s =3D get_name(name, buf); =20 -+ while (getline(&line, &linelen, fh) !=3D -1) { -+ char *s, *name; -+ s =3D get_name(&name, line); =20 - get_dev_fields(s, ife); - if (target && !strcmp(target,name)) - { -@@ -417,6 +426,8 @@ static int if_readlist_rep(const char *t - err =3D -1; - } -=20 -+ out: -+ free(line); - fclose(fh); - return err; - } diff --git a/net-tools/patches/008-net-tools-sctp-statistics.patch b/net-tool= s/patches/008-net-tools-sctp-statistics.patch deleted file mode 100644 index b84b8aa18..000000000 --- a/net-tools/patches/008-net-tools-sctp-statistics.patch +++ /dev/null @@ -1,534 +0,0 @@ -diff -up net-tools-2.0/netstat.c.sctp net-tools-2.0/netstat.c ---- net-tools-2.0/netstat.c.sctp 2013-09-23 15:14:59.524866201 +0200 -+++ net-tools-2.0/netstat.c 2013-09-23 15:24:20.259143969 +0200 -@@ -115,7 +115,7 @@ - #endif -=20 - /* prototypes for statistics.c */ --int parsesnmp(int, int, int); -+int parsesnmp(int, int, int, int); - void inittab(void); - int parsesnmp6(int, int, int); - void inittab6(void); -@@ -888,159 +888,269 @@ static int igmp_info(void) - igmp_do_one, "igmp", "igmp6"); - } -=20 --static int ip_parse_dots(uint32_t *addr, char const *src) { -- unsigned a, b, c, d; -- unsigned ret =3D 4-sscanf(src, "%u.%u.%u.%u", &a, &b, &c, &d); -- *addr =3D htonl((a << 24)|(b << 16)|(c << 8)|d); -- return ret; --} -- --static void print_ip_service(struct sockaddr_in *addr, char const *protname, -- char *buf, unsigned size) { -- struct aftype *ap; -- -- if(size =3D=3D 0) return; -- -- /* print host */ -- if((ap =3D get_afntype(addr->sin_family)) =3D=3D NULL) { -- fprintf(stderr, _("netstat: unsupported address family %d !\n"), -- addr->sin_family); -- return; -- } -- safe_strncpy(buf, ap->sprint((struct sockaddr*)addr, flag_not), size); -- -- /* print service */ -- if(flag_all || (flag_lst && !addr->sin_port) || (!flag_lst && addr->sin_p= ort)) { -- char bfs[32]; -- -- snprintf(bfs, sizeof(bfs), "%s", -- get_sname(addr->sin_port, (char*)protname, flag_not & FLAG_NUM_PORT)); -- -- /* check if we must cut on host and/or service name */ -- { -- unsigned const bufl =3D strlen(buf); -- unsigned const bfsl =3D strlen(bfs); -- -- if(bufl+bfsl+2 > size) { -- unsigned const half =3D (size-2)>>1; -- if(bufl > half) { -- if(bfsl > half) { -- buf[size-2-half] =3D '\0'; -- bfs[half+1] =3D '\0'; -- } -- else buf[size-2-bfsl] =3D '\0'; -- } -- else bfs[size-2-bufl] =3D '\0'; -- } -+static const char *sctp_socket_state_str(int state) -+{ -+ if(state>=3D0 && state<=3D10) -+ return tcp_state[state]; -+ else { -+ static char state_str_buf[64]; -+ sprintf(state_str_buf,"UNKNOWN(%d)",state); -+ return state_str_buf; - } -- strcat(buf, ":"); -- strcat(buf, bfs); -- } - } -=20 --/* process single SCTP endpoint */ --static void sctp_do_ept(int lnr, char const *line, const char *prot) -+static struct aftype *process_sctp_addr_str(const char *addr_str, struct so= ckaddr *sa) - { -- struct sockaddr_in laddr, raddr; -- unsigned uid, inode; -- -- char l_addr[23], r_addr[23]; -- -- /* fill sockaddr_in structures */ -- { -- unsigned lport; -- unsigned ate; -- -- if(lnr =3D=3D 0) return; -- if(sscanf(line, "%*X %*X %*u %*u %*u %u %u %u %n", -- &lport, &uid, &inode, &ate) < 3) goto err; -- -- /* decode IP address */ -- if(ip_parse_dots(&laddr.sin_addr.s_addr, line+ate)) goto err; -- raddr.sin_addr.s_addr =3D htonl(0); -- laddr.sin_family =3D raddr.sin_family =3D AF_INET; -- laddr.sin_port =3D htons(lport); -- raddr.sin_port =3D htons(0); -- } -+ 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] =3D htons(u0); -+ in6.s6_addr16[1] =3D htons(u1); -+ in6.s6_addr16[2] =3D htons(u2); -+ in6.s6_addr16[3] =3D htons(u3); -+ in6.s6_addr16[4] =3D htons(u4); -+ in6.s6_addr16[5] =3D htons(u5); -+ in6.s6_addr16[6] =3D htons(u6); -+ in6.s6_addr16[7] =3D htons(u7); -+ -+ inet_ntop(AF_INET6, &in6, addr6_str, sizeof(addr6_str)); -+ inet6_aftype.input(1, addr6_str, sa); -+ sa->sa_family =3D AF_INET6; -+#endif -+ } else { -+ ((struct sockaddr_in*)sa)->sin_addr.s_addr =3D inet_addr(addr_str); -+ sa->sa_family =3D AF_INET; -+ } -+ return get_afntype(sa->sa_family); -+} -=20 -- /* print IP:service to l_addr and r_addr */ -- print_ip_service(&laddr, prot, l_addr, sizeof(l_addr)); -- print_ip_service(&raddr, prot, r_addr, sizeof(r_addr)); -- -- /* Print line */ -- printf("%-4s %6d %6d %-*s %-*s %-11s", -- prot, 0, 0, -- (int)netmax(23,strlen(l_addr)), l_addr, -- (int)netmax(23,strlen(r_addr)), r_addr, -- _(tcp_state[TCP_LISTEN])); -- finish_this_one(uid, inode, ""); -- return; -- err: -- fprintf(stderr, "SCTP error in line: %d\n", lnr); --} -- --/* process single SCTP association */ --static void sctp_do_assoc(int lnr, char const *line, const char *prot) --{ -- struct sockaddr_in laddr, raddr; -- unsigned long rxq, txq; -- unsigned uid, inode; -- -- char l_addr[23], r_addr[23]; -- -- /* fill sockaddr_in structures */ -- { -- unsigned lport, rport; -- unsigned ate; -- char const *addr; -- -- if(lnr =3D=3D 0) return; -- if(sscanf(line, "%*X %*X %*u %*u %*u %*u %*u %lu %lu %u %u %u %u %n", -- &txq, &rxq, &uid, &inode, &lport, &rport, &ate) < 6) goto err; -- -- /* decode IP addresses */ -- addr =3D strchr(line+ate, '*'); -- if(addr =3D=3D 0) goto err; -- if(ip_parse_dots(&laddr.sin_addr.s_addr, ++addr)) goto err; -- addr =3D strchr(addr, '*'); -- if(addr =3D=3D 0) goto err; -- if(ip_parse_dots(&raddr.sin_addr.s_addr, ++addr)) goto err; -- -- /* complete sockaddr_in structures */ -- laddr.sin_family =3D raddr.sin_family =3D AF_INET; -- laddr.sin_port =3D htons(lport); -- raddr.sin_port =3D htons(rport); -- } -+static void sctp_eps_do_one(int lnr, char *line, const char *proto) -+{ -+ char buffer[1024]; -+ int 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 *sst_str; -+ const char *lport_str; -+ const char *uid_str; -+ const char *inode_str; -+ char *laddrs_str; -+ -+ if(lnr =3D=3D 0) { -+ /* ENDPT SOCK STY SST HBKT LPORT UID INODE LADDRS */ -+ return; -+ } -+ strtok(line," \t\n"); /*skip endpt*/ -+ strtok(0," \t\n"); /*skip sock*/ -+ strtok(0," \t\n"); /*skp sty*/ -+ sst_str =3D strtok(0," \t\n"); -+ strtok(0," \t\n"); /*skip hash bucket*/ -+ lport_str=3Dstrtok(0," \t\n"); -+ uid_str =3D strtok(0," \t\n"); -+ inode_str =3D strtok(0," \t\n"); -+ laddrs_str=3Dstrtok(0,"\t\n"); -+ -+ if (!sst_str || !lport_str || !uid_str || !inode_str) { -+ fprintf(stderr, _("warning, got bogus sctp eps line.\n")); -+ return; -+ } -+ state =3D atoi(sst_str); -+ port =3D atoi(lport_str); -+ uid =3D atoi(uid_str); -+ inode =3D strtoul(inode_str,0,0); -+ -+ const char *this_local_addr; -+ int first=3D1; -+ char local_port[16]; -+ snprintf(local_port, sizeof(local_port), "%s", -+ get_sname(htons(port), proto, flag_not & FLAG_NUM_PORT)); -+ for(this_local_addr=3Dstrtok(laddrs_str," \t\n"); -+ this_local_addr; -+ this_local_addr=3Dstrtok(0," \t\n")) -+ { -+ char local_addr[64]; -+ ap =3D process_sctp_addr_str(this_local_addr, (struct sockaddr*)&lo= caladdr); -+ 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(" %-11s", first?sctp_socket_state_str(state):""); -+ first =3D 0; -+ } -+ finish_this_one(uid,inode,""); -+} -+ -+static void sctp_assoc_do_one(int lnr, char *line, const char *proto) -+{ -+ char buffer[1024]; -+ int state, lport,rport; -+ int uid; -+ unsigned rxqueue,txqueue; -+ unsigned long inode; -+=20 -+ struct aftype *ap; -+#if HAVE_AFINET6 -+ struct sockaddr_in6 localaddr,remoteaddr; -+#else -+ struct sockaddr_in localaddr,remoteaddr; -+#endif -+ const char *sst_str; -+ const char *txqueue_str; -+ const char *rxqueue_str; -+ const char *lport_str,*rport_str; -+ const char *uid_str; -+ const char *inode_str; -+ char *laddrs_str; -+ char *raddrs_str; -+ -+ if(lnr =3D=3D 0) { -+ /* ASSOC SOCK STY SST ST HBKT ASSOC-ID TX_QUEUE RX_QUEUE UID INODE L= PORT RPORT LADDRS <-> RADDRS */ -+ return; -+ } -+ -+ strtok(line," \t\n"); /*skip assoc*/ -+ strtok(0," \t\n"); /*skip sock*/ -+ strtok(0," \t\n"); /*skp sty*/ -+ sst_str =3D strtok(0," \t\n"); -+ strtok(0," \t\n"); -+ strtok(0," \t\n"); /*skip hash bucket*/ -+ strtok(0," \t\n"); /*skip hash assoc-id*/ -+ txqueue_str =3D strtok(0," \t\n"); -+ rxqueue_str =3D strtok(0," \t\n"); -+ uid_str =3D strtok(0," \t\n"); -+ inode_str =3D strtok(0," \t\n"); -+ lport_str=3Dstrtok(0," \t\n"); -+ rport_str=3Dstrtok(0," \t\n"); -+ laddrs_str =3D strtok(0,"<->\t\n"); -+ raddrs_str =3D strtok(0,"<->\t\n"); -+ -+ if (!sst_str || !txqueue_str || !rxqueue_str || !uid_str || -+ !inode_str || !lport_str || !rport_str) { -+ fprintf(stderr, _("warning, got bogus sctp assoc line.\n")); -+ return; -+ } -+ -+ state =3D atoi(sst_str); -+ txqueue =3D atoi(txqueue_str); -+ rxqueue =3D atoi(rxqueue_str); -+ uid =3D atoi(uid_str); -+ inode =3D strtoul(inode_str,0,0); -+ lport =3D atoi(lport_str); -+ rport =3D atoi(rport_str); -+ -+ /*print all addresses*/ -+ const char *this_local_addr; -+ const char *this_remote_addr; -+ char *ss1,*ss2; -+ int first=3D1; -+ char local_port[16]; -+ char remote_port[16]; -+ snprintf(local_port, sizeof(local_port), "%s", -+ get_sname(htons(lport), proto, -+ flag_not & FLAG_NUM_PORT)); -+ snprintf(remote_port, sizeof(remote_port), "%s", -+ get_sname(htons(rport), proto, -+ flag_not & FLAG_NUM_PORT)); -+ -+ this_local_addr=3Dstrtok_r(laddrs_str," \t\n",&ss1); -+ this_remote_addr=3Dstrtok_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] =3D=3D '*') { -+ /* skip * */ -+ this_local_addr++; -+ } -+ ap =3D process_sctp_addr_str(this_local_addr, (struct sockaddr*= )&localaddr); -+ if(ap) -+ safe_strncpy(local_addr, -+ ap->sprint((struct sockaddr *) &localaddr, flag_not), s= izeof(local_addr)); -+ else -+ sprintf(local_addr,_("unsupported address family %d"), = ((struct sockaddr*)&localaddr)->sa_family); -+ } -+ if(this_remote_addr) { -+ if (this_remote_addr[0] =3D=3D '*') { -+ /* skip * */ -+ this_remote_addr++; -+ } -+ ap =3D 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); -+ } -=20 -- /* print IP:service to l_addr and r_addr */ -- print_ip_service(&laddr, prot, l_addr, sizeof(l_addr)); -- print_ip_service(&raddr, prot, r_addr, sizeof(r_addr)); -- -- /* Print line */ -- printf("%-4s %6ld %6ld %-*s %-*s %-11s", -- prot, rxq, txq, -- (int)netmax(23,strlen(l_addr)), l_addr, -- (int)netmax(23,strlen(r_addr)), r_addr, -- _(tcp_state[TCP_ESTABLISHED])); -- finish_this_one(uid, inode, ""); -- return; -- err: -- fprintf(stderr, "SCTP error in line: %d\n", lnr); -+ 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(" %-11s", first?sctp_socket_state_str(state):""); -+ -+ first =3D 0; -+ this_local_addr=3Dstrtok_r(0," \t\n",&ss1); -+ this_remote_addr=3Dstrtok_r(0," \t\n",&ss2); -+ } -+ finish_this_one(uid,inode,""); - } -=20 --static int sctp_info_epts(void) { -+static int sctp_info_eps(void) -+{ - INFO_GUTS6(_PATH_PROCNET_SCTPEPTS, _PATH_PROCNET_SCTP6EPTS, "AF INET (sct= p)", -- sctp_do_ept, "sctp", "sctp6"); -+ sctp_eps_do_one, "sctp", "sctp6"); - } -=20 - static int sctp_info_assocs(void) { - INFO_GUTS6(_PATH_PROCNET_SCTPASSOCS, _PATH_PROCNET_SCTP6ASSOCS, "AF INET = (sctp)", -- sctp_do_assoc, "sctp", "sctp6"); -+ sctp_assoc_do_one, "sctp", "sctp6"); - } -=20 - static int sctp_info(void) { - int res; -- res =3D sctp_info_epts(); -+ res =3D sctp_info_eps(); - if(res) return res; - return sctp_info_assocs(); - } -@@ -2234,7 +2344,7 @@ int main - if (!strcmp(afname, "inet")) { - #if HAVE_AFINET - inittab(); -- i =3D parsesnmp(flag_raw, flag_tcp, flag_udp); -+ i =3D parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp); - #else - ENOSUPP("netstat", "AF INET"); - #endif -diff -up net-tools-2.0/statistics.c.sctp net-tools-2.0/statistics.c ---- net-tools-2.0/statistics.c.sctp 2013-09-23 15:14:59.501866518 +0200 -+++ net-tools-2.0/statistics.c 2013-09-23 15:14:59.534866063 +0200 -@@ -21,7 +21,7 @@ - #define UFWARN(x) - #endif -=20 --int print_static,f_raw,f_tcp,f_udp,f_unknown =3D 1; -+int print_static,f_raw,f_tcp,f_udp,f_sctp,f_unknown =3D 1; -=20 - enum State { - number =3D 0, opt_number, i_forward, i_inp_icmp, i_outp_icmp, i_rto_alg, -@@ -299,6 +299,27 @@ struct entry Tcpexttab[] =3D - { "TCPRenoRecoveryFail", N_("%llu classic Reno fast retransmits failed"= ), opt_number }, - }; -=20 -+struct entry Sctptab[] =3D -+{ -+ {"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"), nu= mber}, -+ {"SctpInCtrlChunks", N_("%llu Number of control chunks received"), numb= er}, -+ {"SctpInOrderChunks", N_("%llu Number of ordered chunks received"), num= ber}, -+ {"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 { - char *title; - struct entry *tab; -@@ -312,6 +333,7 @@ struct tabtab snmptabs[] =3D - {"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} - }; -@@ -502,11 +524,38 @@ void process6_fd(FILE *f) -=20 - } -=20 --int parsesnmp(int flag_raw, int flag_tcp, int flag_udp) -+/* 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; -+ =20 -+ tab =3D newtable(snmptabs, "Sctp"); -+ =20 -+ while (fgets(buf1, sizeof buf1, f)) { -+ sp =3D buf1 + strcspn(buf1, " \t\n"); -+ if (!sp) { -+ fprintf(stderr,_("error parsing %s\n"), filename); -+ return; -+ } -+ *sp =3D '\0'; -+ sp++; -+ -+ sp +=3D strspn(sp, " \t\n");=20 -+ -+ if (*sp !=3D '\0' && *(tab->flag)) =09 -+ printval(tab, buf1, strtoul(sp, 0, 10)); -+ } -+ return; -+} -+ -+int parsesnmp(int flag_raw, int flag_tcp, int flag_udp, int flag_sctp) -+ - { - FILE *f; -=20 -- f_raw =3D flag_raw; f_tcp =3D flag_tcp; f_udp =3D flag_udp; -+ f_raw =3D flag_raw; f_tcp =3D flag_tcp; f_udp =3D flag_udp; f_sctp =3D = flag_sctp; -=20 - f =3D proc_fopen("/proc/net/snmp"); - if (!f) { -@@ -539,6 +588,17 @@ int parsesnmp(int flag_raw, int flag_tcp -=20 - fclose(f); - } -+ -+ f =3D proc_fopen("/proc/net/sctp/snmp"); -+ if (f) { -+ process_fd2(f,"/proc/net/sctp/snmp"); -+ if (ferror(f)) { -+ perror("/proc/net/sctp/snmp"); -+ fclose(f); -+ return(1); -+ } -+ } -+ - return(0); - } -=20 diff --git a/net-tools/patches/009-net-tools-ifconfig-long-iface-crasher.patc= h b/net-tools/patches/009-net-tools-ifconfig-long-iface-crasher.patch deleted file mode 100644 index d1ba07720..000000000 --- a/net-tools/patches/009-net-tools-ifconfig-long-iface-crasher.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -up net-tools-2.0/lib/interface.c.long_iface net-tools-2.0/lib/interfac= e.c ---- net-tools-2.0/lib/interface.c.long_iface 2014-11-24 15:09:45.130254503 += 0100 -+++ net-tools-2.0/lib/interface.c 2014-11-24 15:10:54.662270496 +0100 -@@ -216,6 +216,7 @@ out: -=20 - static const char *get_name(char **namep, const char *p) - { -+ int count =3D 0; - while (isspace(*p)) - p++; - char *name =3D *namep =3D p; -@@ -224,7 +225,13 @@ static const char *get_name(char **namep - break; - if (*p =3D=3D ':') { /* could be an alias */ - const char *dot =3D p++; -- while (*p && isdigit(*p)) p++; -+ count++; -+ while (*p && isdigit(*p)) { -+ p++; -+ count++; -+ if (count =3D=3D (IFNAMSIZ-1)) -+ break; -+ } - if (*p =3D=3D ':') { - /* Yes it is, backup and copy it. */ - p =3D dot; -@@ -240,6 +247,9 @@ static const char *get_name(char **namep - break; - } - *name++ =3D *p++; -+ count++; -+ if (count =3D=3D (IFNAMSIZ-1)) -+ break; - } - *name++ =3D '\0'; - return p; --=20 2.30.2 --===============4810836443433530012==--