Accepting request 504435 from home:scarabeus_iv:branches:network:utilities
OBS-URL: https://build.opensuse.org/request/show/504435 OBS-URL: https://build.opensuse.org/package/show/network:utilities/net-tools?expand=0&rev=53
This commit is contained in:
parent
821ae9745f
commit
bb98832925
585
0001-Add-ether-wake-binary.patch
Normal file
585
0001-Add-ether-wake-binary.patch
Normal file
|
@ -0,0 +1,585 @@
|
|||
From 259d1c453c7dc3b0291f3b4755567a94b778480e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tchvatal@suse.com>
|
||||
Date: Sat, 17 Jun 2017 22:06:03 +0200
|
||||
Subject: [PATCH 1/7] Add ether-wake binary
|
||||
|
||||
---
|
||||
Makefile | 6 +-
|
||||
ether-wake.c | 445 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
man/en_US/ether-wake.8 | 81 +++++++++
|
||||
3 files changed, 531 insertions(+), 1 deletion(-)
|
||||
create mode 100644 ether-wake.c
|
||||
create mode 100644 man/en_US/ether-wake.8
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index bf67bc6..cb171a0 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -33,7 +33,7 @@ SBINDIR ?= /sbin
|
||||
NET_LIB_PATH = lib
|
||||
NET_LIB_NAME = net-tools
|
||||
|
||||
-PROGS := ifconfig netstat route nameif
|
||||
+PROGS := ifconfig netstat route nameif ether-wake
|
||||
|
||||
-include config.make
|
||||
ifeq ($(HAVE_ARP_TOOLS),1)
|
||||
@@ -205,6 +205,9 @@ ipmaddr: $(NET_LIB) ipmaddr.o
|
||||
mii-tool: $(NET_LIB) mii-tool.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ mii-tool.o $(NLIB) $(LDLIBS)
|
||||
|
||||
+ether-wake: $(NET_LIB) ether-wake.o
|
||||
+ $(CC) $(CFLAGS) $(LDFLAGS) -o ether-wake ether-wake.o $(NLIB) $(LDLIBS)
|
||||
+
|
||||
installbin:
|
||||
@echo
|
||||
@echo "######################################################"
|
||||
@@ -217,6 +220,7 @@ installbin:
|
||||
install -m 0755 nameif ${BASEDIR}${SBINDIR}
|
||||
install -m 0755 netstat ${BASEDIR}${BINDIR}
|
||||
install -m 0755 route ${BASEDIR}${BINDIR}
|
||||
+ install -m 0755 ether-wake ${BASEDIR}${SBINDIR}
|
||||
ifeq ($(HAVE_ARP_TOOLS),1)
|
||||
install -m 0755 arp ${BASEDIR}${SBINDIR}
|
||||
install -m 0755 rarp ${BASEDIR}${SBINDIR}
|
||||
diff --git a/ether-wake.c b/ether-wake.c
|
||||
new file mode 100644
|
||||
index 0000000..cfceb44
|
||||
--- /dev/null
|
||||
+++ b/ether-wake.c
|
||||
@@ -0,0 +1,445 @@
|
||||
+/* ether-wake.c: Send a magic packet to wake up sleeping machines. */
|
||||
+
|
||||
+static char version_msg[] =
|
||||
+"ether-wake.c: v1.09 11/12/2003 Donald Becker, http://www.scyld.com/";
|
||||
+static char brief_usage_msg[] =
|
||||
+"usage: ether-wake -i <ifname> [-p aa:bb:cc:dd[:ee:ff]] 00:11:22:33:44:55\n"
|
||||
+" Use '-u' to see the complete set of options.\n";
|
||||
+static char usage_msg[] =
|
||||
+"usage: ether-wake -i <ifname> [-p aa:bb:cc:dd[:ee:ff]] 00:11:22:33:44:55\n"
|
||||
+"\n"
|
||||
+" This program generates and transmits a Wake-On-LAN (WOL)\n"
|
||||
+" \"Magic Packet\", used for restarting machines that have been\n"
|
||||
+" soft-powered-down (ACPI D3-warm state).\n"
|
||||
+" It currently generates the standard AMD Magic Packet format, with\n"
|
||||
+" an optional password appended.\n"
|
||||
+"\n"
|
||||
+" The single required parameter is the Ethernet MAC (station) address\n"
|
||||
+" of the machine to wake or a host ID with known NSS 'ethers' entry.\n"
|
||||
+" The MAC address may be found with the 'arp' program while the target\n"
|
||||
+" machine is awake.\n"
|
||||
+"\n"
|
||||
+" Options:\n"
|
||||
+" -b Send wake-up packet to the broadcast address.\n"
|
||||
+" -D Increase the debug level.\n"
|
||||
+" -i ifname Use interface ifname instead of sending a wake packet to all interfaces.\n"
|
||||
+" -p <pw> Append the four or six byte password PW to the packet.\n"
|
||||
+" A password is only required for a few adapter types.\n"
|
||||
+" The password may be specified in ethernet hex format\n"
|
||||
+" or dotted decimal (Internet address)\n"
|
||||
+" -p 00:22:44:66:88:aa\n"
|
||||
+" -p 192.168.1.1\n";
|
||||
+
|
||||
+/*
|
||||
+ This program generates and transmits a Wake-On-LAN (WOL) "Magic Packet",
|
||||
+ used for restarting machines that have been soft-powered-down
|
||||
+ (ACPI D3-warm state). It currently generates the standard AMD Magic Packet
|
||||
+ format, with an optional password appended.
|
||||
+
|
||||
+ This software may be used and distributed according to the terms
|
||||
+ of the GNU Public License, incorporated herein by reference.
|
||||
+ Contact the author for use under other terms.
|
||||
+
|
||||
+ This source file was originally part of the network tricks package, and
|
||||
+ is now distributed to support the Scyld Beowulf system.
|
||||
+ Copyright 1999-2003 Donald Becker and Scyld Computing Corporation.
|
||||
+
|
||||
+ The author may be reached as becker@scyld, or C/O
|
||||
+ Scyld Computing Corporation
|
||||
+ 914 Bay Ridge Road, Suite 220
|
||||
+ Annapolis MD 21403
|
||||
+
|
||||
+ Notes:
|
||||
+ On some systems dropping root capability allows the process to be
|
||||
+ dumped, traced or debugged.
|
||||
+ If someone traces this program, they get control of a raw socket.
|
||||
+ Linux handles this safely, but beware when porting this program.
|
||||
+
|
||||
+ An alternative to needing 'root' is using a UDP broadcast socket, however
|
||||
+ doing so only works with adapters configured for unicast+broadcast Rx
|
||||
+ filter. That configuration consumes more power.
|
||||
+*/
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+#include <errno.h>
|
||||
+#include <ctype.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#if 0 /* Only exists on some versions. */
|
||||
+#include <ioctls.h>
|
||||
+#endif
|
||||
+
|
||||
+#include <sys/socket.h>
|
||||
+
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/ioctl.h>
|
||||
+#include <linux/if.h>
|
||||
+
|
||||
+#include <features.h>
|
||||
+#if __GLIBC__ >= 2 && __GLIBC_MINOR >= 1
|
||||
+#include <netpacket/packet.h>
|
||||
+#include <net/ethernet.h>
|
||||
+#else
|
||||
+#include <asm/types.h>
|
||||
+#include <linux/if_packet.h>
|
||||
+#include <linux/if_ether.h>
|
||||
+#endif
|
||||
+#include <netdb.h>
|
||||
+#include <netinet/ether.h>
|
||||
+
|
||||
+#include "interface.h"
|
||||
+#include "sockets.h"
|
||||
+
|
||||
+/* Grrr, no consistency between include versions.
|
||||
+ Enable this if setsockopt() isn't declared with your library. */
|
||||
+#if 0
|
||||
+extern int setsockopt __P ((int __fd, int __level, int __optname,
|
||||
+ __ptr_t __optval, int __optlen));
|
||||
+#else /* New, correct head files. */
|
||||
+#include <sys/socket.h>
|
||||
+#endif
|
||||
+
|
||||
+u_char outpack[1000];
|
||||
+int outpack_sz = 0;
|
||||
+int debug = 0;
|
||||
+u_char wol_passwd[6];
|
||||
+int wol_passwd_sz = 0;
|
||||
+
|
||||
+static int opt_no_src_addr = 0, opt_broadcast = 0;
|
||||
+
|
||||
+static int get_dest_addr(const char *arg, struct ether_addr *eaddr);
|
||||
+static int get_fill(unsigned char *pkt, struct ether_addr *eaddr);
|
||||
+static int get_wol_pw(const char *optarg);
|
||||
+
|
||||
+typedef struct {
|
||||
+ int s;
|
||||
+ int verbose;
|
||||
+ int pktsize;
|
||||
+} if_info;
|
||||
+
|
||||
+static int send_wol_packet(char *ifname, int s, int verbose, int pktsize);
|
||||
+
|
||||
+static int do_wake(struct interface *ife, void *cookie) {
|
||||
+ if_info *info = (if_info *)cookie;
|
||||
+ send_wol_packet(ife->name, info->s, info->verbose, info->pktsize);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int main(int argc, char *argv[])
|
||||
+{
|
||||
+ char *ifname = NULL;
|
||||
+ int s; /* Raw socket */
|
||||
+ int errflag = 0, verbose = 0, do_version = 0;
|
||||
+ int perm_failure = 0;
|
||||
+ int c, pktsize;
|
||||
+ struct ether_addr eaddr;
|
||||
+ if_info info;
|
||||
+
|
||||
+ 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("%s",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,"%s", brief_usage_msg);
|
||||
+ return 3;
|
||||
+ }
|
||||
+
|
||||
+ if (ifname == NULL) {
|
||||
+ fprintf(stderr, "Specify -i <interface>.\n");
|
||||
+ 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);
|
||||
+
|
||||
+ if (ifname == NULL) {
|
||||
+ info.s = s;
|
||||
+ info.verbose = verbose;
|
||||
+ info.pktsize = pktsize;
|
||||
+
|
||||
+ /* Create a channel to the NET kernel. */
|
||||
+ if ((sockets_open(0)) < 0) {
|
||||
+ perror("socket");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ return for_all_interfaces(do_wake, &info);
|
||||
+ }
|
||||
+
|
||||
+ return send_wol_packet(ifname, s, verbose, pktsize);
|
||||
+}
|
||||
+
|
||||
+/* Send a Wake-On-LAN (WOL) "Magic Packet" to Interface IFNAME using
|
||||
+ Socket S with a packet size PKTSIZE. VERBOSE implies
|
||||
+ verbosity. */
|
||||
+
|
||||
+static int send_wol_packet(char *ifname, int s, int verbose, int pktsize)
|
||||
+{
|
||||
+ int i;
|
||||
+ int one = 1; /* True, for socket options. */
|
||||
+#if defined(PF_PACKET)
|
||||
+ struct sockaddr_ll whereto;
|
||||
+#else
|
||||
+ struct sockaddr whereto; /* who to wake up */
|
||||
+#endif
|
||||
+
|
||||
+ /* 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;
|
||||
+ const char *hwaddr = if_hwaddr.ifr_hwaddr.sa_data;
|
||||
+
|
||||
+ strncpy(if_hwaddr.ifr_name, ifname, IFNAMSIZ);
|
||||
+ if_hwaddr.ifr_name[IFNAMSIZ-1] = '\0';
|
||||
+ 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, IFNAMSIZ);
|
||||
+ ifr.ifr_name[IFNAMSIZ-1] = '\0';
|
||||
+ 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
|
||||
+
|
||||
+ char senderrmsg[IFNAMSIZ+16] = "'";
|
||||
+ strcat(senderrmsg, ifname);
|
||||
+ strcat(senderrmsg, "', sendto");
|
||||
+ if ((i = sendto(s, outpack, pktsize, 0, (struct sockaddr *)&whereto,
|
||||
+ sizeof(whereto))) < 0)
|
||||
+ perror(senderrmsg);
|
||||
+ else if (debug)
|
||||
+ printf("'%s', Sendto worked ! %d.\n", ifname, 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/man/en_US/ether-wake.8 b/man/en_US/ether-wake.8
|
||||
new file mode 100644
|
||||
index 0000000..d0569c2
|
||||
--- /dev/null
|
||||
+++ b/man/en_US/ether-wake.8
|
||||
@@ -0,0 +1,81 @@
|
||||
+.\" Hey, EMACS: -*- nroff -*-
|
||||
+.\" First parameter, NAME, should be all caps
|
||||
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
+.\" other parameters are allowed: see man(7), man(1)
|
||||
+.TH ETHER-WAKE 8 "March 31, 2003" "Scyld"
|
||||
+.\" Please adjust this date whenever revising the manpage.
|
||||
+.\"
|
||||
+.\" Some roff macros, for reference:
|
||||
+.\" .nh disable hyphenation
|
||||
+.\" .hy enable hyphenation
|
||||
+.\" .ad l left justify
|
||||
+.\" .ad b justify to both left and right margins
|
||||
+.\" .nf disable filling
|
||||
+.\" .fi enable filling
|
||||
+.\" .br insert line break
|
||||
+.\" .sp <n> insert n+1 empty lines
|
||||
+.\" for manpage-specific macros, see man(7)
|
||||
+.SH NAME
|
||||
+ether-wake \- A tool to send a Wake-On-LAN "Magic Packet"
|
||||
+.SH SYNOPSIS
|
||||
+.B ether-wake
|
||||
+.RI [ options ] " Host-ID"
|
||||
+.SH DESCRIPTION
|
||||
+This manual page documents the usage of the
|
||||
+.B ether-wake
|
||||
+command.
|
||||
+.PP
|
||||
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||
+.\" \fI<whatever>\fP escape sequences to invoke 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 sending a wake packet to all interfaces.
|
||||
+.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 ether-wake program was written by Donald Becker at Scyld Computing
|
||||
+Corporation for use with the Scyld(\*(Tm) Beowulf System.
|
||||
--
|
||||
2.13.1
|
||||
|
33
0002-Do-not-warn-about-interface-socket-not-binded.patch
Normal file
33
0002-Do-not-warn-about-interface-socket-not-binded.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
From 5b612570220e66ea3197b88b5f9d81e064f9e873 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tchvatal@suse.com>
|
||||
Date: Sat, 17 Jun 2017 22:15:06 +0200
|
||||
Subject: [PATCH 2/7] Do not warn about interface socket not binded
|
||||
|
||||
---
|
||||
lib/interface.c | 10 ++++------
|
||||
1 file changed, 4 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/lib/interface.c b/lib/interface.c
|
||||
index e8ab2b8..94e554b 100644
|
||||
--- a/lib/interface.c
|
||||
+++ b/lib/interface.c
|
||||
@@ -173,12 +173,10 @@ static int if_readconf(void)
|
||||
(as of 2.1.128) */
|
||||
skfd = get_socket_for_af(AF_INET);
|
||||
if (skfd < 0) {
|
||||
- fprintf(stderr, _("warning: no inet socket available: %s\n"),
|
||||
- strerror(errno));
|
||||
- /* Try to soldier on with whatever socket we can get hold of. */
|
||||
- skfd = sockets_open(0);
|
||||
- if (skfd < 0)
|
||||
- return -1;
|
||||
+ /* Try to soldier on with whatever socket we can get hold of. */
|
||||
+ skfd = sockets_open(0);
|
||||
+ if (skfd < 0)
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
ifc.ifc_buf = NULL;
|
||||
--
|
||||
2.13.1
|
||||
|
47
0003-Add-support-for-EiB-in-interface.c.patch
Normal file
47
0003-Add-support-for-EiB-in-interface.c.patch
Normal file
|
@ -0,0 +1,47 @@
|
|||
From 1198aae1c5d434f6e9bc6a0af8060e82eed3a6c9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tchvatal@suse.com>
|
||||
Date: Sat, 17 Jun 2017 22:21:34 +0200
|
||||
Subject: [PATCH 3/7] Add support for EiB in interface.c
|
||||
|
||||
Taken from Fedora package
|
||||
---
|
||||
lib/interface.c | 16 ++++++++--------
|
||||
1 file changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/lib/interface.c b/lib/interface.c
|
||||
index 94e554b..7e326a0 100644
|
||||
--- a/lib/interface.c
|
||||
+++ b/lib/interface.c
|
||||
@@ -864,10 +864,10 @@ void ife_print_long(struct interface *ptr)
|
||||
*/
|
||||
rx = ptr->stats.rx_bytes;
|
||||
short_rx = rx * 10;
|
||||
- if (rx > 1125899906842624ull) {
|
||||
- if (rx > (9223372036854775807ull / 10))
|
||||
- short_rx = rx / 112589990684262ull;
|
||||
- else
|
||||
+ if (rx > 1152921504606846976ull) {
|
||||
+ short_rx = rx / 115292150460684697ull;
|
||||
+ Rext = "EiB";
|
||||
+ } else if (rx > 1125899906842624ull) {
|
||||
short_rx /= 1125899906842624ull;
|
||||
Rext = "PiB";
|
||||
} else if (rx > 1099511627776ull) {
|
||||
@@ -885,10 +885,10 @@ void ife_print_long(struct interface *ptr)
|
||||
}
|
||||
tx = ptr->stats.tx_bytes;
|
||||
short_tx = tx * 10;
|
||||
- if (tx > 1125899906842624ull) {
|
||||
- if (tx > (9223372036854775807ull / 10))
|
||||
- short_tx = tx / 112589990684262ull;
|
||||
- else
|
||||
+ if (tx > 1152921504606846976ull) {
|
||||
+ short_tx = tx / 115292150460684697ull;
|
||||
+ Text = "EiB";
|
||||
+ } else if (tx > 1125899906842624ull) {
|
||||
short_tx /= 1125899906842624ull;
|
||||
Text = "PiB";
|
||||
} else if (tx > 1099511627776ull) {
|
||||
--
|
||||
2.13.1
|
||||
|
28
0004-By-default-do-not-fopen-anything-in-netrom_gr.patch
Normal file
28
0004-By-default-do-not-fopen-anything-in-netrom_gr.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
From 70a4077962be2dc3ea7dc20a3687e9f1c7458ade Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tchvatal@suse.com>
|
||||
Date: Sat, 17 Jun 2017 22:26:14 +0200
|
||||
Subject: [PATCH 4/7] By default do not fopen anything in netrom_gr
|
||||
|
||||
This is SUSE specific patch basically disabling this functionality.
|
||||
---
|
||||
lib/netrom_gr.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/netrom_gr.c b/lib/netrom_gr.c
|
||||
index ec82fe8..eecf148 100644
|
||||
--- a/lib/netrom_gr.c
|
||||
+++ b/lib/netrom_gr.c
|
||||
@@ -32,8 +32,8 @@
|
||||
|
||||
int NETROM_rprint(int options)
|
||||
{
|
||||
- FILE *f1 = fopen(_PATH_PROCNET_NR_NODES, "r");
|
||||
- FILE *f2 = fopen(_PATH_PROCNET_NR_NEIGH, "r");
|
||||
+ FILE *f1 = NULL;
|
||||
+ FILE *f2 = NULL;
|
||||
char buffer[256];
|
||||
int qual, n, w;
|
||||
/*int ext = options & FLAG_EXT;
|
||||
--
|
||||
2.13.1
|
||||
|
221
0005-Add-support-for-interface-rename-in-nameif.patch
Normal file
221
0005-Add-support-for-interface-rename-in-nameif.patch
Normal file
|
@ -0,0 +1,221 @@
|
|||
From 2f92b974dd8f6c0885e060b53254d4470d06235f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tchvatal@suse.com>
|
||||
Date: Sat, 17 Jun 2017 23:07:04 +0200
|
||||
Subject: [PATCH 5/7] Add support for interface rename in nameif
|
||||
|
||||
---
|
||||
man/en_US/nameif.8 | 43 ++++++++++++++++++++++++--------------
|
||||
nameif.c | 61 ++++++++++++++++++++++++++++++++++++++----------------
|
||||
2 files changed, 70 insertions(+), 34 deletions(-)
|
||||
|
||||
diff --git a/man/en_US/nameif.8 b/man/en_US/nameif.8
|
||||
index 195304d..ccea694 100644
|
||||
--- a/man/en_US/nameif.8
|
||||
+++ b/man/en_US/nameif.8
|
||||
@@ -4,26 +4,37 @@ nameif \- name network interfaces based on MAC addresses
|
||||
.SH SYNOPSIS
|
||||
.B "nameif [\-c configfile] [\-s]"
|
||||
.br
|
||||
-.B "nameif [\-c configfile] [\-s] {interface macaddress}"
|
||||
+.B "nameif [\-c configfile] [\-s] [interface macaddress]"
|
||||
+.br
|
||||
+.B "nameif [-c configfile] [-r] [newifname oldifname]"
|
||||
.SH DESCRIPTION
|
||||
-.B nameif
|
||||
-renames network interfaces based on mac addresses. When no arguments are
|
||||
-given
|
||||
+.B nameif
|
||||
+renames network interfaces based on mac addresses or interface names.
|
||||
+When no arguments are given
|
||||
.I /etc/mactab
|
||||
-is read. Each line of it contains an interface name and a Ethernet MAC
|
||||
-address. Comments are allowed starting with #.
|
||||
+is read. Each line of it contains an interface name and a Ethernet MAC
|
||||
+address. Comments are allowed starting with #.
|
||||
Otherwise the interfaces specified on the command line are processed.
|
||||
.I nameif
|
||||
-looks for the interface with the given MAC address and renames it to the
|
||||
-name given.
|
||||
-
|
||||
-When the
|
||||
-.I \-s
|
||||
-argument is given all error messages go to the syslog.
|
||||
-
|
||||
-When the
|
||||
-.I \-c
|
||||
-argument is given with a file name that file is read instead of /etc/mactab.
|
||||
+looks for the interface with the given MAC address or old interface name
|
||||
+and renames it to the name given.
|
||||
+.SH OPTIONS
|
||||
+.TP
|
||||
+.B "[-s|--syslog]"
|
||||
+Log all error messages to syslog.
|
||||
+.TP
|
||||
+.B "[-r|--rename]"
|
||||
+Rename the interface given by
|
||||
+.I oldifname
|
||||
+to the new name
|
||||
+.I newifname
|
||||
+without consulting any macaddress.
|
||||
+.TP
|
||||
+.B "[-c|--config-file configfile]"
|
||||
+Read
|
||||
+.I configfile
|
||||
+instead of
|
||||
+.I /etc/mactab.
|
||||
|
||||
.SH NOTES
|
||||
.I nameif
|
||||
diff --git a/nameif.c b/nameif.c
|
||||
index b280e59..bdc1dfa 100644
|
||||
--- a/nameif.c
|
||||
+++ b/nameif.c
|
||||
@@ -28,6 +28,7 @@
|
||||
const char default_conf[] = "/etc/mactab";
|
||||
const char *fname = default_conf;
|
||||
int use_syslog;
|
||||
+int do_rename;
|
||||
int ctl_sk = -1;
|
||||
|
||||
void err(char *msg)
|
||||
@@ -114,7 +115,8 @@ int getmac(char *name, unsigned char *mac)
|
||||
struct change {
|
||||
struct change *next;
|
||||
int found;
|
||||
- char ifname[IFNAMSIZ+1];
|
||||
+ unsigned char ifname_old[IFNAMSIZ+1];
|
||||
+ unsigned char ifname_new[IFNAMSIZ+1];
|
||||
unsigned char mac[6];
|
||||
};
|
||||
struct change *clist;
|
||||
@@ -128,13 +130,28 @@ struct change *lookupmac(unsigned char *mac)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+struct change *lookupifname(unsigned char *ifname_old)
|
||||
+{
|
||||
+ struct change *ch;
|
||||
+ for (ch = clist;ch;ch = ch->next)
|
||||
+ if (!strcmp(ch->ifname_old, ifname_old))
|
||||
+ return ch;
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
int addchange(char *p, struct change *ch, char *pos)
|
||||
{
|
||||
- if (strchr(ch->ifname, ':'))
|
||||
- warning(_("alias device %s at %s probably has no mac"),
|
||||
- ch->ifname, pos);
|
||||
- if (parsemac(p,ch->mac) < 0)
|
||||
- complain(_("cannot parse MAC `%s' at %s"), p, pos);
|
||||
+ if (do_rename) {
|
||||
+ if (strlen(p)+1>IFNAMSIZ)
|
||||
+ complain(_("interface name `%s' too long"), p);
|
||||
+ strcpy(ch->ifname_old, p);
|
||||
+ } else {
|
||||
+ if (strchr(ch->ifname_new, ':'))
|
||||
+ warning(_("alias device %s at %s probably has no mac"),
|
||||
+ ch->ifname_new, pos);
|
||||
+ if (parsemac(p,ch->mac) < 0)
|
||||
+ complain(_("cannot parse MAC `%s' at %s"), p, pos);
|
||||
+ }
|
||||
ch->next = clist;
|
||||
clist = ch;
|
||||
return 0;
|
||||
@@ -173,8 +190,8 @@ void readconf(void)
|
||||
if (n > IFNAMSIZ-1)
|
||||
complain(_("interface name too long at line %d"), line);
|
||||
ch = xmalloc(sizeof(struct change));
|
||||
- memcpy(ch->ifname, p, n);
|
||||
- ch->ifname[n] = 0;
|
||||
+ memcpy(ch->ifname_new, p, n);
|
||||
+ ch->ifname_new[n] = 0;
|
||||
p += n;
|
||||
p += strspn(p, " \t");
|
||||
n = strspn(p, "0123456789ABCDEFabcdef:");
|
||||
@@ -187,6 +204,7 @@ void readconf(void)
|
||||
|
||||
struct option lopt[] = {
|
||||
{"syslog", 0, NULL, 's' },
|
||||
+ {"rename", 0, NULL, 'r' },
|
||||
{"config-file", 1, NULL, 'c' },
|
||||
{"help", 0, NULL, '?' },
|
||||
{NULL},
|
||||
@@ -194,7 +212,7 @@ struct option lopt[] = {
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
- fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}\n"));
|
||||
+ fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] [-r] {ifname macaddress|oldifname}\n"));
|
||||
exit(E_USAGE);
|
||||
}
|
||||
|
||||
@@ -209,7 +227,7 @@ int main(int ac, char **av)
|
||||
int ret = 0;
|
||||
|
||||
for (;;) {
|
||||
- int c = getopt_long(ac,av,"c:s",lopt,NULL);
|
||||
+ int c = getopt_long(ac,av,"c:sr",lopt,NULL);
|
||||
if (c == -1) break;
|
||||
switch (c) {
|
||||
default:
|
||||
@@ -221,6 +239,9 @@ int main(int ac, char **av)
|
||||
case 's':
|
||||
use_syslog = 1;
|
||||
break;
|
||||
+ case 'r':
|
||||
+ do_rename = 1;
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +256,7 @@ int main(int ac, char **av)
|
||||
usage();
|
||||
if (strlen(av[optind])+1>IFNAMSIZ)
|
||||
complain(_("interface name `%s' too long"), av[optind]);
|
||||
- safe_strncpy(ch->ifname, av[optind], sizeof(ch->ifname));
|
||||
+ safe_strncpy(ch->ifname_new, av[optind], sizeof(ch->ifname_new));
|
||||
optind++;
|
||||
sprintf(pos,_("argument %d"),optind);
|
||||
addchange(av[optind], ch, pos);
|
||||
@@ -266,18 +287,22 @@ int main(int ac, char **av)
|
||||
if (n > IFNAMSIZ-1)
|
||||
complain(_("interface name `%s' too long"), p);
|
||||
|
||||
- if (getmac(p, mac) < 0)
|
||||
- continue;
|
||||
+ if (do_rename) {
|
||||
+ ch = lookupifname(p);
|
||||
+ } else {
|
||||
+ if (getmac(p, mac) < 0)
|
||||
+ continue;
|
||||
|
||||
- ch = lookupmac(mac);
|
||||
+ ch = lookupmac(mac);
|
||||
+ }
|
||||
if (!ch)
|
||||
continue;
|
||||
|
||||
ch->found = 1;
|
||||
- if (strcmp(p, ch->ifname)) {
|
||||
- if (setname(p, ch->ifname) < 0)
|
||||
+ if (strcmp(p, ch->ifname_new)) {
|
||||
+ if (setname(p, ch->ifname_new) < 0)
|
||||
complain(_("cannot change name of %s to %s: %s"),
|
||||
- p, ch->ifname, strerror(errno));
|
||||
+ p, ch->ifname_new, strerror(errno));
|
||||
}
|
||||
}
|
||||
fclose(ifh);
|
||||
@@ -286,7 +311,7 @@ int main(int ac, char **av)
|
||||
struct change *ch = clist;
|
||||
clist = clist->next;
|
||||
if (!ch->found){
|
||||
- warning(_("interface '%s' not found"), ch->ifname);
|
||||
+ complain(_("interface '%s' not found"), ch->ifname_new);
|
||||
ret = 1;
|
||||
}
|
||||
free(ch);
|
||||
--
|
||||
2.13.1
|
||||
|
85
0006-Allow-interface-stacking.patch
Normal file
85
0006-Allow-interface-stacking.patch
Normal file
|
@ -0,0 +1,85 @@
|
|||
From 3e27ced0c24be18dc443f7eb1421c7c3c1755cfe Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tchvatal@suse.com>
|
||||
Date: Sun, 18 Jun 2017 08:54:17 +0200
|
||||
Subject: [PATCH 6/7] Allow interface stacking
|
||||
|
||||
---
|
||||
lib/interface.c | 25 +++++++++++++++----------
|
||||
1 file changed, 15 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/lib/interface.c b/lib/interface.c
|
||||
index 7e326a0..42d86fb 100644
|
||||
--- a/lib/interface.c
|
||||
+++ b/lib/interface.c
|
||||
@@ -208,10 +208,11 @@ out:
|
||||
return err;
|
||||
}
|
||||
|
||||
-static const char *get_name(char *name, const char *p)
|
||||
+static const char *get_name(char **namep, const char *p)
|
||||
{
|
||||
while (isspace(*p))
|
||||
p++;
|
||||
+ char *name = *namep = p;
|
||||
while (*p) {
|
||||
if (isspace(*p))
|
||||
break;
|
||||
@@ -314,9 +315,10 @@ static int get_dev_fields(const char *bp, struct interface *ife)
|
||||
static int if_readlist_proc(const char *target)
|
||||
{
|
||||
FILE *fh;
|
||||
- char buf[512];
|
||||
struct interface *ife;
|
||||
int err;
|
||||
+ char *line = NULL;
|
||||
+ size_t linelen = 0;
|
||||
|
||||
fh = fopen(_PATH_PROCNET_DEV, "r");
|
||||
if (!fh) {
|
||||
@@ -324,10 +326,11 @@ static int if_readlist_proc(const char *target)
|
||||
_PATH_PROCNET_DEV, strerror(errno));
|
||||
return -2;
|
||||
}
|
||||
- if (fgets(buf, sizeof buf, fh))
|
||||
- /* eat line */;
|
||||
- if (fgets(buf, sizeof buf, fh))
|
||||
- /* eat line */;
|
||||
+ if (getline(&line, &linelen, fh) == -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,
|
||||
@@ -352,14 +355,14 @@ static int if_readlist_proc(const char *target)
|
||||
if (!fmt)
|
||||
return -1;
|
||||
#else
|
||||
- procnetdev_vsn = procnetdev_version(buf);
|
||||
+ procnetdev_vsn = procnetdev_version(line);
|
||||
#endif
|
||||
|
||||
err = 0;
|
||||
- while (fgets(buf, sizeof buf, fh)) {
|
||||
+ while (getline(&line, &linelen, fh) != -1) {
|
||||
const char *s;
|
||||
- char name[IFNAMSIZ];
|
||||
- s = get_name(name, buf);
|
||||
+ char *name;
|
||||
+ s = get_name(&name, line);
|
||||
ife = if_cache_add(name);
|
||||
get_dev_fields(s, ife);
|
||||
ife->statistics_valid = 1;
|
||||
@@ -374,6 +377,8 @@ static int if_readlist_proc(const char *target)
|
||||
#if 0
|
||||
free(fmt);
|
||||
#endif
|
||||
+ out:
|
||||
+ free(line);
|
||||
fclose(fh);
|
||||
return err;
|
||||
}
|
||||
--
|
||||
2.13.1
|
||||
|
44
0007-Introduce-T-notrim-option-in-netstat.patch
Normal file
44
0007-Introduce-T-notrim-option-in-netstat.patch
Normal file
|
@ -0,0 +1,44 @@
|
|||
From 0e30aa568f29e1626177458cfe1d33b25c6da7a6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tchvatal@suse.com>
|
||||
Date: Sun, 18 Jun 2017 09:12:33 +0200
|
||||
Subject: [PATCH 7/7] Introduce T notrim option in netstat
|
||||
|
||||
This is the same as wide option but unfortunately SUSE carried
|
||||
for last 10 years patch using the -T option so we need not to regress
|
||||
in script usage.
|
||||
---
|
||||
netstat.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/netstat.c b/netstat.c
|
||||
index fe25e92..401ac3b 100644
|
||||
--- a/netstat.c
|
||||
+++ b/netstat.c
|
||||
@@ -2043,6 +2043,7 @@ int main
|
||||
{"fib", 0, 0, 'F'},
|
||||
{"groups", 0, 0, 'g'},
|
||||
{"context", 0, 0, 'Z'},
|
||||
+ {"notrim", 0, 0, 'T'},
|
||||
{NULL, 0, 0, 0}
|
||||
};
|
||||
|
||||
@@ -2054,7 +2055,7 @@ int main
|
||||
getroute_init(); /* Set up AF routing support */
|
||||
|
||||
afname[0] = '\0';
|
||||
- while ((i = getopt_long(argc, argv, "A:CFMacdeghilnNoprsStuUvVWw2fx64?Z", longopts, &lop)) != EOF)
|
||||
+ while ((i = getopt_long(argc, argv, "A:CFMacdeghilnNoprsStuUvVWw2fx64?ZT", longopts, &lop)) != EOF)
|
||||
switch (i) {
|
||||
case -1:
|
||||
break;
|
||||
@@ -2098,6 +2099,7 @@ int main
|
||||
case 'i':
|
||||
flag_int++;
|
||||
break;
|
||||
+ case 'T':
|
||||
case 'W':
|
||||
flag_wide++;
|
||||
break;
|
||||
--
|
||||
2.13.1
|
||||
|
14
_service
Normal file
14
_service
Normal file
|
@ -0,0 +1,14 @@
|
|||
<services>
|
||||
<service mode="disabled" name="tar_scm">
|
||||
<param name="url">git://git.code.sf.net/p/net-tools/code</param>
|
||||
<param name="scm">git</param>
|
||||
<param name="changesgenerate">enable</param>
|
||||
<param name="filename">net-tools</param>
|
||||
<param name="versionformat">2.0+git%cd.%h</param>
|
||||
</service>
|
||||
<service mode="disabled" name="recompress">
|
||||
<param name="file">*.tar</param>
|
||||
<param name="compression">xz</param>
|
||||
</service>
|
||||
<service mode="disabled" name="set_version"/>
|
||||
</services>
|
81
ether-wake.8
81
ether-wake.8
|
@ -1,81 +0,0 @@
|
|||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH ETHER-WAKE 8 "March 31, 2003" "Scyld"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
.\" .nh disable hyphenation
|
||||
.\" .hy enable hyphenation
|
||||
.\" .ad l left justify
|
||||
.\" .ad b justify to both left and right margins
|
||||
.\" .nf disable filling
|
||||
.\" .fi enable filling
|
||||
.\" .br insert line break
|
||||
.\" .sp <n> insert n+1 empty lines
|
||||
.\" for manpage-specific macros, see man(7)
|
||||
.SH NAME
|
||||
ether-wake \- A tool to send a Wake-On-LAN "Magic Packet"
|
||||
.SH SYNOPSIS
|
||||
.B ether-wake
|
||||
.RI [ options ] " Host-ID"
|
||||
.SH DESCRIPTION
|
||||
This manual page documents the usage of the
|
||||
.B ether-wake
|
||||
command.
|
||||
.PP
|
||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||
.\" \fI<whatever>\fP escape sequences to invoke 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 ether-wake program was written by Donald Becker at Scyld Computing
|
||||
Corporation for use with the Scyld(\*(Tm) Beowulf System.
|
397
ether-wake.c
397
ether-wake.c
|
@ -1,397 +0,0 @@
|
|||
/* ether-wake.c: Send a magic packet to wake up sleeping machines. */
|
||||
|
||||
static char version_msg[] =
|
||||
"ether-wake.c: v1.09 11/12/2003 Donald Becker, http://www.scyld.com/";
|
||||
static char brief_usage_msg[] =
|
||||
"usage: ether-wake -i <ifname> [-p aa:bb:cc:dd[:ee:ff]] 00:11:22:33:44:55\n"
|
||||
" Use '-u' to see the complete set of options.\n";
|
||||
static char usage_msg[] =
|
||||
"usage: ether-wake -i <ifname> [-p aa:bb:cc:dd[:ee:ff]] 00:11:22:33:44:55\n"
|
||||
"\n"
|
||||
" This program generates and transmits a Wake-On-LAN (WOL)\n"
|
||||
" \"Magic Packet\", used for restarting machines that have been\n"
|
||||
" soft-powered-down (ACPI D3-warm state).\n"
|
||||
" It currently generates the standard AMD Magic Packet format, with\n"
|
||||
" an optional password appended.\n"
|
||||
"\n"
|
||||
" The single required parameter is the Ethernet MAC (station) address\n"
|
||||
" of the machine to wake or a host ID with known NSS 'ethers' entry.\n"
|
||||
" The MAC address may be found with the 'arp' program while the target\n"
|
||||
" machine is awake.\n"
|
||||
"\n"
|
||||
" Options:\n"
|
||||
" -b Send wake-up packet to the broadcast address.\n"
|
||||
" -D Increase the debug level.\n"
|
||||
" -i ifname Use interface IFNAME.\n"
|
||||
" -p <pw> Append the four or six byte password PW to the packet.\n"
|
||||
" A password is only required for a few adapter types.\n"
|
||||
" The password may be specified in ethernet hex format\n"
|
||||
" or dotted decimal (Internet address)\n"
|
||||
" -p 00:22:44:66:88:aa\n"
|
||||
" -p 192.168.1.1\n";
|
||||
|
||||
/*
|
||||
This program generates and transmits a Wake-On-LAN (WOL) "Magic Packet",
|
||||
used for restarting machines that have been soft-powered-down
|
||||
(ACPI D3-warm state). It currently generates the standard AMD Magic Packet
|
||||
format, with an optional password appended.
|
||||
|
||||
This software may be used and distributed according to the terms
|
||||
of the GNU Public License, incorporated herein by reference.
|
||||
Contact the author for use under other terms.
|
||||
|
||||
This source file was originally part of the network tricks package, and
|
||||
is now distributed to support the Scyld Beowulf system.
|
||||
Copyright 1999-2003 Donald Becker and Scyld Computing Corporation.
|
||||
|
||||
The author may be reached as becker@scyld, or C/O
|
||||
Scyld Computing Corporation
|
||||
914 Bay Ridge Road, Suite 220
|
||||
Annapolis MD 21403
|
||||
|
||||
Notes:
|
||||
On some systems dropping root capability allows the process to be
|
||||
dumped, traced or debugged.
|
||||
If someone traces this program, they get control of a raw socket.
|
||||
Linux handles this safely, but beware when porting this program.
|
||||
|
||||
An alternative to needing 'root' is using a UDP broadcast socket, however
|
||||
doing so only works with adapters configured for unicast+broadcast Rx
|
||||
filter. That configuration consumes more power.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#if 0 /* Only exists on some versions. */
|
||||
#include <ioctls.h>
|
||||
#endif
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/if.h>
|
||||
|
||||
#include <features.h>
|
||||
#if __GLIBC__ >= 2 && __GLIBC_MINOR >= 1
|
||||
#include <netpacket/packet.h>
|
||||
#include <net/ethernet.h>
|
||||
#else
|
||||
#include <asm/types.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <linux/if_ether.h>
|
||||
#endif
|
||||
#include <netdb.h>
|
||||
#include <netinet/ether.h>
|
||||
|
||||
/* Grrr, no consistency between include versions.
|
||||
Enable this if setsockopt() isn't declared with your library. */
|
||||
#if 0
|
||||
extern int setsockopt __P ((int __fd, int __level, int __optname,
|
||||
__ptr_t __optval, int __optlen));
|
||||
#else /* New, correct head files. */
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
u_char outpack[1000];
|
||||
int outpack_sz = 0;
|
||||
int debug = 0;
|
||||
u_char wol_passwd[6];
|
||||
int wol_passwd_sz = 0;
|
||||
|
||||
static int opt_no_src_addr = 0, opt_broadcast = 0;
|
||||
|
||||
static int get_dest_addr(const char *arg, struct ether_addr *eaddr);
|
||||
static int get_fill(unsigned char *pkt, struct ether_addr *eaddr);
|
||||
static int get_wol_pw(const char *optarg);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char *ifname = NULL;
|
||||
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 (ifname == NULL) {
|
||||
fprintf(stderr, "Specify -i <interface>.\n");
|
||||
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:
|
||||
*/
|
307
manpages.diff
307
manpages.diff
|
@ -1,307 +0,0 @@
|
|||
diff -ur net-tools-1.60/man/de_DE/hostname.1 net-tools-1.60.mmj/man/de_DE/hostname.1
|
||||
--- net-tools-1.60/man/de_DE/hostname.1 Mon Mar 15 21:31:16 1999
|
||||
+++ net-tools-1.60.mmj/man/de_DE/hostname.1 Wed Feb 6 12:11:35 2002
|
||||
@@ -12,10 +12,6 @@
|
||||
.br
|
||||
dnsdomainname \- den DNS Domainnamen des Systems anzeigen
|
||||
.br
|
||||
-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
|
||||
@@ -33,8 +29,6 @@
|
||||
.RB [ \-s ]
|
||||
.RB [ \-\-short ]
|
||||
.RB [ \-y ]
|
||||
-.RB [ \-\-yp ]
|
||||
-.RB [ \-\-nis ]
|
||||
.RB [ \-n ]
|
||||
.RB [ \-\-node ]
|
||||
|
||||
@@ -70,19 +64,12 @@
|
||||
.PP
|
||||
.B dnsdomainname
|
||||
.RB [ \-v ]
|
||||
-.br
|
||||
-.B nisdomainname
|
||||
-.RB [ \-v ]
|
||||
-.br
|
||||
-.B ypdomainname
|
||||
-.RB [ \-v ]
|
||||
|
||||
.SH BESCHREIBUNG
|
||||
.B Hostname
|
||||
ist das Programm, das zum Anzeigen oder setzen des aktuellen Host-, Domain-,
|
||||
oder Knotennamens des Systems verwendet wird. Diese Namen werden von vielen
|
||||
der Netzwerksprogrammen zur Identifikation der Maschine verwendet.
|
||||
-Au\(sserdem wird der Domainname von NIS/YP verwendet.
|
||||
|
||||
.SS "NAMEN AUSLESEN"
|
||||
Wenn ohne Argumente augerufen, zeigen die Programme den aktuellen Namen an:
|
||||
@@ -94,11 +81,10 @@
|
||||
Funktion ermittelt wird, an.
|
||||
|
||||
.LP
|
||||
-.B "domainname, nisdomainname, ypdomainname"
|
||||
+.B "domainname"
|
||||
zeigen den Namen des Systems, wie er von der
|
||||
.BR getdomainname (2)
|
||||
-Funktion ermittelt wird, an. Dieser Name wird auch der YP/NIS Domainname
|
||||
-des Systems genannt.
|
||||
+Funktion ermittelt wird, an.
|
||||
|
||||
.LP
|
||||
.B nodename
|
||||
@@ -212,11 +198,6 @@
|
||||
.TP
|
||||
.I "\-v, \-\-verbose"
|
||||
Ausf\(:uhrlichere Ausgaben.
|
||||
-.TP
|
||||
-.I "\-y, \-\-yp, \-\-nis"
|
||||
-Den NIS-Domainnamen anzeigen. Wenn ein Argument oder die
|
||||
-.B \-\-file name
|
||||
-Option gegeben wird, dann kann Root auch eine neue NIS-Domain setzen.
|
||||
.SH DATEIEN
|
||||
.B /etc/hosts
|
||||
.SH AUTOREN
|
||||
diff -ur net-tools-1.60/man/en_US/hostname.1 net-tools-1.60.mmj/man/en_US/hostname.1
|
||||
--- net-tools-1.60/man/en_US/hostname.1 Sat Feb 27 13:11:14 1999
|
||||
+++ net-tools-1.60.mmj/man/en_US/hostname.1 Wed Feb 6 12:10:42 2002
|
||||
@@ -7,10 +7,6 @@
|
||||
.br
|
||||
dnsdomainname \- show the system's DNS domain name
|
||||
.br
|
||||
-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
|
||||
@@ -28,8 +24,6 @@
|
||||
.RB [ \-s ]
|
||||
.RB [ \-\-short ]
|
||||
.RB [ \-y ]
|
||||
-.RB [ \-\-yp ]
|
||||
-.RB [ \-\-nis ]
|
||||
.RB [ \-n ]
|
||||
.RB [ \-\-node ]
|
||||
|
||||
@@ -65,12 +59,6 @@
|
||||
.PP
|
||||
.B dnsdomainname
|
||||
.RB [ \-v ]
|
||||
-.br
|
||||
-.B nisdomainname
|
||||
-.RB [ \-v ]
|
||||
-.br
|
||||
-.B ypdomainname
|
||||
-.RB [ \-v ]
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B Hostname
|
||||
@@ -90,12 +78,6 @@
|
||||
function.
|
||||
|
||||
.LP
|
||||
-.B "domainname, nisdomainname, ypdomainname"
|
||||
-will print the name of the system as returned by the
|
||||
-.BR getdomainname (2)
|
||||
-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)
|
||||
@@ -197,11 +179,6 @@
|
||||
.TP
|
||||
.I "\-v, \-\-verbose"
|
||||
Be verbose and tell what's going on.
|
||||
-.TP
|
||||
-.I "\-y, \-\-yp, \-\-nis"
|
||||
-Display the NIS domain name. If a parameter is given (or
|
||||
-.B \-\-file name
|
||||
-) then root can also set a new NIS domain.
|
||||
.SH FILES
|
||||
.B /etc/hosts
|
||||
.SH AUTHOR
|
||||
diff -ur net-tools-1.60/man/fr_FR/hostname.1 net-tools-1.60.mmj/man/fr_FR/hostname.1
|
||||
--- net-tools-1.60/man/fr_FR/hostname.1 Sun Apr 18 21:23:46 1999
|
||||
+++ net-tools-1.60.mmj/man/fr_FR/hostname.1 Wed Feb 6 12:34:23 2002
|
||||
@@ -2,14 +2,8 @@
|
||||
.SH NOM
|
||||
hostname \- affiche ou définit le nom d'hôte du système
|
||||
.br
|
||||
-domainname \- affiche le nom de domaine NIS/YP du système
|
||||
-.br
|
||||
dnsdomainname \- affiche le nom de domaine du système
|
||||
.br
|
||||
-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
|
||||
@@ -26,9 +20,6 @@
|
||||
.RB [ \-\-long ]
|
||||
.RB [ \-s ]
|
||||
.RB [ \-\-short ]
|
||||
-.RB [ \-y ]
|
||||
-.RB [ \-\-yp ]
|
||||
-.RB [ \-\-nis ]
|
||||
.RB [ \-n ]
|
||||
.RB [ \-\-node ]
|
||||
|
||||
@@ -64,19 +55,12 @@
|
||||
.PP
|
||||
.B dnsdomainname
|
||||
.RB [ \-v ]
|
||||
-.br
|
||||
-.B nisdomainname
|
||||
-.RB [ \-v ]
|
||||
-.br
|
||||
-.B ypdomainname
|
||||
-.RB [ \-v ]
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B Hostname
|
||||
est le programme utilisé soit pour définir le nom d'hôte, soit
|
||||
pour visualiser le nom d'hôte ou de domaine du système. Ce nom est
|
||||
-utilisé par différents programmes réseaux pour identifier la machine. Le
|
||||
-nom de domaine est également utilisé par les NIS/YP.
|
||||
+utilisé par différents programmes réseaux pour identifier la machine.
|
||||
|
||||
.SS "OBTENTION DU NOM"
|
||||
Appelé sans argument, le programme affiche les noms courants:
|
||||
@@ -147,8 +131,6 @@
|
||||
(habituellement dans
|
||||
.IR /etc/host.conf )
|
||||
. Si le fichier 'hosts' est analysé avant d'interroger le DNS ou
|
||||
-NIS) vous pouvez le changer dans le fichier
|
||||
-.IR /etc/hosts .
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
@@ -157,9 +139,6 @@
|
||||
.TP
|
||||
.I "\-d, \-\-domain"
|
||||
Affiche le nom du domaine DNS. Ne pas utiliser la commande
|
||||
-.B domainname
|
||||
-pour obtenir le nom de domaine DNS car vous obtiendrez en réalité le
|
||||
-nom de domaine NIS. Utilisez plutôt la commande
|
||||
.B dnsdomainname
|
||||
.
|
||||
.TP
|
||||
@@ -195,11 +174,7 @@
|
||||
.TP
|
||||
.I "\-v, \-\-verbose"
|
||||
Mode verbeux.
|
||||
-.TP
|
||||
-.I "\-y, \-\-yp, \-\-nis"
|
||||
-Affiche le nom de domaine NIS. Si un paramètre est fourni (ou
|
||||
-.B \-\-file nom_fichier
|
||||
-) le super-utilisateur peut également définir un nouveau nom de domaine NIS.
|
||||
+
|
||||
.SH FICHIERS
|
||||
.B /etc/hosts
|
||||
.SH AUTEURS
|
||||
diff -ur net-tools-1.60/man/pt_BR/hostname.1 net-tools-1.60.mmj/man/pt_BR/hostname.1
|
||||
--- net-tools-1.60/man/pt_BR/hostname.1 Sat Jan 9 16:55:57 1999
|
||||
+++ net-tools-1.60.mmj/man/pt_BR/hostname.1 Wed Feb 6 12:22:46 2002
|
||||
@@ -2,14 +2,8 @@
|
||||
|
||||
.SH NOME
|
||||
hostname \- mostra ou configura o nome da máquina
|
||||
-.BR
|
||||
-domainname \- mostra ou configura o nome do domínio NIS/YP
|
||||
-.BR
|
||||
+.br
|
||||
dnsdomainname \- mostra o nome do domínio DNS
|
||||
-.BR
|
||||
-nisdomainname \- mostra ou configura o nome do domínio NIS/YP
|
||||
-.BR
|
||||
-ypdomainname \- mostra ou configura o nome do domínio NIS/YP
|
||||
|
||||
.SH SINOPSE
|
||||
.B hostname
|
||||
@@ -26,8 +20,6 @@
|
||||
.RB [ \-s ]
|
||||
.RB [ \-\-short ]
|
||||
.RB [ \-y ]
|
||||
-.RB [ \-\-yp ]
|
||||
-.RB [ \-\-nis ]
|
||||
|
||||
.PP
|
||||
.B hostname
|
||||
@@ -37,13 +29,6 @@
|
||||
.RB [ máquina ]
|
||||
|
||||
.PP
|
||||
-.B domainname
|
||||
-.RB [ \-v ]
|
||||
-.RB [ \-F\ filename ]
|
||||
-.RB [ \-\-file\ nome_arquivo ]
|
||||
-.RB [ nome ]
|
||||
-
|
||||
-.PP
|
||||
.B hostname
|
||||
.RB [ \-v ]
|
||||
.RB [ \-h ]
|
||||
@@ -54,19 +39,12 @@
|
||||
.PP
|
||||
.B dnsdomainname
|
||||
.RB [ \-v ]
|
||||
-.LP
|
||||
-.B nisdomainname
|
||||
-.RB [ \-v ]
|
||||
-.LP
|
||||
-.B ypdomainname
|
||||
-.RB [ \-v ]
|
||||
|
||||
.SH DESCRIÇÃO
|
||||
.B hostname
|
||||
é o programa usado para configurar ou mostrar o nome corrente da máquina
|
||||
ou o domínio do sistema. Este nome é usado por muitos dos programas de
|
||||
-rede para identificar a máquina. O nome do domínio também é usado pelo
|
||||
-NIS/YP.
|
||||
+rede para identificar a máquina.
|
||||
|
||||
.SS "OBTER NOME"
|
||||
Quando chamado sem argumentos o programa mostra os nomes correntes:
|
||||
@@ -78,7 +56,7 @@
|
||||
|
||||
|
||||
.LP
|
||||
-.B "domainname, nisdomainname, ypdomainname"
|
||||
+.B "domainname"
|
||||
mostrará o nome do sistema conforme retornado pela função
|
||||
.BR getdomainname (2).
|
||||
Isto também é conhecido como o nome de domínio YP/NIS do sistema.
|
||||
@@ -89,11 +67,6 @@
|
||||
O FQDN do sistema é retornado pelo comando
|
||||
.BR "hostname \-\-fqdn" .
|
||||
|
||||
-.SS "CONFIGURAR NOME"
|
||||
-Quando chamado com um argumento ou com a opção
|
||||
-.B \-\-file
|
||||
-, o comando configura o nome da máquina ou do domínio NIS/YP.
|
||||
-
|
||||
.LP
|
||||
Note que somente o super usuário pode mudar os nomes.
|
||||
|
||||
@@ -172,11 +145,6 @@
|
||||
.TP
|
||||
.I "\-v, \-\-verbose"
|
||||
Mostra uma saída detalhada do que está acontecendo.
|
||||
-.TP
|
||||
-.I "\-y, \-\-yp, \-\-nis"
|
||||
-Mostra o nome do domínio NIS. Se um parâmetro for especificado (ou
|
||||
-.B \-\-file arquivo
|
||||
-) então o root também pode configurar um novo domínio NIS.
|
||||
.SH ARQUIVOS
|
||||
.B /etc/hosts
|
||||
.SH AUTOR
|
|
@ -1,202 +0,0 @@
|
|||
--- man/en_US/nameif.8
|
||||
+++ man/en_US/nameif.8
|
||||
@@ -4,26 +4,37 @@
|
||||
.SH SYNOPSIS
|
||||
.B "nameif [-c configfile] [-s]"
|
||||
.br
|
||||
-.B "nameif [-c configfile] [-s] {interface macaddress}"
|
||||
+.B "nameif [-c configfile] [-s] [interface macaddress]"
|
||||
+.br
|
||||
+.B "nameif [-c configfile] [-r] [newifname oldifname]"
|
||||
.SH DESCRIPTION
|
||||
.B nameif
|
||||
-renames network interfaces based on mac addresses. When no arguments are
|
||||
-given
|
||||
+renames network interfaces based on mac addresses or interface names.
|
||||
+When no arguments are given
|
||||
.I /etc/mactab
|
||||
is read. Each line of it contains an interface name and a Ethernet MAC
|
||||
address. Comments are allowed starting with #.
|
||||
Otherwise the interfaces specified on the command line are processed.
|
||||
.I nameif
|
||||
-looks for the interface with the given MAC address and renames it to the
|
||||
-name given.
|
||||
-
|
||||
-When the
|
||||
-.I -s
|
||||
-argument is given all error messages go to the syslog.
|
||||
-
|
||||
-When the
|
||||
-.I -c
|
||||
-argument is given with a file name that file is read instead of /etc/mactab.
|
||||
+looks for the interface with the given MAC address or old interface name
|
||||
+and renames it to the name given.
|
||||
+.SH OPTIONS
|
||||
+.TP
|
||||
+.B "[-s|--syslog]"
|
||||
+Log all error messages to syslog.
|
||||
+.TP
|
||||
+.B "[-r|--rename]"
|
||||
+Rename the interface given by
|
||||
+.I oldifname
|
||||
+to the new name
|
||||
+.I newifname
|
||||
+without consulting any macaddress.
|
||||
+.TP
|
||||
+.B "[-c|--config-file configfile]"
|
||||
+Read
|
||||
+.I configfile
|
||||
+instead of
|
||||
+.I /etc/mactab.
|
||||
|
||||
.SH NOTES
|
||||
.I nameif
|
||||
--- nameif.c
|
||||
+++ nameif.c
|
||||
@@ -26,6 +26,7 @@
|
||||
const char default_conf[] = "/etc/mactab";
|
||||
const char *fname = default_conf;
|
||||
int use_syslog;
|
||||
+int do_rename;
|
||||
int ctl_sk = -1;
|
||||
|
||||
void err(char *msg)
|
||||
@@ -118,7 +119,8 @@
|
||||
|
||||
struct change {
|
||||
struct change *next,**pprev;
|
||||
- char ifname[IFNAMSIZ+1];
|
||||
+ char ifname_old[IFNAMSIZ+1];
|
||||
+ char ifname_new[IFNAMSIZ+1];
|
||||
unsigned char mac[6];
|
||||
};
|
||||
struct change *clist;
|
||||
@@ -132,13 +134,28 @@
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+struct change *lookupifname(unsigned char *ifname_old)
|
||||
+{
|
||||
+ struct change *ch;
|
||||
+ for (ch = clist;ch;ch = ch->next)
|
||||
+ if (!strcmp(ch->ifname_old, ifname_old))
|
||||
+ return ch;
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
int addchange(char *p, struct change *ch, char *pos)
|
||||
{
|
||||
- if (strchr(ch->ifname, ':'))
|
||||
- warning(_("alias device %s at %s probably has no mac"),
|
||||
- ch->ifname, pos);
|
||||
- if (parsemac(p,ch->mac) < 0)
|
||||
- complain(_("cannot parse MAC `%s' at %s"), p, pos);
|
||||
+ if (do_rename) {
|
||||
+ if (strlen(p)+1>IFNAMSIZ)
|
||||
+ complain(_("interface name `%s' too long"), p);
|
||||
+ strcpy(ch->ifname_old, p);
|
||||
+ } else {
|
||||
+ if (strchr(ch->ifname_new, ':'))
|
||||
+ warning(_("alias device %s at %s probably has no mac"),
|
||||
+ ch->ifname_new, 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;
|
||||
@@ -179,8 +196,8 @@
|
||||
n = strcspn(p, " \t");
|
||||
if (n > IFNAMSIZ)
|
||||
complain(_("interface name too long at line %d"), line);
|
||||
- memcpy(ch->ifname, p, n);
|
||||
- ch->ifname[n] = 0;
|
||||
+ memcpy(ch->ifname_new, p, n);
|
||||
+ ch->ifname_new[n] = 0;
|
||||
p += n;
|
||||
p += strspn(p, " \t");
|
||||
n = strspn(p, "0123456789ABCDEFabcdef:");
|
||||
@@ -193,6 +210,7 @@
|
||||
|
||||
struct option lopt[] = {
|
||||
{"syslog", 0, NULL, 's' },
|
||||
+ {"rename", 0, NULL, 'r' },
|
||||
{"config-file", 1, NULL, 'c' },
|
||||
{"help", 0, NULL, '?' },
|
||||
{NULL},
|
||||
@@ -200,7 +218,7 @@
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
- fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}"));
|
||||
+ fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] [-r] {ifname macaddress|oldifname}\n"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -214,7 +232,7 @@
|
||||
size_t linel = 0;
|
||||
|
||||
for (;;) {
|
||||
- int c = getopt_long(ac,av,"c:s",lopt,NULL);
|
||||
+ int c = getopt_long(ac,av,"c:sr",lopt,NULL);
|
||||
if (c == -1) break;
|
||||
switch (c) {
|
||||
default:
|
||||
@@ -226,6 +244,9 @@
|
||||
case 's':
|
||||
use_syslog = 1;
|
||||
break;
|
||||
+ case 'r':
|
||||
+ do_rename = 1;
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +261,7 @@
|
||||
usage();
|
||||
if (strlen(av[optind])+1>IFNAMSIZ)
|
||||
complain(_("interface name `%s' too long"), av[optind]);
|
||||
- strcpy(ch->ifname, av[optind]);
|
||||
+ strcpy(ch->ifname_new, av[optind]);
|
||||
optind++;
|
||||
sprintf(pos,_("argument %d"),optind);
|
||||
addchange(av[optind], ch, pos);
|
||||
@@ -271,18 +292,22 @@
|
||||
if (n > IFNAMSIZ-1)
|
||||
complain(_("interface name `%s' too long"), p);
|
||||
|
||||
- if (getmac(p, mac) < 0)
|
||||
- continue;
|
||||
+ if (do_rename) {
|
||||
+ ch = lookupifname(p);
|
||||
+ } else {
|
||||
+ if (getmac(p, mac) < 0)
|
||||
+ continue;
|
||||
|
||||
- ch = lookupmac(mac);
|
||||
+ ch = lookupmac(mac);
|
||||
+ }
|
||||
if (!ch)
|
||||
continue;
|
||||
-
|
||||
+
|
||||
*ch->pprev = ch->next;
|
||||
- if (strcmp(p, ch->ifname)) {
|
||||
- if (setname(p, ch->ifname) < 0)
|
||||
+ if (strcmp(p, ch->ifname_new)) {
|
||||
+ if (setname(p, ch->ifname_new) < 0)
|
||||
complain(_("cannot change name of %s to %s: %s"),
|
||||
- p, ch->ifname, strerror(errno));
|
||||
+ p, ch->ifname_new, strerror(errno));
|
||||
}
|
||||
free(ch);
|
||||
}
|
||||
@@ -291,7 +316,7 @@
|
||||
while (clist) {
|
||||
struct change *ch = clist;
|
||||
clist = clist->next;
|
||||
- warning(_("interface '%s' not found"), ch->ifname);
|
||||
+ complain(_("interface '%s' not found"), ch->ifname_new);
|
||||
free(ch);
|
||||
}
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
--- net-tools-1.60/arp.c 2001-04-08 10:05:05.000000000 -0700
|
||||
+++ net-tools-1.60.new/arp.c 2006-01-31 13:10:01.479716750 -0800
|
||||
@@ -100,7 +100,7 @@ static int arp_del(char **args)
|
||||
{
|
||||
char host[128];
|
||||
struct arpreq req;
|
||||
- struct sockaddr sa;
|
||||
+ struct sockaddr_storage ss;
|
||||
int flags = 0;
|
||||
int err;
|
||||
|
||||
@@ -112,12 +112,12 @@ static int arp_del(char **args)
|
||||
return (-1);
|
||||
}
|
||||
safe_strncpy(host, *args, (sizeof host));
|
||||
- if (ap->input(0, host, &sa) < 0) {
|
||||
+ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) {
|
||||
ap->herror(host);
|
||||
return (-1);
|
||||
}
|
||||
/* If a host has more than one address, use the correct one! */
|
||||
- memcpy((char *) &req.arp_pa, (char *) &sa, sizeof(struct sockaddr));
|
||||
+ memcpy((char *) &req.arp_pa, (char *) &ss, sizeof(struct sockaddr));
|
||||
|
||||
if (hw_set)
|
||||
req.arp_ha.sa_family = hw->type;
|
||||
@@ -177,11 +177,11 @@ static int arp_del(char **args)
|
||||
usage();
|
||||
if (strcmp(*args, "255.255.255.255") != 0) {
|
||||
strcpy(host, *args);
|
||||
- if (ap->input(0, host, &sa) < 0) {
|
||||
+ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) {
|
||||
ap->herror(host);
|
||||
return (-1);
|
||||
}
|
||||
- memcpy((char *) &req.arp_netmask, (char *) &sa,
|
||||
+ memcpy((char *) &req.arp_netmask, (char *) &ss,
|
||||
sizeof(struct sockaddr));
|
||||
req.arp_flags |= ATF_NETMASK;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ static int arp_set(char **args)
|
||||
{
|
||||
char host[128];
|
||||
struct arpreq req;
|
||||
- struct sockaddr sa;
|
||||
+ struct sockaddr_storage ss;
|
||||
int flags;
|
||||
|
||||
memset((char *) &req, 0, sizeof(req));
|
||||
@@ -271,12 +271,12 @@ static int arp_set(char **args)
|
||||
return (-1);
|
||||
}
|
||||
safe_strncpy(host, *args++, (sizeof host));
|
||||
- if (ap->input(0, host, &sa) < 0) {
|
||||
+ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) {
|
||||
ap->herror(host);
|
||||
return (-1);
|
||||
}
|
||||
/* If a host has more than one address, use the correct one! */
|
||||
- memcpy((char *) &req.arp_pa, (char *) &sa, sizeof(struct sockaddr));
|
||||
+ memcpy((char *) &req.arp_pa, (char *) &ss, sizeof(struct sockaddr));
|
||||
|
||||
/* Fetch the hardware address. */
|
||||
if (*args == NULL) {
|
||||
@@ -346,11 +346,11 @@ static int arp_set(char **args)
|
||||
usage();
|
||||
if (strcmp(*args, "255.255.255.255") != 0) {
|
||||
strcpy(host, *args);
|
||||
- if (ap->input(0, host, &sa) < 0) {
|
||||
+ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) {
|
||||
ap->herror(host);
|
||||
return (-1);
|
||||
}
|
||||
- memcpy((char *) &req.arp_netmask, (char *) &sa,
|
||||
+ memcpy((char *) &req.arp_netmask, (char *) &ss,
|
||||
sizeof(struct sockaddr));
|
||||
flags |= ATF_NETMASK;
|
||||
}
|
||||
@@ -519,7 +519,7 @@ static void arp_disp(char *name, char *i
|
||||
static int arp_show(char *name)
|
||||
{
|
||||
char host[100];
|
||||
- struct sockaddr sa;
|
||||
+ struct sockaddr_storage ss;
|
||||
char ip[100];
|
||||
char hwa[100];
|
||||
char mask[100];
|
||||
@@ -535,11 +535,11 @@ static int arp_show(char *name)
|
||||
if (name != NULL) {
|
||||
/* Resolve the host name. */
|
||||
safe_strncpy(host, name, (sizeof host));
|
||||
- if (ap->input(0, host, &sa) < 0) {
|
||||
+ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) {
|
||||
ap->herror(host);
|
||||
return (-1);
|
||||
}
|
||||
- safe_strncpy(host, ap->sprint(&sa, 1), sizeof(host));
|
||||
+ safe_strncpy(host, ap->sprint((struct sockaddr*)&ss, 1), sizeof(host));
|
||||
}
|
||||
/* Open the PROCps kernel table. */
|
||||
if ((fp = fopen(_PATH_PROCNET_ARP, "r")) == NULL) {
|
||||
@@ -575,10 +575,11 @@ static int arp_show(char *name)
|
||||
if (opt_n)
|
||||
hostname = "?";
|
||||
else {
|
||||
- if (ap->input(0, ip, &sa) < 0)
|
||||
+ if (ap->input(0, ip, (struct sockaddr*)&ss) < 0)
|
||||
hostname = ip;
|
||||
else
|
||||
- hostname = ap->sprint(&sa, opt_n | 0x8000);
|
||||
+ hostname = ap->sprint((struct sockaddr*)&ss,
|
||||
+ opt_n | 0x8000);
|
||||
if (strcmp(hostname, ip) == 0)
|
||||
hostname = "?";
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
--- net-tools-1.60/hostname.c
|
||||
+++ net-tools-1.60/hostname.c
|
||||
@@ -32,6 +32,7 @@
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
+#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
@@ -98,6 +99,7 @@
|
||||
fprintf(stderr, _("%s: name too long\n"), program_name);
|
||||
break;
|
||||
default:
|
||||
+ break;
|
||||
}
|
||||
exit(1);
|
||||
};
|
||||
@@ -117,6 +119,7 @@
|
||||
fprintf(stderr, _("%s: name too long\n"), program_name);
|
||||
break;
|
||||
default:
|
||||
+ break;
|
||||
}
|
||||
exit(1);
|
||||
};
|
||||
@@ -174,6 +177,7 @@
|
||||
printf("%s\n", hp->h_name);
|
||||
break;
|
||||
default:
|
||||
+ return;
|
||||
}
|
||||
}
|
||||
|
||||
--- net-tools-1.60/lib/inet_sr.c
|
||||
+++ net-tools-1.60/lib/inet_sr.c
|
||||
@@ -105,6 +105,7 @@
|
||||
case 2:
|
||||
isnet = 0; break;
|
||||
default:
|
||||
+ break;
|
||||
}
|
||||
|
||||
/* Fill in the other fields. */
|
|
@ -1,298 +0,0 @@
|
|||
# net-tools-1.60-cont-buff.patch
|
||||
# This Patch fixes the -ic option from netstat
|
||||
# without destroying the proc_read buffer function
|
||||
# if any questions occur contact my at fdg@suse.de
|
||||
Index: net-tools-1.60/ifconfig.c
|
||||
===================================================================
|
||||
--- net-tools-1.60.orig/ifconfig.c
|
||||
+++ net-tools-1.60/ifconfig.c
|
||||
@@ -108,7 +108,7 @@ static int if_print(char *ifname)
|
||||
printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
|
||||
|
||||
if (!ifname) {
|
||||
- res = for_all_interfaces(do_if_print, &opt_a);
|
||||
+ res = for_all_interfaces(do_if_print, &opt_a, 0);
|
||||
} else {
|
||||
struct interface *ife;
|
||||
|
||||
@@ -1081,7 +1081,7 @@ static int set_ifstate(char *parent, uns
|
||||
pt.flag = flag;
|
||||
memset(searcher, 0, sizeof(searcher));
|
||||
i = for_all_interfaces((int (*)(struct interface *,void *))do_ifcmd,
|
||||
- &pt);
|
||||
+ &pt, 0);
|
||||
if (i == -1)
|
||||
return -1;
|
||||
if (i == 1)
|
||||
Index: net-tools-1.60/include/interface.h
|
||||
===================================================================
|
||||
--- net-tools-1.60.orig/include/interface.h
|
||||
+++ net-tools-1.60/include/interface.h
|
||||
@@ -63,10 +63,10 @@ struct interface {
|
||||
|
||||
extern int if_fetch(struct interface *ife);
|
||||
|
||||
-extern int for_all_interfaces(int (*)(struct interface *, void *), void *);
|
||||
+extern int for_all_interfaces(int (*)(struct interface *, void *), void *, int);
|
||||
extern int free_interface_list(void);
|
||||
extern struct interface *lookup_interface(char *name);
|
||||
-extern int if_readlist(void);
|
||||
+extern int if_readlist(int);
|
||||
|
||||
extern int do_if_fetch(struct interface *ife);
|
||||
extern int do_if_print(struct interface *ife, void *cookie);
|
||||
@@ -76,6 +76,8 @@ extern void ife_print(struct interface *
|
||||
extern int ife_short;
|
||||
|
||||
extern const char *if_port_text[][4];
|
||||
+extern int get_iface_count(void);
|
||||
+char *get_iface_name(int index);
|
||||
|
||||
/* Defines for poor glibc2.0 users, the feature check is done at runtime */
|
||||
#if !defined(SIOCSIFTXQLEN)
|
||||
Index: net-tools-1.60/lib/interface.c
|
||||
===================================================================
|
||||
--- net-tools-1.60.orig/lib/interface.c
|
||||
+++ net-tools-1.60/lib/interface.c
|
||||
@@ -90,7 +90,7 @@ int ife_field = 5;
|
||||
|
||||
static struct interface *int_list, *int_last;
|
||||
|
||||
-static int if_readlist_proc(char *);
|
||||
+static int if_readlist_proc(char *, int);
|
||||
|
||||
static struct interface *add_interface(char *name)
|
||||
{
|
||||
@@ -120,17 +120,17 @@ struct interface *lookup_interface(char
|
||||
{
|
||||
struct interface *ife = NULL;
|
||||
|
||||
- if (if_readlist_proc(name) < 0)
|
||||
+ if (if_readlist_proc(name, 0) < 0)
|
||||
return NULL;
|
||||
ife = add_interface(name);
|
||||
return ife;
|
||||
}
|
||||
|
||||
-int for_all_interfaces(int (*doit) (struct interface *, void *), void *cookie)
|
||||
+int for_all_interfaces(int (*doit) (struct interface *, void *), void *cookie, int flag_cacheof)
|
||||
{
|
||||
struct interface *ife;
|
||||
|
||||
- if (!int_list && (if_readlist() < 0))
|
||||
+ if (!int_list && (if_readlist(flag_cacheof) < 0))
|
||||
return -1;
|
||||
for (ife = int_list; ife; ife = ife->next) {
|
||||
int err = doit(ife, cookie);
|
||||
@@ -162,6 +162,7 @@ int free_interface_list(void)
|
||||
while ((ife = int_list) != NULL) {
|
||||
int_list = ife->next;
|
||||
free(ife);
|
||||
+ int_last = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -315,7 +316,7 @@ static int get_dev_fields(char *bp, stru
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int if_readlist_proc(char *target)
|
||||
+static int if_readlist_proc(char *target, int flag_cacheof)
|
||||
{
|
||||
static int proc_read;
|
||||
FILE *fh;
|
||||
@@ -323,10 +324,12 @@ static int if_readlist_proc(char *target
|
||||
struct interface *ife;
|
||||
int err;
|
||||
|
||||
- if (proc_read)
|
||||
- return 0;
|
||||
- if (!target)
|
||||
- proc_read = 1;
|
||||
+ if (proc_read) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if ((!target) && (flag_cacheof == 0)) {
|
||||
+ proc_read = 1;
|
||||
+ }
|
||||
|
||||
fh = fopen(_PATH_PROCNET_DEV, "r");
|
||||
if (!fh) {
|
||||
@@ -386,9 +389,9 @@ static int if_readlist_proc(char *target
|
||||
return err;
|
||||
}
|
||||
|
||||
-int if_readlist(void)
|
||||
+int if_readlist(int flag_cacheof)
|
||||
{
|
||||
- int err = if_readlist_proc(NULL);
|
||||
+ int err = if_readlist_proc(NULL, flag_cacheof);
|
||||
if (!err)
|
||||
err = if_readconf();
|
||||
return err;
|
||||
@@ -910,3 +913,26 @@ void ife_print(struct interface *i)
|
||||
else
|
||||
ife_print_long(i);
|
||||
}
|
||||
+
|
||||
+int get_iface_count(void)
|
||||
+{
|
||||
+ int num_iface = 0;
|
||||
+ struct interface* ife = int_list;
|
||||
+
|
||||
+ for (; ife != NULL; ife=ife->next) {
|
||||
+ num_iface++;
|
||||
+ }
|
||||
+
|
||||
+ return num_iface;
|
||||
+}
|
||||
+
|
||||
+char* get_iface_name(int index) {
|
||||
+ struct interface* ife = int_list;
|
||||
+
|
||||
+ while ((index-- > 0) && (ife->next != NULL)) {
|
||||
+ ife = ife->next;
|
||||
+ }
|
||||
+
|
||||
+ return ife->name;
|
||||
+}
|
||||
+
|
||||
Index: net-tools-1.60/netstat.c
|
||||
===================================================================
|
||||
--- net-tools-1.60.orig/netstat.c
|
||||
+++ net-tools-1.60/netstat.c
|
||||
@@ -153,9 +153,24 @@ int flag_exp = 1;
|
||||
int flag_prg = 0;
|
||||
int flag_arg = 0;
|
||||
int flag_ver = 0;
|
||||
+int flag_cacheof = 0;
|
||||
|
||||
FILE *procinfo;
|
||||
|
||||
+struct iface_cache {
|
||||
+ char iface_name[16+1];
|
||||
+ int rxok;
|
||||
+ int rxerr;
|
||||
+ int rxdrp;
|
||||
+ int rxovr;
|
||||
+ int txok;
|
||||
+ int txerr;
|
||||
+ int txdrp;
|
||||
+ int txovr;
|
||||
+};
|
||||
+
|
||||
+static struct iface_cache* mycache;
|
||||
+
|
||||
#define INFO_GUTS1(file,name,proc) \
|
||||
procinfo = fopen((file), "r"); \
|
||||
if (procinfo == NULL) { \
|
||||
@@ -253,6 +268,77 @@ static char prg_cache_loaded = 0;
|
||||
/* NOT working as of glibc-2.0.7: */
|
||||
#undef DIRENT_HAVE_D_TYPE_WORKS
|
||||
|
||||
+int do_if_cache_print(struct interface *ife, void *cookie)
|
||||
+{
|
||||
+ int *opt_a = (int *) cookie;
|
||||
+ int res;
|
||||
+ int num_iface = get_iface_count();
|
||||
+ int i;
|
||||
+
|
||||
+ struct iface_cache* cur_iface_cache = NULL;
|
||||
+
|
||||
+ res = do_if_fetch(ife);
|
||||
+
|
||||
+ if (mycache == NULL) {
|
||||
+ mycache = malloc(num_iface * sizeof(struct iface_cache));
|
||||
+ if (mycache == NULL) { exit(-1); }
|
||||
+ memset(mycache, '\0', num_iface * sizeof(struct iface_cache));
|
||||
+ for (i=0; i < num_iface; i++) {
|
||||
+ strncpy(mycache[i].iface_name, get_iface_name(i), 16);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (i=0; i < num_iface; i++) {
|
||||
+ if (strcmp(ife->name, mycache[i].iface_name) == 0) {
|
||||
+ cur_iface_cache = &mycache[i];
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (cur_iface_cache != NULL) {
|
||||
+ int swap;
|
||||
+
|
||||
+ swap = ife->stats.rx_packets;
|
||||
+ ife->stats.rx_packets -= cur_iface_cache->rxok;
|
||||
+ cur_iface_cache->rxok = swap;
|
||||
+
|
||||
+ swap = ife->stats.rx_errors;
|
||||
+ ife->stats.rx_errors -= cur_iface_cache->rxerr;
|
||||
+ cur_iface_cache->rxerr = swap;
|
||||
+
|
||||
+ swap = ife->stats.rx_dropped;
|
||||
+ ife->stats.rx_dropped -= cur_iface_cache->rxdrp;
|
||||
+ cur_iface_cache->rxdrp = swap;
|
||||
+
|
||||
+ swap = ife->stats.rx_fifo_errors;
|
||||
+ ife->stats.rx_fifo_errors -= cur_iface_cache->rxovr;
|
||||
+ cur_iface_cache->rxovr = swap;
|
||||
+
|
||||
+ swap = ife->stats.tx_packets;
|
||||
+ ife->stats.tx_packets -= cur_iface_cache->txok;
|
||||
+ cur_iface_cache->txok = swap;
|
||||
+
|
||||
+ swap = ife->stats.tx_errors;
|
||||
+ ife->stats.tx_errors -= cur_iface_cache->txerr;
|
||||
+ cur_iface_cache->txerr = swap;
|
||||
+
|
||||
+ swap = ife->stats.tx_dropped;
|
||||
+ ife->stats.tx_dropped -= cur_iface_cache->txdrp;
|
||||
+ cur_iface_cache->txdrp = swap;
|
||||
+
|
||||
+ swap = ife->stats.tx_fifo_errors;
|
||||
+ ife->stats.tx_fifo_errors -= cur_iface_cache->txovr;
|
||||
+ cur_iface_cache->txovr = swap;
|
||||
+ }
|
||||
+
|
||||
+ if (res >= 0) {
|
||||
+ if ((ife->flags & IFF_UP) || *opt_a) {
|
||||
+ ife_print(ife);
|
||||
+ }
|
||||
+ }
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
static void prg_cache_add(int inode, char *name)
|
||||
{
|
||||
unsigned hi = PRG_HASHIT(inode);
|
||||
@@ -1458,10 +1544,20 @@ static int iface_info(void)
|
||||
|
||||
get_max_ifacename();
|
||||
|
||||
- if (for_all_interfaces(do_if_print, &flag_all) < 0) {
|
||||
- perror(_("missing interface information"));
|
||||
- exit(1);
|
||||
+ if (flag_cacheof == 1) {
|
||||
+ if (for_all_interfaces(do_if_cache_print, &flag_all, flag_cacheof) < 0) {
|
||||
+ perror(_("missing interface information"));
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ }
|
||||
+ else {
|
||||
+ if (for_all_interfaces(do_if_print, &flag_all, flag_cacheof) < 0) {
|
||||
+ perror(_("missing interface information"));
|
||||
+ exit(1);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+
|
||||
if (flag_cnt)
|
||||
free_interface_list();
|
||||
else {
|
||||
@@ -1588,6 +1684,7 @@ int main
|
||||
flag_lst++;
|
||||
break;
|
||||
case 'c':
|
||||
+ flag_cacheof = 1;
|
||||
flag_cnt++;
|
||||
break;
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
--- po/cs.po
|
||||
+++ po/cs.po 2011/09/12 10:35:27
|
||||
@@ -788,8 +788,7 @@ msgstr "Nevím, jak nastavit adresu třídy
|
||||
msgid ""
|
||||
"(No info could be read for \"-p\": geteuid()=%d but you should be root.)\n"
|
||||
msgstr ""
|
||||
-"(Pro \"-p\" nelze získat žádné informace: geteuid()=%d, ale je třeba, aby "
|
||||
-"jste\n"
|
||||
+"(Pro \"-p\" nelze získat žádné informace: geteuid()=%d, ale je třeba, abyste\n"
|
||||
"byl superuživatelem)\n"
|
||||
|
||||
#: ../netstat.c:387
|
||||
@@ -797,8 +796,8 @@ msgid ""
|
||||
"(Not all processes could be identified, non-owned process info\n"
|
||||
" will not be shown, you would have to be root to see it all.)\n"
|
||||
msgstr ""
|
||||
-"(Všechny procesy nemohly být identifikovány. Budou vypsaány informace\n"
|
||||
-"pouze o procesech, jichž jste vlastníkem. Aby jste mohl vidět vše, musel\n"
|
||||
+"(Všechny procesy nemohly být identifikovány. Budou vypsány informace\n"
|
||||
+"pouze o procesech, jichž jste vlastníkem. Abyste mohl vidět vše, musel\n"
|
||||
"byste být superuživatelem.)\n"
|
||||
|
||||
#: ../netstat.c:394 ../netstat.c:1089 ../netstat.c:1166
|
|
@ -1,215 +0,0 @@
|
|||
--- man/de_DE/ifconfig.8 2009-12-16 11:38:15.000000000 +0100
|
||||
+++ man/de_DE/ifconfig.8 2009-12-16 11:39:28.000000000 +0100
|
||||
@@ -175,14 +175,6 @@
|
||||
sein, diesen Wert auf eine kleinen Wert f\(:ur langsame Ger\(:ate mit hoher
|
||||
Paketlaufzeit (Modems, ISDN) zu setzen um zu verhindern, da\(ss schnelle
|
||||
Gro\(ss\(:ubertragungen interaktiven Verkehr wie Telnet zu sehr st\(:oren.
|
||||
-.SH BEMERKUNGEN
|
||||
-Seit Kernel Version 2.2 gibt es keine expliziten Statistiken f\(:ur
|
||||
-Schnittstellenaliase mehr. Die Statistiken f\(:ur die Originaladresse werden
|
||||
-mit allen Aliasen auf das gleiche Ger\(:at geteilt. Um Statistiken per
|
||||
-Adresse zu erhalten sollte explizite EIntr\(:age f\(:ur die Adresse mit dem
|
||||
-.BR ipchains(8)
|
||||
-Kommando gemacht werden.
|
||||
-
|
||||
.SH DATEIEN
|
||||
.I /proc/net/socket
|
||||
.br
|
||||
@@ -193,7 +185,7 @@
|
||||
W\(:ahrend AppleTalk DDP und IPX Adressen angezeigt werden, k\(:onnen sie mit
|
||||
diesem Kommando nicht ge\(:andert werden.
|
||||
.SH SIEHE AUCH
|
||||
-route(8), netstat(8), arp(8), rarp(8), ipchains(8)
|
||||
+route(8), netstat(8), arp(8), rarp(8)
|
||||
.SH AUTOREN
|
||||
Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
|
||||
.br
|
||||
--- man/de_DE/netstat.8 2009-12-16 11:38:10.000000000 +0100
|
||||
+++ man/de_DE/netstat.8 2009-12-16 11:40:03.000000000 +0100
|
||||
@@ -409,14 +409,6 @@
|
||||
(Dieser Abschnitt sollte von jemandem, der davon Ahnung hat geschrieben
|
||||
werden.)
|
||||
|
||||
-.PP
|
||||
-.SH BEMERKUNGEN
|
||||
-Seit der Kern Version 2.2 zeigt netstat -i keine Schnittstellenstatistiken
|
||||
-von Schnittstellenaliasen mehr an. Um Statistiken per Schnittstelle zur
|
||||
-erhalten, m\(:ussen jetzt mit dem
|
||||
-.BR ipchains(8)
|
||||
-Befehl explizite Regeln zugef\(:ugt werden.
|
||||
-
|
||||
.SH DATEIEN
|
||||
.ta
|
||||
.I /etc/services
|
||||
@@ -480,7 +472,6 @@
|
||||
.BR ipfw (4),
|
||||
.BR ipfw (8),
|
||||
.BR ipfwadm (8)
|
||||
-.BR ipchains (8)
|
||||
|
||||
.PP
|
||||
.SH PROBLEME
|
||||
--- man/en_US/netstat.8 2009-12-16 11:40:19.000000000 +0100
|
||||
+++ man/en_US/netstat.8 2009-12-16 11:41:52.000000000 +0100
|
||||
@@ -355,15 +355,6 @@
|
||||
.P
|
||||
.SS Active AX.25 sockets
|
||||
(this needs to be done by somebody who knows it)
|
||||
-.PP
|
||||
-.SH NOTES
|
||||
-Starting with Linux release 2.2
|
||||
-.B netstat -i
|
||||
-does not show interface statistics for alias interfaces. To get per
|
||||
-alias interface counters you need to setup explicit rules using the
|
||||
-.BR ipchains(8)
|
||||
-command.
|
||||
-
|
||||
.SH FILES
|
||||
.ta
|
||||
.I /etc/services
|
||||
@@ -428,7 +419,6 @@
|
||||
.SH SEE ALSO
|
||||
.BR route (8),
|
||||
.BR ifconfig (8),
|
||||
-.BR ipchains (8),
|
||||
.BR iptables (8),
|
||||
.BR proc (5)
|
||||
.P
|
||||
--- man/en_US/ifconfig.8 2009-12-16 11:40:28.000000000 +0100
|
||||
+++ man/en_US/ifconfig.8 2009-12-16 11:41:12.000000000 +0100
|
||||
@@ -173,14 +173,6 @@
|
||||
to prevent fast bulk transfers from disturbing interactive traffic like
|
||||
telnet too much.
|
||||
.SH NOTES
|
||||
-Since kernel release 2.2 there are no explicit interface statistics for
|
||||
-alias interfaces anymore. The statistics printed for the original address
|
||||
-are shared with all alias addresses on the same device. If you want per-address
|
||||
-statistics you should add explicit accounting
|
||||
-rules for the address using the
|
||||
-.BR ipchains(8)
|
||||
-command.
|
||||
-.LP
|
||||
Interrupt problems with Ethernet device drivers fail with EAGAIN. See
|
||||
.I http://cesdis.gsfc.nasa.gov/linux/misc/irq-conflict.html
|
||||
for more information.
|
||||
@@ -194,7 +186,7 @@
|
||||
While appletalk DDP and IPX addresses will be displayed they cannot be
|
||||
altered by this command.
|
||||
.SH SEE ALSO
|
||||
-route(8), netstat(8), arp(8), rarp(8), ipchains(8)
|
||||
+route(8), netstat(8), arp(8), rarp(8)
|
||||
.SH AUTHORS
|
||||
Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
|
||||
.br
|
||||
--- man/fr_FR/ifconfig.8 2009-12-16 11:42:30.000000000 +0100
|
||||
+++ man/fr_FR/ifconfig.8 2009-12-16 11:42:51.000000000 +0100
|
||||
@@ -177,15 +177,6 @@
|
||||
to small values for slower devices with a high latency (modem links, ISDN)
|
||||
to prevent fast bulk transfers from disturbing interactive traffic like
|
||||
telnet too much.
|
||||
-.SH NOTES
|
||||
-Depuis le noyau 2.2 il n'y a plus de statistiques d'interface explicite
|
||||
-pour les interfaces en alias. Les statistiques affichées pour la véritable
|
||||
-adresse sont partagées avec toutes les adresses alias du même périphérique.
|
||||
-Si vous voulez des adresses par interface, vous devez ajouter des règles de
|
||||
-comptabilité particulières pour l'adresse en utilisant la commande
|
||||
-.BR ipchains(8)
|
||||
-.
|
||||
-
|
||||
.SH FICHIERS
|
||||
.I /proc/net/socket
|
||||
.br
|
||||
@@ -196,7 +187,7 @@
|
||||
Même si les adresses appletalk DDP et IPX peuvent être affichées,
|
||||
elles ne peuvent être modifiées avec cette commande.
|
||||
.SH VOIR AUSSI
|
||||
-route(8), netstat(8), arp(8), rarp(8), ipchains(8)
|
||||
+route(8), netstat(8), arp(8), rarp(8)
|
||||
.SH AUTHORS
|
||||
Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
|
||||
.br
|
||||
--- man/fr_FR/netstat.8 2009-12-16 11:42:20.000000000 +0100
|
||||
+++ man/fr_FR/netstat.8 2009-12-16 11:43:09.000000000 +0100
|
||||
@@ -404,14 +404,6 @@
|
||||
|
||||
(à faire par quelqu'un qui connaît)
|
||||
|
||||
-.PP
|
||||
-.SH NOTES
|
||||
-Depuis la version 2.2 du noyau, netstat -i n'affiche plus les statistiques
|
||||
-des interfaces alias. Pour obtenir les compteurs par interface alias, vous
|
||||
-devez définir des règles spécifiques à l'aide de la commande
|
||||
-.BR ipchains(8)
|
||||
-.
|
||||
-
|
||||
.SH FICHIERS
|
||||
.ta
|
||||
.I /etc/services
|
||||
@@ -474,7 +466,6 @@
|
||||
.BR ipfw (4),
|
||||
.BR ipfw (8),
|
||||
.BR ipfwadm (8)
|
||||
-.BR ipchains (8)
|
||||
|
||||
.PP
|
||||
.SH BUGS
|
||||
--- man/pt_BR/netstat.8 2009-12-16 11:43:27.000000000 +0100
|
||||
+++ man/pt_BR/netstat.8 2009-12-16 11:43:42.000000000 +0100
|
||||
@@ -370,13 +370,6 @@
|
||||
|
||||
(Isso precisa ser feito por alguém que saiba fazê-lo.)
|
||||
|
||||
-.PP
|
||||
-.SH NOTAS
|
||||
-Desde o kernel 2.2 o netstat -i não mostra estatísticas para apelidos (aliases)
|
||||
-de interfaces. Para obter contadores por apelido de interface você precisa
|
||||
-configurar regras explícitas usando o comando
|
||||
-+.BR ipchains(8)
|
||||
-.
|
||||
.SH FILES
|
||||
.ta
|
||||
.I /etc/services
|
||||
@@ -439,7 +432,6 @@
|
||||
.BR ipfw (4),
|
||||
.BR ipfw (8),
|
||||
.BR ipfwadm (8)
|
||||
-.BR ipchains (8)
|
||||
|
||||
.PP
|
||||
.SH BUGS
|
||||
--- man/pt_BR/ifconfig.8 2009-12-16 11:43:31.000000000 +0100
|
||||
+++ man/pt_BR/ifconfig.8 2009-12-16 11:44:03.000000000 +0100
|
||||
@@ -143,24 +143,6 @@
|
||||
O nome ou endereço IP da máquina (um nome de máquina será traduzido para
|
||||
um endereço IP) da interface. Este parâmetro é necessário, apesar
|
||||
da sintaxe atualmente não requisitá-lo.
|
||||
-.SH NOTAS
|
||||
-
|
||||
-+Since kernel release 2.2 there are no explicit interface statistics for
|
||||
-+alias interfaces anymore. The statistics printed for the original address
|
||||
-+are shared with all alias addresses on the same device. If you want per-address
|
||||
-+statistics you should add explicit accounting
|
||||
-+rules for the address using the
|
||||
-+.BR ipchains(8)
|
||||
-+command.
|
||||
-
|
||||
-Deste o kernel 2.2 não existem mais estatísticas explícitas para os apelidos (aliases)
|
||||
-de interfaces. As estatísticas mostradas para o endereço original são compartilhadas
|
||||
-como todos os endereços associados ao mesmo dispositivo. Se desejar estatísticas
|
||||
-por endereço você deve explicitamente adicionar regras de contabilização para os
|
||||
-endereços usando o comando
|
||||
-.BR ipchains(8)
|
||||
-.
|
||||
-
|
||||
.SH ARQUIVOS
|
||||
.I /proc/net/socket
|
||||
.br
|
||||
@@ -169,7 +151,7 @@
|
||||
Os endereços appletalk DDP e IPX serão mostrados, mas não podem ser alterados
|
||||
com este comando.
|
||||
.SH VEJA TAMBÉM
|
||||
-route(8), netstat(8), arp(8), rarp(8), ipchains(8)
|
||||
+route(8), netstat(8), arp(8), rarp(8)
|
||||
.SH AUTORES
|
||||
Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
|
||||
Alan Cox, <Alan.Cox@linux.org>
|
|
@ -1,15 +0,0 @@
|
|||
--- netstat.c
|
||||
+++ netstat.c 2011/02/15 11:22:47
|
||||
@@ -899,8 +899,10 @@ static void tcp_do_one(int lnr, const ch
|
||||
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 (!flag_trim) {
|
||||
+ if ((strlen(rem_addr) + strlen(buffer)) > 22)
|
||||
+ rem_addr[22 - strlen(buffer)] = '\0';
|
||||
+ }
|
||||
|
||||
strcat(rem_addr, ":");
|
||||
strcat(rem_addr, buffer);
|
|
@ -1,111 +0,0 @@
|
|||
--- net-tools-1.60/lib/interface.c.errors 2001-02-10 20:31:15.000000000 +0100
|
||||
+++ net-tools-1.60/lib/interface.c 2004-05-24 14:24:14.000000000 +0200
|
||||
@@ -239,7 +239,7 @@
|
||||
switch (procnetdev_vsn) {
|
||||
case 3:
|
||||
sscanf(bp,
|
||||
- "%llu %llu %lu %lu %lu %lu %lu %lu %llu %llu %lu %lu %lu %lu %lu %lu",
|
||||
+ "%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu",
|
||||
&ife->stats.rx_bytes,
|
||||
&ife->stats.rx_packets,
|
||||
&ife->stats.rx_errors,
|
||||
@@ -259,7 +259,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, "%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu",
|
||||
&ife->stats.rx_bytes,
|
||||
&ife->stats.rx_packets,
|
||||
&ife->stats.rx_errors,
|
||||
@@ -277,7 +277,7 @@
|
||||
ife->stats.rx_multicast = 0;
|
||||
break;
|
||||
case 1:
|
||||
- sscanf(bp, "%llu %lu %lu %lu %lu %llu %lu %lu %lu %lu %lu",
|
||||
+ sscanf(bp, "%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu",
|
||||
&ife->stats.rx_packets,
|
||||
&ife->stats.rx_errors,
|
||||
&ife->stats.rx_dropped,
|
||||
@@ -832,12 +832,12 @@
|
||||
*/
|
||||
printf(" ");
|
||||
|
||||
- printf(_("RX packets:%llu errors:%lu dropped:%lu overruns:%lu frame:%lu\n"),
|
||||
+ printf(_("RX packets:%llu errors:%llu dropped:%llu overruns:%llu frame:%llu\n"),
|
||||
ptr->stats.rx_packets, ptr->stats.rx_errors,
|
||||
ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors,
|
||||
ptr->stats.rx_frame_errors);
|
||||
if (can_compress)
|
||||
- printf(_(" compressed:%lu\n"), ptr->stats.rx_compressed);
|
||||
+ printf(_(" compressed:%llu\n"), ptr->stats.rx_compressed);
|
||||
|
||||
rx = ptr->stats.rx_bytes;
|
||||
tx = ptr->stats.tx_bytes;
|
||||
@@ -849,13 +849,13 @@
|
||||
else if (tx > 1024) { short_tx /= 1024; strcpy(Text, "Kb"); }
|
||||
|
||||
printf(" ");
|
||||
- printf(_("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"),
|
||||
+ printf(_("TX packets:%llu errors:%llu dropped:%llu overruns:%llu carrier:%llu\n"),
|
||||
ptr->stats.tx_packets, ptr->stats.tx_errors,
|
||||
ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors,
|
||||
ptr->stats.tx_carrier_errors);
|
||||
- printf(_(" collisions:%lu "), ptr->stats.collisions);
|
||||
+ printf(_(" collisions:%llu "), ptr->stats.collisions);
|
||||
if (can_compress)
|
||||
- printf(_("compressed:%lu "), ptr->stats.tx_compressed);
|
||||
+ printf(_("compressed:%llu "), ptr->stats.tx_compressed);
|
||||
if (ptr->tx_queue_len != -1)
|
||||
printf(_("txqueuelen:%d "), ptr->tx_queue_len);
|
||||
printf("\n ");
|
||||
--- net-tools-1.60/include/interface.h.errors 2001-02-10 20:24:25.000000000 +0100
|
||||
+++ net-tools-1.60/include/interface.h 2004-05-24 14:22:33.000000000 +0200
|
||||
@@ -3,28 +3,28 @@
|
||||
unsigned long long tx_packets; /* total packets transmitted */
|
||||
unsigned long long rx_bytes; /* total bytes received */
|
||||
unsigned long long tx_bytes; /* total bytes transmitted */
|
||||
- unsigned long rx_errors; /* bad packets received */
|
||||
- unsigned long tx_errors; /* packet transmit problems */
|
||||
- unsigned long rx_dropped; /* no space in linux buffers */
|
||||
- unsigned long tx_dropped; /* no space available in linux */
|
||||
- unsigned long rx_multicast; /* multicast packets received */
|
||||
- unsigned long rx_compressed;
|
||||
- unsigned long tx_compressed;
|
||||
- unsigned long collisions;
|
||||
+ unsigned long long rx_errors; /* bad packets received */
|
||||
+ unsigned long long tx_errors; /* packet transmit problems */
|
||||
+ unsigned long long rx_dropped; /* no space in linux buffers */
|
||||
+ unsigned long long tx_dropped; /* no space available in linux */
|
||||
+ unsigned long long rx_multicast; /* multicast packets received */
|
||||
+ unsigned long long rx_compressed;
|
||||
+ unsigned long long tx_compressed;
|
||||
+ unsigned long long collisions;
|
||||
|
||||
/* detailed rx_errors: */
|
||||
- unsigned long rx_length_errors;
|
||||
- unsigned long rx_over_errors; /* receiver ring buff overflow */
|
||||
- unsigned long rx_crc_errors; /* recved pkt with crc error */
|
||||
- unsigned long rx_frame_errors; /* recv'd frame alignment error */
|
||||
- unsigned long rx_fifo_errors; /* recv'r fifo overrun */
|
||||
- unsigned long rx_missed_errors; /* receiver missed packet */
|
||||
+ unsigned long long rx_length_errors;
|
||||
+ unsigned long long rx_over_errors; /* receiver ring buff overflow */
|
||||
+ unsigned long long rx_crc_errors; /* recved pkt with crc error */
|
||||
+ unsigned long long rx_frame_errors; /* recv'd frame alignment error */
|
||||
+ unsigned long long rx_fifo_errors; /* recv'r fifo overrun */
|
||||
+ unsigned long long rx_missed_errors; /* receiver missed packet */
|
||||
/* detailed tx_errors */
|
||||
- unsigned long tx_aborted_errors;
|
||||
- unsigned long tx_carrier_errors;
|
||||
- unsigned long tx_fifo_errors;
|
||||
- unsigned long tx_heartbeat_errors;
|
||||
- unsigned long tx_window_errors;
|
||||
+ unsigned long long tx_aborted_errors;
|
||||
+ unsigned long long tx_carrier_errors;
|
||||
+ unsigned long long tx_fifo_errors;
|
||||
+ unsigned long long tx_heartbeat_errors;
|
||||
+ unsigned long long tx_window_errors;
|
||||
};
|
||||
|
||||
struct interface {
|
|
@ -1,18 +0,0 @@
|
|||
--- net-tools-1.60/iptunnel.c 2009-08-06 16:15:00.000000000 +0200
|
||||
+++ net-tools-1.60/iptunnel.c 2009-08-06 16:15:51.000000000 +0200
|
||||
@@ -485,6 +485,7 @@
|
||||
if ((ptr = strchr(buf, ':')) == NULL ||
|
||||
(*ptr++ = 0, sscanf(buf, "%s", name) != 1)) {
|
||||
fprintf(stderr, _("Wrong format of /proc/net/dev. Sorry.\n"));
|
||||
+ fclose (fp);
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(ptr, "%ld%ld%ld%ld%ld%ld%ld%*d%ld%ld%ld%ld%ld%ld%ld",
|
||||
@@ -521,6 +522,7 @@
|
||||
tx_packets, tx_bytes, tx_errs, tx_colls, tx_carrier, tx_drops);
|
||||
}
|
||||
}
|
||||
+ fclose (fp);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
Index: net-tools-1.60/iptunnel.c
|
||||
===================================================================
|
||||
--- net-tools-1.60.orig/iptunnel.c
|
||||
+++ net-tools-1.60/iptunnel.c
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/in.h>
|
||||
-#include <netinet/ip.h>
|
||||
+#include <linux/ip.h>
|
||||
#include <arpa/inet.h>
|
||||
#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1))
|
||||
#include <net/if.h>
|
|
@ -1,243 +0,0 @@
|
|||
--- hostname.c
|
||||
+++ hostname.c 2010/07/20 12:25:42
|
||||
@@ -79,6 +79,7 @@ static void setnname(char *nname)
|
||||
fprintf(stderr, _("%s: name too long\n"), program_name);
|
||||
break;
|
||||
default:
|
||||
+ break;
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
@@ -125,49 +126,171 @@ static void setdname(char *dname)
|
||||
};
|
||||
}
|
||||
|
||||
+struct alias_t {
|
||||
+ char name[NI_MAXHOST];
|
||||
+ struct alias_t *next;
|
||||
+};
|
||||
+struct aliases_t {
|
||||
+ struct alias_t *head;
|
||||
+ struct alias_t *tail;
|
||||
+};
|
||||
+
|
||||
+static void aliases_add(struct aliases_t *aliases, char *alias)
|
||||
+{
|
||||
+ struct alias_t *a;
|
||||
+ int f = 0;
|
||||
+
|
||||
+ if( !aliases || !alias || !*alias)
|
||||
+ return;
|
||||
+
|
||||
+ for(a=aliases->head; !f && a; a=a->next) {
|
||||
+ f = (strcasecmp(a->name, alias) == 0);
|
||||
+ }
|
||||
+ if(!f) {
|
||||
+ a = calloc(1, sizeof(struct alias_t));
|
||||
+ if( a) {
|
||||
+ strncat(a->name, alias, sizeof(a->name)-1);
|
||||
+ if (aliases->tail) {
|
||||
+ aliases->tail->next = a;
|
||||
+ aliases->tail = a;
|
||||
+ } else {
|
||||
+ aliases->head = a;
|
||||
+ aliases->tail = a;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void showhname(char *hname, int c)
|
||||
{
|
||||
- struct hostent *hp;
|
||||
+ struct addrinfo hints;
|
||||
+ struct addrinfo *res=NULL, *rp;
|
||||
register char *p, **alias;
|
||||
- struct in_addr **ip;
|
||||
+ int ret, retry=3;
|
||||
+ size_t n;
|
||||
|
||||
if (opt_v)
|
||||
fprintf(stderr, _("Resolving `%s' ...\n"), hname);
|
||||
- if (!(hp = gethostbyname(hname))) {
|
||||
- herror(program_name);
|
||||
+
|
||||
+ memset(&hints, 0, sizeof(struct addrinfo));
|
||||
+ hints.ai_family = AF_UNSPEC;
|
||||
+ hints.ai_flags = AI_CANONNAME | AI_CANONIDN;
|
||||
+ hints.ai_socktype = SOCK_STREAM;
|
||||
+ hints.ai_protocol = 0;
|
||||
+ do {
|
||||
+ ret = getaddrinfo(hname, NULL, &hints, &res);
|
||||
+ } while(ret == EAI_AGAIN && retry-- > 0
|
||||
+ && usleep(50000) == 0);
|
||||
+
|
||||
+ if (ret != 0 || res == NULL) {
|
||||
+ fprintf(stderr, _("%s: %s\n"),
|
||||
+ program_name, gai_strerror(ret));
|
||||
exit(1);
|
||||
}
|
||||
+
|
||||
if (opt_v) {
|
||||
- fprintf(stderr, _("Result: h_name=`%s'\n"),
|
||||
- hp->h_name);
|
||||
+ for(n=0, rp=res; rp; rp=rp->ai_next, n++) {
|
||||
+ char buf[INET6_ADDRSTRLEN] = {'\0'};
|
||||
+ const char *str = NULL;
|
||||
+ const char *typ = NULL;
|
||||
+ const void *adr = NULL;
|
||||
+
|
||||
+ if(rp->ai_canonname)
|
||||
+ fprintf(stderr, _("Result: ai_canonname[%zd]=`%s'\n"),
|
||||
+ n, rp->ai_canonname);
|
||||
+
|
||||
+ switch(rp->ai_addr->sa_family) {
|
||||
+ case AF_INET:
|
||||
+ typ = "ipv4";
|
||||
+ adr = &(((struct sockaddr_in *)rp->ai_addr)->sin_addr);
|
||||
+ break;
|
||||
+ case AF_INET6:
|
||||
+ typ = "ipv6";
|
||||
+ adr = &(((struct sockaddr_in6 *)rp->ai_addr)->sin6_addr);
|
||||
+ break;
|
||||
+ }
|
||||
+ if( !adr)
|
||||
+ continue;
|
||||
+
|
||||
+ if(opt_v > 1)
|
||||
+ fprintf(stderr, _("Result: ai_addrtype[%zd]=`%s'\n"), n, typ);
|
||||
|
||||
- alias = hp->h_aliases;
|
||||
- while (alias[0])
|
||||
- fprintf(stderr, _("Result: h_aliases=`%s'\n"),
|
||||
- *alias++);
|
||||
-
|
||||
- ip = (struct in_addr **) hp->h_addr_list;
|
||||
- while (ip[0])
|
||||
- fprintf(stderr, _("Result: h_addr_list=`%s'\n"),
|
||||
- inet_ntoa(**ip++));
|
||||
+ str = inet_ntop(rp->ai_addr->sa_family,
|
||||
+ adr, buf, sizeof(buf));
|
||||
+ if(str)
|
||||
+ fprintf(stderr, _("Result: ai_addr[%zd]=`%s'\n"), n, str);
|
||||
+ }
|
||||
}
|
||||
- if (!(p = strchr(hp->h_name, '.')) && (c == 'd'))
|
||||
+ if (!(p = strchr(res->ai_canonname, '.')) && (c == 'd')) {
|
||||
+ freeaddrinfo(res);
|
||||
return;
|
||||
+ }
|
||||
|
||||
switch (c) {
|
||||
- case 'a':
|
||||
- while (hp->h_aliases[0]) {
|
||||
- printf("%s", *hp->h_aliases++);
|
||||
- if (hp->h_aliases[0])
|
||||
- printf(" ");
|
||||
+ case 'a': {
|
||||
+ /*
|
||||
+ ** getaddrinfo / getnameinfo do not provide aliases,
|
||||
+ ** so we have to fetch them using gethostbyaddr ...
|
||||
+ */
|
||||
+ struct aliases_t aliases = { NULL, NULL };
|
||||
+ struct alias_t *a;
|
||||
+
|
||||
+ for(n=0, rp=res; rp; rp=rp->ai_next, n++) {
|
||||
+ struct hostent *hp;
|
||||
+ const void *adr = NULL;
|
||||
+ socklen_t len;
|
||||
+
|
||||
+ switch(rp->ai_addr->sa_family) {
|
||||
+ case AF_INET:
|
||||
+ adr = &(((struct sockaddr_in *)rp->ai_addr)->sin_addr);
|
||||
+ len = sizeof(struct in_addr);
|
||||
+ break;
|
||||
+ case AF_INET6:
|
||||
+ adr = &(((struct sockaddr_in6 *)rp->ai_addr)->sin6_addr);
|
||||
+ len = sizeof(struct in6_addr);
|
||||
+ break;
|
||||
+ }
|
||||
+ if( !adr)
|
||||
+ continue;
|
||||
+
|
||||
+ hp = gethostbyaddr(adr, len, rp->ai_addr->sa_family);
|
||||
+ if(hp) {
|
||||
+ for(alias = hp->h_aliases; alias && *alias; alias++) {
|
||||
+ if(opt_v)
|
||||
+ fprintf(stderr, _("Result: h_aliases[%zd]=`%s'\n"),
|
||||
+ n, *alias);
|
||||
+ aliases_add(&aliases, *alias);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ while( (a=aliases.head)) {
|
||||
+ aliases.head = a->next;
|
||||
+ printf("%s%s", a->name, (a->next ? " " : ""));
|
||||
+ free(a);
|
||||
}
|
||||
printf("\n");
|
||||
- break;
|
||||
+ } break;
|
||||
case 'i':
|
||||
- while (hp->h_addr_list[0]) {
|
||||
- printf("%s", inet_ntoa(*(struct in_addr *) *hp->h_addr_list++));
|
||||
- if (hp->h_addr_list[0])
|
||||
- printf(" ");
|
||||
+ for(n=0, rp=res; rp; rp=rp->ai_next, n++) {
|
||||
+ char buf[INET6_ADDRSTRLEN] = {'\0'};
|
||||
+ const char *str = NULL;
|
||||
+ const void *adr = NULL;
|
||||
+
|
||||
+ switch(rp->ai_addr->sa_family) {
|
||||
+ case AF_INET:
|
||||
+ adr = &(((struct sockaddr_in *)rp->ai_addr)->sin_addr);
|
||||
+ break;
|
||||
+ case AF_INET6:
|
||||
+ adr = &(((struct sockaddr_in6 *)rp->ai_addr)->sin6_addr);
|
||||
+ break;
|
||||
+ }
|
||||
+ if( !adr)
|
||||
+ continue;
|
||||
+
|
||||
+ str = inet_ntop(rp->ai_addr->sa_family,
|
||||
+ adr, buf, sizeof(buf));
|
||||
+ if(str)
|
||||
+ printf("%s%s", str, (rp->ai_next ? " " : ""));
|
||||
}
|
||||
printf("\n");
|
||||
break;
|
||||
@@ -175,16 +298,17 @@ static void showhname(char *hname, int c
|
||||
printf("%s\n", ++p);
|
||||
break;
|
||||
case 'f':
|
||||
- printf("%s\n", hp->h_name);
|
||||
+ printf("%s\n", res->ai_canonname);
|
||||
break;
|
||||
case 's':
|
||||
if (p != NULL)
|
||||
*p = '\0';
|
||||
- printf("%s\n", hp->h_name);
|
||||
+ printf("%s\n", res->ai_canonname);
|
||||
break;
|
||||
default:
|
||||
- return;
|
||||
+ break;
|
||||
}
|
||||
+ freeaddrinfo(res);
|
||||
}
|
||||
|
||||
static void setfilename(char *name, int what)
|
||||
@@ -336,11 +460,12 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
case 'V':
|
||||
version();
|
||||
+ break; // not reached
|
||||
case '?':
|
||||
case 'h':
|
||||
default:
|
||||
usage();
|
||||
-
|
||||
+ break; // not reached
|
||||
};
|
||||
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
Index: net-tools-1.60/hostname.c
|
||||
===================================================================
|
||||
--- net-tools-1.60.orig/hostname.c
|
||||
+++ net-tools-1.60/hostname.c
|
||||
@@ -300,11 +300,6 @@ static void showhname(char *hname, int c
|
||||
case 'f':
|
||||
printf("%s\n", res->ai_canonname);
|
||||
break;
|
||||
- case 's':
|
||||
- if (p != NULL)
|
||||
- *p = '\0';
|
||||
- printf("%s\n", res->ai_canonname);
|
||||
- break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -494,7 +489,12 @@ int main(int argc, char **argv)
|
||||
fprintf(stderr, _("gethostname()=`%s'\n"), myname);
|
||||
if (!type)
|
||||
printf("%s\n", myname);
|
||||
- else
|
||||
+ else if (type == 's') {
|
||||
+ char *p = strchr(myname, '.');
|
||||
+ if (p)
|
||||
+ *p = '\0';
|
||||
+ printf("%s\n", myname);
|
||||
+ } else
|
||||
showhname(myname, type);
|
||||
break;
|
||||
case 3:
|
|
@ -1,26 +0,0 @@
|
|||
--- net-tools-1.60/hostname.c 2007-05-02 10:28:42.000000000 +0200
|
||||
+++ net-tools-1.60/hostname.c 2007-05-02 10:35:59.000000000 +0200
|
||||
@@ -156,13 +156,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':
|
|
@ -1,11 +0,0 @@
|
|||
--- net-tools-1.60/lib/tr.c
|
||||
+++ net-tools-1.60/lib/tr.c
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if_arp.h>
|
||||
-#include <linux/if_tr.h>
|
||||
+#include <netinet/if_tr.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
|
@ -1,52 +0,0 @@
|
|||
--- net-tools-1.60/ifconfig.c.orig 2008-11-06 16:25:50.000000000 +0100
|
||||
+++ net-tools-1.60/ifconfig.c 2008-11-06 16:36:10.000000000 +0100
|
||||
@@ -227,13 +227,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,7 +903,7 @@
|
||||
/* 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;
|
||||
@@ -911,8 +911,8 @@
|
||||
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 +960,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
|
|
@ -1,14 +0,0 @@
|
|||
--- net-tools-1.60/man/en_US/ifconfig.8 2000-10-28 12:59:42.000000000 +0200
|
||||
+++ net-tools-1.60/man/en_US/ifconfig.8 2008-03-02 18:03:05.954727145 +0100
|
||||
@@ -11,6 +11,11 @@
|
||||
used at boot time to set up interfaces as necessary. After that, it
|
||||
is usually only needed when debugging or when system tuning is needed.
|
||||
.LP
|
||||
+.B WARNING:
|
||||
+.B Ifconfig
|
||||
+is obsolete on system with Linux kernel newer than 2.0. On this system
|
||||
+you should use ip. See the ip manual page for details
|
||||
+.LP
|
||||
If no arguments are given,
|
||||
.B ifconfig
|
||||
displays the status of the currently active interfaces. If
|
|
@ -1,11 +0,0 @@
|
|||
--- lib/interface.c 2007-06-18 13:51:41.000000000 -0400
|
||||
+++ lib/interface.c 2007-06-18 13:52:04.000000000 -0400
|
||||
@@ -718,7 +718,7 @@
|
||||
/* FIXME: should be integrated into interface.c. */
|
||||
|
||||
if ((f = fopen(_PATH_PROCNET_IFINET6, "r")) != NULL) {
|
||||
- while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
|
||||
+ while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %08x %02x %02x %02x %20s\n",
|
||||
addr6p[0], addr6p[1], addr6p[2], addr6p[3],
|
||||
addr6p[4], addr6p[5], addr6p[6], addr6p[7],
|
||||
&if_idx, &plen, &scope, &dad_status, devname) != EOF) {
|
|
@ -1,202 +0,0 @@
|
|||
--- config.in 2000-05-21 07:32:12.000000000 -0700
|
||||
+++ config.in 2005-02-07 10:45:14.108286619 -0800
|
||||
@@ -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.
|
||||
--- lib/hw.c 2000-05-20 11:27:25.000000000 -0700
|
||||
+++ lib/hw.c 2005-02-07 09:56:22.315428035 -0800
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
--- lib/ib.c 1969-12-31 16:00:00.000000000 -0800
|
||||
+++ lib/ib.c 2005-02-07 12:55:04.635559244 -0800
|
||||
@@ -0,0 +1,147 @@
|
||||
+/*
|
||||
+ * lib/ib.c This file contains an implementation of the "Infiniband"
|
||||
+ * support functions.
|
||||
+ *
|
||||
+ * Version: $Id: ib.c,v 1.1 2005/02/06 11:00:47 tduffy Exp $
|
||||
+ *
|
||||
+ * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
|
||||
+ * Copyright 1993 MicroWalt Corporation
|
||||
+ * Tom Duffy <tduffy@sun.com>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it
|
||||
+ * and/or modify it under the terms of the GNU General
|
||||
+ * Public License as published by the Free Software
|
||||
+ * Foundation; either version 2 of the License, or (at
|
||||
+ * your option) any later version.
|
||||
+ */
|
||||
+#include "config.h"
|
||||
+
|
||||
+#if HAVE_HWIB
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/socket.h>
|
||||
+#include <net/if_arp.h>
|
||||
+#include <linux/if_infiniband.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+#include <errno.h>
|
||||
+#include <ctype.h>
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
+#include "net-support.h"
|
||||
+#include "pathnames.h"
|
||||
+#include "intl.h"
|
||||
+#include "util.h"
|
||||
+
|
||||
+extern struct hwtype ib_hwtype;
|
||||
+
|
||||
+
|
||||
+/* 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_HWETHER */
|
||||
--- lib/Makefile 2000-10-28 03:59:42.000000000 -0700
|
||||
+++ lib/Makefile 2005-02-07 10:02:14.662640164 -0800
|
||||
@@ -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
|
|
@ -1,30 +0,0 @@
|
|||
Index: net-tools-1.60/lib/interface.c
|
||||
===================================================================
|
||||
--- net-tools-1.60.orig/lib/interface.c
|
||||
+++ net-tools-1.60/lib/interface.c
|
||||
@@ -608,10 +608,10 @@ void ife_print_short(struct interface *p
|
||||
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 ",
|
||||
+ printf(" %8llu %6lu %6lu %6lu ",
|
||||
ptr->stats.tx_packets, ptr->stats.tx_errors,
|
||||
ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors);
|
||||
} else {
|
||||
Index: net-tools-1.60/netstat.c
|
||||
===================================================================
|
||||
--- net-tools-1.60.orig/netstat.c
|
||||
+++ net-tools-1.60/netstat.c
|
||||
@@ -1919,7 +1919,7 @@ static int iface_info(void)
|
||||
}
|
||||
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 (flag_cacheof == 1) {
|
|
@ -1,19 +0,0 @@
|
|||
--- net-tools-1.60/lib/interface.c 2008-11-20 12:01:16.000000000 +0100
|
||||
+++ net-tools-1.60/lib/interface.c 2008-11-20 12:19:22.000000000 +0100
|
||||
@@ -161,12 +161,10 @@
|
||||
(as of 2.1.128) */
|
||||
skfd = get_socket_for_af(AF_INET);
|
||||
if (skfd < 0) {
|
||||
- fprintf(stderr, _("warning: no inet socket available: %s\n"),
|
||||
- strerror(errno));
|
||||
- /* Try to soldier on with whatever socket we can get hold of. */
|
||||
- skfd = sockets_open(0);
|
||||
- if (skfd < 0)
|
||||
- return -1;
|
||||
+ /* Try to soldier on with whatever socket we can get hold of. */
|
||||
+ skfd = sockets_open(0);
|
||||
+ if (skfd < 0)
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
ifc.ifc_buf = NULL;
|
|
@ -1,70 +0,0 @@
|
|||
Index: lib/interface.c
|
||||
===================================================================
|
||||
--- lib/interface.c.orig
|
||||
+++ lib/interface.c
|
||||
@@ -216,10 +216,11 @@ out:
|
||||
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;
|
||||
@@ -320,9 +321,10 @@ static int if_readlist_proc(char *target
|
||||
{
|
||||
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;
|
||||
@@ -337,8 +339,11 @@ static int if_readlist_proc(char *target
|
||||
_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,
|
||||
@@ -363,13 +368,13 @@ static int if_readlist_proc(char *target
|
||||
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;
|
||||
@@ -385,6 +390,8 @@ static int if_readlist_proc(char *target
|
||||
#if 0
|
||||
free(fmt);
|
||||
#endif
|
||||
+ out:
|
||||
+ free(line);
|
||||
fclose(fh);
|
||||
return err;
|
||||
}
|
|
@ -1,281 +0,0 @@
|
|||
--- netstat.c.ms 2009-09-14 10:47:30.000000000 +0200
|
||||
+++ netstat.c 2009-09-14 10:47:37.000000000 +0200
|
||||
@@ -105,6 +105,8 @@
|
||||
/* prototypes for statistics.c */
|
||||
void parsesnmp(int, int, int, int);
|
||||
void inittab(void);
|
||||
+void parsesnmp6(int, int, int, int);
|
||||
+void inittab6(void);
|
||||
|
||||
typedef enum {
|
||||
SS_FREE = 0, /* not allocated */
|
||||
@@ -2183,9 +2185,28 @@
|
||||
}
|
||||
|
||||
if (flag_sta) {
|
||||
- inittab();
|
||||
- parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp);
|
||||
- exit(0);
|
||||
+ char *tmp1, *tmp2;
|
||||
+ char buf[256];
|
||||
+ if (!afname[0]) {
|
||||
+ inittab();
|
||||
+ parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp);
|
||||
+ } else {
|
||||
+ safe_strncpy(buf, afname, sizeof(buf));
|
||||
+ tmp1 = buf;
|
||||
+ if ((tmp2 = index(tmp1, ','))) {
|
||||
+ printf("Multiple interface\n");
|
||||
+ } else if(!strncmp(buf,"inet6",5)) {
|
||||
+#if HAVE_AFINET6
|
||||
+ inittab6();
|
||||
+ parsesnmp6(flag_raw, flag_tcp, flag_udp, flag_sctp);
|
||||
+#else
|
||||
+ printf("Address type not supported for stats\n");
|
||||
+#endif
|
||||
+ } else {
|
||||
+ printf("Address type not supported for stats\n");
|
||||
+ }
|
||||
+ }
|
||||
+ exit(1);
|
||||
}
|
||||
|
||||
if (flag_rou) {
|
||||
--- statistics.c.ms 2009-09-14 10:47:18.000000000 +0200
|
||||
+++ statistics.c 2009-09-14 10:49:26.000000000 +0200
|
||||
@@ -83,6 +83,32 @@
|
||||
{"FragCreates", N_("%lu fragments created"), opt_number}
|
||||
};
|
||||
|
||||
+struct entry Ip6tab[] =
|
||||
+{
|
||||
+ {"Ip6InReceives", N_("%u total packets received"), number},
|
||||
+ {"Ip6InHdrErrors", N_("%u with invalid headers"), opt_number},
|
||||
+ {"Ip6InTooBigErrors", N_("%u with packets too big"), opt_number},
|
||||
+ {"Ip6InNoRoutes", N_("%u incoming packets with no route"), opt_number},
|
||||
+ {"Ip6InAddrErrors", N_("%u with invalid addresses"), opt_number},
|
||||
+ {"Ip6InUnknownProtos", N_("%u with unknown protocol"), opt_number},
|
||||
+ {"Ip6InTruncatedPkts", N_("%u with truncated packets"), opt_number},
|
||||
+ {"Ip6InDiscards", N_("%u incoming packets discarded"), number},
|
||||
+ {"Ip6InDelivers", N_("%u incoming packets delivered"), number},
|
||||
+ {"Ip6OutForwDatagrams", N_("%u forwarded"), number},
|
||||
+ {"Ip6OutRequests", N_("%u requests sent out"), number}, /*? */
|
||||
+ {"Ip6OutDiscards", N_("%u outgoing packets dropped"), opt_number},
|
||||
+ {"Ip6OutNoRoutes", N_("%u dropped because of missing route"), opt_number},
|
||||
+ {"Ip6ReasmTimeout", N_("%u fragments dropped after timeout"), opt_number},
|
||||
+ {"Ip6ReasmReqds", N_("%u reassemblies required"), opt_number}, /* ? */
|
||||
+ {"Ip6ReasmOKs", N_("%u packets reassembled ok"), opt_number},
|
||||
+ {"Ip6ReasmFails", N_("%u packet reassembles failed"), opt_number},
|
||||
+ {"Ip6FragOKs", N_("%u fragments received ok"), opt_number},
|
||||
+ {"Ip6FragFails", N_("%u fragments failed"), opt_number},
|
||||
+ {"Ip6FragCreates", N_("%u fragments created"), opt_number},
|
||||
+ {"Ip6InMcastPkts", N_("%u incoming multicast packets"), opt_number},
|
||||
+ {"Ip6OutMcastPkts", N_("%u outgoing multicast packets"), opt_number}
|
||||
+};
|
||||
+
|
||||
struct entry Icmptab[] =
|
||||
{
|
||||
{"InMsgs", N_("%lu ICMP messages received"), number},
|
||||
@@ -113,6 +139,41 @@
|
||||
{"OutAddrMaskReps", N_("address mask replies: %lu"), i_outp_icmp | I_TITLE},
|
||||
};
|
||||
|
||||
+struct entry Icmp6tab[] =
|
||||
+{
|
||||
+ {"Icmp6InMsgs", N_("%u ICMP messages received"), number},
|
||||
+ {"Icmp6InErrors", N_("%u input ICMP message failed."), number},
|
||||
+ {"Icmp6InDestUnreachs", N_("destination unreachable: %u"), i_inp_icmp | I_TITLE},
|
||||
+ {"Icmp6InPktTooBigs", N_("packets too big: %u"), i_inp_icmp | I_TITLE},
|
||||
+ {"Icmp6InTimeExcds", N_("received ICMPv6 time exceeded: %u"), i_inp_icmp | I_TITLE},
|
||||
+ {"Icmp6InParmProblems", N_("parameter problem: %u"), i_inp_icmp | I_TITLE},
|
||||
+ {"Icmp6InEchos", N_("echo requests: %u"), i_inp_icmp | I_TITLE},
|
||||
+ {"Icmp6InEchoReplies", N_("echo replies: %u"), i_inp_icmp | I_TITLE},
|
||||
+ {"Icmp6InGroupMembQueries", N_("group member queries: %u"), i_inp_icmp | I_TITLE},
|
||||
+ {"Icmp6InGroupMembResponses", N_("group member responses: %u"), i_inp_icmp | I_TITLE},
|
||||
+ {"Icmp6InGroupMembReductions", N_("group member reductions: %u"), i_inp_icmp | I_TITLE},
|
||||
+ {"Icmp6InRouterSolicits", N_("router solicits: %u"), i_inp_icmp | I_TITLE},
|
||||
+ {"Icmp6InRouterAdvertisements", N_("router advertisement: %u"), i_inp_icmp | I_TITLE},
|
||||
+ {"Icmp6InNeighborSolicits", N_("neighbour solicits: %u"), i_inp_icmp | I_TITLE},
|
||||
+ {"Icmp6InNeighborAdvertisements", N_("neighbour advertisement: %u"), i_inp_icmp | I_TITLE},
|
||||
+ {"Icmp6InRedirects", N_("redirects: %u"), i_inp_icmp | I_TITLE},
|
||||
+ {"Icmp6OutMsgs", N_("%u ICMP messages sent"), number},
|
||||
+ {"Icmp6OutDestUnreachs", N_("destination unreachable: %u"), i_outp_icmp | I_TITLE},
|
||||
+ {"Icmp6OutPktTooBigs", N_("packets too big: %u"), i_outp_icmp | I_TITLE},
|
||||
+ {"Icmp6OutTimeExcds", N_("sent ICMPv6 time exceeded: %u"), i_outp_icmp | I_TITLE},
|
||||
+ {"Icmp6OutParmProblems", N_("parameter problem: %u"), i_outp_icmp | I_TITLE},
|
||||
+ {"Icmp6OutEchos", N_("echo requests: %u"), i_outp_icmp | I_TITLE},
|
||||
+ {"Icmp6OutEchoReplies", N_("echo replies: %u"), i_outp_icmp | I_TITLE},
|
||||
+ {"Icmp6OutGroupMembQueries", N_("group member queries: %u"), i_outp_icmp | I_TITLE},
|
||||
+ {"Icmp6OutGroupMembResponses", N_("group member responses: %u"), i_outp_icmp | I_TITLE},
|
||||
+ {"Icmp6OutGroupMembReductions", N_("group member reductions: %u"), i_outp_icmp | I_TITLE},
|
||||
+ {"Icmp6OutRouterSolicits", N_("router solicits: %u"), i_outp_icmp | I_TITLE},
|
||||
+ {"Icmp6OutRouterAdvertisements ", N_("router advertisement: %u"), i_outp_icmp | I_TITLE},
|
||||
+ {"Icmp6OutNeighborSolicits", N_("neighbor solicits: %u"), i_outp_icmp | I_TITLE},
|
||||
+ {"Icmp6OutNeighborAdvertisements", N_("neighbor advertisements: %u"), i_outp_icmp | I_TITLE},
|
||||
+ {"Icmp6OutRedirects", N_("redirects: %u"), i_outp_icmp | I_TITLE},
|
||||
+};
|
||||
+
|
||||
struct entry Tcptab[] =
|
||||
{
|
||||
{"RtoAlgorithm", N_("RTO algorithm is %s"), i_rto_alg | I_STATIC},
|
||||
@@ -139,6 +200,14 @@
|
||||
{"OutDatagrams", N_("%lu packets sent"), number},
|
||||
};
|
||||
|
||||
+struct entry Udp6tab[] =
|
||||
+{
|
||||
+ {"Udp6InDatagrams", N_("%u packets received"), number},
|
||||
+ {"Udp6NoPorts", N_("%u packets to unknown port received."), number},
|
||||
+ {"Udp6InErrors", N_("%u packet receive errors"), number},
|
||||
+ {"Udp6OutDatagrams", N_("%u packets sent"), number},
|
||||
+};
|
||||
+
|
||||
struct entry Tcpexttab[] =
|
||||
{
|
||||
{"SyncookiesSent", N_("%lu SYN cookies sent"), opt_number},
|
||||
@@ -226,6 +295,15 @@
|
||||
{NULL}
|
||||
};
|
||||
|
||||
+struct tabtab snmp6tabs[] =
|
||||
+{
|
||||
+ {"Ip6", Ip6tab, sizeof(Ip6tab), &f_raw},
|
||||
+ {"Icmp6", Icmp6tab, sizeof(Icmp6tab), &f_raw},
|
||||
+ {"Udp6", Udp6tab, sizeof(Udp6tab), &f_udp},
|
||||
+ {"Tcp6", Tcptab, sizeof(Tcptab), &f_tcp},
|
||||
+ {NULL}
|
||||
+};
|
||||
+
|
||||
/* XXX IGMP */
|
||||
|
||||
int cmpentries(const void *a, const void *b)
|
||||
@@ -311,7 +389,7 @@
|
||||
return &dummytab;
|
||||
}
|
||||
|
||||
-void process_fd(FILE *f)
|
||||
+void process_fd(FILE *f, int all, char *filter)
|
||||
{
|
||||
char buf1[8192], buf2[8192];
|
||||
char *sp, *np, *p;
|
||||
@@ -327,6 +405,12 @@
|
||||
goto formaterr;
|
||||
*sp = '\0';
|
||||
|
||||
+ if (!all) {
|
||||
+ if (strncmp(buf1, filter, strlen(filter))) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
tab = newtable(snmptabs, buf1);
|
||||
if (tab == NULL) {
|
||||
printf("unknown %s\n", buf1);
|
||||
@@ -387,6 +471,40 @@
|
||||
return;
|
||||
}
|
||||
|
||||
+void cpytitle(char *original, char *new)
|
||||
+{
|
||||
+ char *ptr = original;
|
||||
+ while(*ptr != '6' && *ptr != '\0') {
|
||||
+ *new = *ptr;
|
||||
+ new++;
|
||||
+ ptr++;
|
||||
+ }
|
||||
+ *new = *ptr;
|
||||
+ new++;
|
||||
+ *new = '\0';
|
||||
+}
|
||||
+
|
||||
+void process6_fd(FILE *f)
|
||||
+{
|
||||
+ char buf1[1024],buf2[50],buf3[1024];
|
||||
+ unsigned long val;
|
||||
+ struct tabtab *tab = NULL;
|
||||
+ int cpflg = 0;
|
||||
+
|
||||
+ while (fgets(buf1, sizeof buf1, f)) {
|
||||
+ sscanf(buf1, "%s %lu", buf2, &val);
|
||||
+ if(!cpflg) {
|
||||
+ cpytitle(buf2, buf3);
|
||||
+ tab = newtable(snmp6tabs, buf3);
|
||||
+ cpflg = 1;
|
||||
+ }
|
||||
+ if(!strstr(buf2, buf3)) {
|
||||
+ cpytitle(buf2, buf3);
|
||||
+ tab = newtable(snmp6tabs, buf3);
|
||||
+ }
|
||||
+ printval(tab, buf2, val);
|
||||
+ }
|
||||
+}
|
||||
|
||||
void parsesnmp(int flag_raw, int flag_tcp, int flag_udp, int flag_sctp)
|
||||
{
|
||||
@@ -399,7 +517,7 @@
|
||||
perror(_("cannot open /proc/net/snmp"));
|
||||
return;
|
||||
}
|
||||
- process_fd(f);
|
||||
+ process_fd(f, 1, NULL);
|
||||
|
||||
if (ferror(f))
|
||||
perror("/proc/net/snmp");
|
||||
@@ -409,7 +527,7 @@
|
||||
f = fopen("/proc/net/netstat", "r");
|
||||
|
||||
if (f) {
|
||||
- process_fd(f);
|
||||
+ process_fd(f, 1, NULL);
|
||||
|
||||
if (ferror(f))
|
||||
perror("/proc/net/netstat");
|
||||
@@ -429,7 +547,33 @@
|
||||
|
||||
return;
|
||||
}
|
||||
-
|
||||
+
|
||||
+void parsesnmp6(int flag_raw, int flag_tcp, int flag_udp, int flag_sctp)
|
||||
+{
|
||||
+ FILE *f;
|
||||
+
|
||||
+ f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp, f_sctp = flag_sctp;
|
||||
+
|
||||
+ f = fopen("/proc/net/snmp6", "r");
|
||||
+ if (!f) {
|
||||
+ perror(_("cannot open /proc/net/snmp6"));
|
||||
+ return;
|
||||
+ }
|
||||
+ process6_fd(f);
|
||||
+ if (ferror(f))
|
||||
+ perror("/proc/net/snmp6");
|
||||
+
|
||||
+ fclose(f);
|
||||
+ f = fopen("/proc/net/snmp", "r");
|
||||
+ if (!f) {
|
||||
+ perror(_("cannot open /proc/net/snmp"));
|
||||
+ return;
|
||||
+ }
|
||||
+ process_fd(f, 0, "Tcp");
|
||||
+ if (ferror(f))
|
||||
+ perror("/proc/net/snmp");
|
||||
+ fclose(f);
|
||||
+}
|
||||
|
||||
void inittab(void)
|
||||
{
|
||||
@@ -440,3 +584,13 @@
|
||||
qsort(t->tab, t->size / sizeof(struct entry),
|
||||
sizeof(struct entry), cmpentries);
|
||||
}
|
||||
+
|
||||
+void inittab6(void)
|
||||
+{
|
||||
+ struct tabtab *t;
|
||||
+
|
||||
+ for (t = snmp6tabs; t->title; t++)
|
||||
+ qsort(t->tab, t->size / sizeof(struct entry),
|
||||
+ sizeof(struct entry), cmpentries);
|
||||
+}
|
||||
+
|
|
@ -1,22 +0,0 @@
|
|||
--- lib/x25.c
|
||||
+++ lib/x25.c
|
||||
@@ -119,7 +119,7 @@
|
||||
/* All done. */
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "x25_input(%s): ", orig);
|
||||
- for (i = 0; i < sizeof(x25_address); i++)
|
||||
+ for (i = 0; i < sizeof(struct x25_address); i++)
|
||||
fprintf(stderr, "%02X ", sap->sa_data[i] & 0377);
|
||||
fprintf(stderr, "\n");
|
||||
#endif
|
||||
--- lib/x25_sr.c
|
||||
+++ lib/x25_sr.c
|
||||
@@ -77,7 +77,7 @@
|
||||
rt.sigdigits=sigdigits;
|
||||
|
||||
/* x25_route_struct.address isn't type struct sockaddr_x25, Why? */
|
||||
- memcpy(&rt.address, &sx25.sx25_addr, sizeof(x25_address));
|
||||
+ memcpy(&rt.address, &sx25.sx25_addr, sizeof(struct x25_address));
|
||||
|
||||
while (*args) {
|
||||
if (!strcmp(*args,"device") || !strcmp(*args,"dev")) {
|
|
@ -1,20 +0,0 @@
|
|||
--- net-tools-1.60/lib/inet.c
|
||||
+++ net-tools-1.60/lib/inet.c
|
||||
@@ -144,7 +144,7 @@
|
||||
struct hostent *ent;
|
||||
struct netent *np;
|
||||
struct addr *pn;
|
||||
- unsigned long ad, host_ad;
|
||||
+ uint32_t ad, host_ad;
|
||||
int host = 0;
|
||||
|
||||
/* Grmpf. -FvK */
|
||||
@@ -155,7 +155,7 @@
|
||||
errno = EAFNOSUPPORT;
|
||||
return (-1);
|
||||
}
|
||||
- ad = (unsigned long) sin->sin_addr.s_addr;
|
||||
+ ad = sin->sin_addr.s_addr;
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "rresolve: %08lx, mask %08x, num %08x \n", ad, netmask, numeric);
|
||||
#endif
|
|
@ -1,8 +0,0 @@
|
|||
--- net-tools-1.60/config.in
|
||||
+++ net-tools-1.60/config.in
|
||||
@@ -88,4 +88,4 @@
|
||||
*
|
||||
bool 'IP Masquerading support' HAVE_FW_MASQUERADE y
|
||||
bool 'Build iptunnel and ipmaddr' HAVE_IP_TOOLS y
|
||||
-bool 'Build mii-tool' HAVE_MII y
|
||||
+bool 'Build mii-tool' HAVE_MII n
|
|
@ -1,29 +0,0 @@
|
|||
--- mii-tool.c
|
||||
+++ mii-tool.c
|
||||
@@ -379,16 +379,16 @@
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
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,
|
||||
+"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)
|
|
@ -1,47 +0,0 @@
|
|||
--- net-tools-1.60/nameif.c
|
||||
+++ net-tools-1.60/nameif.c
|
||||
@@ -118,7 +118,8 @@
|
||||
}
|
||||
|
||||
struct change {
|
||||
- struct change *next,**pprev;
|
||||
+ struct change *next;
|
||||
+ int found;
|
||||
char ifname_old[IFNAMSIZ+1];
|
||||
char ifname_new[IFNAMSIZ+1];
|
||||
unsigned char mac[6];
|
||||
@@ -156,10 +157,7 @@
|
||||
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;
|
||||
}
|
||||
@@ -303,20 +301,20 @@
|
||||
if (!ch)
|
||||
continue;
|
||||
|
||||
- *ch->pprev = ch->next;
|
||||
+ ch->found = 1;
|
||||
if (strcmp(p, ch->ifname_new)) {
|
||||
if (setname(p, ch->ifname_new) < 0)
|
||||
complain(_("cannot change name of %s to %s: %s"),
|
||||
p, ch->ifname_new, strerror(errno));
|
||||
}
|
||||
- free(ch);
|
||||
}
|
||||
fclose(ifh);
|
||||
|
||||
while (clist) {
|
||||
struct change *ch = clist;
|
||||
clist = clist->next;
|
||||
- complain(_("interface '%s' not found"), ch->ifname_new);
|
||||
+ if (!ch->found)
|
||||
+ complain(_("interface '%s' not found"), ch->ifname_new);
|
||||
free(ch);
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
--- lib/netrom_gr.c 2009-10-07 12:26:35.000000000 +0200
|
||||
+++ lib/netrom_gr.c 2009-10-07 12:28:15.000000000 +0200
|
||||
@@ -32,8 +32,8 @@
|
||||
|
||||
int NETROM_rprint(int options)
|
||||
{
|
||||
- FILE *f1 = fopen(_PATH_PROCNET_NR_NODES, "r");
|
||||
- FILE *f2 = fopen(_PATH_PROCNET_NR_NEIGH, "r");
|
||||
+ FILE *f1 = NULL;
|
||||
+ FILE *f2 = NULL;
|
||||
char buffer[256];
|
||||
int qual, n, w;
|
||||
/*int ext = options & FLAG_EXT;
|
|
@ -1,46 +0,0 @@
|
|||
--- net-tools-1.60/netstat.c 2008-09-10 08:32:10.000000000 +0000
|
||||
+++ net-tools-1.60/netstat.c 2008-09-10 08:33:08.000000000 +0000
|
||||
@@ -1922,8 +1922,6 @@
|
||||
printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
|
||||
}
|
||||
|
||||
- get_max_ifacename();
|
||||
-
|
||||
if (flag_cacheof == 1) {
|
||||
if (for_all_interfaces(do_if_cache_print, &flag_all, flag_cacheof) < 0) {
|
||||
perror(_("missing interface information"));
|
||||
@@ -2203,6 +2201,7 @@
|
||||
return (i);
|
||||
}
|
||||
if (flag_int) {
|
||||
+ get_max_ifacename(flag_cacheof);
|
||||
for (;;) {
|
||||
i = iface_info();
|
||||
if (!flag_cnt || i)
|
||||
--- net-tools-1.60/lib/interface.c 2008-09-09 21:24:57.612332000 +0200
|
||||
+++ net-tools-1.60/lib/interface.c 2008-09-09 21:27:23.843946000 +0200
|
||||
@@ -140,12 +140,12 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
-void get_max_ifacename(void)
|
||||
+void get_max_ifacename(int flag_cacheof)
|
||||
{
|
||||
struct interface *ife;
|
||||
int tmp = ife_field;
|
||||
|
||||
- if (!int_list && (if_readlist(0) < 0)) {
|
||||
+ if (!int_list && (if_readlist(flag_cacheof) < 0)) {
|
||||
return;
|
||||
}
|
||||
for (ife = int_list; ife; ife = ife->next) {
|
||||
--- net-tools-1.60/include/interface.h 2008-09-09 21:25:12.272655000 +0200
|
||||
+++ net-tools-1.60/include/interface.h 2008-09-09 21:27:48.718043000 +0200
|
||||
@@ -64,6 +64,7 @@
|
||||
extern int if_fetch(struct interface *ife);
|
||||
|
||||
extern int for_all_interfaces(int (*)(struct interface *, void *), void *, int);
|
||||
+extern void get_max_ifacename(int flag_cacheof);
|
||||
extern int free_interface_list(void);
|
||||
extern struct interface *lookup_interface(char *name);
|
||||
extern int if_readlist(int);
|
|
@ -1,215 +0,0 @@
|
|||
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 },
|
||||
};
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
diff -Naurp net-tools-1.60/netstat.c net-tools-1.60-new/netstat.c
|
||||
--- net-tools-1.60/netstat.c 2006-03-17 14:01:23.000000000 +0530
|
||||
+++ net-tools-1.60-new/netstat.c 2006-03-17 13:58:47.000000000 +0530
|
||||
@@ -231,7 +231,7 @@ static struct iface_cache* mycache;
|
||||
|
||||
static struct prg_node {
|
||||
struct prg_node *next;
|
||||
- int inode;
|
||||
+ unsigned long inode;
|
||||
char name[PROGNAME_WIDTH];
|
||||
} *prg_hash[PRG_HASH_SIZE];
|
||||
|
||||
@@ -335,7 +335,7 @@ int do_if_cache_print(struct interface *
|
||||
return res;
|
||||
}
|
||||
|
||||
-static void prg_cache_add(int inode, char *name)
|
||||
+static void prg_cache_add(unsigned long inode, char *name)
|
||||
{
|
||||
unsigned hi = PRG_HASHIT(inode);
|
||||
struct prg_node **pnp,*pn;
|
||||
@@ -358,7 +358,7 @@ static void prg_cache_add(int inode, cha
|
||||
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;
|
||||
@@ -1185,7 +1185,8 @@ static void unix_do_one(int nr, const ch
|
||||
static int has = 0;
|
||||
char path[MAXPATHLEN], ss_flags[32];
|
||||
char *ss_proto, *ss_state, *ss_type;
|
||||
- int num, state, type, inode;
|
||||
+ int num, state, type;
|
||||
+ unsigned long inode;
|
||||
void *d;
|
||||
unsigned long refcnt, proto, flags;
|
||||
|
||||
@@ -1195,14 +1196,14 @@ static void unix_do_one(int nr, const ch
|
||||
return;
|
||||
}
|
||||
path[0] = '\0';
|
||||
- num = sscanf(line, "%p: %lX %lX %lX %X %X %d %s",
|
||||
+ num = sscanf(line, "%p: %lX %lX %lX %X %X %ld %s",
|
||||
&d, &refcnt, &proto, &flags, &type, &state, &inode, path);
|
||||
if (num < 6) {
|
||||
fprintf(stderr, _("warning, got bogus unix line.\n"));
|
||||
return;
|
||||
}
|
||||
if (!(has & HAS_INODE))
|
||||
- snprintf(path,sizeof(path),"%d",inode);
|
||||
+ snprintf(path,sizeof(path),"%ld",inode);
|
||||
|
||||
if (!flag_all) {
|
||||
if ((state == SS_UNCONNECTED) && (flags & SO_ACCEPTCON)) {
|
||||
@@ -1294,7 +1295,7 @@ static void unix_do_one(int nr, const ch
|
||||
printf("%-5s %-6ld %-11s %-10s %-13s ",
|
||||
ss_proto, refcnt, ss_flags, ss_type, ss_state);
|
||||
if (has & HAS_INODE)
|
||||
- printf("%-6d ",inode);
|
||||
+ printf("%-6ld ",inode);
|
||||
else
|
||||
printf("- ");
|
||||
if (flag_prg)
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
--- net-tools-1.60/man/en_US/netstat.8
|
||||
+++ net-tools-1.60/man/en_US/netstat.8
|
||||
@@ -41,8 +41,7 @@
|
||||
.RB [ \-\-continuous | \-c]
|
||||
.P
|
||||
.B netstat
|
||||
-.RB { \-\-interfaces | \-i }
|
||||
-.RI [ iface ]
|
||||
+.RB [ \-\-interfaces | \-i ]
|
||||
.RB [ \-\-all | \-a ]
|
||||
.RB [ \-\-extend | \-e [ \-\-extend | \-e] ]
|
||||
.RB [ \-\-verbose | \-v ]
|
||||
@@ -101,9 +100,8 @@
|
||||
Display the kernel routing tables.
|
||||
.SS "\-\-groups , \-g"
|
||||
Display multicast group membership information for IPv4 and IPv6.
|
||||
-.SS "\-\-interface=\fIiface \fR, \fB\-i"
|
||||
-Display a table of all network interfaces, or the specified
|
||||
-.IR iface ) .
|
||||
+.SS "\-\-interfaces \fR, \fB\-i"
|
||||
+Display a table of all network interfaces.
|
||||
.SS "\-\-masquerade , \-M"
|
||||
Display a list of masqueraded connections.
|
||||
.SS "\-\-statistics , \-s"
|
|
@ -1,25 +0,0 @@
|
|||
--- netstat.c 2009-12-21 15:28:40.000000000 +0530
|
||||
+++ netstat.c 2009-12-21 15:59:54.000000000 +0530
|
||||
@@ -2190,6 +2190,7 @@ int main
|
||||
if (!afname[0]) {
|
||||
inittab();
|
||||
parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp);
|
||||
+ return 0;
|
||||
} else {
|
||||
safe_strncpy(buf, afname, sizeof(buf));
|
||||
tmp1 = buf;
|
||||
@@ -2199,9 +2200,14 @@ int main
|
||||
#if HAVE_AFINET6
|
||||
inittab6();
|
||||
parsesnmp6(flag_raw, flag_tcp, flag_udp, flag_sctp);
|
||||
+ return 0;
|
||||
#else
|
||||
printf("Address type not supported for stats\n");
|
||||
#endif
|
||||
+ } else if(!strncmp(buf,"inet",4)) {
|
||||
+ inittab();
|
||||
+ parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp);
|
||||
+ return 0;
|
||||
} else {
|
||||
printf("Address type not supported for stats\n");
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
--- net-tools-1.60/netstat.c 2009-08-12 10:24:54.000000000 +0200
|
||||
+++ net-tools-1.60/netstat.c 2009-08-12 10:33:00.000000000 +0200
|
||||
@@ -179,6 +179,7 @@
|
||||
int flag_arg = 0;
|
||||
int flag_ver = 0;
|
||||
int flag_cacheof = 0;
|
||||
+int flag_trim = 0;
|
||||
|
||||
#define OPT_SCTP 0x100
|
||||
|
||||
@@ -887,10 +888,10 @@
|
||||
snprintf(buffer, sizeof(buffer), "%s",
|
||||
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 (!flag_trim) {
|
||||
+ if ((strlen(local_addr) + strlen(buffer)) > 22)
|
||||
+ local_addr[22 - strlen(buffer)] = '\0';
|
||||
+ }
|
||||
strcat(local_addr, ":");
|
||||
strcat(local_addr, buffer);
|
||||
snprintf(buffer, sizeof(buffer), "%s",
|
||||
@@ -1038,8 +1039,10 @@
|
||||
snprintf(buffer, sizeof(buffer), "%s",
|
||||
get_sname(htons(local_port), "udp",
|
||||
flag_not & FLAG_NUM_PORT));
|
||||
- if ((strlen(local_addr) + strlen(buffer)) > 22)
|
||||
- local_addr[22 - strlen(buffer)] = '\0';
|
||||
+ if (!flag_trim) {
|
||||
+ if ((strlen(local_addr) + strlen(buffer)) > 22)
|
||||
+ local_addr[22 - strlen(buffer)] = '\0';
|
||||
+ }
|
||||
strcat(local_addr, ":");
|
||||
strcat(local_addr, buffer);
|
||||
|
||||
@@ -1510,8 +1513,10 @@
|
||||
flag_not & FLAG_NUM_PORT));
|
||||
safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr,
|
||||
flag_not & FLAG_NUM_HOST), sizeof(local_addr));
|
||||
- if ((strlen(local_addr) + strlen(buffer)) > 22)
|
||||
- local_addr[22 - strlen(buffer)] = '\0';
|
||||
+ if (!flag_trim) {
|
||||
+ if ((strlen(local_addr) + strlen(buffer)) > 22)
|
||||
+ local_addr[22 - strlen(buffer)] = '\0';
|
||||
+ }
|
||||
strcat(local_addr, ":");
|
||||
strcat(local_addr, buffer);
|
||||
|
||||
@@ -1981,6 +1986,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, _(" -T, --notrim dont't trim address information\n"));
|
||||
|
||||
fprintf(stderr, _(" <Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom --sctp\n"));
|
||||
fprintf(stderr, _(" <AF>=Use '-A <af>' or '--<af>'; default: %s\n"), DFLT_AF);
|
||||
@@ -2026,6 +2032,7 @@
|
||||
{"cache", 0, 0, 'C'},
|
||||
{"fib", 0, 0, 'F'},
|
||||
{"groups", 0, 0, 'g'},
|
||||
+ {"notrim", 0, 0, 'T'},
|
||||
{NULL, 0, 0, 0}
|
||||
};
|
||||
|
||||
@@ -2037,7 +2044,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:acdegphinNorstuVv?wxlT", longopts, &lop)) != EOF)
|
||||
switch (i) {
|
||||
case -1:
|
||||
break;
|
||||
@@ -2137,6 +2144,10 @@
|
||||
usage();
|
||||
case 's':
|
||||
flag_sta++;
|
||||
+ break;
|
||||
+ case 'T':
|
||||
+ flag_trim++;
|
||||
+ break;
|
||||
}
|
||||
|
||||
if (flag_int + flag_rou + flag_mas + flag_sta > 1)
|
||||
--- net-tools-1.60/man/en_US/netstat.8 2009-08-12 10:20:38.000000000 +0200
|
||||
+++ net-tools-1.60/man/en_US/netstat.8 2009-08-12 10:23:27.000000000 +0200
|
||||
@@ -164,6 +164,8 @@
|
||||
Show both listening and non-listening sockets. With the
|
||||
.B --interfaces
|
||||
option, show interfaces that are not marked
|
||||
+.SS "\-T, \-\-notrim"
|
||||
+Don't trim the network address information
|
||||
.SS "\-F"
|
||||
Print routing information from the FIB. (This is the default.)
|
||||
.SS "\-C"
|
|
@ -1,49 +0,0 @@
|
|||
--- net-tools-1.60/netstat.c
|
||||
+++ net-tools-1.60/netstat.c
|
||||
@@ -850,8 +850,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",
|
||||
@@ -1004,7 +1004,7 @@
|
||||
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));
|
||||
@@ -1016,7 +1016,7 @@
|
||||
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));
|
||||
+ flag_not & FLAG_NUM_HOST), sizeof(rem_addr));
|
||||
if ((strlen(rem_addr) + strlen(buffer)) > 22)
|
||||
rem_addr[22 - strlen(buffer)] = '\0';
|
||||
strcat(rem_addr, ":");
|
||||
@@ -1126,7 +1126,7 @@
|
||||
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));
|
||||
+ flag_not & FLAG_NUM_HOST), sizeof(local_addr));
|
||||
if ((strlen(local_addr) + strlen(buffer)) > 22)
|
||||
local_addr[22 - strlen(buffer)] = '\0';
|
||||
strcat(local_addr, ":");
|
||||
@@ -1135,7 +1135,7 @@
|
||||
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));
|
||||
+ flag_not & FLAG_NUM_HOST), sizeof(rem_addr));
|
||||
if ((strlen(rem_addr) + strlen(buffer)) > 22)
|
||||
rem_addr[22 - strlen(buffer)] = '\0';
|
||||
strcat(rem_addr, ":");
|
|
@ -1,260 +0,0 @@
|
|||
Index: net-tools-1.60/arp.c
|
||||
===================================================================
|
||||
--- arp.c
|
||||
+++ arp.c
|
||||
@@ -514,6 +514,10 @@ static void arp_disp(char *name, char *i
|
||||
printf(_("on %s\n"), dev);
|
||||
}
|
||||
|
||||
+static void obsolescence_warning(void)
|
||||
+{
|
||||
+ fprintf(stderr,_("arp is obsolete: please use `ip neigh` instead.\n"));
|
||||
+}
|
||||
|
||||
/* Display the contents of the ARP cache in the kernel. */
|
||||
static int arp_show(char *name)
|
||||
@@ -601,6 +605,7 @@ static int arp_show(char *name)
|
||||
}
|
||||
}
|
||||
(void) fclose(fp);
|
||||
+ obsolescence_warning();
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -662,6 +667,8 @@ int main(int argc, char **argv)
|
||||
textdomain("net-tools");
|
||||
#endif
|
||||
|
||||
+ obsolescence_warning();
|
||||
+
|
||||
/* Initialize variables... */
|
||||
if ((hw = get_hwtype(DFLT_HW)) == NULL) {
|
||||
fprintf(stderr, _("%s: hardware type not supported!\n"), DFLT_HW);
|
||||
Index: net-tools-1.60/ifconfig.c
|
||||
===================================================================
|
||||
--- ifconfig.c
|
||||
+++ ifconfig.c
|
||||
@@ -225,6 +225,19 @@ static int set_netmask(int skfd, struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * This is called twice on purpose. Once at the start of the program,
|
||||
+ * so that users piping it into |less will see it on the first page
|
||||
+ * (if there is lots of output), and once again at the end of the program,
|
||||
+ * for users that do not pipe it into anything, seeing the last page
|
||||
+ * (also with lots of output).
|
||||
+ */
|
||||
+static void obsolescence_warning(void)
|
||||
+{
|
||||
+ fprintf(stderr,_("ifconfig is obsolete: please use `ip addr` or `ip link`. "
|
||||
+ "For statistics, use `ip -s link`.\n"));
|
||||
+}
|
||||
+
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct sockaddr sa, sa_netmask;
|
||||
@@ -253,6 +266,8 @@ int main(int argc, char **argv)
|
||||
textdomain("net-tools");
|
||||
#endif
|
||||
|
||||
+ obsolescence_warning();
|
||||
+
|
||||
/* Find any options. */
|
||||
argc--;
|
||||
argv++;
|
||||
@@ -295,6 +310,8 @@ int main(int argc, char **argv)
|
||||
if (argc == 0) {
|
||||
int err = if_print((char *) NULL);
|
||||
(void) close(skfd);
|
||||
+ if (err == 0)
|
||||
+ obsolescence_warning();
|
||||
exit(err < 0);
|
||||
}
|
||||
/* No. Fetch the interface name. */
|
||||
@@ -987,6 +1004,9 @@ int main(int argc, char **argv)
|
||||
spp++;
|
||||
}
|
||||
|
||||
+ if (goterr == 0)
|
||||
+ obsolescence_warning();
|
||||
+
|
||||
return (goterr);
|
||||
}
|
||||
|
||||
Index: net-tools-1.60/ipmaddr.c
|
||||
===================================================================
|
||||
--- ipmaddr.c
|
||||
+++ ipmaddr.c
|
||||
@@ -396,6 +396,9 @@ int main(int argc, char **argv)
|
||||
textdomain("net-tools");
|
||||
#endif
|
||||
|
||||
+ fprintf(stderr,_("Note: multicast address configuration should "
|
||||
+ "be done through `ip maddr` instead.\n"));
|
||||
+
|
||||
basename = strrchr(argv[0], '/');
|
||||
if (basename == NULL)
|
||||
basename = argv[0];
|
||||
Index: net-tools-1.60/iptunnel.c
|
||||
===================================================================
|
||||
--- iptunnel.c
|
||||
+++ iptunnel.c
|
||||
@@ -587,6 +587,9 @@ int main(int argc, char **argv)
|
||||
textdomain("net-tools");
|
||||
#endif
|
||||
|
||||
+ fprintf(stderr,_("Note: tunnel configuration should "
|
||||
+ "be done through `ip tunnel` instead.\n"));
|
||||
+
|
||||
basename = strrchr(argv[0], '/');
|
||||
if (basename == NULL)
|
||||
basename = argv[0];
|
||||
Index: net-tools-1.60/netstat.c
|
||||
===================================================================
|
||||
--- netstat.c
|
||||
+++ netstat.c
|
||||
@@ -1989,6 +1989,34 @@ static void usage(void)
|
||||
exit(E_USAGE);
|
||||
}
|
||||
|
||||
+static void netstat_obsolescence_warning(void)
|
||||
+{
|
||||
+ fprintf(stderr,_("netstat is obsolete: please use `ss` instead.\n"));
|
||||
+}
|
||||
+
|
||||
+static void route_obsolescence_warning(void)
|
||||
+{
|
||||
+ fprintf(stderr,_("`netstat -r` is obsolete: "
|
||||
+ "please use `ip route` instead.\n"));
|
||||
+}
|
||||
+
|
||||
+static void stat_obsolescence_warning(void)
|
||||
+{
|
||||
+ fprintf(stderr,_("`netstat -i` is obsolete: "
|
||||
+ "please use `ip -s link` instead.\n"));
|
||||
+}
|
||||
+
|
||||
+static void groups_obsolescence_warning(void)
|
||||
+{
|
||||
+ fprintf(stderr,_("`netstat -g` is obsolete: "
|
||||
+ "please use `ip maddr` instead.\n"));
|
||||
+}
|
||||
+
|
||||
+static void masq_obsolescence_warning(void)
|
||||
+{
|
||||
+ fprintf(stderr,_("`netstat -M` is obsolete: "
|
||||
+ "please use `conntrack -L` instead.\n"));
|
||||
+}
|
||||
|
||||
int main
|
||||
(int argc, char *argv[]) {
|
||||
@@ -2152,6 +2180,7 @@ int main
|
||||
+ flag_ax25 + flag_netrom + flag_igmp + flag_x25;
|
||||
|
||||
if (flag_mas) {
|
||||
+ masq_obsolescence_warning();
|
||||
#if HAVE_FW_MASQUERADE && HAVE_AFINET
|
||||
#if MORE_THAN_ONE_MASQ_AF
|
||||
if (!afname[0])
|
||||
@@ -2168,6 +2197,7 @@ int main
|
||||
ENOSUPP("netstat.c", "FW_MASQUERADE");
|
||||
i = -1;
|
||||
#endif
|
||||
+ masq_obsolescence_warning();
|
||||
return (i);
|
||||
}
|
||||
|
||||
@@ -2180,6 +2210,8 @@ int main
|
||||
if (flag_rou) {
|
||||
int options = 0;
|
||||
|
||||
+ route_obsolescence_warning();
|
||||
+
|
||||
if (!afname[0])
|
||||
strcpy(afname, DFLT_AF);
|
||||
|
||||
@@ -2198,9 +2230,11 @@ int main
|
||||
break;
|
||||
sleep(1);
|
||||
}
|
||||
+ route_obsolescence_warning();
|
||||
return (i);
|
||||
}
|
||||
if (flag_int) {
|
||||
+ stat_obsolescence_warning();
|
||||
get_max_ifacename(flag_cacheof);
|
||||
for (;;) {
|
||||
i = iface_info();
|
||||
@@ -2208,8 +2242,10 @@ int main
|
||||
break;
|
||||
sleep(1);
|
||||
}
|
||||
+ stat_obsolescence_warning();
|
||||
return (i);
|
||||
}
|
||||
+ netstat_obsolescence_warning();
|
||||
for (;;) {
|
||||
if (!flag_arg || flag_tcp || flag_udp || flag_sctp || flag_raw) {
|
||||
#if HAVE_AFINET
|
||||
@@ -2261,6 +2297,7 @@ int main
|
||||
}
|
||||
|
||||
if (flag_igmp) {
|
||||
+ groups_obsolescence_warning();
|
||||
#if HAVE_AFINET6
|
||||
printf( "IPv6/");
|
||||
#endif
|
||||
@@ -2268,6 +2305,7 @@ int main
|
||||
printf( _("Interface RefCnt Group\n") );
|
||||
printf( "--------------- ------ ---------------------\n" );
|
||||
i = igmp_info();
|
||||
+ groups_obsolescence_warning();
|
||||
if (i)
|
||||
return (i);
|
||||
}
|
||||
@@ -2340,5 +2378,6 @@ int main
|
||||
sleep(1);
|
||||
prg_cache_clear();
|
||||
}
|
||||
+ netstat_obsolescence_warning();
|
||||
return (i);
|
||||
}
|
||||
Index: net-tools-1.60/route.c
|
||||
===================================================================
|
||||
--- route.c
|
||||
+++ route.c
|
||||
@@ -102,6 +102,10 @@ static void version(void)
|
||||
exit(E_VERSION);
|
||||
}
|
||||
|
||||
+static void obsolescence_warning(void)
|
||||
+{
|
||||
+ fprintf(stderr,_("route is obsolete: please use `ip route` instead.\n"));
|
||||
+}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@@ -128,6 +132,9 @@ int main(int argc, char **argv)
|
||||
bindtextdomain("net-tools", "/usr/share/locale");
|
||||
textdomain("net-tools");
|
||||
#endif
|
||||
+
|
||||
+ obsolescence_warning();
|
||||
+
|
||||
getroute_init(); /* Set up AF routing support */
|
||||
setroute_init();
|
||||
afname[0] = '\0';
|
||||
@@ -218,9 +225,10 @@ int main(int argc, char **argv)
|
||||
if (!opt_fc)
|
||||
options |= FLAG_FIB;
|
||||
|
||||
- if (what == RTACTION_SHOW)
|
||||
+ if (what == RTACTION_SHOW) {
|
||||
i = route_info(afname, options);
|
||||
- else
|
||||
+ obsolescence_warning();
|
||||
+ } else
|
||||
i = route_edit(what, afname, options, ++argv);
|
||||
|
||||
if (i == E_OPTERR)
|
|
@ -1,63 +0,0 @@
|
|||
--- net-tools-1.60/plipconfig.c.org 2012-01-09 11:44:28.000000000 +0100
|
||||
+++ net-tools-1.60/plipconfig.c 2012-01-09 11:53:30.000000000 +0100
|
||||
@@ -62,7 +62,6 @@
|
||||
{
|
||||
fprintf(stderr, _("Usage: plipconfig interface [nibble NN] [trigger NN]\n"));
|
||||
fprintf(stderr, _(" plipconfig [-V] [--version] [-h] [--help]\n"));
|
||||
- exit(-1);
|
||||
}
|
||||
|
||||
void print_plip(void)
|
||||
@@ -91,17 +90,22 @@
|
||||
while (argv[0] && *argv[0] == '-') {
|
||||
if (!strcmp(*argv, "-V") || !strcmp(*argv, "--version"))
|
||||
version();
|
||||
- else if (!strcmp(*argv, "-h") || !strcmp(*argv, "--help"))
|
||||
+ else if (!strcmp(*argv, "-h") || !strcmp(*argv, "--help")) {
|
||||
usage();
|
||||
+ exit(0);
|
||||
+ }
|
||||
else {
|
||||
usage();
|
||||
+ exit(-1);
|
||||
}
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
|
||||
- if (argc == 0)
|
||||
+ if (argc == 0) {
|
||||
usage();
|
||||
+ exit(-1);
|
||||
+ }
|
||||
|
||||
spp = argv;
|
||||
strncpy(ifr.ifr_name, *spp++, IFNAMSIZ);
|
||||
@@ -119,20 +123,25 @@
|
||||
}
|
||||
while (*spp != (char *) NULL) {
|
||||
if (!strcmp(*spp, "nibble")) {
|
||||
- if (*++spp == NULL)
|
||||
+ if (*++spp == NULL) {
|
||||
usage();
|
||||
+ exit(-1);
|
||||
+ }
|
||||
plip->nibble = atoi(*spp);
|
||||
spp++;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(*spp, "trigger")) {
|
||||
- if (*++spp == NULL)
|
||||
+ if (*++spp == NULL) {
|
||||
usage();
|
||||
+ exit(-1);
|
||||
+ }
|
||||
plip->trigger = atoi(*spp);
|
||||
spp++;
|
||||
continue;
|
||||
}
|
||||
usage();
|
||||
+ exit(-1);
|
||||
}
|
||||
|
||||
plip->pcmd = PLIP_SET_TIMEOUT;
|
|
@ -1,14 +0,0 @@
|
|||
--- net-tools-1.60/man/en_US/plipconfig.8.org 2011-04-13 10:03:35.135247120 +0530
|
||||
+++ net-tools-1.60/man/en_US/plipconfig.8 2011-04-13 10:25:55.615256803 +0530
|
||||
@@ -2,9 +2,9 @@
|
||||
.SH NAME
|
||||
plipconfig \- fine tune PLIP device parameters
|
||||
.SH SYNOPSIS
|
||||
-.B "plipconfig interface"
|
||||
+.B "plipconfig interface [nibble NN] [trigger NN]"
|
||||
.br
|
||||
-.B "plipconfig interface [nibble NN] [trigger NN] [unit NN]"
|
||||
+.B "plipconfig [-V] [--version] [-h] [--help]"
|
||||
.SH DESCRIPTION
|
||||
.B Plipconfig
|
||||
is used to (hopefully) improve PLIP performance by changing the default
|
|
@ -1,42 +0,0 @@
|
|||
--- net-tools-1.60/plipconfig.c.org 2011-07-21 04:35:23.000000000 -0400
|
||||
+++ net-tools-1.60/plipconfig.c 2011-07-21 04:35:38.000000000 -0400
|
||||
@@ -43,9 +43,6 @@
|
||||
#include "net-support.h"
|
||||
#include "version.h"
|
||||
|
||||
-int opt_a = 0;
|
||||
-int opt_i = 0;
|
||||
-int opt_v = 0;
|
||||
int skfd = -1;
|
||||
|
||||
struct ifreq ifr;
|
||||
@@ -63,9 +60,8 @@ static void version(void)
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
- fprintf(stderr, _("Usage: plipconfig [-a] [-i] [-v] interface\n"));
|
||||
- fprintf(stderr, _(" [nibble NN] [trigger NN]\n"));
|
||||
- fprintf(stderr, _(" plipconfig -V | --version\n"));
|
||||
+ fprintf(stderr, _("Usage: plipconfig interface [nibble NN] [trigger NN]\n"));
|
||||
+ fprintf(stderr, _(" plipconfig [-V] [--version] [-h] [--help]\n"));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@@ -93,12 +89,13 @@ int main(int argc, char **argv)
|
||||
argc--;
|
||||
argv++;
|
||||
while (argv[0] && *argv[0] == '-') {
|
||||
- if (!strcmp(*argv, "-a"))
|
||||
- opt_a = 1;
|
||||
- if (!strcmp(*argv, "-v"))
|
||||
- opt_v = 1;
|
||||
if (!strcmp(*argv, "-V") || !strcmp(*argv, "--version"))
|
||||
version();
|
||||
+ else if (!strcmp(*argv, "-h") || !strcmp(*argv, "--help"))
|
||||
+ usage();
|
||||
+ else {
|
||||
+ usage();
|
||||
+ }
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
--- net-tools-1.60/statistics.c 2009-05-12 19:11:39.000000000 +0000
|
||||
+++ net-tools-1.60/statistics.c 2009-05-12 19:12:26.000000000 +0000
|
||||
@@ -233,7 +233,7 @@
|
||||
return strcmp(((struct entry *) a)->title, ((struct entry *) b)->title);
|
||||
}
|
||||
|
||||
-void printval(struct tabtab *tab, char *title, int val)
|
||||
+void printval(struct tabtab *tab, char *title, signed long val)
|
||||
{
|
||||
struct entry *ent = NULL, key;
|
||||
int type;
|
||||
@@ -244,7 +244,7 @@
|
||||
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);
|
||||
+ printf("%*s%s: %lu\n", states[state].indent, "", title, val);
|
||||
return;
|
||||
}
|
||||
type = ent->type;
|
|
@ -1,13 +0,0 @@
|
|||
Index: net-tools-1.60/netstat.c
|
||||
===================================================================
|
||||
--- net-tools-1.60.orig/netstat.c
|
||||
+++ net-tools-1.60/netstat.c
|
||||
@@ -2140,7 +2140,7 @@ int main
|
||||
usage();
|
||||
|
||||
if ((flag_inet || flag_inet6 || flag_sta) && !(flag_tcp || flag_udp || flag_sctp || flag_raw))
|
||||
- flag_tcp = flag_udp = flag_sctp = flag_raw = 1;
|
||||
+ flag_tcp = flag_udp = flag_raw = 1;
|
||||
|
||||
if ((flag_tcp || flag_udp || flag_sctp || flag_raw || flag_igmp) && !(flag_inet || flag_inet6))
|
||||
flag_inet = flag_inet6 = 1;
|
|
@ -1,644 +0,0 @@
|
|||
lib/pathnames.h | 2
|
||||
netstat.c | 408 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
statistics.c | 67 ++++++++-
|
||||
3 files changed, 464 insertions(+), 13 deletions(-)
|
||||
|
||||
Index: net-tools-1.60/netstat.c
|
||||
===================================================================
|
||||
--- net-tools-1.60.orig/netstat.c
|
||||
+++ net-tools-1.60/netstat.c
|
||||
@@ -58,6 +58,7 @@
|
||||
*
|
||||
*990420 {1.38} Tuan Hoang removed a useless assignment from igmp_do_one()
|
||||
*20010404 {1.39} Arnaldo Carvalho de Melo - use setlocale
|
||||
+ *20050516 {1.40} Ivan Skytte Joergensen:Added SCTP support
|
||||
*
|
||||
* This program is free software; you can redistribute it
|
||||
* and/or modify it under the terms of the GNU General
|
||||
@@ -102,7 +103,7 @@
|
||||
#endif
|
||||
|
||||
/* prototypes for statistics.c */
|
||||
-void parsesnmp(int, int, int);
|
||||
+void parsesnmp(int, int, int, int);
|
||||
void inittab(void);
|
||||
|
||||
typedef enum {
|
||||
@@ -113,6 +114,29 @@ typedef enum {
|
||||
SS_DISCONNECTING /* in process of disconnecting */
|
||||
} socket_state;
|
||||
|
||||
+
|
||||
+#define SCTP_NSTATES 9 /* The number of states in array*/
|
||||
+
|
||||
+static const char *sctp_state[] = {
|
||||
+ N_("EMPTY"),
|
||||
+ N_("CLOSED"),
|
||||
+ N_("COOKIE_WAIT"),
|
||||
+ N_("COOKIE_ECHOED"),
|
||||
+ N_("ESTABLISHED"),
|
||||
+ N_("SHUTDOWN_PENDING"),
|
||||
+ N_("SHUTDOWN_SENT"),
|
||||
+ N_("SHUTDOWN_RECEIVED"),
|
||||
+ N_("SHUTDOWN_ACK_SENT")
|
||||
+};
|
||||
+
|
||||
+#define SCTP_NTYPES 3 /* The number of types in array */
|
||||
+
|
||||
+static const char *sctp_type[] = {
|
||||
+ N_("udp"),
|
||||
+ N_("udp-high-bw"),
|
||||
+ N_("tcp")
|
||||
+};
|
||||
+
|
||||
#define SO_ACCEPTCON (1<<16) /* performed a listen */
|
||||
#define SO_WAITDATA (1<<17) /* wait data to read */
|
||||
#define SO_NOSPACE (1<<18) /* no space to write */
|
||||
@@ -143,6 +167,7 @@ int flag_opt = 0;
|
||||
int flag_raw = 0;
|
||||
int flag_tcp = 0;
|
||||
int flag_udp = 0;
|
||||
+int flag_sctp= 0;
|
||||
int flag_igmp= 0;
|
||||
int flag_rom = 0;
|
||||
int flag_exp = 1;
|
||||
@@ -151,6 +176,8 @@ int flag_arg = 0;
|
||||
int flag_ver = 0;
|
||||
int flag_cacheof = 0;
|
||||
|
||||
+#define OPT_SCTP 0x100
|
||||
+
|
||||
FILE *procinfo;
|
||||
|
||||
struct iface_cache {
|
||||
@@ -1052,6 +1079,359 @@ static int udp_info(void)
|
||||
udp_do_one);
|
||||
}
|
||||
|
||||
+static const char *sctp_socket_type_str(int type) {
|
||||
+ if(type>=0 && type<SCTP_NTYPES)
|
||||
+ return sctp_type[type];
|
||||
+ else {
|
||||
+ static char type_str_buf[64];
|
||||
+ sprintf(type_str_buf,"UNKNOWN(%d)",type);
|
||||
+ return type_str_buf;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static const char *sctp_state_str(int state)
|
||||
+{
|
||||
+ if(state>=0 && state<SCTP_NSTATES)
|
||||
+ return sctp_state[state];
|
||||
+ else {
|
||||
+ static char state_str_buf[64];
|
||||
+ sprintf(state_str_buf,"UNKNOWN(%d)",state);
|
||||
+ return state_str_buf;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static const char *sctp_socket_state_str(int state)
|
||||
+{
|
||||
+ if(state>=0 && state<=10)
|
||||
+ return tcp_state[state];
|
||||
+ else {
|
||||
+ static char state_str_buf[64];
|
||||
+ sprintf(state_str_buf,"UNKNOWN(%d)",state);
|
||||
+ return state_str_buf;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static struct aftype *process_sctp_addr_str(const char *addr_str, struct sockaddr *sa)
|
||||
+{
|
||||
+ if (strchr(addr_str,':')) {
|
||||
+#if HAVE_AFINET6
|
||||
+ extern struct aftype inet6_aftype;
|
||||
+ /* Demangle what the kernel gives us */
|
||||
+ struct in6_addr in6;
|
||||
+ char addr6_str[INET6_ADDRSTRLEN];
|
||||
+ unsigned u0,u1,u2,u3,u4,u5,u6,u7;
|
||||
+ sscanf(addr_str, "%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",
|
||||
+ &u0, &u1, &u2, &u3, &u4, &u5, &u6, &u7);
|
||||
+ in6.s6_addr16[0] = htons(u0);
|
||||
+ in6.s6_addr16[1] = htons(u1);
|
||||
+ in6.s6_addr16[2] = htons(u2);
|
||||
+ in6.s6_addr16[3] = htons(u3);
|
||||
+ in6.s6_addr16[4] = htons(u4);
|
||||
+ in6.s6_addr16[5] = htons(u5);
|
||||
+ in6.s6_addr16[6] = htons(u6);
|
||||
+ in6.s6_addr16[7] = htons(u7);
|
||||
+
|
||||
+ inet_ntop(AF_INET6, &in6, addr6_str, sizeof(addr6_str));
|
||||
+ inet6_aftype.input(1, addr6_str, sa);
|
||||
+ sa->sa_family = AF_INET6;
|
||||
+#endif
|
||||
+ } else {
|
||||
+ ((struct sockaddr_in*)sa)->sin_addr.s_addr = inet_addr(addr_str);
|
||||
+ sa->sa_family = AF_INET;
|
||||
+ }
|
||||
+ return get_afntype(sa->sa_family);
|
||||
+}
|
||||
+
|
||||
+static void sctp_eps_do_one(int lnr, char *line)
|
||||
+{
|
||||
+ char buffer[1024];
|
||||
+ int type, state, port;
|
||||
+ int uid;
|
||||
+ unsigned long inode;
|
||||
+
|
||||
+ struct aftype *ap;
|
||||
+#if HAVE_AFINET6
|
||||
+ struct sockaddr_in6 localaddr;
|
||||
+#else
|
||||
+ struct sockaddr_in localaddr;
|
||||
+#endif
|
||||
+ const char *sty_str;
|
||||
+ const char *sst_str;
|
||||
+ const char *lport_str;
|
||||
+ const char *uid_str;
|
||||
+ const char *inode_str;
|
||||
+ const char *pladdr_str;
|
||||
+ char *laddrs_str;
|
||||
+
|
||||
+ if(lnr == 0) {
|
||||
+ /* ENDPT SOCK STY SST HBKT LPORT uid inode pladdr LADDRS*/
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ strtok(line," \t\n"); /*skip ptr*/
|
||||
+ strtok(0," \t\n"); /*skip ptr*/
|
||||
+ sty_str = strtok(0," \t\n");
|
||||
+ sst_str = strtok(0," \t\n");
|
||||
+ strtok(0," \t\n"); /*skip hash bucket*/
|
||||
+ lport_str=strtok(0," \t\n");
|
||||
+ uid_str = strtok(0," \t\n");
|
||||
+ inode_str = strtok(0," \t\n");
|
||||
+ pladdr_str = strtok(0," \t\n");
|
||||
+ laddrs_str=strtok(0,"\t\n");
|
||||
+
|
||||
+ type = atoi(sty_str);
|
||||
+ state = atoi(sst_str);
|
||||
+ port = atoi(lport_str);
|
||||
+ uid = atoi(uid_str);
|
||||
+ inode = strtoul(inode_str,0,0);
|
||||
+
|
||||
+ if(flag_sctp<=1) {
|
||||
+ /* only print the primary address */
|
||||
+ char local_addr[64];
|
||||
+ char local_port[16];
|
||||
+
|
||||
+ ap = process_sctp_addr_str(pladdr_str, (struct sockaddr*)&localaddr);
|
||||
+ if(ap)
|
||||
+ safe_strncpy(local_addr,
|
||||
+ ap->sprint((struct sockaddr *) &localaddr, flag_not),
|
||||
+ sizeof(local_addr));
|
||||
+ else
|
||||
+ sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family);
|
||||
+
|
||||
+ snprintf(local_port, sizeof(local_port), "%s",
|
||||
+ get_sname(htons(port), "sctp",
|
||||
+ flag_not & FLAG_NUM_PORT));
|
||||
+
|
||||
+ printf("sctp ");
|
||||
+ sprintf(buffer,"%s:%s", local_addr, local_port);
|
||||
+ printf("%-47s", buffer);
|
||||
+ printf(" %-12s", sctp_socket_state_str(state));
|
||||
+ } else {
|
||||
+ /*print all addresses*/
|
||||
+ const char *this_local_addr;
|
||||
+ int first=1;
|
||||
+ char local_port[16];
|
||||
+ snprintf(local_port, sizeof(local_port), "%s",
|
||||
+ get_sname(htons(port), "sctp",
|
||||
+ flag_not & FLAG_NUM_PORT));
|
||||
+ for(this_local_addr=strtok(laddrs_str," \t\n");
|
||||
+ this_local_addr;
|
||||
+ this_local_addr=strtok(0," \t\n"))
|
||||
+ {
|
||||
+ char local_addr[64];
|
||||
+ ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr);
|
||||
+ if(ap)
|
||||
+ safe_strncpy(local_addr,
|
||||
+ ap->sprint((struct sockaddr *) &localaddr, flag_not),
|
||||
+ sizeof(local_addr));
|
||||
+ else
|
||||
+ sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family);
|
||||
+
|
||||
+ if(!first) printf("\n");
|
||||
+ if(first)
|
||||
+ printf("sctp ");
|
||||
+ else
|
||||
+ printf(" ");
|
||||
+ sprintf(buffer,"%s:%s", local_addr, local_port);
|
||||
+ printf("%-47s", buffer);
|
||||
+ printf(" %-12s", first?sctp_socket_state_str(state):"");
|
||||
+ first = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ finish_this_one(uid,inode,"");
|
||||
+}
|
||||
+
|
||||
+static void sctp_assoc_do_one(int lnr, char *line)
|
||||
+{
|
||||
+ char buffer[1024];
|
||||
+ int type, state, state2, lport,rport;
|
||||
+ int uid;
|
||||
+ unsigned rxqueue,txqueue;
|
||||
+ unsigned long inode;
|
||||
+
|
||||
+ struct aftype *ap;
|
||||
+#if HAVE_AFINET6
|
||||
+ struct sockaddr_in6 localaddr,remoteaddr;
|
||||
+#else
|
||||
+ struct sockaddr_in localaddr,remoteaddr;
|
||||
+#endif
|
||||
+ const char *sty_str;
|
||||
+ const char *sst_str;
|
||||
+ const char *st_str;
|
||||
+ const char *txqueue_str;
|
||||
+ const char *rxqueue_str;
|
||||
+ const char *lport_str,*rport_str;
|
||||
+ const char *uid_str;
|
||||
+ const char *inode_str;
|
||||
+ const char *pladdr_str;
|
||||
+ char *laddrs_str;
|
||||
+ const char *praddr_str;
|
||||
+ char *raddrs_str;
|
||||
+
|
||||
+ if(lnr == 0) {
|
||||
+ /* ASSOC SOCK STY SST ST HBKT tx_queue rx_queue uid inode LPORT RPORT pladdr praddr LADDRS <-> RADDRS*/
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ strtok(line," \t\n"); /*skip ptr*/
|
||||
+ strtok(0," \t\n"); /*skip ptr*/
|
||||
+ sty_str = strtok(0," \t\n");
|
||||
+ sst_str = strtok(0," \t\n");
|
||||
+ st_str = strtok(0," \t\n");
|
||||
+ strtok(0," \t\n"); /*skip hash bucket*/
|
||||
+ txqueue_str = strtok(0," \t\n");
|
||||
+ rxqueue_str = strtok(0," \t\n");
|
||||
+ uid_str = strtok(0," \t\n");
|
||||
+ inode_str = strtok(0," \t\n");
|
||||
+ lport_str=strtok(0," \t\n");
|
||||
+ rport_str=strtok(0," \t\n");
|
||||
+ pladdr_str = strtok(0," \t\n");
|
||||
+ praddr_str = strtok(0," \t\n");
|
||||
+ laddrs_str=strtok(0,"<->\t\n");
|
||||
+ raddrs_str=strtok(0,"<->\t\n");
|
||||
+
|
||||
+ type = atoi(sty_str);
|
||||
+ state = atoi(sst_str);
|
||||
+ state2 = atoi(st_str);
|
||||
+ txqueue = atoi(txqueue_str);
|
||||
+ rxqueue = atoi(rxqueue_str);
|
||||
+ uid = atoi(uid_str);
|
||||
+ inode = strtoul(inode_str,0,0);
|
||||
+ lport = atoi(lport_str);
|
||||
+ rport = atoi(rport_str);
|
||||
+
|
||||
+ if(flag_sctp<=1) {
|
||||
+ /* only print the primary addresses */
|
||||
+ char local_addr[64];
|
||||
+ char local_port[16];
|
||||
+ char remote_addr[64];
|
||||
+ char remote_port[16];
|
||||
+
|
||||
+ ap = process_sctp_addr_str(pladdr_str, (struct sockaddr*)&localaddr);
|
||||
+ if(ap)
|
||||
+ safe_strncpy(local_addr,
|
||||
+ ap->sprint((struct sockaddr *) &localaddr, flag_not),
|
||||
+ sizeof(local_addr));
|
||||
+ else
|
||||
+ sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family);
|
||||
+
|
||||
+ snprintf(local_port, sizeof(local_port), "%s",
|
||||
+ get_sname(htons(lport), "sctp",
|
||||
+ flag_not & FLAG_NUM_PORT));
|
||||
+
|
||||
+ ap = process_sctp_addr_str(praddr_str, (struct sockaddr*)&remoteaddr);
|
||||
+ if(ap)
|
||||
+ safe_strncpy(remote_addr,
|
||||
+ ap->sprint((struct sockaddr *) &remoteaddr, flag_not),
|
||||
+ sizeof(remote_addr));
|
||||
+ else
|
||||
+ sprintf(remote_addr,_("unsupported address family %d"), ((struct sockaddr*)&remoteaddr)->sa_family);
|
||||
+
|
||||
+ snprintf(remote_port, sizeof(remote_port), "%s",
|
||||
+ get_sname(htons(rport), "sctp",
|
||||
+ flag_not & FLAG_NUM_PORT));
|
||||
+
|
||||
+ printf("sctp");
|
||||
+ printf(" %6u %6u ", rxqueue, txqueue);
|
||||
+ sprintf(buffer,"%s:%s", local_addr, local_port);
|
||||
+ printf("%-23s", buffer);
|
||||
+ printf(" ");
|
||||
+ sprintf(buffer,"%s:%s", remote_addr, remote_port);
|
||||
+ printf("%-23s", buffer);
|
||||
+ printf(" %-12s", sctp_socket_state_str(state));
|
||||
+ } else {
|
||||
+ /*print all addresses*/
|
||||
+ const char *this_local_addr;
|
||||
+ const char *this_remote_addr;
|
||||
+ char *ss1,*ss2;
|
||||
+ int first=1;
|
||||
+ char local_port[16];
|
||||
+ char remote_port[16];
|
||||
+ snprintf(local_port, sizeof(local_port), "%s",
|
||||
+ get_sname(htons(lport), "sctp",
|
||||
+ flag_not & FLAG_NUM_PORT));
|
||||
+ snprintf(remote_port, sizeof(remote_port), "%s",
|
||||
+ get_sname(htons(rport), "sctp",
|
||||
+ flag_not & FLAG_NUM_PORT));
|
||||
+
|
||||
+ this_local_addr=strtok_r(laddrs_str," \t\n",&ss1);
|
||||
+ this_remote_addr=strtok_r(raddrs_str," \t\n",&ss2);
|
||||
+ while(this_local_addr || this_remote_addr) {
|
||||
+ char local_addr[64];
|
||||
+ char remote_addr[64];
|
||||
+ if(this_local_addr) {
|
||||
+ ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr);
|
||||
+ if(ap)
|
||||
+ safe_strncpy(local_addr,
|
||||
+ ap->sprint((struct sockaddr *) &localaddr, flag_not),
|
||||
+ sizeof(local_addr));
|
||||
+ else
|
||||
+ sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family);
|
||||
+ }
|
||||
+ if(this_remote_addr) {
|
||||
+ ap = process_sctp_addr_str(this_remote_addr, (struct sockaddr*)&remoteaddr);
|
||||
+ if(ap)
|
||||
+ safe_strncpy(remote_addr,
|
||||
+ ap->sprint((struct sockaddr *) &remoteaddr, flag_not),
|
||||
+ sizeof(remote_addr));
|
||||
+ else
|
||||
+ sprintf(remote_addr,_("unsupported address family %d"), ((struct sockaddr*)&remoteaddr)->sa_family);
|
||||
+ }
|
||||
+
|
||||
+ if(!first) printf("\n");
|
||||
+ if(first)
|
||||
+ printf("sctp %6u %6u ", rxqueue, txqueue);
|
||||
+ else
|
||||
+ printf(" ");
|
||||
+ if(this_local_addr) {
|
||||
+ if(first)
|
||||
+ sprintf(buffer,"%s:%s", local_addr, local_port);
|
||||
+ else
|
||||
+ sprintf(buffer,"%s", local_addr);
|
||||
+ printf("%-23s", buffer);
|
||||
+ } else
|
||||
+ printf("%-23s", "");
|
||||
+ printf(" ");
|
||||
+ if(this_remote_addr) {
|
||||
+ if(first)
|
||||
+ sprintf(buffer,"%s:%s", remote_addr, remote_port);
|
||||
+ else
|
||||
+ sprintf(buffer,"%s", remote_addr);
|
||||
+ printf("%-23s", buffer);
|
||||
+ } else
|
||||
+ printf("%-23s", "");
|
||||
+
|
||||
+ printf(" %-12s", first?sctp_socket_state_str(state):"");
|
||||
+
|
||||
+ first = 0;
|
||||
+ this_local_addr=strtok_r(0," \t\n",&ss1);
|
||||
+ this_remote_addr=strtok_r(0," \t\n",&ss2);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ finish_this_one(uid,inode,"");
|
||||
+}
|
||||
+
|
||||
+static int sctp_info_eps(void)
|
||||
+{
|
||||
+ INFO_GUTS(_PATH_PROCNET_SCTP_EPS, "AF INET (sctp)",
|
||||
+ sctp_eps_do_one);
|
||||
+}
|
||||
+
|
||||
+static int sctp_info_assocs(void)
|
||||
+{
|
||||
+ INFO_GUTS(_PATH_PROCNET_SCTP_ASSOCS, "AF INET (sctp)",
|
||||
+ sctp_assoc_do_one);
|
||||
+}
|
||||
+
|
||||
+static int sctp_info(void)
|
||||
+{
|
||||
+ if(flag_all)
|
||||
+ sctp_info_eps();
|
||||
+ return sctp_info_assocs();
|
||||
+}
|
||||
+
|
||||
static void raw_do_one(int lnr, const char *line)
|
||||
{
|
||||
char buffer[8192], local_addr[64], rem_addr[64];
|
||||
@@ -1599,7 +1979,7 @@ static void usage(void)
|
||||
fprintf(stderr, _(" -F, --fib display Forwarding Information Base (default)\n"));
|
||||
fprintf(stderr, _(" -C, --cache display routing cache instead of FIB\n\n"));
|
||||
|
||||
- fprintf(stderr, _(" <Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom\n"));
|
||||
+ fprintf(stderr, _(" <Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom --sctp\n"));
|
||||
fprintf(stderr, _(" <AF>=Use '-A <af>' or '--<af>'; default: %s\n"), DFLT_AF);
|
||||
fprintf(stderr, _(" List of possible address families (which support routing):\n"));
|
||||
print_aflist(1); /* 1 = routeable */
|
||||
@@ -1624,6 +2004,7 @@ int main
|
||||
{"protocol", 1, 0, 'A'},
|
||||
{"tcp", 0, 0, 't'},
|
||||
{"udp", 0, 0, 'u'},
|
||||
+ {"sctp", 0, 0, OPT_SCTP },
|
||||
{"raw", 0, 0, 'w'},
|
||||
{"unix", 0, 0, 'x'},
|
||||
{"listening", 0, 0, 'l'},
|
||||
@@ -1653,7 +2034,7 @@ int main
|
||||
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:acdegphinNorstuVv?wxl", longopts, &lop)) != EOF)
|
||||
switch (i) {
|
||||
case -1:
|
||||
break;
|
||||
@@ -1735,10 +2116,12 @@ int main
|
||||
case 't':
|
||||
flag_tcp++;
|
||||
break;
|
||||
-
|
||||
case 'u':
|
||||
flag_udp++;
|
||||
break;
|
||||
+ case OPT_SCTP:
|
||||
+ flag_sctp++;
|
||||
+ break;
|
||||
case 'w':
|
||||
flag_raw++;
|
||||
break;
|
||||
@@ -1756,13 +2139,13 @@ int main
|
||||
if (flag_int + flag_rou + flag_mas + flag_sta > 1)
|
||||
usage();
|
||||
|
||||
- if ((flag_inet || flag_inet6 || flag_sta) && !(flag_tcp || flag_udp || flag_raw))
|
||||
- flag_tcp = flag_udp = flag_raw = 1;
|
||||
+ if ((flag_inet || flag_inet6 || flag_sta) && !(flag_tcp || flag_udp || flag_sctp || flag_raw))
|
||||
+ flag_tcp = flag_udp = flag_sctp = flag_raw = 1;
|
||||
|
||||
- if ((flag_tcp || flag_udp || flag_raw || flag_igmp) && !(flag_inet || flag_inet6))
|
||||
+ if ((flag_tcp || flag_udp || flag_sctp || flag_raw || flag_igmp) && !(flag_inet || flag_inet6))
|
||||
flag_inet = flag_inet6 = 1;
|
||||
|
||||
- flag_arg = flag_tcp + flag_udp + flag_raw + flag_unx + flag_ipx
|
||||
+ flag_arg = flag_tcp + flag_udp + flag_sctp + flag_raw + flag_unx + flag_ipx
|
||||
+ flag_ax25 + flag_netrom + flag_igmp + flag_x25;
|
||||
|
||||
if (flag_mas) {
|
||||
@@ -1787,7 +2170,7 @@ int main
|
||||
|
||||
if (flag_sta) {
|
||||
inittab();
|
||||
- parsesnmp(flag_raw, flag_tcp, flag_udp);
|
||||
+ parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -1824,7 +2207,7 @@ int main
|
||||
return (i);
|
||||
}
|
||||
for (;;) {
|
||||
- if (!flag_arg || flag_tcp || flag_udp || flag_raw) {
|
||||
+ if (!flag_arg || flag_tcp || flag_udp || flag_sctp || flag_raw) {
|
||||
#if HAVE_AFINET
|
||||
prg_cache_load();
|
||||
printf(_("Active Internet connections ")); /* xxx */
|
||||
@@ -1862,6 +2245,11 @@ int main
|
||||
if (i)
|
||||
return (i);
|
||||
}
|
||||
+ if (!flag_arg || flag_sctp) {
|
||||
+ i = sctp_info();
|
||||
+ if (i)
|
||||
+ return (i);
|
||||
+ }
|
||||
if (!flag_arg || flag_raw) {
|
||||
i = raw_info();
|
||||
if (i)
|
||||
Index: net-tools-1.60/statistics.c
|
||||
===================================================================
|
||||
--- net-tools-1.60.orig/statistics.c
|
||||
+++ net-tools-1.60/statistics.c
|
||||
@@ -20,7 +20,7 @@
|
||||
#define UFWARN(x)
|
||||
#endif
|
||||
|
||||
-int print_static,f_raw,f_tcp,f_udp,f_unknown = 1;
|
||||
+int print_static,f_raw,f_tcp,f_udp,f_sctp,f_unknown = 1;
|
||||
|
||||
enum State {
|
||||
number = 0, opt_number, i_forward, i_inp_icmp, i_outp_icmp, i_rto_alg,
|
||||
@@ -187,6 +187,27 @@ struct entry Tcpexttab[] =
|
||||
"packet sending"), opt_number },
|
||||
};
|
||||
|
||||
+struct entry Sctptab[] =
|
||||
+{
|
||||
+ {"SctpCurrEstab", N_("%u Current Associations"), number},
|
||||
+ {"SctpActiveEstabs", N_("%u Active Associations"), number},
|
||||
+ {"SctpPassiveEstabs", N_("%u Passive Associations"), number},
|
||||
+ {"SctpAborteds", N_("%u Number of Aborteds "), number},
|
||||
+ {"SctpShutdowns", N_("%u Number of Graceful Terminations"), number},
|
||||
+ {"SctpOutOfBlues", N_("%u Number of Out of Blue packets"), number},
|
||||
+ {"SctpChecksumErrors", N_("%u Number of Packets with invalid Checksum"), number},
|
||||
+ {"SctpOutCtrlChunks", N_("%u Number of control chunks sent"), number},
|
||||
+ {"SctpOutOrderChunks", N_("%u Number of ordered chunks sent"), number},
|
||||
+ {"SctpOutUnorderChunks", N_("%u Number of Unordered chunks sent"), number},
|
||||
+ {"SctpInCtrlChunks", N_("%u Number of control chunks received"), number},
|
||||
+ {"SctpInOrderChunks", N_("%u Number of ordered chunks received"), number},
|
||||
+ {"SctpInUnorderChunks", N_("%u Number of Unordered chunks received"), number},
|
||||
+ {"SctpFragUsrMsgs", N_("%u Number of messages fragmented"), number},
|
||||
+ {"SctpReasmUsrMsgs", N_("%u Number of messages reassembled "), number},
|
||||
+ {"SctpOutSCTPPacks", N_("%u Number of SCTP packets sent"), number},
|
||||
+ {"SctpInSCTPPacks", N_("%u Number of SCTP packets received"), number},
|
||||
+};
|
||||
+
|
||||
struct tabtab {
|
||||
char *title;
|
||||
struct entry *tab;
|
||||
@@ -200,6 +221,7 @@ struct tabtab snmptabs[] =
|
||||
{"Icmp", Icmptab, sizeof(Icmptab), &f_raw},
|
||||
{"Tcp", Tcptab, sizeof(Tcptab), &f_tcp},
|
||||
{"Udp", Udptab, sizeof(Udptab), &f_udp},
|
||||
+ {"Sctp", Sctptab, sizeof(Sctptab), &f_sctp},
|
||||
{"TcpExt", Tcpexttab, sizeof(Tcpexttab), &f_tcp},
|
||||
{NULL}
|
||||
};
|
||||
@@ -337,12 +359,40 @@ formaterr:
|
||||
return;
|
||||
}
|
||||
|
||||
+/* Process a file with name-value lines (like /proc/net/sctp/snmp) */
|
||||
+void process_fd2(FILE *f, const char *filename)
|
||||
+{
|
||||
+ char buf1[1024];
|
||||
+ char *sp;
|
||||
+ struct tabtab *tab;
|
||||
+
|
||||
+ tab = newtable(snmptabs, "Sctp");
|
||||
+
|
||||
+ while (fgets(buf1, sizeof buf1, f)) {
|
||||
+ sp = buf1 + strcspn(buf1, " \t\n");
|
||||
+ if (!sp)
|
||||
+ goto formaterr;
|
||||
+ *sp = '\0';
|
||||
+ sp++;
|
||||
+
|
||||
+ sp += strspn(sp, " \t\n");
|
||||
+
|
||||
+ if (*sp != '\0' && *(tab->flag))
|
||||
+ printval(tab, buf1, strtoul(sp, 0, 10));
|
||||
+ }
|
||||
+ return;
|
||||
+
|
||||
+formaterr:
|
||||
+ fprintf(stderr,_("error parsing %s\n"), filename);
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
|
||||
-void parsesnmp(int flag_raw, int flag_tcp, int flag_udp)
|
||||
+void parsesnmp(int flag_raw, int flag_tcp, int flag_udp, int flag_sctp)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
- f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp;
|
||||
+ f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp, f_sctp = flag_sctp;
|
||||
|
||||
f = fopen("/proc/net/snmp", "r");
|
||||
if (!f) {
|
||||
@@ -366,6 +416,17 @@ void parsesnmp(int flag_raw, int flag_tc
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
+
|
||||
+ f = fopen("/proc/net/sctp/snmp", "r");
|
||||
+ if (f) {
|
||||
+ process_fd2(f,"/proc/net/sctp/snmp");
|
||||
+ if (ferror(f))
|
||||
+ perror("/proc/net/sctp/snmp");
|
||||
+
|
||||
+ fclose(f);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
return;
|
||||
}
|
||||
|
||||
Index: net-tools-1.60/lib/pathnames.h
|
||||
===================================================================
|
||||
--- net-tools-1.60.orig/lib/pathnames.h
|
||||
+++ net-tools-1.60/lib/pathnames.h
|
||||
@@ -45,6 +45,8 @@
|
||||
#define _PATH_PROCNET_X25 "/proc/net/x25"
|
||||
#define _PATH_PROCNET_X25_ROUTE "/proc/net/x25_routes"
|
||||
#define _PATH_PROCNET_DEV_MCAST "/proc/net/dev_mcast"
|
||||
+#define _PATH_PROCNET_SCTP_EPS "/proc/net/sctp/eps"
|
||||
+#define _PATH_PROCNET_SCTP_ASSOCS "/proc/net/sctp/assocs"
|
||||
|
||||
/* pathname for the netlink device */
|
||||
#define _PATH_DEV_ROUTE "/dev/route"
|
|
@ -1,13 +0,0 @@
|
|||
diff -u net-tools-1.60/statistics.c~ net-tools-1.60/statistics.c
|
||||
--- net-tools-1.60/statistics.c~ 2001-02-02 19:01:23.000000000 +0100
|
||||
+++ net-tools-1.60/statistics.c 2006-02-06 11:49:39.000000000 +0100
|
||||
@@ -291,7 +291,7 @@
|
||||
|
||||
void process_fd(FILE *f)
|
||||
{
|
||||
- char buf1[1024], buf2[1024];
|
||||
+ char buf1[8192], buf2[8192];
|
||||
char *sp, *np, *p;
|
||||
while (fgets(buf1, sizeof buf1, f)) {
|
||||
int endflag;
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
--- net-tools-1.60/mii-tool.c
|
||||
+++ net-tools-1.60/mii-tool.c
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
+#include <linux/sockios.h>
|
||||
#ifndef __GLIBC__
|
||||
#include <linux/if_arp.h>
|
||||
#include <linux/if_ether.h>
|
|
@ -1,38 +0,0 @@
|
|||
Index: net-tools-1.60/lib/masq_info.c
|
||||
===================================================================
|
||||
--- net-tools-1.60.orig/lib/masq_info.c
|
||||
+++ net-tools-1.60/lib/masq_info.c
|
||||
@@ -98,16 +98,16 @@ static int read_masqinfo(FILE * f, struc
|
||||
if (has_pdelta) {
|
||||
if ((n = fscanf(f, " %s %lX:%hX %lX:%hX %hX %lX %hd %hd %lu",
|
||||
buf,
|
||||
- (unsigned long *) &ms->src.sin_addr.s_addr, &ms->sport,
|
||||
- (unsigned long *) &ms->dst.sin_addr.s_addr, &ms->dport,
|
||||
+ &ms->src.sin_addr.s_addr, &ms->sport,
|
||||
+ &ms->dst.sin_addr.s_addr, &ms->dport,
|
||||
&ms->mport, &ms->initseq, &ms->delta,
|
||||
&ms->pdelta, &ms->expires)) == -1)
|
||||
return nread;
|
||||
} else {
|
||||
if ((n = fscanf(f, " %s %lX:%hX %lX:%hX %hX %lX %hd %lu",
|
||||
buf,
|
||||
- (unsigned long *) &ms->src.sin_addr.s_addr, &ms->sport,
|
||||
- (unsigned long *) &ms->dst.sin_addr.s_addr, &ms->dport,
|
||||
+ &ms->src.sin_addr.s_addr, &ms->sport,
|
||||
+ &ms->dst.sin_addr.s_addr, &ms->dport,
|
||||
&ms->mport, &ms->initseq, &ms->delta,
|
||||
&ms->expires)) == -1)
|
||||
return nread;
|
||||
Index: net-tools-1.60/plipconfig.c
|
||||
===================================================================
|
||||
--- net-tools-1.60.orig/plipconfig.c
|
||||
+++ net-tools-1.60/plipconfig.c
|
||||
@@ -108,7 +108,7 @@ int main(int argc, char **argv)
|
||||
|
||||
spp = argv;
|
||||
strncpy(ifr.ifr_name, *spp++, IFNAMSIZ);
|
||||
- plip=(struct plipconf *)&ifr.ifr_data;
|
||||
+ plip=&ifr.ifr_data;
|
||||
|
||||
plip->pcmd = PLIP_GET_TIMEOUT; /* get current settings for device */
|
||||
if (ioctl(skfd, SIOCDEVPLIP, &ifr) < 0) {
|
|
@ -1,12 +0,0 @@
|
|||
# A length of accepted tcp/unix connections queue is passed in this field since kernel 2.6.18
|
||||
# andrei.nigmatulin@gmail.com
|
||||
--- net-tools-1.60/netstat.c 2008-08-04 19:53:08.000000000 +0100
|
||||
+++ net-tools-1.60/netstat.c 2008-08-04 19:53:16.000000000 +0100
|
||||
@@ -877,7 +877,6 @@
|
||||
if (state == TCP_LISTEN) {
|
||||
time_len = 0;
|
||||
retr = 0L;
|
||||
- rxq = 0L;
|
||||
txq = 0L;
|
||||
}
|
||||
safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr,
|
|
@ -1,175 +0,0 @@
|
|||
--- o/lib/inet.c 2016-11-01 01:21:04.603738000 +0100
|
||||
+++ n/lib/inet.c 2016-11-01 01:16:39.432527900 +0100
|
||||
@@ -73,14 +73,15 @@
|
||||
|
||||
static struct addr *INET_nn = NULL; /* addr-to-name cache */
|
||||
|
||||
+#define gethostbyname(N) NULL
|
||||
|
||||
static int INET_resolve(char *name, struct sockaddr_in *sin, int hostfirst)
|
||||
{
|
||||
struct hostent *hp;
|
||||
struct netent *np;
|
||||
-
|
||||
+ struct addrinfo * ai, hints = { 0 };
|
||||
/* Grmpf. -FvK */
|
||||
- sin->sin_family = AF_INET;
|
||||
+ hints .ai_family = sin->sin_family = AF_INET;
|
||||
sin->sin_port = 0;
|
||||
|
||||
/* Default is special, meaning 0.0.0.0. */
|
||||
@@ -96,6 +97,14 @@
|
||||
#ifdef DEBUG
|
||||
if (hostfirst) fprintf (stderr, "gethostbyname (%s)\n", name);
|
||||
#endif
|
||||
+ if (hostfirst)
|
||||
+ {
|
||||
+ int const e = getaddrinfo (name, NULL, &hints, &ai);
|
||||
+ switch (e)
|
||||
+ {
|
||||
+ case 0: memcpy (&sin ->sin_addr, ai ->ai_addr, ai ->ai_addrlen); freeaddrinfo (ai); return 0;
|
||||
+ case EAI_AGAIN: h_errno = TRY_AGAIN; break; default: h_errno = NO_RECOVERY; break; }
|
||||
+ }
|
||||
if (hostfirst &&
|
||||
(hp = gethostbyname(name)) != (struct hostent *) NULL) {
|
||||
memcpy((char *) &sin->sin_addr, (char *) hp->h_addr_list[0],
|
||||
@@ -123,6 +132,13 @@
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "gethostbyname (%s)\n", name);
|
||||
#endif
|
||||
+ {
|
||||
+ int const e = getaddrinfo (name, NULL, &hints, &ai);
|
||||
+ switch (e)
|
||||
+ {
|
||||
+ case 0: memcpy (&sin ->sin_addr, ai ->ai_addr, ai ->ai_addrlen); freeaddrinfo (ai); return 0;
|
||||
+ case EAI_AGAIN: h_errno = TRY_AGAIN; break; default: h_errno = NO_RECOVERY; break; }
|
||||
+ }
|
||||
if ((hp = gethostbyname(name)) == (struct hostent *) NULL) {
|
||||
errno = h_errno;
|
||||
return -1;
|
||||
--- o/rarp.c 2001-04-08 18:05:05.000000000 +0100
|
||||
+++ n/rarp.c 2016-11-01 10:18:47.603745500 +0100
|
||||
@@ -48,19 +48,18 @@
|
||||
static struct hwtype *hardware = NULL;
|
||||
|
||||
/* Delete an entry from the RARP cache. */
|
||||
-static int rarp_delete(int fd, struct hostent *hp)
|
||||
+static int rarp_delete(int fd, struct addrinfo *ai)
|
||||
{
|
||||
struct arpreq req;
|
||||
struct sockaddr_in *si;
|
||||
unsigned int found = 0;
|
||||
- char **addr;
|
||||
|
||||
/* The host can have more than one address, so we loop on them. */
|
||||
- for (addr = hp->h_addr_list; *addr != NULL; addr++) {
|
||||
+ for (; ai != NULL; ai = ai ->ai_next) {
|
||||
memset((char *) &req, 0, sizeof(req));
|
||||
si = (struct sockaddr_in *) &req.arp_pa;
|
||||
- si->sin_family = hp->h_addrtype;
|
||||
- memcpy((char *) &si->sin_addr, *addr, hp->h_length);
|
||||
+ si->sin_family = ai ->ai_family;
|
||||
+ memcpy((char *) &si->sin_addr, ai ->ai_addr, ai ->ai_addrlen);
|
||||
|
||||
/* Call the kernel. */
|
||||
if (ioctl(fd, SIOCDRARP, &req) == 0) {
|
||||
@@ -80,13 +79,13 @@
|
||||
}
|
||||
|
||||
if (found == 0)
|
||||
- printf(_("no RARP entry for %s.\n"), hp->h_name);
|
||||
+ printf(_("no RARP entry for %s.\n"), ai ->ai_canonname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Set an entry in the RARP cache. */
|
||||
-static int rarp_set(int fd, struct hostent *hp, char *hw_addr)
|
||||
+static int rarp_set(int fd, struct addrinfo *ai, char *hw_addr)
|
||||
{
|
||||
struct arpreq req;
|
||||
struct sockaddr_in *si;
|
||||
@@ -99,8 +98,8 @@
|
||||
/* Clear and fill in the request block. */
|
||||
memset((char *) &req, 0, sizeof(req));
|
||||
si = (struct sockaddr_in *) &req.arp_pa;
|
||||
- si->sin_family = hp->h_addrtype;
|
||||
- memcpy((char *) &si->sin_addr, hp->h_addr_list[0], hp->h_length);
|
||||
+ si->sin_family = ai->ai_family;
|
||||
+ memcpy((char *) &si->sin_addr, ai->ai_addr, ai->ai_addrlen);
|
||||
req.arp_ha.sa_family = hardware->type;
|
||||
memcpy(req.arp_ha.sa_data, sap.sa_data, hardware->alen);
|
||||
|
||||
@@ -122,7 +121,7 @@
|
||||
char *host, *addr;
|
||||
int linenr;
|
||||
FILE *fp;
|
||||
- struct hostent *hp;
|
||||
+ struct addrinfo * ai, hints = {}; hints .ai_family = AF_INET;
|
||||
|
||||
if ((fp = fopen(name, "r")) == NULL) {
|
||||
fprintf(stderr, _("rarp: cannot open file %s:%s.\n"), name, strerror(errno));
|
||||
@@ -140,11 +139,16 @@
|
||||
fprintf(stderr, _("rarp: format error at %s:%u\n"), name, linenr);
|
||||
continue;
|
||||
}
|
||||
- if ((hp = gethostbyname(host)) == NULL) {
|
||||
- fprintf(stderr, _("rarp: %s: unknown host\n"), host);
|
||||
- }
|
||||
- if (rarp_set(fd, hp, addr) != 0) {
|
||||
- fprintf(stderr, _("rarp: cannot set entry from %s:%u\n"), name, linenr);
|
||||
+ {
|
||||
+ int const e = getaddrinfo (host, NULL, &hints, &ai);
|
||||
+ if (e)
|
||||
+ fprintf(stderr, _("rarp: %s: unknown host\n"), host);
|
||||
+ else {
|
||||
+ if (rarp_set(fd, ai, addr) != 0) {
|
||||
+ fprintf(stderr, _("rarp: cannot set entry from %s:%u\n"), name, linenr);
|
||||
+ }
|
||||
+ freeaddrinfo (ai);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +209,6 @@
|
||||
{
|
||||
int result = 0, mode = 0, c, nargs = 0, verbose = 0;
|
||||
char *args[3];
|
||||
- struct hostent *hp;
|
||||
int fd;
|
||||
|
||||
#if I18N
|
||||
@@ -225,7 +228,7 @@
|
||||
case 'h':
|
||||
usage();
|
||||
case 'V':
|
||||
- fprintf(stderr, version_string);
|
||||
+ fputs (version_string, stderr);
|
||||
exit(E_VERSION);
|
||||
break;
|
||||
case 'v':
|
||||
@@ -285,16 +288,21 @@
|
||||
if (nargs != (mode - 1)) {
|
||||
usage();
|
||||
}
|
||||
- if ((hp = gethostbyname(args[0])) == NULL) {
|
||||
+ {
|
||||
+ struct addrinfo * ai, hints = {}; hints .ai_family = AF_INET; hints .ai_flags = AI_CANONNAME;
|
||||
+ int const e = getaddrinfo ((args[0]), NULL, &hints, &ai);
|
||||
+ if (e) {
|
||||
fprintf(stderr, _("rarp: %s: unknown host\n"), args[0]);
|
||||
exit(1);
|
||||
- }
|
||||
+ }
|
||||
if (fd = socket(PF_INET, SOCK_DGRAM, 0), fd < 0) {
|
||||
perror("socket");
|
||||
exit(1);
|
||||
}
|
||||
- result = (mode == MODE_DELETE) ? rarp_delete(fd, hp) : rarp_set(fd, hp, args[1]);
|
||||
+ result = (mode == MODE_DELETE) ? rarp_delete(fd, ai) : rarp_set(fd, ai, args[1]);
|
||||
close(fd);
|
||||
+ freeaddrinfo (ai);
|
||||
+ }
|
||||
break;
|
||||
|
||||
case MODE_ETHERS:
|
|
@ -1,223 +0,0 @@
|
|||
--- Makefile
|
||||
+++ Makefile 2008/05/05 13:05:05
|
||||
@@ -90,7 +90,7 @@
|
||||
# You may need to uncomment and edit these if you are using libc5 and IPv6.
|
||||
COPTS = -D_GNU_SOURCE -O2 -Wall -g # -I/usr/inet6/include
|
||||
ifeq ($(origin LOPTS), undefined)
|
||||
-LOPTS =
|
||||
+LOPTS = -s
|
||||
endif
|
||||
RESLIB = # -L/usr/inet6/lib -linet6
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
|
||||
config: cleanconfig config.h
|
||||
|
||||
-install: all savebin installbin installdata
|
||||
+install: all installbin installdata
|
||||
|
||||
update: all installbin installdata
|
||||
|
||||
--- config.in
|
||||
+++ config.in 2008/05/05 13:05:05
|
||||
@@ -42,14 +42,14 @@
|
||||
* course, welcome. Answer `n' here if you have no support for
|
||||
* internationalization on your system.
|
||||
*
|
||||
-bool 'Does your system support GNU gettext?' I18N n
|
||||
+bool 'Does your system support GNU gettext?' I18N y
|
||||
*
|
||||
*
|
||||
* Protocol Families.
|
||||
*
|
||||
bool 'UNIX protocol family' HAVE_AFUNIX y
|
||||
bool 'INET (TCP/IP) protocol family' HAVE_AFINET y
|
||||
-bool 'INET6 (IPv6) protocol family' HAVE_AFINET6 n
|
||||
+bool 'INET6 (IPv6) protocol family' HAVE_AFINET6 y
|
||||
bool 'Novell IPX/SPX protocol family' HAVE_AFIPX y
|
||||
bool 'Appletalk DDP protocol family' HAVE_AFATALK y
|
||||
bool 'AX25 (packet radio) protocol family' HAVE_AFAX25 y
|
||||
@@ -75,9 +75,9 @@
|
||||
bool 'NET/ROM (packet radio) support' HAVE_HWNETROM y
|
||||
bool 'X.25 (generic) support' HAVE_HWX25 y
|
||||
bool 'DLCI/FRAD (frame relay) support' HAVE_HWFR y
|
||||
-bool 'SIT (IPv6-in-IPv4) support' HAVE_HWSIT n
|
||||
-bool 'FDDI (generic) support' HAVE_HWFDDI n
|
||||
-bool 'HIPPI (generic) support' HAVE_HWHIPPI n
|
||||
+bool 'SIT (IPv6-in-IPv4) support' HAVE_HWSIT y
|
||||
+bool 'FDDI (generic) support' HAVE_HWFDDI y
|
||||
+bool 'HIPPI (generic) support' HAVE_HWHIPPI y
|
||||
bool 'Ash hardware support' HAVE_HWASH n
|
||||
bool '(Cisco)-HDLC/LAPB support' HAVE_HWHDLCLAPB n
|
||||
bool 'IrDA support' HAVE_HWIRDA y
|
||||
@@ -86,6 +86,6 @@
|
||||
*
|
||||
* Other Features.
|
||||
*
|
||||
-bool 'IP Masquerading support' HAVE_FW_MASQUERADE n
|
||||
-bool 'Build iptunnel and ipmaddr' HAVE_IP_TOOLS n
|
||||
-bool 'Build mii-tool' HAVE_MII n
|
||||
+bool 'IP Masquerading support' HAVE_FW_MASQUERADE y
|
||||
+bool 'Build iptunnel and ipmaddr' HAVE_IP_TOOLS y
|
||||
+bool 'Build mii-tool' HAVE_MII y
|
||||
--- configure.sh
|
||||
+++ configure.sh 2008/05/05 13:05:05
|
||||
@@ -58,9 +58,8 @@
|
||||
#
|
||||
function readln()
|
||||
{
|
||||
- echo -n "$1"
|
||||
- IFS='@' read ans || exit 1
|
||||
- [ -z "$ans" ] && ans=$2
|
||||
+ echo "$1"
|
||||
+ ans=$2
|
||||
}
|
||||
|
||||
# bool processes a boolean argument
|
||||
--- lib/inet6_gr.c
|
||||
+++ lib/inet6_gr.c 2008/05/05 13:05:05
|
||||
@@ -34,6 +34,10 @@
|
||||
|
||||
/* neighbour discovery from linux-2.4.0/include/net/neighbour.h */
|
||||
|
||||
+#ifndef HZ
|
||||
+#define HZ sysconf(_SC_CLK_TCK)
|
||||
+#endif
|
||||
+
|
||||
#define NUD_INCOMPLETE 0x01
|
||||
#define NUD_REACHABLE 0x02
|
||||
#define NUD_STALE 0x04
|
||||
--- lib/inet_sr.c
|
||||
+++ lib/inet_sr.c 2008/05/05 13:05:05
|
||||
@@ -40,6 +40,10 @@
|
||||
#define full_mask(x) (((struct sockaddr_in *)&(x))->sin_addr.s_addr)
|
||||
#endif
|
||||
|
||||
+#ifndef HZ
|
||||
+#define HZ sysconf(_SC_CLK_TCK)
|
||||
+#endif
|
||||
+
|
||||
extern struct aftype inet_aftype;
|
||||
|
||||
static int skfd = -1;
|
||||
--- lib/interface.c
|
||||
+++ lib/interface.c 2008/05/05 13:05:05
|
||||
@@ -86,6 +86,7 @@
|
||||
int procnetdev_vsn = 1;
|
||||
|
||||
int ife_short;
|
||||
+int ife_field = 5;
|
||||
|
||||
static struct interface *int_list, *int_last;
|
||||
|
||||
@@ -139,6 +140,22 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
+void get_max_ifacename(void)
|
||||
+{
|
||||
+ struct interface *ife;
|
||||
+ int tmp = ife_field;
|
||||
+
|
||||
+ if (!int_list && (if_readlist(0) < 0)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ for (ife = int_list; ife; ife = ife->next) {
|
||||
+ tmp = strlen (ife->name);
|
||||
+ if (tmp > ife_field) {
|
||||
+ ife_field = tmp;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
int free_interface_list(void)
|
||||
{
|
||||
struct interface *ife;
|
||||
@@ -579,7 +596,7 @@
|
||||
|
||||
void ife_print_short(struct interface *ptr)
|
||||
{
|
||||
- printf("%-5.5s ", ptr->name);
|
||||
+ printf("%-*.*s ", ife_field,ife_field,ptr->name);
|
||||
printf("%5d %3d", ptr->mtu, ptr->metric);
|
||||
/* If needed, display the interface statistics. */
|
||||
if (ptr->statistics_valid) {
|
||||
@@ -670,7 +687,9 @@
|
||||
if (hw == NULL)
|
||||
hw = get_hwntype(-1);
|
||||
|
||||
- printf(_("%-9.9s Link encap:%s "), ptr->name, hw->title);
|
||||
+ printf(_("%-*.*s Link encap:%s "),
|
||||
+ ife_field+4,ife_field+4,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) &&
|
||||
--- man/en_US/hostname.1
|
||||
+++ man/en_US/hostname.1 2008/05/05 13:06:26
|
||||
@@ -107,6 +107,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
|
||||
--- netstat.c
|
||||
+++ netstat.c 2008/05/05 13:05:05
|
||||
@@ -117,6 +117,10 @@
|
||||
#define SO_WAITDATA (1<<17) /* wait data to read */
|
||||
#define SO_NOSPACE (1<<18) /* no space to write */
|
||||
|
||||
+#ifndef HZ
|
||||
+#define HZ sysconf(_SC_CLK_TCK)
|
||||
+#endif
|
||||
+
|
||||
#define DFLT_AF "inet"
|
||||
|
||||
#define FEATURE_NETSTAT
|
||||
@@ -1452,6 +1456,8 @@
|
||||
printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
|
||||
}
|
||||
|
||||
+ get_max_ifacename();
|
||||
+
|
||||
if (for_all_interfaces(do_if_print, &flag_all) < 0) {
|
||||
perror(_("missing interface information"));
|
||||
exit(1);
|
||||
--- po/de.po
|
||||
+++ po/de.po 2008/05/05 13:05:05
|
||||
@@ -2148,7 +2148,7 @@
|
||||
"Source Destination Gateway Flags Metric Ref Use "
|
||||
"Iface\n"
|
||||
msgstr ""
|
||||
-"Ziel Ziel Genmask Flags Metric Ref Ben "
|
||||
+"Quelle Ziel Maske Flags Metric Ref Ben "
|
||||
"Iface\n"
|
||||
|
||||
#: ../lib/inet_gr.c:261
|
|
@ -1,3 +0,0 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7ae4dd6d44d6715f18e10559ffd270511b6e55a8900ca54fbebafe0ae6cf7d7b
|
||||
size 198520
|
3
net-tools-2.0+git20170221.479bb4a.tar.xz
Normal file
3
net-tools-2.0+git20170221.479bb4a.tar.xz
Normal file
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b088e44c978045eee1a3d171bdd259ac9cee8af1071f16461dfe20c3bb34a5bd
|
||||
size 197992
|
56
net-tools-configure.patch
Normal file
56
net-tools-configure.patch
Normal file
|
@ -0,0 +1,56 @@
|
|||
Index: Makefile
|
||||
===================================================================
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -109,7 +109,7 @@ all: config.h version.h subdirs $(PROGS
|
||||
|
||||
config: cleanconfig config.h
|
||||
|
||||
-install: all savebin installbin installdata
|
||||
+install: all installbin installdata
|
||||
|
||||
update: all installbin installdata
|
||||
|
||||
Index: config.in
|
||||
===================================================================
|
||||
--- a/config.in
|
||||
+++ b/config.in
|
||||
@@ -42,7 +42,7 @@
|
||||
* course, welcome. Answer `n' here if you have no support for
|
||||
* internationalization on your system.
|
||||
*
|
||||
-bool 'Does your system support GNU gettext?' I18N n
|
||||
+bool 'Does your system support GNU gettext?' I18N y
|
||||
*
|
||||
*
|
||||
* Protocol Families.
|
||||
@@ -91,10 +91,10 @@ bool 'InfiniBand hardware support' HAVE_
|
||||
*
|
||||
bool 'IP Masquerading support' HAVE_FW_MASQUERADE y
|
||||
bool 'Build arp and rarp' HAVE_ARP_TOOLS y
|
||||
-bool 'Build hostname' HAVE_HOSTNAME_TOOLS y
|
||||
-bool 'Install hostname NIS/YP symlinks' HAVE_HOSTNAME_SYMLINKS y
|
||||
+bool 'Build hostname' HAVE_HOSTNAME_TOOLS n
|
||||
+bool 'Install hostname NIS/YP symlinks' HAVE_HOSTNAME_SYMLINKS n
|
||||
bool 'Build iptunnel and ipmaddr' HAVE_IP_TOOLS y
|
||||
-bool 'Build mii-tool' HAVE_MII y
|
||||
+bool 'Build mii-tool' HAVE_MII n
|
||||
bool 'Build plipconfig' HAVE_PLIP_TOOLS y
|
||||
bool 'Build slattach' HAVE_SERIAL_TOOLS y
|
||||
bool 'SELinux support' HAVE_SELINUX n
|
||||
Index: configure.sh
|
||||
===================================================================
|
||||
--- a/configure.sh
|
||||
+++ b/configure.sh
|
||||
@@ -66,9 +66,8 @@ config_fd_redir='<&7'
|
||||
#
|
||||
function readln()
|
||||
{
|
||||
- echo -n "$1"
|
||||
- IFS='@' read ans || exit 1
|
||||
- [ -z "$ans" ] && ans=$2
|
||||
+ echo "$1"
|
||||
+ ans=$2
|
||||
}
|
||||
|
||||
# bool processes a boolean argument
|
|
@ -1,3 +1,125 @@
|
|||
-------------------------------------------------------------------
|
||||
Sun Jun 18 07:29:18 UTC 2017 - tchvatal@suse.com
|
||||
|
||||
- Drop netstat xinetd service as we are phasing xinetd out
|
||||
There is probably no need to replace it here as netstat was
|
||||
deprecated and now users should favor 'ss' command from
|
||||
iproute2
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Jun 18 07:27:20 UTC 2017 - tchvatal@suse.com
|
||||
|
||||
- Provide compat symlink to /bin and /sbin to be on safe side
|
||||
if someone hardcoded them in scripts (most distros switched
|
||||
7 years ago)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Jun 17 19:53:44 UTC 2017 - tchvatal@suse.com
|
||||
|
||||
- Disable removed binaries for build rather than on install
|
||||
* Refresh patch net-tools-configure.patch
|
||||
- Make sure we respect optflags
|
||||
- Add patch 0001-Add-ether-wake-binary.patch replacing standalone
|
||||
ether-wake code in the archive
|
||||
- Add patch 0002-Do-not-warn-about-interface-socket-not-binded.patch
|
||||
replacing net-tools-1.60-interface_socket.diff
|
||||
- Add patch 0003-Add-support-for-EiB-in-interface.c.patch enabling
|
||||
EiB support in interfaces
|
||||
- Add patch 0004-By-default-do-not-fopen-anything-in-netrom_gr.patch
|
||||
relpacing net-tools-1.60-netrom-fopen.diff
|
||||
- Add patch 0005-Add-support-for-interface-rename-in-nameif.patch
|
||||
replacing nameif-rename.patch
|
||||
- Add patch 0006-Allow-interface-stacking.patch
|
||||
replacing net-tools-1.60-interface_stack.patch
|
||||
- Add patch 0007-Introduce-T-notrim-option-in-netstat.patch
|
||||
replacing net-tools-1.60-dont-trim-foreign-addr6.diff
|
||||
and also net-tools-1.60-notrim.diff
|
||||
- Drop net-tools-1.60-use-gai.patch as it should be upstreamed first
|
||||
and it does not apply clearly at all now
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Jun 17 19:41:08 UTC 2017 - tchvatal@suse.com
|
||||
|
||||
- Move binaries to sbindir and bindir respectively
|
||||
- Switch from generating filelists to actually state them within
|
||||
the spec-file, now it is quite readable
|
||||
- Move ifconfig and route to %{_bindir} as upstream does
|
||||
(and debian/rh/... do too)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Jun 17 08:09:20 UTC 2017 - tchvatal@suse.com
|
||||
|
||||
- Remove all the manpage altering patches as they are from 2002 and
|
||||
older while it changed and touching different languages for
|
||||
rebasing is not bright idea, the same applies for translations
|
||||
as upstream updated the translations we will pretend their
|
||||
strings win
|
||||
- Switch to git service repacking so we don't have to carry all
|
||||
the patches ourselves
|
||||
- Update to version 2.0+git20170221.479bb4a:
|
||||
* slattach/plipconfig: add a config knob to control them
|
||||
* Fixed trailing whitespace issue with a and i flags (#7)
|
||||
* iptunnel: drop netinet/ip.h include
|
||||
* iptunnel: fix building w/older linux headers
|
||||
* build: respect standard $(LDLIBS) variable
|
||||
* netstat: improve ROSE support
|
||||
* AX.25: Rename all references to axattach to kissattach.
|
||||
* Update all instances of my email address.
|
||||
* Fix conversion of some ROSE addresses.
|
||||
* Fix incorrect ARP output
|
||||
- Merge patch net-tools-1.60-miioff.diff in the main config patch
|
||||
- Rename net-tools-1.60.dif to net-tools-configure.patch in order
|
||||
to reflect what it actually does
|
||||
- Drop nstrcmp.c as VCS contains newer version
|
||||
- Drop patches that were either merged upstream or fixed bit differently:
|
||||
* manpages.diff
|
||||
* net-tools-1.60-arp-unaligned-access.patch
|
||||
* net-tools-1.60-compoundstatement.diff
|
||||
* net-tools-1.60-cont-buff.patch
|
||||
* net-tools-1.60-cs_CZ.bnc715580.diff
|
||||
* net-tools-1.60-doc.dif
|
||||
* net-tools-1.60-errors.patch
|
||||
* net-tools-1.60-fclose.diff
|
||||
* net-tools-1.60-fix-header-conflict.patch
|
||||
* net-tools-1.60-hostname-ipv6.patch
|
||||
* net-tools-1.60-hostname-s.patch
|
||||
* net-tools-1.60-hostname-space.patch
|
||||
* net-tools-1.60-ifconfig-SIOCSIFNETMASK.diff
|
||||
* net-tools-1.60-ifconfig.8.diff
|
||||
* net-tools-1.60-ifindex.diff
|
||||
* net-tools-1.60-infiniband.diff
|
||||
* net-tools-1.60-ipv6-statistics.diff
|
||||
* net-tools-1.60-krn26.dif
|
||||
* net-tools-1.60-long_to_int.diff
|
||||
* net-tools-1.60-multilinestr.diff
|
||||
* net-tools-1.60-nameif.diff
|
||||
* net-tools-1.60-netstat-ci.diff
|
||||
* net-tools-1.60-netstat-output.patch
|
||||
* net-tools-1.60-netstat-p.patch
|
||||
* net-tools-1.60-netstat.8.diff
|
||||
* net-tools-1.60-netstat_retval.diff
|
||||
* net-tools-1.60-numericstuff.diff
|
||||
* net-tools-1.60-plipconfig-ecode.patch
|
||||
* net-tools-1.60-plipconfig-manpage.patch
|
||||
* net-tools-1.60-plipconfig-usage.patch
|
||||
* net-tools-1.60-printval-conversion.patch
|
||||
* net-tools-1.60-sctp-quiet
|
||||
* net-tools-1.60-sctp.patch
|
||||
* net-tools-1.60-snmp-counter-overflow.patch
|
||||
* net-tools-1.60-sockios-SIOCGMIIPHY.diff
|
||||
* net-tools-1.60-strictaliasing.diff
|
||||
* net-tools-1.60-tcp-recvq-listen.patch
|
||||
* netstat-trunc.dif
|
||||
* net-tools-1.60-if_tr.diff
|
||||
* net-tools-1.60-interface_mtu.diff
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Jun 17 08:02:18 UTC 2017 - tchvatal@suse.com
|
||||
|
||||
- Cleanup a bit with spec-cleaner and remove sle11 conditions
|
||||
- Drop the patch net-tools-1.60-obsolete.diff
|
||||
* If restored it is in the VCS and it silences all the rpm warnings
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 1 10:01:53 UTC 2016 - giecrilj@stegny.2a.pl
|
||||
|
||||
|
|
333
net-tools.spec
333
net-tools.spec
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# spec file for package net-tools
|
||||
#
|
||||
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
|
@ -17,100 +17,40 @@
|
|||
|
||||
|
||||
Name: net-tools
|
||||
Url: https://sourceforge.net/projects/net-tools/
|
||||
Version: 1.60
|
||||
Version: 2.0+git20170221.479bb4a
|
||||
Release: 0
|
||||
Summary: Important Programs for Networking
|
||||
License: GPL-2.0+
|
||||
Group: Productivity/Networking/Other
|
||||
Requires: hostname
|
||||
Provides: iputils:/usr/sbin/traceroute6
|
||||
Provides: net_tool = %version
|
||||
Obsoletes: net_tool < %version
|
||||
%if 0%{?suse_version}
|
||||
Recommends: %name-lang = %version
|
||||
#force new traceroute or else..
|
||||
Recommends: traceroute >= 2.0.0
|
||||
%endif
|
||||
# provides hostname, domainname and dnsdomainname
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
Source: http://www.tazenda.demon.co.uk/phil/net-tools/net-tools-%{version}.tar.bz2
|
||||
Source2: netstat.xinetd
|
||||
Source3: nstrcmp.c
|
||||
Source4: ether-wake.c
|
||||
Source5: ether-wake.8
|
||||
Url: https://sourceforge.net/projects/net-tools/
|
||||
# Repacked by the service file from git
|
||||
Source: %{name}-%{version}.tar.xz
|
||||
# PATCH-FEATURE-SUSE: set configure values to our liking as we do not need
|
||||
# everything here
|
||||
Patch0: net-tools-configure.patch
|
||||
# Git formatted patches described in each patch
|
||||
Patch1: 0001-Add-ether-wake-binary.patch
|
||||
Patch2: 0002-Do-not-warn-about-interface-socket-not-binded.patch
|
||||
Patch3: 0003-Add-support-for-EiB-in-interface.c.patch
|
||||
Patch4: 0004-By-default-do-not-fopen-anything-in-netrom_gr.patch
|
||||
Patch5: 0005-Add-support-for-interface-rename-in-nameif.patch
|
||||
Patch6: 0006-Allow-interface-stacking.patch
|
||||
Patch7: 0007-Introduce-T-notrim-option-in-netstat.patch
|
||||
BuildRequires: help2man
|
||||
Patch: net-tools-%{version}.dif
|
||||
Patch1: netstat-trunc.dif
|
||||
Patch2: manpages.diff
|
||||
Patch4: net-tools-1.60-multilinestr.diff
|
||||
Patch5: net-tools-1.60-krn26.dif
|
||||
Patch7: net-tools-1.60-long_to_int.diff
|
||||
Patch8: net-tools-1.60-compoundstatement.diff
|
||||
Patch9: nameif-rename.patch
|
||||
Patch10: net-tools-1.60-errors.patch
|
||||
Patch11: net-tools-1.60-cont-buff.patch
|
||||
Patch12: net-tools-1.60-miioff.diff
|
||||
Patch13: net-tools-1.60-nameif.diff
|
||||
Patch14: net-tools-1.60-sockios-SIOCGMIIPHY.diff
|
||||
Patch15: net-tools-1.60-numericstuff.diff
|
||||
Patch16: net-tools-1.60-if_tr.diff
|
||||
Patch18: net-tools-1.60-netstat.8.diff
|
||||
Patch19: net-tools-1.60-strictaliasing.diff
|
||||
Patch20: net-tools-1.60-interface_stack.patch
|
||||
Patch21: net-tools-1.60-arp-unaligned-access.patch
|
||||
Patch22: net-tools-1.60-snmp-counter-overflow.patch
|
||||
Patch23: net-tools-1.60-netstat-output.patch
|
||||
Patch24: net-tools-1.60-netstat-p.patch
|
||||
Patch25: net-tools-1.60-sctp.patch
|
||||
Patch26: net-tools-1.60-sctp-quiet
|
||||
Patch27: net-tools-1.60-hostname-space.patch
|
||||
Patch30: net-tools-1.60-ifconfig.8.diff
|
||||
Patch31: net-tools-1.60-tcp-recvq-listen.patch
|
||||
Patch32: net-tools-1.60-netstat-ci.diff
|
||||
Patch33: net-tools-1.60-ifconfig-SIOCSIFNETMASK.diff
|
||||
Patch34: net-tools-1.60-interface_socket.diff
|
||||
Patch35: net-tools-1.60-interface_mtu.diff
|
||||
Patch36: net-tools-1.60-printval-conversion.patch
|
||||
#Patch38: net-tools-1.60-obsolete.diff
|
||||
Patch39: net-tools-1.60-fclose.diff
|
||||
Patch40: net-tools-1.60-notrim.diff
|
||||
Patch41: net-tools-1.60-ipv6-statistics.diff
|
||||
Patch42: net-tools-1.60-ifindex.diff
|
||||
Patch43: net-tools-1.60-infiniband.diff
|
||||
Patch44: net-tools-1.60-netrom-fopen.diff
|
||||
Patch45: net-tools-1.60-doc.dif
|
||||
Patch46: net-tools-1.60-netstat_retval.diff
|
||||
Patch47: net-tools-1.60-hostname-ipv6.patch
|
||||
Patch48: net-tools-1.60-dont-trim-foreign-addr6.diff
|
||||
Patch49: net-tools-1.60-cs_CZ.bnc715580.diff
|
||||
Patch50: net-tools-1.60-plipconfig-usage.patch
|
||||
Patch51: net-tools-1.60-plipconfig-manpage.patch
|
||||
Patch52: net-tools-1.60-plipconfig-ecode.patch
|
||||
# PATCH-FIX-UPSTREAM net-tools-1.60-hostname-s.patch boo#872264 ticket#14 commit#452f8e
|
||||
Patch53: net-tools-1.60-hostname-s.patch
|
||||
Patch54: net-tools-1.60-fix-header-conflict.patch
|
||||
Patch55: net-tools-1.60-use-gai.patch
|
||||
Requires: hostname
|
||||
Recommends: %{name}-lang = %{version}
|
||||
Recommends: traceroute >= 2.0.0
|
||||
Provides: net_tool = %{version}
|
||||
Obsoletes: net_tool < %{version}
|
||||
|
||||
%description
|
||||
This package contains essential programs for network administration and
|
||||
maintenance: netstat, arp, ifconfig, rarp, and route.
|
||||
|
||||
|
||||
|
||||
Authors:
|
||||
--------
|
||||
Fred N. van Kempen <waltje@uwalt.nl.mugnet.org>
|
||||
Bernd Eckenfels <net-tools@lina.inka.de>
|
||||
Fred Baumgarten <dc6iq@insu1.etec.uni-karlsruhe.de>
|
||||
Peter Tobias <tobias@et-inf.fho-emden.de>
|
||||
Olaf Kirch <okir@suse.de>
|
||||
|
||||
%lang_package
|
||||
|
||||
%package deprecated
|
||||
Summary: Deprecated Networking Utilities
|
||||
Group: Productivity/Networking/Other
|
||||
Recommends: %{name}-lang = %{version}
|
||||
|
||||
%description deprecated
|
||||
This package contains the arp, ifconfig, netstat and route utilities,
|
||||
|
@ -120,168 +60,101 @@ which have been replaced by tools from the iproute2 package:
|
|||
* netstat -> ss [-r]
|
||||
* route -> ip r
|
||||
|
||||
%lang_package
|
||||
|
||||
%prep
|
||||
%setup
|
||||
cp %{S:3} lib/
|
||||
%patch
|
||||
%patch1
|
||||
%patch2 -p1
|
||||
%patch4
|
||||
%patch5
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9
|
||||
%patch10 -p1 -b .errors
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
%patch25 -p1
|
||||
%patch26 -p1
|
||||
%patch27 -p1
|
||||
%patch30 -p1
|
||||
%patch31 -p1
|
||||
%patch32 -p1
|
||||
%patch33 -p1
|
||||
%patch34 -p1
|
||||
%patch35 -p1
|
||||
%patch36 -p1
|
||||
#not applied, see bugzilla discussion
|
||||
%{nil %patch38 -p1}
|
||||
%patch39 -p1
|
||||
%patch40 -p1
|
||||
%patch41
|
||||
%patch42
|
||||
%patch43
|
||||
%patch44
|
||||
%patch45
|
||||
%patch46
|
||||
%patch47
|
||||
%patch48
|
||||
%patch49
|
||||
%patch50 -p1
|
||||
%patch51 -p1
|
||||
%patch52 -p1
|
||||
%patch53 -p1
|
||||
%patch54 -p1
|
||||
%patch55 -p1
|
||||
cp %{S:4} .
|
||||
cp %{S:5} ./man/en_US
|
||||
COPYING='%{_docdir}/rpmlint-mini/COPYING'
|
||||
if test -r "${COPYING}" && ! diff -u COPYING "${COPYING}" # diff failed
|
||||
then # The file COPYING distributed by upstream is not genuine; I have reported the case to <license-violation@gnu.org>.
|
||||
# Upstream contains a valid version in master but it has not been released yet (Bug #25).
|
||||
# In the mean time:
|
||||
# 1. Verify that the intention of the authors is to release under GPLv2.
|
||||
while read line
|
||||
do case "${line}" in
|
||||
('*'*' GNU General') read line
|
||||
case "${line}" in
|
||||
('* Public License '*) read line
|
||||
case "${line}" in
|
||||
('*'*' version 2 of the License,'*) gpl=2
|
||||
break
|
||||
esac
|
||||
esac
|
||||
esac
|
||||
done < arp.c
|
||||
test "${gpl}" -eq 2
|
||||
# 2. Verify that the file at $COPYING contains GPLv2.
|
||||
while :
|
||||
do read line
|
||||
case "${line}" in
|
||||
('GNU GENERAL PUBLIC LICENSE') read line
|
||||
case "${line}" in
|
||||
('Version 2,'*) break
|
||||
esac
|
||||
esac
|
||||
exit 1
|
||||
done < "${COPYING}"
|
||||
# 3. Replace the faulty file with a correct one.
|
||||
cp -t. "${COPYING}"
|
||||
fi # diff failed
|
||||
%setup -q
|
||||
%autopatch -p1
|
||||
|
||||
%build
|
||||
|
||||
# Kernel 3.6 removes if_strip.h - disable STRIP
|
||||
%if 0%{?suse_version} > 1220
|
||||
%__sed -i -e '/HAVE_HWSTRIP y/s/y$/n/' config.in
|
||||
%else
|
||||
test -r %{_includedir}/linux/if_strip.h || sed -i -e '/HAVE_HWSTRIP y/s/y$/n/' config.in
|
||||
%endif
|
||||
#
|
||||
|
||||
make config
|
||||
make COPTS="-D_GNU_SOURCE $RPM_OPT_FLAGS" LOPTS="$RPM_OPT_FLAGS"
|
||||
gcc $RPM_OPT_FLAGS -D_GNU_SOURCE -fwhole-program -o ether-wake ether-wake.c
|
||||
export CFLAGS="%{optflags}"
|
||||
make %{?_smp_mflags} config
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
install -d -m 755 %{buildroot}/etc/xinetd.d
|
||||
install -m 644 %{S:2} %{buildroot}/etc/xinetd.d/netstat
|
||||
make install BASEDIR=%{buildroot}
|
||||
install -m 755 ether-wake %{buildroot}/sbin
|
||||
for tool in \
|
||||
%ifarch s390
|
||||
plipconfig slattach \
|
||||
%endif
|
||||
hostname domainname dnsdomainname nisdomainname ypdomainname mii-tool rarp
|
||||
do
|
||||
rm -f %{buildroot}/*bin/$tool
|
||||
rm -f %{buildroot}/%{_mandir}/man*/$tool.*
|
||||
rm -f %{buildroot}/%{_mandir}/*/man*/$tool.*
|
||||
done
|
||||
%make_install BINDIR=%{_bindir} SBINDIR=%{_sbindir}
|
||||
|
||||
# remove rarp as it is not usefull with our kernel
|
||||
rm -fv %{buildroot}/usr/*bin/rarp
|
||||
rm -fv %{buildroot}/%{_mandir}/man*/rarp.*
|
||||
rm -fv %{buildroot}/%{_mandir}/*/man*/rarp.*
|
||||
# Fix manpage locations
|
||||
mv %{buildroot}/%{_mandir}/de_DE %{buildroot}/%{_mandir}/de
|
||||
mv %{buildroot}/%{_mandir}/fr_FR %{buildroot}/%{_mandir}/fr
|
||||
%if 0%{?suse_version} < 1120
|
||||
rm -rf %{buildroot}/%{_mandir}/pt_BR
|
||||
%endif
|
||||
for tool in iptunnel ipmaddr
|
||||
do t="%{buildroot}/%{_mandir}/man8/${tool}.8"
|
||||
help2man -s8 "%{buildroot}/sbin/${tool}" --no-discard-stderr >"${t}"
|
||||
gzip "${t}"
|
||||
# Generate missing manpages
|
||||
for tool in iptunnel ipmaddr; do
|
||||
t="%{buildroot}/%{_mandir}/man8/${tool}.8"
|
||||
help2man -s8 "%{buildroot}%{_sbindir}/${tool}" --no-discard-stderr >"${t}"
|
||||
done
|
||||
%find_lang %{name} --all-name --with-man
|
||||
# generate bin/sbin compat symlinks
|
||||
mkdir -p %{buildroot}/sbin
|
||||
mkdir -p %{buildroot}/bin
|
||||
for i in ether-wake nameif plipconfig slattach arp ipmaddr iptunnel; do
|
||||
ln -s %{_sbindir}/$i %{buildroot}/sbin/$i
|
||||
done
|
||||
for i in netstat ifconfig route; do
|
||||
ln -s %{_bindir}/$i %{buildroot}/bin/$i
|
||||
done
|
||||
%find_lang %{name} --all-name
|
||||
|
||||
# generate the filelist for net-tools-deprecated
|
||||
for tool in arp ifconfig ipmaddr iptunnel netstat route; do
|
||||
for dir in bin sbin; do
|
||||
if test -x "%{buildroot}/$dir/$tool"; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
p="/$dir/$tool"
|
||||
echo "$p"
|
||||
echo "%%exclude $p" >>excluded.list
|
||||
find $RPM_BUILD_ROOT/%_mandir -name "$tool.*"\
|
||||
-printf '%_mandir/%%P*\n'
|
||||
done >deprecated.list
|
||||
cat deprecated.list
|
||||
for p in $(<deprecated.list)
|
||||
do echo "%%exclude $p"
|
||||
done | tee -a '%{name}.lang' >excluded.list
|
||||
|
||||
%files -f excluded.list
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
/bin/*
|
||||
/sbin/*
|
||||
%_mandir/man*/*
|
||||
%config(noreplace) /etc/xinetd.d/netstat
|
||||
%doc COPYING README ABOUT-NLS README.ipv6
|
||||
%doc COPYING README ABOUT-NLS
|
||||
%{_sbindir}/ether-wake
|
||||
/sbin/ether-wake
|
||||
%{_sbindir}/nameif
|
||||
/sbin/nameif
|
||||
%{_sbindir}/plipconfig
|
||||
/sbin/plipconfig
|
||||
%{_sbindir}/slattach
|
||||
/sbin/slattach
|
||||
%{_mandir}/de/man5/ethers.5%{ext_man}
|
||||
%{_mandir}/de/man8/plipconfig.8%{ext_man}
|
||||
%{_mandir}/de/man8/slattach.8%{ext_man}
|
||||
%{_mandir}/fr/man5/ethers.5%{ext_man}
|
||||
%{_mandir}/fr/man8/plipconfig.8%{ext_man}
|
||||
%{_mandir}/fr/man8/slattach.8%{ext_man}
|
||||
%{_mandir}/man5/ethers.5%{ext_man}
|
||||
%{_mandir}/man8/ether-wake.8%{ext_man}
|
||||
%{_mandir}/man8/nameif.8%{ext_man}
|
||||
%{_mandir}/man8/plipconfig.8%{ext_man}
|
||||
%{_mandir}/man8/slattach.8%{ext_man}
|
||||
|
||||
%files deprecated -f deprecated.list
|
||||
%files deprecated
|
||||
%defattr(-,root,root)
|
||||
%doc COPYING
|
||||
%{_bindir}/netstat
|
||||
/bin/netstat
|
||||
%{_sbindir}/arp
|
||||
/sbin/arp
|
||||
%{_bindir}/ifconfig
|
||||
/bin/ifconfig
|
||||
%{_sbindir}/ipmaddr
|
||||
/sbin/ipmaddr
|
||||
%{_sbindir}/iptunnel
|
||||
/sbin/iptunnel
|
||||
%{_bindir}/route
|
||||
/bin/route
|
||||
%{_mandir}/de/man8/arp.8%{ext_man}
|
||||
%{_mandir}/de/man8/ifconfig.8%{ext_man}
|
||||
%{_mandir}/de/man8/netstat.8%{ext_man}
|
||||
%{_mandir}/de/man8/route.8%{ext_man}
|
||||
%{_mandir}/fr/man8/arp.8%{ext_man}
|
||||
%{_mandir}/fr/man8/ifconfig.8%{ext_man}
|
||||
%{_mandir}/fr/man8/netstat.8%{ext_man}
|
||||
%{_mandir}/fr/man8/route.8%{ext_man}
|
||||
%{_mandir}/man8/arp.8%{ext_man}
|
||||
%{_mandir}/man8/ifconfig.8%{ext_man}
|
||||
%{_mandir}/man8/netstat.8%{ext_man}
|
||||
%{_mandir}/man8/route.8%{ext_man}
|
||||
%{_mandir}/man8/ipmaddr.8%{ext_man}
|
||||
%{_mandir}/man8/iptunnel.8%{ext_man}
|
||||
%{_mandir}/pt_BR/man8/arp.8%{ext_man}
|
||||
%{_mandir}/pt_BR/man8/ifconfig.8%{ext_man}
|
||||
%{_mandir}/pt_BR/man8/netstat.8%{ext_man}
|
||||
%{_mandir}/pt_BR/man8/route.8%{ext_man}
|
||||
|
||||
%files lang -f %{name}.lang
|
||||
%doc COPYING
|
||||
%defattr(-,root,root)
|
||||
|
||||
%changelog
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
--- lib/inet6.c 2000/10/28 11:04:00 1.10
|
||||
+++ lib/inet6.c 2001/08/25 11:11:22
|
||||
@@ -44,6 +44,21 @@
|
||||
|
||||
extern int h_errno; /* some netdb.h versions don't export this */
|
||||
|
||||
+char * fix_v4_address(char *buf, struct in6_addr *in6)
|
||||
+{
|
||||
+ if (IN6_IS_ADDR_V4MAPPED(in6->s6_addr)) {
|
||||
+ char *s =strchr(buf, '.');
|
||||
+ if (s) {
|
||||
+ while (s > buf && *s != ':')
|
||||
+ --s;
|
||||
+ if (*s == ':') ++s;
|
||||
+ else s = NULL;
|
||||
+ }
|
||||
+ if (s) return s;
|
||||
+ }
|
||||
+ return buf;
|
||||
+}
|
||||
+
|
||||
static int INET6_resolve(char *name, struct sockaddr_in6 *sin6)
|
||||
{
|
||||
struct addrinfo req, *ai;
|
||||
@@ -109,13 +124,14 @@
|
||||
}
|
||||
|
||||
|
||||
+
|
||||
/* Display an Internet socket address. */
|
||||
static char *INET6_print(unsigned char *ptr)
|
||||
{
|
||||
static char name[80];
|
||||
|
||||
inet_ntop(AF_INET6, (struct in6_addr *) ptr, name, 80);
|
||||
- return name;
|
||||
+ return fix_v4_address(name, (struct in6_addr *)ptr);
|
||||
}
|
||||
|
||||
|
||||
@@ -129,13 +145,14 @@
|
||||
return safe_strncpy(buff, _("[NONE SET]"), sizeof(buff));
|
||||
if (INET6_rresolve(buff, (struct sockaddr_in6 *) sap, numeric) != 0)
|
||||
return safe_strncpy(buff, _("[UNKNOWN]"), sizeof(buff));
|
||||
- return (buff);
|
||||
+ return (fix_v4_address(buff, &((struct sockaddr_in6 *)sap)->sin6_addr));
|
||||
}
|
||||
|
||||
|
||||
static int INET6_getsock(char *bufp, struct sockaddr *sap)
|
||||
{
|
||||
struct sockaddr_in6 *sin6;
|
||||
+ char *p;
|
||||
|
||||
sin6 = (struct sockaddr_in6 *) sap;
|
||||
sin6->sin6_family = AF_INET6;
|
||||
@@ -143,7 +160,9 @@
|
||||
|
||||
if (inet_pton(AF_INET6, bufp, sin6->sin6_addr.s6_addr) <= 0)
|
||||
return (-1);
|
||||
-
|
||||
+ p = fix_v4_address(bufp, &sin6->sin6_addr);
|
||||
+ if (p != bufp)
|
||||
+ memcpy(bufp, p, strlen(p)+1);
|
||||
return 16; /* ?;) */
|
||||
}
|
||||
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
# netstat (like the services finger and systat) give out user information which
|
||||
# may be valuable to potential "system crackers." Many sites choose to disable
|
||||
# some or all of these services to improve security. Try "telnet localhost
|
||||
# systat" and "telnet localhost netstat" to see that information yourself!
|
||||
#
|
||||
service netstat
|
||||
{
|
||||
disable = yes
|
||||
socket_type = stream
|
||||
protocol = tcp
|
||||
wait = no
|
||||
user = root
|
||||
server = /bin/netstat
|
||||
server_args = -a
|
||||
}
|
||||
|
51
nstrcmp.c
51
nstrcmp.c
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* Copyright 1998 by Andi Kleen. Subject to the GPL.
|
||||
* Copyright 2002 by Bruno Hall who contributed a shorter rewrite
|
||||
* which actually works
|
||||
*
|
||||
* $Id: nstrcmp.c,v 1.3 2002/12/10 00:37:33 ecki Exp $
|
||||
*/
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "util.h"
|
||||
|
||||
|
||||
/* like strcmp(), but knows about numbers */
|
||||
/* basically splits the string up in non-numerical and numerical
|
||||
* parts, compares the ascii values with their character values
|
||||
* and the numbers by their numerical value.
|
||||
*/
|
||||
int nstrcmp(const char *a, const char *b)
|
||||
{
|
||||
int nra, nrb;
|
||||
const char *na, *nb;
|
||||
|
||||
/* skip equal chars */
|
||||
while (*a == *b && !isdigit(*a)) {
|
||||
if (*a++ == 0)
|
||||
return 0;
|
||||
b++;
|
||||
}
|
||||
|
||||
/* compare numbers */
|
||||
if (isdigit(*a) && isdigit(*b)) {
|
||||
nra = strtoul(a,&na,10);
|
||||
nrb = strtoul(b,&nb,10);
|
||||
|
||||
/* different interfaces (eth1 vs eth2) */
|
||||
if (nra != nrb)
|
||||
return nra - nrb;
|
||||
|
||||
/* no sub interface ( eth0 / eth0 ) */
|
||||
if ((*na == 0) && (*nb == 0))
|
||||
return 0;
|
||||
a = na;
|
||||
b = nb;
|
||||
}
|
||||
/* While there might be more numbers to come, the kernel
|
||||
* now takes them as strings.
|
||||
* eth1:blubber and eth1:0 and eth1:00 are all different things.
|
||||
*/
|
||||
return strcmp(a,b);
|
||||
}
|
Loading…
Reference in New Issue
Block a user