From 709c4d66e0b107ca606941b988bad717c0b45d9b Mon Sep 17 00:00:00 2001 From: Denys Dmytriyenko Date: Tue, 17 Mar 2009 14:32:59 -0400 Subject: rename packages/ to recipes/ per earlier agreement See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko Acked-by: Mike Westerhof Acked-by: Philip Balister Acked-by: Khem Raj Acked-by: Marcin Juszkiewicz Acked-by: Koen Kooi Acked-by: Frans Meulenbroeks --- recipes/net-tools/files/README | 1 + recipes/net-tools/files/ether-wake.8 | 81 +++ recipes/net-tools/files/ether-wake.c | 392 +++++++++++++ recipes/net-tools/files/mii-diag.8 | 160 +++++ recipes/net-tools/files/mii-diag.c | 650 +++++++++++++++++++++ .../net-tools/files/net-tools-1.57-bug22040.patch | 50 ++ .../files/net-tools-1.60-arp_overflow.patch | 11 + recipes/net-tools/files/net-tools-1.60-bcast.patch | 99 ++++ .../net-tools/files/net-tools-1.60-bitkeeper.patch | 17 + recipes/net-tools/files/net-tools-1.60-config.h | 75 +++ recipes/net-tools/files/net-tools-1.60-config.make | 36 ++ recipes/net-tools/files/net-tools-1.60-cycle.patch | 311 ++++++++++ recipes/net-tools/files/net-tools-1.60-de.patch | 11 + .../files/net-tools-1.60-duplicate-tcp.patch | 194 ++++++ recipes/net-tools/files/net-tools-1.60-gcc33.patch | 31 + recipes/net-tools/files/net-tools-1.60-gcc34.patch | 36 ++ .../files/net-tools-1.60-hostname_man.patch | 35 ++ .../net-tools/files/net-tools-1.60-ifaceopt.patch | 52 ++ .../net-tools/files/net-tools-1.60-ifconfig.patch | 107 ++++ .../files/net-tools-1.60-ifconfig_ib.patch | 202 +++++++ .../files/net-tools-1.60-inet6-lookup.patch | 81 +++ .../net-tools/files/net-tools-1.60-interface.patch | 110 ++++ .../files/net-tools-1.60-interface_stack.patch | 115 ++++ recipes/net-tools/files/net-tools-1.60-ipx.patch | 36 ++ .../net-tools/files/net-tools-1.60-isofix.patch | 33 ++ recipes/net-tools/files/net-tools-1.60-man.patch | 132 +++++ .../net-tools/files/net-tools-1.60-manydevs.patch | 13 + .../files/net-tools-1.60-mii-tool-obsolete.patch | 25 + .../net-tools/files/net-tools-1.60-miiioctl.patch | 17 + .../net-tools/files/net-tools-1.60-nameif.patch | 67 +++ .../net-tools/files/net-tools-1.60-netmask.patch | 61 ++ .../files/net-tools-1.60-netstat_stop_trim.patch | 80 +++ .../files/net-tools-1.60-netstat_ulong.patch | 11 + recipes/net-tools/files/net-tools-1.60-note.patch | 13 + .../net-tools/files/net-tools-1.60-num-ports.patch | 78 +++ .../net-tools/files/net-tools-1.60-overflow.patch | 63 ++ recipes/net-tools/files/net-tools-1.60-parse.patch | 70 +++ recipes/net-tools/files/net-tools-1.60-pie.patch | 13 + .../net-tools/files/net-tools-1.60-return.patch | 28 + .../net-tools/files/net-tools-1.60-selinux.patch | 205 +++++++ .../net-tools/files/net-tools-1.60-siunits.patch | 80 +++ .../net-tools/files/net-tools-1.60-statalias.patch | 15 + .../files/net-tools-1.60-statistics.patch | 65 +++ recipes/net-tools/files/net-tools-1.60-stdo.patch | 11 + .../files/net-tools-1.60-trailingblank.patch | 26 + .../files/net-tools-1.60-trim_iface.patch | 31 + recipes/net-tools/files/net-tools-1.60-trunc.patch | 42 ++ recipes/net-tools/files/net-tools-1.60-ulong.patch | 215 +++++++ .../files/net-tools-1.60-virtualname.patch | 36 ++ recipes/net-tools/net-tools_1.60.bb | 112 ++++ 50 files changed, 4435 insertions(+) create mode 100644 recipes/net-tools/files/README create mode 100644 recipes/net-tools/files/ether-wake.8 create mode 100644 recipes/net-tools/files/ether-wake.c create mode 100644 recipes/net-tools/files/mii-diag.8 create mode 100644 recipes/net-tools/files/mii-diag.c create mode 100644 recipes/net-tools/files/net-tools-1.57-bug22040.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-arp_overflow.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-bcast.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-bitkeeper.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-config.h create mode 100644 recipes/net-tools/files/net-tools-1.60-config.make create mode 100644 recipes/net-tools/files/net-tools-1.60-cycle.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-de.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-duplicate-tcp.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-gcc33.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-gcc34.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-hostname_man.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-ifaceopt.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-ifconfig.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-ifconfig_ib.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-inet6-lookup.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-interface.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-interface_stack.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-ipx.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-isofix.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-man.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-manydevs.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-mii-tool-obsolete.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-miiioctl.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-nameif.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-netmask.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-netstat_stop_trim.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-netstat_ulong.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-note.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-num-ports.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-overflow.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-parse.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-pie.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-return.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-selinux.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-siunits.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-statalias.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-statistics.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-stdo.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-trailingblank.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-trim_iface.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-trunc.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-ulong.patch create mode 100644 recipes/net-tools/files/net-tools-1.60-virtualname.patch create mode 100644 recipes/net-tools/net-tools_1.60.bb (limited to 'recipes/net-tools') diff --git a/recipes/net-tools/files/README b/recipes/net-tools/files/README new file mode 100644 index 0000000000..76e14a2341 --- /dev/null +++ b/recipes/net-tools/files/README @@ -0,0 +1 @@ +Patches were downloaded from http://ftp.uni-koeln.de/mirrors/fedora/linux/core/5/source/SRPMS/net-tools-1.60-62.1.src.rpm diff --git a/recipes/net-tools/files/ether-wake.8 b/recipes/net-tools/files/ether-wake.8 new file mode 100644 index 0000000000..26b4f85a8a --- /dev/null +++ b/recipes/net-tools/files/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 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\fP and +.\" \fI\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/recipes/net-tools/files/ether-wake.c b/recipes/net-tools/files/ether-wake.c new file mode 100644 index 0000000000..eef22a7ab2 --- /dev/null +++ b/recipes/net-tools/files/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 ] [-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 ] [-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 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 +#include +#include +#include +#include +#include + +#if 0 /* Only exists on some versions. */ +#include +#endif + +#include + +#include +#include +#include + +#include +#if __GLIBC__ >= 2 && __GLIBC_MINOR >= 1 +#include +#include +#else +#include +#include +#include +#endif +#include +#include + +/* 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 +#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/recipes/net-tools/files/mii-diag.8 b/recipes/net-tools/files/mii-diag.8 new file mode 100644 index 0000000000..aa0dc0be15 --- /dev/null +++ b/recipes/net-tools/files/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 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, +.\" 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 +.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="-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/recipes/net-tools/files/mii-diag.c b/recipes/net-tools/files/mii-diag.c new file mode 100644 index 0000000000..17d8bef63b --- /dev/null +++ b/recipes/net-tools/files/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 + + 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\n"; + +static const char usage_msg[] = +"Usage: %s [--help] [-aDfrRvVw] [-AF ] [--watch] .\n"; +static const char long_usage_msg[] = +"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\ + The default interface is \"eth0\".\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 != 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<= 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 = 5; i >= 0; i--) + if (lkpar & (0x20<] [-i ] -Ds [netmask ] 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/recipes/net-tools/files/net-tools-1.60-arp_overflow.patch b/recipes/net-tools/files/net-tools-1.60-arp_overflow.patch new file mode 100644 index 0000000000..4679a51675 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-bcast.patch b/recipes/net-tools/files/net-tools-1.60-bcast.patch new file mode 100644 index 0000000000..9489e26352 --- /dev/null +++ b/recipes/net-tools/files/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 + #include + #include ++#include + #include + #include + #include +@@ -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/recipes/net-tools/files/net-tools-1.60-bitkeeper.patch b/recipes/net-tools/files/net-tools-1.60-bitkeeper.patch new file mode 100644 index 0000000000..6871304d3b --- /dev/null +++ b/recipes/net-tools/files/net-tools-1.60-bitkeeper.patch @@ -0,0 +1,17 @@ +--- net-tools-1.60/netplug-1.2.9/Makefile.kill_bitkeeper 2005-01-10 11:36:32.000000000 +0100 ++++ net-tools-1.60/netplug-1.2.9/Makefile 2005-01-10 11:38:01.796744224 +0100 +@@ -24,10 +24,12 @@ + install $(install_opts) -m 755 scripts/rc.netplugd $(initdir)/netplugd + install -C $(install_opts) -m 444 man/man8/netplugd.8 $(mandir)/man8 + +-bk_root := $(shell bk root) ++#bk_root := $(shell bk root) ++bk_root := $(shell) + tar_root := netplug-$(version) + tar_file := $(bk_root)/$(tar_root).tar.bz2 +-files := $(shell bk sfiles -Ug) ++#files := $(shell bk sfiles -Ug) ++file := $(shell) + + tarball: $(tar_file) + diff --git a/recipes/net-tools/files/net-tools-1.60-config.h b/recipes/net-tools/files/net-tools-1.60-config.h new file mode 100644 index 0000000000..b01fd72bfe --- /dev/null +++ b/recipes/net-tools/files/net-tools-1.60-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 0 + +/* + * + * Protocol Families. + * + */ +#define HAVE_AFUNIX 1 +#define HAVE_AFINET 1 +#define HAVE_AFINET6 1 +#define HAVE_AFIPX 0 +#define HAVE_AFATALK 0 +#define HAVE_AFAX25 0 +#define HAVE_AFNETROM 1 +#define HAVE_AFROSE 0 +#define HAVE_AFX25 0 +#define HAVE_AFECONET 0 +#define HAVE_AFDECnet 0 +#define HAVE_AFASH 0 + +/* + * + * Device Hardware types. + * + */ +#define HAVE_HWETHER 1 +#define HAVE_HWARC 1 +#define HAVE_HWSLIP 1 +#define HAVE_HWPPP 1 +#define HAVE_HWTUNNEL 1 +#define HAVE_HWSTRIP 1 +#define HAVE_HWTR 1 +#define HAVE_HWAX25 0 +#define HAVE_HWROSE 0 +#define HAVE_HWNETROM 1 +#define HAVE_HWX25 0 +#define HAVE_HWFR 1 +#define HAVE_HWSIT 0 +#define HAVE_HWFDDI 0 +#define HAVE_HWHIPPI 0 +#define HAVE_HWASH 0 +#define HAVE_HWHDLCLAPB 0 +#define HAVE_HWIRDA 1 +#define HAVE_HWEC 0 +#define HAVE_HWIB 0 + +/* + * + * Other Features. + * + */ +#define HAVE_FW_MASQUERADE 1 +#define HAVE_IP_TOOLS 1 +#define HAVE_MII 1 diff --git a/recipes/net-tools/files/net-tools-1.60-config.make b/recipes/net-tools/files/net-tools-1.60-config.make new file mode 100644 index 0000000000..11082004cd --- /dev/null +++ b/recipes/net-tools/files/net-tools-1.60-config.make @@ -0,0 +1,36 @@ +# I18N=0 +HAVE_AFUNIX=1 +HAVE_AFINET=1 +HAVE_AFINET6=1 +# HAVE_AFIPX=0 +# HAVE_AFATALK=0 +# HAVE_AFAX25=0 +HAVE_AFNETROM=1 +# HAVE_AFROSE=0 +# HAVE_AFX25=0 +# HAVE_AFECONET=0 +# HAVE_AFDECnet=0 +# HAVE_AFASH=0 +HAVE_HWETHER=1 +HAVE_HWARC=1 +HAVE_HWSLIP=1 +HAVE_HWPPP=1 +HAVE_HWTUNNEL=1 +HAVE_HWSTRIP=1 +HAVE_HWTR=1 +# HAVE_HWAX25=0 +# HAVE_HWROSE=0 +HAVE_HWNETROM=1 +# HAVE_HWX25=0 +HAVE_HWFR=1 +# HAVE_HWSIT=0 +# HAVE_HWFDDI=0 +# HAVE_HWHIPPI=0 +# HAVE_HWASH=0 +# HAVE_HWHDLCLAPB=0 +HAVE_HWIRDA=1 +# HAVE_HWEC=0 +# HAVE_HWIB=0 +HAVE_FW_MASQUERADE=1 +HAVE_IP_TOOLS=1 +HAVE_MII=1 diff --git a/recipes/net-tools/files/net-tools-1.60-cycle.patch b/recipes/net-tools/files/net-tools-1.60-cycle.patch new file mode 100644 index 0000000000..ce659ec5ad --- /dev/null +++ b/recipes/net-tools/files/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] [] -r netstat {-V|--version|-h|--help}\n")); + fprintf(stderr, _(" netstat [-vnNcaeol] [ ...]\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/recipes/net-tools/files/net-tools-1.60-de.patch b/recipes/net-tools/files/net-tools-1.60-de.patch new file mode 100644 index 0000000000..f015f13d24 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-duplicate-tcp.patch b/recipes/net-tools/files/net-tools-1.60-duplicate-tcp.patch new file mode 100644 index 0000000000..316ac65a5b --- /dev/null +++ b/recipes/net-tools/files/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; +@@ -1849,6 +2014,7 @@ + break; + sleep(1); + prg_cache_clear(); ++ tcp_node_hash_clear(); + } + return (i); + } diff --git a/recipes/net-tools/files/net-tools-1.60-gcc33.patch b/recipes/net-tools/files/net-tools-1.60-gcc33.patch new file mode 100644 index 0000000000..a6ae422a72 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-gcc34.patch b/recipes/net-tools/files/net-tools-1.60-gcc34.patch new file mode 100644 index 0000000000..5f700c128e --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-hostname_man.patch b/recipes/net-tools/files/net-tools-1.60-hostname_man.patch new file mode 100644 index 0000000000..84a4051cdf --- /dev/null +++ b/recipes/net-tools/files/net-tools-1.60-hostname_man.patch @@ -0,0 +1,35 @@ +--- 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,32 @@ + complete FQDN of the system is returned with + .BR "hostname \-\-fqdn" . + ++.LP ++The function ++.BR gethostname(2) ++is used to get the hostname. Only when the ++.BR "hostname \-s" ++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/recipes/net-tools/files/net-tools-1.60-ifaceopt.patch b/recipes/net-tools/files/net-tools-1.60-ifaceopt.patch new file mode 100644 index 0000000000..a561d07986 --- /dev/null +++ b/recipes/net-tools/files/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] [] -r netstat {-V|--version|-h|--help}\n")); + fprintf(stderr, _(" netstat [-vnNcaeol] [ ...]\n")); +- fprintf(stderr, _(" netstat { [-veenNac] -i[] | [-cnNe] -M | -s } [delay]\n\n")); ++ fprintf(stderr, _(" netstat { [-veenNac] -I[] | [-veenNac] -i | [-cnNe] -M | -s } [delay]\n\n")); + + fprintf(stderr, _(" -r, --route display routing table\n")); +- fprintf(stderr, _(" -i, --interfaces=[] display interface table\n")); ++ fprintf(stderr, _(" -I, --interfaces=[] display interface table for \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/recipes/net-tools/files/net-tools-1.60-ifconfig.patch b/recipes/net-tools/files/net-tools-1.60-ifconfig.patch new file mode 100644 index 0000000000..a209bd4197 --- /dev/null +++ b/recipes/net-tools/files/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] [[]
]\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/recipes/net-tools/files/net-tools-1.60-ifconfig_ib.patch b/recipes/net-tools/files/net-tools-1.60-ifconfig_ib.patch new file mode 100644 index 0000000000..b5a234f25d --- /dev/null +++ b/recipes/net-tools/files/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, ++ * Copyright 1993 MicroWalt Corporation ++ * Tom Duffy ++ * ++ * 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 ++#include ++#include ++/*#include - not in gcc-kernheaders*/ ++#include ++#include ++#include ++#include ++#include ++#include ++#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/recipes/net-tools/files/net-tools-1.60-inet6-lookup.patch b/recipes/net-tools/files/net-tools-1.60-inet6-lookup.patch new file mode 100644 index 0000000000..3d4854a6fb --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-interface.patch b/recipes/net-tools/files/net-tools-1.60-interface.patch new file mode 100644 index 0000000000..3a1bc910aa --- /dev/null +++ b/recipes/net-tools/files/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] [] -r netstat {-V|--version|-h|--help}\n")); + fprintf(stderr, _(" netstat [-vnNcaeol] [ ...]\n")); +- fprintf(stderr, _(" netstat { [-veenNac] -i | [-cnNe] -M | -s } [delay]\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")); +- 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=[] 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, _(" : Name of interface to monitor/list.\n")); + fprintf(stderr, _(" ={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom\n")); + fprintf(stderr, _(" =Use '-A ' or '--'; 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/recipes/net-tools/files/net-tools-1.60-interface_stack.patch b/recipes/net-tools/files/net-tools-1.60-interface_stack.patch new file mode 100644 index 0000000000..c16f539753 --- /dev/null +++ b/recipes/net-tools/files/net-tools-1.60-interface_stack.patch @@ -0,0 +1,115 @@ +Bugzilla Bug 176714 – *** stack smashing detected ***: /sbin/ifconfig terminated + +--- lib/interface.c-old 2005-12-30 11:08:15.000000000 -0800 ++++ 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/recipes/net-tools/files/net-tools-1.60-ipx.patch b/recipes/net-tools/files/net-tools-1.60-ipx.patch new file mode 100644 index 0000000000..d4458b9462 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-isofix.patch b/recipes/net-tools/files/net-tools-1.60-isofix.patch new file mode 100644 index 0000000000..4bbaff18a9 --- /dev/null +++ b/recipes/net-tools/files/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 \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 \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 \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/recipes/net-tools/files/net-tools-1.60-man.patch b/recipes/net-tools/files/net-tools-1.60-man.patch new file mode 100644 index 0000000000..2deac4a46b --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-manydevs.patch b/recipes/net-tools/files/net-tools-1.60-manydevs.patch new file mode 100644 index 0000000000..d07ffbacb3 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-mii-tool-obsolete.patch b/recipes/net-tools/files/net-tools-1.60-mii-tool-obsolete.patch new file mode 100644 index 0000000000..efb7f27ad7 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-miiioctl.patch b/recipes/net-tools/files/net-tools-1.60-miiioctl.patch new file mode 100644 index 0000000000..4859273ede --- /dev/null +++ b/recipes/net-tools/files/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 diff --git a/recipes/net-tools/files/net-tools-1.60-nameif.patch b/recipes/net-tools/files/net-tools-1.60-nameif.patch new file mode 100644 index 0000000000..7ba1f0002d --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-netmask.patch b/recipes/net-tools/files/net-tools-1.60-netmask.patch new file mode 100644 index 0000000000..532898acaf --- /dev/null +++ b/recipes/net-tools/files/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 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/recipes/net-tools/files/net-tools-1.60-netstat_stop_trim.patch b/recipes/net-tools/files/net-tools-1.60-netstat_stop_trim.patch new file mode 100644 index 0000000000..425b5c6ca0 --- /dev/null +++ b/recipes/net-tools/files/net-tools-1.60-netstat_stop_trim.patch @@ -0,0 +1,80 @@ +--- 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 \-\-trim" ++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,17 +983,21 @@ + 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)); + local_addr[sizeof(local_addr)-1] = 0; + 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)); +@@ -1776,6 +1783,7 @@ + {"fib", 0, 0, 'F'}, + {"groups", 0, 0, 'g'}, + {"context", 0, 0, 'Z'}, ++ {"trim", 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) { diff --git a/recipes/net-tools/files/net-tools-1.60-netstat_ulong.patch b/recipes/net-tools/files/net-tools-1.60-netstat_ulong.patch new file mode 100644 index 0000000000..56869dc539 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-note.patch b/recipes/net-tools/files/net-tools-1.60-note.patch new file mode 100644 index 0000000000..4853ccd635 --- /dev/null +++ b/recipes/net-tools/files/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, + .br diff --git a/recipes/net-tools/files/net-tools-1.60-num-ports.patch b/recipes/net-tools/files/net-tools-1.60-num-ports.patch new file mode 100644 index 0000000000..829c9d6a77 --- /dev/null +++ b/recipes/net-tools/files/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)); +@@ -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)); +@@ -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)); +@@ -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)); +@@ -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/recipes/net-tools/files/net-tools-1.60-overflow.patch b/recipes/net-tools/files/net-tools-1.60-overflow.patch new file mode 100644 index 0000000000..d363149514 --- /dev/null +++ b/recipes/net-tools/files/net-tools-1.60-overflow.patch @@ -0,0 +1,63 @@ +diff -ur net-tools-1.60.orig/netstat.c net-tools-1.60/netstat.c +--- net-tools-1.60.orig/netstat.c 2004-04-07 11:47:05.000000000 -0400 ++++ net-tools-1.60/netstat.c 2004-04-07 16:47:15.000000000 -0400 +@@ -777,7 +777,8 @@ + local_addr[22 - strlen(buffer)] = '\0'; + + strcat(local_addr, ":"); +- strcat(local_addr, buffer); ++ strncat(local_addr, buffer, sizeof(local_addr)); ++ local_addr[sizeof(local_addr)-1] = 0; + snprintf(buffer, sizeof(buffer), "%s", + get_sname(htons(rem_port), "tcp", flag_not & FLAG_NUM_PORT)); + +@@ -785,7 +786,8 @@ + rem_addr[22 - strlen(buffer)] = '\0'; + + strcat(rem_addr, ":"); +- strcat(rem_addr, buffer); ++ strncat(rem_addr, buffer, sizeof(rem_addr)); ++ rem_addr[sizeof(rem_addr)-1] = 0; + timers[0] = '\0'; + + if (flag_opt) +@@ -926,7 +928,8 @@ + 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)); ++ local_addr[sizeof(local_addr)-1] = 0; + + snprintf(buffer, sizeof(buffer), "%s", + get_sname(htons(rem_port), "udp", flag_not & FLAG_NUM_PORT)); +@@ -935,7 +938,8 @@ + 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)); ++ rem_addr[sizeof(rem_addr)-1] = 0; + + timers[0] = '\0'; + if (flag_opt) +@@ -1045,7 +1049,8 @@ + 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)); ++ local_addr[sizeof(local_addr)-1] = 0; + + snprintf(buffer, sizeof(buffer), "%s", + get_sname(htons(rem_port), "raw", flag_not & FLAG_NUM_PORT)); +@@ -1054,7 +1059,8 @@ + 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)); ++ rem_addr[sizeof(rem_addr)-1] = 0; + + timers[0] = '\0'; + if (flag_opt) diff --git a/recipes/net-tools/files/net-tools-1.60-parse.patch b/recipes/net-tools/files/net-tools-1.60-parse.patch new file mode 100644 index 0000000000..25890f1b04 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-pie.patch b/recipes/net-tools/files/net-tools-1.60-pie.patch new file mode 100644 index 0000000000..d4496ffbc8 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-return.patch b/recipes/net-tools/files/net-tools-1.60-return.patch new file mode 100644 index 0000000000..8ef10f51c3 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-selinux.patch b/recipes/net-tools/files/net-tools-1.60-selinux.patch new file mode 100644 index 0000000000..d0266696d0 --- /dev/null +++ b/recipes/net-tools/files/net-tools-1.60-selinux.patch @@ -0,0 +1,205 @@ +--- 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 + #include + ++#if HAVE_SELINUX ++#include ++#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, _(" : Name of interface to monitor/list.\n")); + fprintf(stderr, _(" ={-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(); diff --git a/recipes/net-tools/files/net-tools-1.60-siunits.patch b/recipes/net-tools/files/net-tools-1.60-siunits.patch new file mode 100644 index 0000000000..cf6d89c5d3 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-statalias.patch b/recipes/net-tools/files/net-tools-1.60-statalias.patch new file mode 100644 index 0000000000..7c74f74d07 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-statistics.patch b/recipes/net-tools/files/net-tools-1.60-statistics.patch new file mode 100644 index 0000000000..d3a56499e8 --- /dev/null +++ b/recipes/net-tools/files/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 + * 19981113 - i18n fixes - Arnaldo Carvalho de Melo + * 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 unabled 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/recipes/net-tools/files/net-tools-1.60-stdo.patch b/recipes/net-tools/files/net-tools-1.60-stdo.patch new file mode 100644 index 0000000000..4c9d93e88f --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-trailingblank.patch b/recipes/net-tools/files/net-tools-1.60-trailingblank.patch new file mode 100644 index 0000000000..8c752282e2 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-trim_iface.patch b/recipes/net-tools/files/net-tools-1.60-trim_iface.patch new file mode 100644 index 0000000000..150722cd28 --- /dev/null +++ b/recipes/net-tools/files/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] [[]
]\n")); ++ fprintf(stderr, _("Usage:\n ifconfig [-a] [-v] [-s] [[]
]\n")); + #if HAVE_AFINET + fprintf(stderr, _(" [add
[/]]\n")); + fprintf(stderr, _(" [del
[/]]\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/recipes/net-tools/files/net-tools-1.60-trunc.patch b/recipes/net-tools/files/net-tools-1.60-trunc.patch new file mode 100644 index 0000000000..9ff3c0bcc8 --- /dev/null +++ b/recipes/net-tools/files/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)); +@@ -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)); +@@ -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/recipes/net-tools/files/net-tools-1.60-ulong.patch b/recipes/net-tools/files/net-tools-1.60-ulong.patch new file mode 100644 index 0000000000..bc7df29dd6 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/files/net-tools-1.60-virtualname.patch b/recipes/net-tools/files/net-tools-1.60-virtualname.patch new file mode 100644 index 0000000000..326df1d4d1 --- /dev/null +++ b/recipes/net-tools/files/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/recipes/net-tools/net-tools_1.60.bb b/recipes/net-tools/net-tools_1.60.bb new file mode 100644 index 0000000000..2ef5d1967e --- /dev/null +++ b/recipes/net-tools/net-tools_1.60.bb @@ -0,0 +1,112 @@ +SUMMARY="Basic networking tools" +LICENSE="GPL" +PR = "r2" + +# +# NOTE: +# This code currently disbles gettext/i18n! This can be fixed by rerunning +# make config and say NO to gettext. I will leave this excercise for someone +# else. +# Change/generate net-tools-1.60-config.{h,make} to enable/disable features +# and gettext +# +# + +SRC_URI = "http://download.berlios.de/${PN}/${PN}-${PV}.tar.bz2;md5sum=888774accab40217dde927e21979c165 \ + file://net-tools-${PV}-config.h \ + file://net-tools-${PV}-config.make \ + file://ether-wake.c \ + file://ether-wake.8 \ + file://mii-diag.c \ + file://mii-diag.8 \ + file://net-tools-1.57-bug22040.patch;patch=1 \ + file://net-tools-1.60-miiioctl.patch;patch=1 \ + file://net-tools-1.60-manydevs.patch;patch=1;pnum=0 \ + file://net-tools-1.60-virtualname.patch;patch=1 \ + file://net-tools-1.60-cycle.patch;patch=1 \ + file://net-tools-1.60-nameif.patch;patch=1 \ + file://net-tools-1.60-ipx.patch;patch=1 \ + file://net-tools-1.60-inet6-lookup.patch;patch=1 \ + file://net-tools-1.60-man.patch;patch=1 \ + file://net-tools-1.60-gcc33.patch;patch=1 \ + file://net-tools-1.60-trailingblank.patch;patch=1 \ + file://net-tools-1.60-interface.patch;patch=1 \ + file://net-tools-1.60-gcc34.patch;patch=1 \ + file://net-tools-1.60-overflow.patch;patch=1 \ + file://net-tools-1.60-siunits.patch;patch=1 \ + file://net-tools-1.60-trunc.patch;patch=1 \ + file://net-tools-1.60-return.patch;patch=1 \ + file://net-tools-1.60-parse.patch;patch=1 \ + file://net-tools-1.60-netmask.patch;patch=1 \ + file://net-tools-1.60-ulong.patch;patch=1 \ + file://net-tools-1.60-bcast.patch;patch=1 \ + file://net-tools-1.60-mii-tool-obsolete.patch;patch=1 \ + file://net-tools-1.60-netstat_ulong.patch;patch=1 \ + file://net-tools-1.60-note.patch;patch=1 \ + file://net-tools-1.60-num-ports.patch;patch=1 \ + file://net-tools-1.60-duplicate-tcp.patch;patch=1 \ + file://net-tools-1.60-statalias.patch;patch=1 \ + file://net-tools-1.60-isofix.patch;patch=1 \ + file://net-tools-1.60-ifconfig_ib.patch;patch=1 \ + file://net-tools-1.60-de.patch;patch=1 \ + file://net-tools-1.60-pie.patch;patch=1 \ + file://net-tools-1.60-ifaceopt.patch;patch=1 \ + file://net-tools-1.60-trim_iface.patch;patch=1 \ + file://net-tools-1.60-stdo.patch;patch=1 \ + file://net-tools-1.60-statistics.patch;patch=1 \ + file://net-tools-1.60-ifconfig.patch;patch=1 \ + file://net-tools-1.60-arp_overflow.patch;patch=1 \ + file://net-tools-1.60-hostname_man.patch;patch=1 \ + file://net-tools-1.60-interface_stack.patch;patch=1;pnum=0 \ + file://net-tools-1.60-selinux.patch;patch=1 \ + file://net-tools-1.60-netstat_stop_trim.patch;patch=1 " + + +# Copy config and source over to the source directory +do_configure() { + cp ${WORKDIR}/net-tools-${PV}-config.h ${S}/config.h + cp ${WORKDIR}/net-tools-${PV}-config.make ${S}/config.make + cp ${WORKDIR}/ether-wake.c ${S} + cp ${WORKDIR}/ether-wake.8 ${S}/man/en_US + cp ${WORKDIR}/mii-diag.c ${S} + cp ${WORKDIR}/mii-diag.8 ${S}/man/en_US +} + +do_compile() { + export COPTS="$CFLAGS" + export LOPTS="$LDFLAGS" + unset CFLAGS + unset LDFLAGS + + oe_runmake + $CC $CFLAGS -o ether-wake ether-wake.c + $CC $CFLAGS -o mii-diag mii-diag.c +} + +do_install() { + oe_runmake 'BASEDIR=${D}' -n install + oe_runmake 'BASEDIR=${D}' install + + for app in ${D}/${base_sbindir}/* ${D}/${base_bindir}/*; do + mv $app $app.net-tools + done +} + +pkg_postinst_${PN} () { +#!/bin/sh +for app in arp ifconfig ipmaddr iptunnel mii-tool nameif plipconfig rarp route slattach ; do + update-alternatives --install ${base_sbindir}/$app $app $app.${PN} 100 +done + +for app in dnsdomainname domainname hostname netstat nisdomainname ypdomainname ; do + update-alternatives --install ${base_bindir}/$app $app $app.${PN} 100 +done +} + +pkg_prerm_${PN} () { + #!/bin/sh + +for app in arp ifconfig ipmaddr iptunnel mii-tool nameif plipconfig rarp route slattach dnsdomainname domainname hostname netstat nisdomainname ypdomainname ; do + update-alternatives --remove $app $app.${PN} +done +} -- cgit v1.2.3