vapier 08/04/14 04:02:18
Added: 01_all_net-tools-1.60-2.6-compilefix.patch
02_all_net-tools-1.60-gcc34.patch
03_all_net-tools-1.60-cleanup-list-handling.patch
04_all_net-tools-1.60-get_name.patch
20_all_net-tools-1.54-ipvs.patch
21_all_net-tools-1.57-bug22040.patch
22_all_net-tools-1.60-manydevs.patch
23_all_net-tools-1.60-miiioctl.patch
24_all_net-tools-1.60-virtualname.patch
25_all_net-tools-1.60-cycle.patch
26_all_net-tools-1.60-overflow.patch
27_all_net-tools-1.60-netstat_ulong.patch
50_all_net-tools-1.60-multiline-string.patch
51_all_net-tools-1.60-man.patch
52_all_net-tools-1.60-numeric-ports.patch
53_all_net-tools-1.60-appletalk.patch
54_all_net-tools-1.60-wide.patch
55_all_net-tools-1.60-Makefile.patch
56_all_net-tools-1.60-ipv6-hostname.patch
57_all_net-tools-1.60-ifconfig-infiniband.patch
60_all_net-tools-1.60-headers.patch
70_all_net-tools-1.60-unaligned.patch
Log:
relocate into versioned-subdir
Revision Changes Path
1.1 src/patchsets/net-tools/1.60/01_all_net-tools-1.60-2.6-compilefix.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/01_all_net-tools-1.60-2.6-compilefix.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/01_all_net-tools-1.60-2.6-compilefix.patch?rev=1.1&content-type=text/plain
Index: 01_all_net-tools-1.60-2.6-compilefix.patch
===================================================================
diff -ruN net-tools-1.60.orig/lib/x25_sr.c net-tools-1.60/lib/x25_sr.c
--- net-tools-1.60.orig/lib/x25_sr.c 2000-05-20 15:38:10.000000000 +0200
+++ net-tools-1.60/lib/x25_sr.c 2003-10-18 20:33:31.927574928 +0200
@@ -22,6 +22,7 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/x25.h>
+#include <linux/version.h>
#include <ctype.h>
#include <errno.h>
#include <netdb.h>
@@ -77,7 +78,11 @@
rt.sigdigits=sigdigits;
/* x25_route_struct.address isn't type struct sockaddr_x25, Why? */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
memcpy(&rt.address, &sx25.sx25_addr, sizeof(x25_address));
+#else
+ memcpy(&rt.address, &sx25.sx25_addr, sizeof(struct x25_address));
+#endif
while (*args) {
if (!strcmp(*args,"device") || !strcmp(*args,"dev")) {
1.1 src/patchsets/net-tools/1.60/02_all_net-tools-1.60-gcc34.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/02_all_net-tools-1.60-gcc34.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/02_all_net-tools-1.60-gcc34.patch?rev=1.1&content-type=text/plain
Index: 02_all_net-tools-1.60-gcc34.patch
===================================================================
http://bugs.gentoo.org/show_bug.cgi?id=48167
--- ./hostname.c.orig 2001-04-08 17:04:23.000000000 +0000
+++ ./hostname.c 2004-04-17 01:31:11.686122040 +0000
@@ -98,6 +98,7 @@
fprintf(stderr, _("%s: name too long\n"), program_name);
break;
default:
+ ;
}
exit(1);
};
@@ -117,6 +118,7 @@
fprintf(stderr, _("%s: name too long\n"), program_name);
break;
default:
+ ;
}
exit(1);
};
@@ -174,6 +176,7 @@
printf("%s\n", hp->h_name);
break;
default:
+ ;
}
}
--- ./lib/inet_sr.c.orig 2000-02-20 21:46:45.000000000 +0000
+++ ./lib/inet_sr.c 2004-04-17 01:31:02.388535488 +0000
@@ -105,6 +105,7 @@
case 2:
isnet = 0; break;
default:
+ ;
}
/* Fill in the other fields. */
1.1 src/patchsets/net-tools/1.60/03_all_net-tools-1.60-cleanup-list-handling.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/03_all_net-tools-1.60-cleanup-list-handling.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/03_all_net-tools-1.60-cleanup-list-handling.patch?rev=1.1&content-type=text/plain
Index: 03_all_net-tools-1.60-cleanup-list-handling.patch
===================================================================
diff -u -r1.1 -r1.3
--- nameif.c 18 Oct 2000 17:26:29 -0000 1.1
+++ nameif.c 6 Mar 2003 23:26:52 -0000 1.3
@@ -117,7 +117,8 @@
}
struct change {
- struct change *next,**pprev;
+ struct change *next;
+ int found;
char ifname[IFNAMSIZ+1];
unsigned char mac[6];
};
@@ -139,10 +140,7 @@
ch->ifname, pos);
if (parsemac(p,ch->mac) < 0)
complain(_("cannot parse MAC `%s' at %s"), p, pos);
- if (clist)
- clist->pprev = &ch->next;
ch->next = clist;
- ch->pprev = &clist;
clist = ch;
return 0;
}
@@ -200,7 +198,7 @@
void usage(void)
{
- fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}"));
+ fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}\n"));
exit(1);
}
@@ -277,21 +275,21 @@
ch = lookupmac(mac);
if (!ch)
continue;
-
- *ch->pprev = ch->next;
+
+ ch->found = 1;
if (strcmp(p, ch->ifname)) {
if (setname(p, ch->ifname) < 0)
complain(_("cannot change name of %s to %s: %s"),
p, ch->ifname, strerror(errno));
}
- free(ch);
}
fclose(ifh);
while (clist) {
struct change *ch = clist;
clist = clist->next;
- warning(_("interface '%s' not found"), ch->ifname);
+ if (!ch->found)
+ warning(_("interface '%s' not found"), ch->ifname);
free(ch);
}
1.1 src/patchsets/net-tools/1.60/04_all_net-tools-1.60-get_name.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/04_all_net-tools-1.60-get_name.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/04_all_net-tools-1.60-get_name.patch?rev=1.1&content-type=text/plain
Index: 04_all_net-tools-1.60-get_name.patch
===================================================================
Stack smashing attack in if_readlist_proc() from ifconfig
http://bugs.gentoo.org/show_bug.cgi?id=58633
diff -Nrup net-tools-1.60.orig/lib/interface.c net-tools-1.60/lib/interface.c
--- net-tools-1.60.orig/lib/interface.c 2004-08-12 05:54:09.000000000 -0400
+++ net-tools-1.60/lib/interface.c 2004-08-12 06:03:20.000000000 -0400
@@ -203,28 +203,34 @@ out:
static char *get_name(char *name, char *p)
{
- while (isspace(*p))
- p++;
- while (*p) {
- if (isspace(*p))
- break;
- if (*p == ':') { /* could be an alias */
- char *dot = p, *dotname = name;
- *name++ = *p++;
- while (isdigit(*p))
- *name++ = *p++;
- if (*p != ':') { /* it wasn't, backup */
- p = dot;
- name = dotname;
- }
- if (*p == '\0')
- return NULL;
- p++;
- break;
+ /* Extract <name>[:<alias>] from nul-terminated p where p matches
+ <name>[:<alias>]: after leading whitespace.
+ If match is not made, set name empty and return unchanged p */
+ int namestart=0, nameend=0, aliasend;
+ while (isspace(p[namestart]))
+ namestart++;
+ nameend=namestart;
+ while (p[nameend] && p[nameend]!=':' && !isspace(p[nameend]))
+ nameend++;
+ if (p[nameend]==':') {
+ aliasend=nameend+1;
+ while (p[aliasend] && isdigit(p[aliasend]))
+ aliasend++;
+ if (p[aliasend]==':') {
+ nameend=aliasend;
+ }
+ if ((nameend-namestart)<IFNAMSIZ) {
+ memcpy(name,&p[namestart],nameend-namestart);
+ name[nameend-namestart]='\0';
+ p=&p[nameend+1];
+ } else {
+ /* Interface name too large */
+ name[0]='\0';
}
- *name++ = *p++;
+ } else {
+ /* first ':' not found - return empty */
+ name[0]='\0';
}
- *name++ = '\0';
return p;
}
1.1 src/patchsets/net-tools/1.60/20_all_net-tools-1.54-ipvs.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/20_all_net-tools-1.54-ipvs.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/20_all_net-tools-1.54-ipvs.patch?rev=1.1&content-type=text/plain
Index: 20_all_net-tools-1.54-ipvs.patch
===================================================================
--- net-tools-1.54/lib/masq_info.c.orig Sun Jun 13 07:04:49 1999
+++ net-tools-1.54/lib/masq_info.c Tue Jun 27 10:37:09 2000
@@ -118,7 +118,9 @@
ms->src.sin_family = AF_INET;
ms->dst.sin_family = AF_INET;
- if (strcmp("TCP", buf) == 0)
+ if (strcmp("IP", buf) == 0)
+ ms->proto = "ip";
+ else if (strcmp("TCP", buf) == 0)
ms->proto = "tcp";
else if (strcmp("UDP", buf) == 0)
ms->proto = "udp";
1.1 src/patchsets/net-tools/1.60/21_all_net-tools-1.57-bug22040.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/21_all_net-tools-1.57-bug22040.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/21_all_net-tools-1.57-bug22040.patch?rev=1.1&content-type=text/plain
Index: 21_all_net-tools-1.57-bug22040.patch
===================================================================
--- net-tools-1.57/arp.c.orig Sun May 14 17:57:41 2000
+++ net-tools-1.57/arp.c Sat Nov 25 15:05:27 2000
@@ -618,6 +618,7 @@
fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -Ds <hostname> <if> [netmask <nm>] pub <-''-\n\n"));
fprintf(stderr, _(" -a display (all) hosts in alternative (BSD) style\n"));
+ fprintf(stderr, _(" -e display (all) hosts in default (Linux) style\n"));
fprintf(stderr, _(" -s, --set set a new ARP entry\n"));
fprintf(stderr, _(" -d, --delete delete a specified entry\n"));
fprintf(stderr, _(" -v, --verbose be verbose\n"));
--- net-tools-1.57/man/en_US/arp.8.orig Sat Nov 25 15:13:26 2000
+++ net-tools-1.57/man/en_US/arp.8 Sat Nov 25 15:15:12 2000
@@ -3,7 +3,7 @@
arp \- manipulate the system ARP cache
.SH SYNOPSIS
.B arp
-.RB [ \-vn ]
+.RB [ \-evn ]
.RB [ "\-H type" ]
.RB [ "-i if" ]
.B -a
@@ -60,7 +60,7 @@
shows numerical addresses instead of trying to determine symbolic host, port
or user names.
.TP
-.B "\-H type, \-\-hw-type type"
+.B "\-H type, \-\-hw-type type, \-t type"
When setting or reading the ARP cache, this optional parameter tells
.B arp
which class of entries it should check for. The default value of
@@ -81,7 +81,8 @@
.B hostname
parameter is not used,
.B all
-entries will be displayed.
+entries will be displayed.
+The entries will be displayed in alternate (BSD) style.
.TP
.B "\-d hostname, \-\-delete hostname"
Remove any entry for the specified host. This can be used if the
@@ -91,6 +92,9 @@
Use the interface
.BR ifa "'s"
hardware address.
+.TP
+.B "\-e"
+Shows the entries in default (Linux) style.
.TP
.B "\-i If, \-\-device If"
Select an interface. When dumping the ARP cache only entries matching
1.1 src/patchsets/net-tools/1.60/22_all_net-tools-1.60-manydevs.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/22_all_net-tools-1.60-manydevs.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/22_all_net-tools-1.60-manydevs.patch?rev=1.1&content-type=text/plain
Index: 22_all_net-tools-1.60-manydevs.patch
===================================================================
--- lib/nstrcmp.c.bak Fri Apr 12 00:15:01 2002
+++ lib/nstrcmp.c Fri Apr 12 00:15:29 2002
@@ -16,8 +16,8 @@
b++;
}
if (isdigit(*a)) {
- if (!isdigit(*b))
- return -1;
+ if (!isdigit(*b))
+ return 1;
while (a > astr) {
a--;
if (!isdigit(*a)) {
1.1 src/patchsets/net-tools/1.60/23_all_net-tools-1.60-miiioctl.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/23_all_net-tools-1.60-miiioctl.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/23_all_net-tools-1.60-miiioctl.patch?rev=1.1&content-type=text/plain
Index: 23_all_net-tools-1.60-miiioctl.patch
===================================================================
--- net-tools-1.60/include/mii.h.bar Tue Jul 31 11:49:39 2001
+++ net-tools-1.60/include/mii.h Tue Jul 31 11:49:33 2001
@@ -11,11 +11,9 @@
/* network interface ioctl's for MII commands */
#ifndef SIOCGMIIPHY
-#define SIOCGMIIPHY (SIOCDEVPRIVATE) /* Read from current PHY */
-#define SIOCGMIIREG (SIOCDEVPRIVATE+1) /* Read any PHY register */
-#define SIOCSMIIREG (SIOCDEVPRIVATE+2) /* Write any PHY register */
-#define SIOCGPARAMS (SIOCDEVPRIVATE+3) /* Read operational parameters */
-#define SIOCSPARAMS (SIOCDEVPRIVATE+4) /* Set operational parameters */
+#define SIOCGMIIPHY 0x8947 /* Read from current PHY */
+#define SIOCGMIIREG 0x8948 /* Read any PHY register */
+#define SIOCSMIIREG 0x8949 /* Write any PHY register */
#endif
#include <linux/types.h>
1.1 src/patchsets/net-tools/1.60/24_all_net-tools-1.60-virtualname.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/24_all_net-tools-1.60-virtualname.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/24_all_net-tools-1.60-virtualname.patch?rev=1.1&content-type=text/plain
Index: 24_all_net-tools-1.60-virtualname.patch
===================================================================
diff -uNr net-tools-1.60/lib/interface.c net-tools-1.60-2/lib/interface.c
--- net-tools-1.60/lib/interface.c Sat Feb 10 14:31:15 2001
+++ net-tools-1.60-2/lib/interface.c Thu Jul 18 13:15:37 2002
@@ -579,7 +579,7 @@
void ife_print_short(struct interface *ptr)
{
- printf("%-5.5s ", ptr->name);
+ printf("%-9.8s ", ptr->name);
printf("%5d %3d", ptr->mtu, ptr->metric);
/* If needed, display the interface statistics. */
if (ptr->statistics_valid) {
diff -uNr net-tools-1.60/netstat.c net-tools-1.60-2/netstat.c
--- net-tools-1.60/netstat.c Sun Apr 15 10:41:17 2001
+++ net-tools-1.60-2/netstat.c Thu Jul 18 12:48:33 2002
@@ -1449,7 +1449,7 @@
}
if (flag_exp < 2) {
ife_short = 1;
- printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
+ printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
}
if (for_all_interfaces(do_if_print, &flag_all) < 0) {
1.1 src/patchsets/net-tools/1.60/25_all_net-tools-1.60-cycle.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/25_all_net-tools-1.60-cycle.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/25_all_net-tools-1.60-cycle.patch?rev=1.1&content-type=text/plain
Index: 25_all_net-tools-1.60-cycle.patch
===================================================================
--- net-tools-1.60/lib/interface.c.cycle 2003-02-11 14:29:29.000000000 +0100
+++ net-tools-1.60/lib/interface.c 2003-02-11 14:29:29.000000000 +0100
@@ -90,6 +90,7 @@
static struct interface *int_list, *int_last;
static int if_readlist_proc(char *);
+static int if_readlist_rep(char *, struct interface *);
static struct interface *add_interface(char *name)
{
@@ -128,11 +129,13 @@
int for_all_interfaces(int (*doit) (struct interface *, void *), void *cookie)
{
struct interface *ife;
+ int err;
if (!int_list && (if_readlist() < 0))
return -1;
for (ife = int_list; ife; ife = ife->next) {
- int err = doit(ife, cookie);
+ if_readlist_rep(ife->name, ife);
+ err = doit(ife, cookie);
if (err)
return err;
}
@@ -369,6 +372,42 @@
return err;
}
+
+static int if_readlist_rep(char *target, struct interface *ife)
+{
+ FILE *fh;
+ char buf[512];
+ int err;
+
+ fh = fopen(_PATH_PROCNET_DEV, "r");
+ if (!fh) {
+ fprintf(stderr, _("Warning: cannot open %s (%s). Limited output.\n"),
+ _PATH_PROCNET_DEV, strerror(errno));
+ return if_readconf();
+ }
+ fgets(buf, sizeof buf, fh); /* eat line */
+ fgets(buf, sizeof buf, fh);
+
+ procnetdev_vsn = procnetdev_version(buf);
+
+ err = 0;
+ while (fgets(buf, sizeof buf, fh)) {
+ char *s, name[IFNAMSIZ];
+ s = get_name(name, buf);
+ get_dev_fields(s, ife);
+ ife->statistics_valid = 1;
+ if (target && !strcmp(target,name))
+ break;
+ }
+ if (ferror(fh)) {
+ perror(_PATH_PROCNET_DEV);
+ err = -1;
+ }
+
+ fclose(fh);
+ return err;
+}
+
int if_readlist(void)
{
int err = if_readlist_proc(NULL);
--- net-tools-1.60/man/en_US/netstat.8.cycle 2001-01-07 13:43:57.000000000 +0100
+++ net-tools-1.60/man/en_US/netstat.8 2003-02-11 14:29:29.000000000 +0100
@@ -30,6 +30,7 @@
.RB [ \-\-program | \-p ]
.RB [ \-\-verbose | \-v ]
.RB [ \-\-continuous | \-c]
+.RB [delay]
.P
.B netstat
.RB { \-\-route | \-r }
@@ -39,6 +40,7 @@
.RB [ \-\-numeric | \-n ]
.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ]
.RB [ \-\-continuous | \-c]
+.RB [delay]
.P
.B netstat
.RB { \-\-interfaces | \-i }
@@ -50,12 +52,14 @@
.RB [ \-\-numeric | \-n ]
.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ]
.RB [ \-\-continuous | \-c]
+.RB [delay]
.P
.B netstat
.RB { \-\-groups | \-g }
.RB [ \-\-numeric | \-n ]
.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ]
.RB [ \-\-continuous | \-c]
+.RB [delay]
.P
.B netstat
.RB { \-\-masquerade | \-M }
@@ -63,12 +67,14 @@
.RB [ \-\-numeric | \-n ]
.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ]
.RB [ \-\-continuous | \-c]
+.RB [delay]
.P
.B netstat
.RB { \-\-statistics | -s }
.RB [ \-\-tcp | \-t ]
.RB [ \-\-udp | \-u ]
.RB [ \-\-raw | \-w ]
+.RB [delay]
.P
.B netstat
.RB { \-\-version | \-V }
@@ -170,6 +176,10 @@
Print routing information from the FIB. (This is the default.)
.SS "\-C"
Print routing information from the route cache.
+.SS delay
+Netstat will cycle printing through statistics every
+.B delay
+seconds.
.IR UP .
.P
.SH OUTPUT
--- net-tools-1.60/netstat.c.cycle 2003-02-11 14:29:29.000000000 +0100
+++ net-tools-1.60/netstat.c 2003-02-11 15:07:26.000000000 +0100
@@ -102,7 +102,7 @@
#endif
/* prototypes for statistics.c */
-void parsesnmp(int, int, int);
+int parsesnmp(int, int, int);
void inittab(void);
typedef enum {
@@ -1440,6 +1440,8 @@
static int iface_info(void)
{
+ static int count=0;
+
if (skfd < 0) {
if ((skfd = sockets_open(0)) < 0) {
perror("socket");
@@ -1449,20 +1451,21 @@
}
if (flag_exp < 2) {
ife_short = 1;
- printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
+ if(!(count % 8))
+ printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
}
if (for_all_interfaces(do_if_print, &flag_all) < 0) {
perror(_("missing interface information"));
exit(1);
}
- if (flag_cnt)
+ if (!flag_cnt) {
free_interface_list();
- else {
close(skfd);
skfd = -1;
}
+ count++;
return 0;
}
@@ -1478,7 +1481,7 @@
{
fprintf(stderr, _("usage: netstat [-veenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}\n"));
fprintf(stderr, _(" netstat [-vnNcaeol] [<Socket> ...]\n"));
- fprintf(stderr, _(" netstat { [-veenNac] -i | [-cnNe] -M | -s }\n\n"));
+ fprintf(stderr, _(" netstat { [-veenNac] -i | [-cnNe] -M | -s } [delay]\n\n"));
fprintf(stderr, _(" -r, --route display routing table\n"));
fprintf(stderr, _(" -i, --interfaces display interface table\n"));
@@ -1514,6 +1517,7 @@
(int argc, char *argv[]) {
int i;
int lop;
+ int reptimer = 1;
struct option longopts[] =
{
AFTRANS_OPTS,
@@ -1655,6 +1659,12 @@
flag_sta++;
}
+ if(argc == optind + 1) {
+ if((reptimer = atoi(argv[optind])) <= 0)
+ usage();
+ flag_cnt++;
+ }
+
if (flag_int + flag_rou + flag_mas + flag_sta > 1)
usage();
@@ -1666,7 +1676,7 @@
flag_arg = flag_tcp + flag_udp + flag_raw + flag_unx + flag_ipx
+ flag_ax25 + flag_netrom + flag_igmp + flag_x25;
-
+
if (flag_mas) {
#if HAVE_FW_MASQUERADE && HAVE_AFINET
#if MORE_THAN_ONE_MASQ_AF
@@ -1678,7 +1688,7 @@
flag_not & FLAG_NUM_PORT, flag_exp);
if (i || !flag_cnt)
break;
- sleep(1);
+ sleep(reptimer);
}
#else
ENOSUPP("netstat.c", "FW_MASQUERADE");
@@ -1688,9 +1698,15 @@
}
if (flag_sta) {
+ for(;;) {
inittab();
- parsesnmp(flag_raw, flag_tcp, flag_udp);
- exit(0);
+ i = parsesnmp(flag_raw, flag_tcp, flag_udp);
+
+ if(i || !flag_cnt)
+ break;
+ sleep(reptimer);
+ }
+ return(i);
}
if (flag_rou) {
@@ -1712,7 +1728,7 @@
i = route_info(afname, options);
if (i || !flag_cnt)
break;
- sleep(1);
+ sleep(reptimer);
}
return (i);
}
@@ -1721,7 +1737,7 @@
i = iface_info();
if (!flag_cnt || i)
break;
- sleep(1);
+ sleep(reptimer);
}
return (i);
}
@@ -1847,7 +1863,7 @@
}
if (!flag_cnt || i)
break;
- sleep(1);
+ sleep(reptimer);
prg_cache_clear();
}
return (i);
--- net-tools-1.60/statistics.c.cycle 2001-02-02 19:01:23.000000000 +0100
+++ net-tools-1.60/statistics.c 2003-02-11 14:29:29.000000000 +0100
@@ -338,7 +338,7 @@
}
-void parsesnmp(int flag_raw, int flag_tcp, int flag_udp)
+int parsesnmp(int flag_raw, int flag_tcp, int flag_udp)
{
FILE *f;
@@ -347,12 +347,14 @@
f = fopen("/proc/net/snmp", "r");
if (!f) {
perror(_("cannot open /proc/net/snmp"));
- return;
+ return(1);
}
process_fd(f);
- if (ferror(f))
+ if (ferror(f)) {
perror("/proc/net/snmp");
+ return(1);
+ }
fclose(f);
@@ -361,12 +363,14 @@
if (f) {
process_fd(f);
- if (ferror(f))
- perror("/proc/net/netstat");
+ if (ferror(f)) {
+ perror("/proc/net/netstat");
+ return(1);
+ }
fclose(f);
}
- return;
+ return(0);
}
1.1 src/patchsets/net-tools/1.60/26_all_net-tools-1.60-overflow.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/26_all_net-tools-1.60-overflow.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/26_all_net-tools-1.60-overflow.patch?rev=1.1&content-type=text/plain
Index: 26_all_net-tools-1.60-overflow.patch
===================================================================
diff -ur net-tools-1.60.orig/netstat.c net-tools-1.60/netstat.c
--- net-tools-1.60.orig/netstat.c 2004-04-07 11:47:05.000000000 -0400
+++ net-tools-1.60/netstat.c 2004-04-07 16:47:15.000000000 -0400
@@ -777,7 +777,8 @@
local_addr[22 - strlen(buffer)] = '\0';
strcat(local_addr, ":");
- strcat(local_addr, buffer);
+ strncat(local_addr, buffer, sizeof(local_addr));
+ local_addr[sizeof(local_addr)-1] = 0;
snprintf(buffer, sizeof(buffer), "%s",
get_sname(htons(rem_port), "tcp", flag_not & FLAG_NUM_PORT));
@@ -785,7 +786,8 @@
rem_addr[22 - strlen(buffer)] = '\0';
strcat(rem_addr, ":");
- strcat(rem_addr, buffer);
+ strncat(rem_addr, buffer, sizeof(rem_addr));
+ rem_addr[sizeof(rem_addr)-1] = 0;
timers[0] = '\0';
if (flag_opt)
@@ -926,7 +928,8 @@
if ((strlen(local_addr) + strlen(buffer)) > 22)
local_addr[22 - strlen(buffer)] = '\0';
strcat(local_addr, ":");
- strcat(local_addr, buffer);
+ strncat(local_addr, buffer, sizeof(local_addr));
+ local_addr[sizeof(local_addr)-1] = 0;
snprintf(buffer, sizeof(buffer), "%s",
get_sname(htons(rem_port), "udp", flag_not & FLAG_NUM_PORT));
@@ -935,7 +938,8 @@
if ((strlen(rem_addr) + strlen(buffer)) > 22)
rem_addr[22 - strlen(buffer)] = '\0';
strcat(rem_addr, ":");
- strcat(rem_addr, buffer);
+ strncat(rem_addr, buffer, sizeof(rem_addr));
+ rem_addr[sizeof(rem_addr)-1] = 0;
timers[0] = '\0';
if (flag_opt)
@@ -1045,7 +1049,8 @@
if ((strlen(local_addr) + strlen(buffer)) > 22)
local_addr[22 - strlen(buffer)] = '\0';
strcat(local_addr, ":");
- strcat(local_addr, buffer);
+ strncat(local_addr, buffer, sizeof(local_addr));
+ local_addr[sizeof(local_addr)-1] = 0;
snprintf(buffer, sizeof(buffer), "%s",
get_sname(htons(rem_port), "raw", flag_not & FLAG_NUM_PORT));
@@ -1054,7 +1059,8 @@
if ((strlen(rem_addr) + strlen(buffer)) > 22)
rem_addr[22 - strlen(buffer)] = '\0';
strcat(rem_addr, ":");
- strcat(rem_addr, buffer);
+ strncat(rem_addr, buffer, sizeof(rem_addr));
+ rem_addr[sizeof(rem_addr)-1] = 0;
timers[0] = '\0';
if (flag_opt)
1.1 src/patchsets/net-tools/1.60/27_all_net-tools-1.60-netstat_ulong.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/27_all_net-tools-1.60-netstat_ulong.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/27_all_net-tools-1.60-netstat_ulong.patch?rev=1.1&content-type=text/plain
Index: 27_all_net-tools-1.60-netstat_ulong.patch
===================================================================
--- net-tools-1.60/netstat.c.netstat_ulong 2004-11-11 14:28:44.000000000 +0100
+++ net-tools-1.60/netstat.c 2004-11-11 14:31:14.099313000 +0100
@@ -273,7 +273,7 @@
strcpy(pn->name,name);
}
-static const char *prg_cache_get(int inode)
+static const char *prg_cache_get(unsigned long inode)
{
unsigned hi=PRG_HASHIT(inode);
struct prg_node *pn;
1.1 src/patchsets/net-tools/1.60/50_all_net-tools-1.60-multiline-string.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/50_all_net-tools-1.60-multiline-string.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/50_all_net-tools-1.60-multiline-string.patch?rev=1.1&content-type=text/plain
Index: 50_all_net-tools-1.60-multiline-string.patch
===================================================================
diff -Naurp net-tools-1.60.orig/mii-tool.c net-tools-1.60/mii-tool.c
--- net-tools-1.60.orig/mii-tool.c 2000-05-21 10:31:17.000000000 -0400
+++ net-tools-1.60/mii-tool.c 2003-03-19 09:55:33.000000000 -0500
@@ -379,16 +379,16 @@ static void watch_one_xcvr(int skfd, cha
/*--------------------------------------------------------------------*/
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.1 src/patchsets/net-tools/1.60/51_all_net-tools-1.60-man.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/51_all_net-tools-1.60-man.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/51_all_net-tools-1.60-man.patch?rev=1.1&content-type=text/plain
Index: 51_all_net-tools-1.60-man.patch
===================================================================
splite writes:
The netstat(8) man page in sys-apps/net-tools states that the "-i" and
"--interfaces" flags to netstat take an optional argument denoting a
particular interface when it in fact does not.
http://bugs.gentoo.org/show_bug.cgi?id=29677
--- man/en_US/netstat.8.orig 2003-09-26 10:08:19.000000000 -0500
+++ man/en_US/netstat.8 2003-09-26 10:25:39.000000000 -0500
@@ -44,7 +44,6 @@
.P
.B netstat
.RB { \-\-interfaces | \-i }
-.RI [ iface ]
.RB [ \-\-all | \-a ]
.RB [ \-\-extend | \-e [ \-\-extend | \-e] ]
.RB [ \-\-verbose | \-v ]
@@ -107,9 +106,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 "\-\-interface , \-i"
+Display a table of all network interfaces.
.SS "\-\-masquerade , \-M"
Display a list of masqueraded connections.
.SS "\-\-statistics , \-s"
1.1 src/patchsets/net-tools/1.60/52_all_net-tools-1.60-numeric-ports.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/52_all_net-tools-1.60-numeric-ports.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/52_all_net-tools-1.60-numeric-ports.patch?rev=1.1&content-type=text/plain
Index: 52_all_net-tools-1.60-numeric-ports.patch
===================================================================
Mads Martin Joergensen writes:
According to the manual the option "--numeric-ports" should not
affect host resolution, but it does. All connected hosts are displayed
with numeric values instead of their FQDN.
http://bugs.gentoo.org/show_bug.cgi?id=76756
--- 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));
+ flag_not & FLAG_NUM_HOST), sizeof(local_addr));
- safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, flag_not),
+ 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.1 src/patchsets/net-tools/1.60/53_all_net-tools-1.60-appletalk.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/53_all_net-tools-1.60-appletalk.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/53_all_net-tools-1.60-appletalk.patch?rev=1.1&content-type=text/plain
Index: 53_all_net-tools-1.60-appletalk.patch
===================================================================
Ripped from debian's patchset
--- net-tools-1.60.orig/lib/ddp_gr.c
+++ net-tools-1.60/lib/ddp_gr.c
@@ -1,3 +1,20 @@
+/*
+ * lib/ddp_gr.c Prinbting of DDP (AppleTalk) routing table
+ * used by the NET-LIB.
+ *
+ * NET-LIB
+ *
+ * Version: $Id: 53_all_net-tools-1.60-appletalk.patch,v 1.1 2008/04/14 04:02:17 vapier Exp $
+ *
+ * Author: Ajax <ajax@...>
+ *
+ * Modification:
+ * 2002-06-02 integrated into main source by Bernd Eckenfels
+ *
+ */
+
+/* TODO: name lookups (/etc/atalk.names? NBP?) */
+
#include "config.h"
#if HAVE_AFATALK
@@ -16,9 +33,61 @@
#include "pathnames.h"
#include "intl.h"
+/* stolen from inet_gr.c */
+#define flags_decode(i,o) do { \
+ o[0] = '\0'; \
+ if (i & RTF_UP) strcat(o, "U"); \
+ if (i & RTF_GATEWAY) strcat(o, "G"); \
+ if (i & RTF_REJECT) strcat(o, "!"); \
+ if (i & RTF_HOST) strcat(o, "H"); \
+ if (i & RTF_REINSTATE) strcat(o, "R"); \
+ if (i & RTF_DYNAMIC) strcat(o, "D"); \
+ if (i & RTF_MODIFIED) strcat(o, "M"); \
+ if (i & RTF_DEFAULT) strcat(o, "d"); \
+ if (i & RTF_ALLONLINK) strcat(o, "a"); \
+ if (i & RTF_ADDRCONF) strcat(o, "c"); \
+ if (i & RTF_NONEXTHOP) strcat(o, "o"); \
+ if (i & RTF_EXPIRES) strcat(o, "e"); \
+ if (i & RTF_CACHE) strcat(o, "c"); \
+ if (i & RTF_FLOW) strcat(o, "f"); \
+ if (i & RTF_POLICY) strcat(o, "p"); \
+ if (i & RTF_LOCAL) strcat(o, "l"); \
+ if (i & RTF_MTU) strcat(o, "u"); \
+ if (i & RTF_WINDOW) strcat(o, "w"); \
+ if (i & RTF_IRTT) strcat(o, "i"); \
+ if (i & RTF_NOTCACHED) strcat(o, "n"); \
+ } while (0)
+
int DDP_rprint(int options)
{
- fprintf(stderr, _("Routing table for `ddp' not yet supported.\n"));
- return (1);
+ FILE *fp;
+ char *dest, *gw, *dev, *flags;
+ char oflags[32];
+ char *hdr = "Destination Gateway Device Flags";
+
+ fp = fopen(_PATH_PROCNET_ATALK_ROUTE, "r");
+
+ if (!fp) {
+ perror("Error opening " _PATH_PROCNET_ATALK_ROUTE);
+ fprintf(stderr, "DDP (AppleTalk) not configured on this system.\n");
+ return 1;
+ }
+
+ fscanf(fp, "%as %as %as %as\n", &dest, &gw, &flags, &dev);
+ free(dest); free(gw); free(dev); free(flags);
+
+ printf("%s\n", hdr);
+
+ while (fscanf(fp, "%as %as %as %as\n", &dest, &gw, &flags, &dev) == 4) {
+ int iflags = atoi(flags);
+ flags_decode(iflags, oflags);
+ printf("%-16s%-16s%-16s%-s\n", dest, gw, dev, oflags);
+ free(dest); free(gw); free(dev); free(flags);
+ }
+
+ fclose(fp);
+
+ return 0;
+
}
#endif
--- net-tools-1.60.orig/lib/pathnames.h
+++ net-tools-1.60/lib/pathnames.h
@@ -45,6 +44,7 @@
#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_ATALK_ROUTE "/proc/net/atalk_route"
/* pathname for the netlink device */
#define _PATH_DEV_ROUTE "/dev/route"
1.1 src/patchsets/net-tools/1.60/54_all_net-tools-1.60-wide.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/54_all_net-tools-1.60-wide.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/54_all_net-tools-1.60-wide.patch?rev=1.1&content-type=text/plain
Index: 54_all_net-tools-1.60-wide.patch
===================================================================
comabug@... writes:
net-tools' netstat should have a -W flag like FreeBSD.
There is currently no way to get the full hostname from netstat
for local/remote hostnames.
http://bugs.gentoo.org/show_bug.cgi?id=53731
diff -ru net-tools-1.60.orig/man/en_US/netstat.8 net-tools-1.60/man/en_US/netstat.8
--- net-tools-1.60.orig/man/en_US/netstat.8 2001-01-07 13:43:57.000000000 +0100
+++ net-tools-1.60/man/en_US/netstat.8 2004-06-12 19:30:55.566822928 +0200
@@ -24,6 +24,7 @@
.RB [ \-\-all | \-a ]
.RB [ \-\-numeric | \-n ]
.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ]
+.RB [ \-\-wide | \-W]
.RB [ \-\-symbolic | \-N ]
.RB [ \-\-extend | \-e [ \-\-extend | \-e] ]
.RB [ \-\-timers | \-o ]
@@ -55,6 +56,7 @@
.RB { \-\-groups | \-g }
.RB [ \-\-numeric | \-n ]
.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ]
+.RB [ \-\-wide | \-W]
.RB [ \-\-continuous | \-c]
.P
.B netstat
@@ -124,6 +126,8 @@
.SS "\-\-numeric-users"
shows numerical user IDs but does not affect the resolution of host or
port names.
+.SS "\-\-wide , \-W"
+Don't truncate host names.
.SS "\-\-protocol=\fIfamily \fR, \fB\-A"
Specifies the address families (perhaps better described as low level
diff -ru net-tools-1.60.orig/netstat.c net-tools-1.60/netstat.c
--- net-tools-1.60.orig/netstat.c 2001-04-15 16:41:17.000000000 +0200
+++ net-tools-1.60/netstat.c 2004-06-12 19:50:23.459276288 +0200
@@ -149,6 +149,7 @@
int flag_prg = 0;
int flag_arg = 0;
int flag_ver = 0;
+int flag_wid = 0;
FILE *procinfo;
@@ -772,7 +773,7 @@
get_sname(htons(local_port), "tcp",
flag_not & FLAG_NUM_PORT));
- if ((strlen(local_addr) + strlen(buffer)) > 22)
+ if (!flag_wid && ((strlen(local_addr) + strlen(buffer)) > 22))
local_addr[22 - strlen(buffer)] = '\0';
strcat(local_addr, ":");
@@ -780,7 +781,7 @@
snprintf(buffer, sizeof(buffer), "%s",
get_sname(htons(rem_port), "tcp", flag_not & FLAG_NUM_PORT));
- if ((strlen(rem_addr) + strlen(buffer)) > 22)
+ if (!flag_wid && ((strlen(rem_addr) + strlen(buffer)) > 22))
rem_addr[22 - strlen(buffer)] = '\0';
strcat(rem_addr, ":");
@@ -922,7 +923,7 @@
snprintf(buffer, sizeof(buffer), "%s",
get_sname(htons(local_port), "udp",
flag_not & FLAG_NUM_PORT));
- if ((strlen(local_addr) + strlen(buffer)) > 22)
+ if (!flag_wid && ((strlen(local_addr) + strlen(buffer)) > 22))
local_addr[22 - strlen(buffer)] = '\0';
strcat(local_addr, ":");
strcat(local_addr, buffer);
@@ -931,7 +932,7 @@
get_sname(htons(rem_port), "udp", flag_not & FLAG_NUM_PORT));
safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr,
flag_not & FLAG_NUM_HOST), sizeof(rem_addr));
- if ((strlen(rem_addr) + strlen(buffer)) > 22)
+ if (!flag_wid && ((strlen(rem_addr) + strlen(buffer)) > 22))
rem_addr[22 - strlen(buffer)] = '\0';
strcat(rem_addr, ":");
strcat(rem_addr, buffer);
@@ -1041,7 +1042,7 @@
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)
+ if (!flag_wid && ((strlen(local_addr) + strlen(buffer)) > 22))
local_addr[22 - strlen(buffer)] = '\0';
strcat(local_addr, ":");
strcat(local_addr, buffer);
@@ -1050,7 +1051,7 @@
get_sname(htons(rem_port), "raw", flag_not & FLAG_NUM_PORT));
safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr,
flag_not & FLAG_NUM_HOST), sizeof(rem_addr));
- if ((strlen(rem_addr) + strlen(buffer)) > 22)
+ if (!flag_wid && ((strlen(rem_addr) + strlen(buffer)) > 22))
rem_addr[22 - strlen(buffer)] = '\0';
strcat(rem_addr, ":");
strcat(rem_addr, buffer);
@@ -1492,6 +1493,7 @@
fprintf(stderr, _(" --numeric-hosts don't resolve host names\n"));
fprintf(stderr, _(" --numeric-ports don't resolve port names\n"));
fprintf(stderr, _(" --numeric-users don't resolve user names\n"));
+ fprintf(stderr, _(" -W, --wide don't truncate host names\n"));
fprintf(stderr, _(" -N, --symbolic resolve hardware names\n"));
fprintf(stderr, _(" -e, --extend display other/more information\n"));
fprintf(stderr, _(" -p, --programs display PID/Program name for sockets\n"));
@@ -1541,6 +1543,7 @@
{"numeric-hosts", 0, 0, '!'},
{"numeric-ports", 0, 0, '@'},
{"numeric-users", 0, 0, '#'},
+ {"wide", 0, 0, 'W'},
{"symbolic", 0, 0, 'N'},
{"cache", 0, 0, 'C'},
{"fib", 0, 0, 'F'},
@@ -1556,7 +1559,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:acdegphinWNorstuVv?wxl", longopts, &lop)) != EOF)
switch (i) {
case -1:
break;
@@ -1612,6 +1615,9 @@
case '#':
flag_not |= FLAG_NUM_USER;
break;
+ case 'W':
+ flag_wid++;
+ break;
case 'N':
flag_not |= FLAG_SYM;
break;
1.1 src/patchsets/net-tools/1.60/55_all_net-tools-1.60-Makefile.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/55_all_net-tools-1.60-Makefile.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/55_all_net-tools-1.60-Makefile.patch?rev=1.1&content-type=text/plain
Index: 55_all_net-tools-1.60-Makefile.patch
===================================================================
Let's clean up the Makefile ... we want to:
- make sure COPTS is clean for clobbering with user $CFLAGS
- make sure LOPTS is clean for clobbering with user $LDFLAGS
- remove all references to config.h since we generate it for the
user and we really do NOT want the interactive configure running
- make sure libdir depends on version.h to fix parallel builds
--- Makefile.orig 2005-01-10 13:11:00.369702792 -0500
+++ Makefile 2005-01-10 13:15:36.542718112 -0500
@@ -88,7 +88,7 @@
# Compiler and Linker Options
# You may need to uncomment and edit these if you are using libc5 and IPv6.
-COPTS = -D_GNU_SOURCE -O2 -Wall -g # -I/usr/inet6/include
+COPTS =
ifeq ($(origin LOPTS), undefined)
LOPTS =
endif
@@ -113,7 +113,7 @@
NET_LIB = $(NET_LIB_PATH)/lib$(NET_LIB_NAME).a
-CFLAGS = $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH)
+CFLAGS = $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH) -D_GNU_SOURCE -Wall
LDFLAGS = $(LOPTS) -L$(NET_LIB_PATH)
SUBDIRS = man/ $(NET_LIB_PATH)/
@@ -127,12 +127,12 @@
MDEFINES = COPTS='$(COPTS)' LOPTS='$(LOPTS)' TOPDIR='$(TOPDIR)'
-%.o: %.c config.h version.h intl.h net-features.h $<
+%.o: %.c version.h intl.h net-features.h $<
$(CC) $(CFLAGS) -c $<
-all: config.h version.h subdirs $(PROGS)
+all: version.h subdirs $(PROGS)
-config: cleanconfig config.h
+config: cleanconfig
install: all savebin installbin installdata
@@ -159,14 +159,6 @@
@tar -cvz -f ../net-tools-$(RELEASE).tar.gz -C .. net-tools
-config.h: config.in Makefile
- @echo "Configuring the Linux net-tools (NET-3 Base Utilities)..." ; echo
- @if [ config.status -nt config.in ]; \
- then ./configure.sh config.status; \
- else ./configure.sh config.in; \
- fi
-
-
version.h: Makefile
@echo "#define RELEASE \"net-tools $(RELEASE)\"" >version.h
@@ -175,7 +167,7 @@
i18n.h: i18ndir
-libdir:
+libdir: version.h
@$(MAKE) -C $(NET_LIB_PATH) $(MDEFINES)
i18ndir:
1.1 src/patchsets/net-tools/1.60/56_all_net-tools-1.60-ipv6-hostname.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/56_all_net-tools-1.60-ipv6-hostname.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/56_all_net-tools-1.60-ipv6-hostname.patch?rev=1.1&content-type=text/plain
Index: 56_all_net-tools-1.60-ipv6-hostname.patch
===================================================================
Patch by pasi.valminen@... to fix FQDN handling with AAAA records
http://bugs.gentoo.org/show_bug.cgi?id=42650
--- hostname.c.orig 2005-02-11 21:17:51.000000000 -0500
+++ hostname.c 2005-02-11 21:18:48.000000000 -0500
@@ -35,6 +35,10 @@
#include <getopt.h>
#include <string.h>
#include <netdb.h>
+#ifdef IPV6
+#include <sys/socket.h> /* for PF_INET6 */
+#include <sys/types.h> /* for inet_ntop */
+#endif /* IPV6 */
#include <errno.h>
#include <sys/param.h>
#include <netinet/in.h>
@@ -127,15 +131,23 @@
static void showhname(char *hname, int c)
{
struct hostent *hp;
+#ifdef IPV6
+ struct in6_addr **ip6;
+#endif /* IPV6 */
register char *p, **alias;
struct in_addr **ip;
if (opt_v)
fprintf(stderr, _("Resolving `%s' ...\n"), hname);
- if (!(hp = gethostbyname(hname))) {
+ if (
+#ifdef IPV6
+ !(hp = gethostbyname2(hname, PF_INET6)) &&
+#endif /* IPV6 */
+ !(hp = gethostbyname(hname))) {
herror(program_name);
exit(1);
}
+
if (opt_v) {
fprintf(stderr, _("Result: h_name=`%s'\n"),
hp->h_name);
@@ -144,11 +156,28 @@
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++));
+#ifdef IPV6
+ if(hp->h_addrtype == PF_INET6) {
+ char addr[INET6_ADDRSTRLEN + 1];
+ addr[INET6_ADDRSTRLEN] = '\0';
+ ip6 = (struct in6_addr **) hp->h_addr_list;
+ while(ip6[0]) {
+ if(inet_ntop(PF_INET6, *ip6++, addr, INET6_ADDRSTRLEN))
+ fprintf(stderr, _("Result: h_addr_list=`%s'\n"), addr);
+ else if(errno == EAFNOSUPPORT)
+ fprintf(stderr, _("%s: protocol family not supported\n"),
+ program_name);
+ else if(errno == ENOSPC)
+ fprintf(stderr, _("%s: name too long\n"), program_name);
+ }
+ } else
+#endif /* IPV6 */
+ {
+ ip = (struct in_addr **) hp->h_addr_list;
+ while (ip[0])
+ fprintf(stderr, _("Result: h_addr_list=`%s'\n"),
+ inet_ntoa(**ip++));
+ }
}
if (!(p = strchr(hp->h_name, '.')) && (c == 'd'))
return;
@@ -160,10 +189,32 @@
printf("\n");
break;
case 'i':
- while (hp->h_addr_list[0])
- printf("%s ", inet_ntoa(*(struct in_addr *) *hp->h_addr_list++));
- printf("\n");
- break;
+#ifdef IPV6
+ if(hp->h_addrtype == PF_INET6) {
+ char addr[INET6_ADDRSTRLEN + 1];
+ addr[INET6_ADDRSTRLEN] = '\0';
+ while(hp->h_addr_list[0]) {
+ if(inet_ntop(PF_INET6, (struct in6_addr *)*hp->h_addr_list++,
+ addr, INET6_ADDRSTRLEN))
+ printf("%s ", addr);
+ else if(errno == EAFNOSUPPORT) {
+ fprintf(stderr, _("\n%s: protocol family not supported\n"),
+ program_name);
+ exit(1);
+ } else if(errno == ENOSPC) {
+ fprintf(stderr, _("\n%s: name too long\n"), program_name);
+ exit(1);
+ }
+ printf("\n");
+ }
+ } else
+#endif /* IPV6 */
+ {
+ while (hp->h_addr_list[0])
+ printf("%s ", inet_ntoa(*(struct in_addr *)*hp->h_addr_list++));
+ printf("\n");
+ }
+ break;
case 'd':
printf("%s\n", ++p);
break;
1.1 src/patchsets/net-tools/1.60/57_all_net-tools-1.60-ifconfig-infiniband.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/57_all_net-tools-1.60-ifconfig-infiniband.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/57_all_net-tools-1.60-ifconfig-infiniband.patch?rev=1.1&content-type=text/plain
Index: 57_all_net-tools-1.60-ifconfig-infiniband.patch
===================================================================
Patch by Tom Duffy <tduffy@...> to teach ifconfig about infiniband
http://bugs.gentoo.org/show_bug.cgi?id=81180
--- net-tools-1.60/config.in
+++ net-tools-1.60-ib/config.in
@@ -82,6 +82,7 @@
bool '(Cisco)-HDLC/LAPB support' HAVE_HWHDLCLAPB n
bool 'IrDA support' HAVE_HWIRDA y
bool 'Econet hardware support' HAVE_HWEC n
+bool 'InfiniBand hardware support' HAVE_HWIB y
*
*
* Other Features.
--- net-tools-1.60/lib/hw.c
+++ net-tools-1.60-ib/lib/hw.c
@@ -73,6 +73,8 @@
extern struct hwtype ec_hwtype;
+extern struct hwtype ib_hwtype;
+
static struct hwtype *hwtypes[] =
{
@@ -144,6 +146,9 @@
#if HAVE_HWX25
&x25_hwtype,
#endif
+#if HAVE_HWIB
+ &ib_hwtype,
+#endif
&unspec_hwtype,
NULL
};
@@ -217,6 +222,9 @@
#if HAVE_HWEC
ec_hwtype.title = _("Econet");
#endif
+#if HAVE_HWIB
+ ib_hwtype.title = _("InfiniBand");
+#endif
sVhwinit = 1;
}
--- net-tools-1.60/lib/ib.c 1969-12-31 16:00:00.000000000 -0800
+++ net-tools-1.60-ib/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: 57_all_net-tools-1.60-ifconfig-infiniband.patch,v 1.1 2008/04/14 04:02:17 vapier Exp $
+ *
+ * Author: Fred N. van Kempen, <waltje@...>
+ * Copyright 1993 MicroWalt Corporation
+ * Tom Duffy <tduffy@...>
+ *
+ * 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 */
--- net-tools-1.60/lib/Makefile 2000-10-28 03:59:42.000000000 -0700
+++ net-tools-1.60-ib/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.1 src/patchsets/net-tools/1.60/60_all_net-tools-1.60-headers.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/60_all_net-tools-1.60-headers.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/60_all_net-tools-1.60-headers.patch?rev=1.1&content-type=text/plain
Index: 60_all_net-tools-1.60-headers.patch
===================================================================
need stdlib.h for exit()
--- net-tools/hostname.c
+++ net-tools/hostname.c
@@ -31,6 +31,7 @@
* your option) any later version.
*/
#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <string.h>
1.1 src/patchsets/net-tools/1.60/70_all_net-tools-1.60-unaligned.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/70_all_net-tools-1.60-unaligned.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/70_all_net-tools-1.60-unaligned.patch?rev=1.1&content-type=text/plain
Index: 70_all_net-tools-1.60-unaligned.patch
===================================================================
fix crash due to unaligned accesses
http://bugs.gentoo.org/163430
Index: arp.c
===================================================================
RCS file: /cvsroot/net-tools/net-tools/arp.c,v
retrieving revision 1.24
diff -u -r1.24 arp.c
--- arp.c 16 May 2005 04:30:17 -0000 1.24
+++ arp.c 4 Dec 2005 02:49:42 -0000
@@ -100,7 +100,8 @@
{
char host[128];
struct arpreq req;
- struct sockaddr sa;
+ struct sockaddr_storage ss;
+ struct sockaddr *sa;
int flags = 0;
int deleted = 0;
@@ -112,12 +113,13 @@
return (-1);
}
safe_strncpy(host, *args, (sizeof host));
- if (ap->input(0, host, &sa) < 0) {
+ sa = (struct sockaddr *)&ss;
+ if (ap->input(0, host, sa) < 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 *) sa, sizeof(struct sockaddr));
if (hw_set)
req.arp_ha.sa_family = hw->type;
@@ -177,11 +179,11 @@
usage();
if (strcmp(*args, "255.255.255.255") != 0) {
strcpy(host, *args);
- if (ap->input(0, host, &sa) < 0) {
+ if (ap->input(0, host, sa) < 0) {
ap->herror(host);
return (-1);
}
- memcpy((char *) &req.arp_netmask, (char *) &sa,
+ memcpy((char *) &req.arp_netmask, (char *) sa,
sizeof(struct sockaddr));
req.arp_flags |= ATF_NETMASK;
}
@@ -266,7 +268,8 @@
{
char host[128];
struct arpreq req;
- struct sockaddr sa;
+ struct sockaddr_storage ss;
+ struct sockaddr *sa;
int flags;
memset((char *) &req, 0, sizeof(req));
@@ -277,12 +280,13 @@
return (-1);
}
safe_strncpy(host, *args++, (sizeof host));
- if (ap->input(0, host, &sa) < 0) {
+ sa = (struct sockaddr *)&ss;
+ if (ap->input(0, host, sa) < 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 *) sa, sizeof(struct sockaddr));
/* Fetch the hardware address. */
if (*args == NULL) {
@@ -352,11 +356,11 @@
usage();
if (strcmp(*args, "255.255.255.255") != 0) {
strcpy(host, *args);
- if (ap->input(0, host, &sa) < 0) {
+ if (ap->input(0, host, sa) < 0) {
ap->herror(host);
return (-1);
}
- memcpy((char *) &req.arp_netmask, (char *) &sa,
+ memcpy((char *) &req.arp_netmask, (char *) sa,
sizeof(struct sockaddr));
flags |= ATF_NETMASK;
}
@@ -525,7 +529,8 @@
static int arp_show(char *name)
{
char host[100];
- struct sockaddr sa;
+ struct sockaddr_storage ss;
+ struct sockaddr *sa;
char ip[100];
char hwa[100];
char mask[100];
@@ -538,14 +543,15 @@
host[0] = '\0';
+ sa = (struct sockaddr *)&ss;
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, sa) < 0) {
ap->herror(host);
return (-1);
}
- safe_strncpy(host, ap->sprint(&sa, 1), sizeof(host));
+ safe_strncpy(host, ap->sprint(sa, 1), sizeof(host));
}
/* Open the PROCps kernel table. */
if ((fp = fopen(_PATH_PROCNET_ARP, "r")) == NULL) {
@@ -581,10 +587,10 @@
if (opt_n)
hostname = "?";
else {
- if (ap->input(0, ip, &sa) < 0)
+ if (ap->input(0, ip, sa) < 0)
hostname = ip;
else
- hostname = ap->sprint(&sa, opt_n | 0x8000);
+ hostname = ap->sprint(sa, opt_n | 0x8000);
if (strcmp(hostname, ip) == 0)
hostname = "?";
}
--
gentoo-commits@g.o mailing list
|