From 80b261f67f5b8afc941791c963266080e1ab3faef5bb13b661059a8bd6c8aa4f Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Mon, 18 Dec 2006 23:17:12 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/net-tools?expand=0&rev=1 --- .gitattributes | 23 + .gitignore | 1 + manpages.diff | 307 ++++++++++ nameif-rename.patch | 202 +++++++ net-tools-1.60-arp-unaligned-access.patch | 116 ++++ net-tools-1.60-compoundstatement.diff | 44 ++ net-tools-1.60-cont-buff.patch | 294 ++++++++++ net-tools-1.60-errors.patch | 111 ++++ net-tools-1.60-if_tr.diff | 11 + net-tools-1.60-interface_stack.patch | 68 +++ net-tools-1.60-krn26.dif | 22 + net-tools-1.60-long_to_int.diff | 20 + net-tools-1.60-miioff.diff | 8 + net-tools-1.60-multilinestr.diff | 29 + net-tools-1.60-nameif.diff | 47 ++ net-tools-1.60-netstat-output.patch | 215 +++++++ net-tools-1.60-netstat-p.patch | 67 +++ net-tools-1.60-netstat.8.diff | 24 + net-tools-1.60-numericstuff.diff | 49 ++ net-tools-1.60-sctp-quiet | 13 + net-tools-1.60-sctp.patch | 644 +++++++++++++++++++++ net-tools-1.60-snmp-counter-overflow.patch | 13 + net-tools-1.60-sockios-SIOCGMIIPHY.diff | 10 + net-tools-1.60-strictaliasing.diff | 38 ++ net-tools-1.60.dif | 126 ++++ net-tools-1.60.tar.bz2 | 3 + net-tools.changes | 388 +++++++++++++ net-tools.spec | 327 +++++++++++ netstat-trunc.dif | 68 +++ netstat.xinetd | 16 + nstrcmp.c | 51 ++ ready | 0 traceroute-1.0.4.tar.bz2 | 3 + traceroute-LDOPTS.diff | 16 + traceroute-maxprobes.diff | 20 + traceroute-strip.diff | 11 + 36 files changed, 3405 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 manpages.diff create mode 100644 nameif-rename.patch create mode 100644 net-tools-1.60-arp-unaligned-access.patch create mode 100644 net-tools-1.60-compoundstatement.diff create mode 100644 net-tools-1.60-cont-buff.patch create mode 100644 net-tools-1.60-errors.patch create mode 100644 net-tools-1.60-if_tr.diff create mode 100644 net-tools-1.60-interface_stack.patch create mode 100644 net-tools-1.60-krn26.dif create mode 100644 net-tools-1.60-long_to_int.diff create mode 100644 net-tools-1.60-miioff.diff create mode 100644 net-tools-1.60-multilinestr.diff create mode 100644 net-tools-1.60-nameif.diff create mode 100644 net-tools-1.60-netstat-output.patch create mode 100644 net-tools-1.60-netstat-p.patch create mode 100644 net-tools-1.60-netstat.8.diff create mode 100644 net-tools-1.60-numericstuff.diff create mode 100644 net-tools-1.60-sctp-quiet create mode 100644 net-tools-1.60-sctp.patch create mode 100644 net-tools-1.60-snmp-counter-overflow.patch create mode 100644 net-tools-1.60-sockios-SIOCGMIIPHY.diff create mode 100644 net-tools-1.60-strictaliasing.diff create mode 100644 net-tools-1.60.dif create mode 100644 net-tools-1.60.tar.bz2 create mode 100644 net-tools.changes create mode 100644 net-tools.spec create mode 100644 netstat-trunc.dif create mode 100644 netstat.xinetd create mode 100644 nstrcmp.c create mode 100644 ready create mode 100644 traceroute-1.0.4.tar.bz2 create mode 100644 traceroute-LDOPTS.diff create mode 100644 traceroute-maxprobes.diff create mode 100644 traceroute-strip.diff diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/manpages.diff b/manpages.diff new file mode 100644 index 0000000..61f8fce --- /dev/null +++ b/manpages.diff @@ -0,0 +1,307 @@ +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 diff --git a/nameif-rename.patch b/nameif-rename.patch new file mode 100644 index 0000000..cb1feb2 --- /dev/null +++ b/nameif-rename.patch @@ -0,0 +1,202 @@ +--- 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); + } + diff --git a/net-tools-1.60-arp-unaligned-access.patch b/net-tools-1.60-arp-unaligned-access.patch new file mode 100644 index 0000000..4bf3c48 --- /dev/null +++ b/net-tools-1.60-arp-unaligned-access.patch @@ -0,0 +1,116 @@ +--- net-tools-1.60/arp.c 2001-04-08 10:05:05.000000000 -0700 ++++ net-tools-1.60.new/arp.c 2006-01-31 13:10:01.479716750 -0800 +@@ -100,7 +100,7 @@ static int arp_del(char **args) + { + char host[128]; + struct arpreq req; +- struct sockaddr sa; ++ struct sockaddr_storage ss; + int flags = 0; + int err; + +@@ -112,12 +112,12 @@ static int arp_del(char **args) + return (-1); + } + safe_strncpy(host, *args, (sizeof host)); +- if (ap->input(0, host, &sa) < 0) { ++ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) { + ap->herror(host); + return (-1); + } + /* If a host has more than one address, use the correct one! */ +- memcpy((char *) &req.arp_pa, (char *) &sa, sizeof(struct sockaddr)); ++ memcpy((char *) &req.arp_pa, (char *) &ss, sizeof(struct sockaddr)); + + if (hw_set) + req.arp_ha.sa_family = hw->type; +@@ -177,11 +177,11 @@ static int arp_del(char **args) + usage(); + if (strcmp(*args, "255.255.255.255") != 0) { + strcpy(host, *args); +- if (ap->input(0, host, &sa) < 0) { ++ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) { + ap->herror(host); + return (-1); + } +- memcpy((char *) &req.arp_netmask, (char *) &sa, ++ memcpy((char *) &req.arp_netmask, (char *) &ss, + sizeof(struct sockaddr)); + req.arp_flags |= ATF_NETMASK; + } +@@ -260,7 +260,7 @@ static int arp_set(char **args) + { + char host[128]; + struct arpreq req; +- struct sockaddr sa; ++ struct sockaddr_storage ss; + int flags; + + memset((char *) &req, 0, sizeof(req)); +@@ -271,12 +271,12 @@ static int arp_set(char **args) + return (-1); + } + safe_strncpy(host, *args++, (sizeof host)); +- if (ap->input(0, host, &sa) < 0) { ++ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) { + ap->herror(host); + return (-1); + } + /* If a host has more than one address, use the correct one! */ +- memcpy((char *) &req.arp_pa, (char *) &sa, sizeof(struct sockaddr)); ++ memcpy((char *) &req.arp_pa, (char *) &ss, sizeof(struct sockaddr)); + + /* Fetch the hardware address. */ + if (*args == NULL) { +@@ -346,11 +346,11 @@ static int arp_set(char **args) + usage(); + if (strcmp(*args, "255.255.255.255") != 0) { + strcpy(host, *args); +- if (ap->input(0, host, &sa) < 0) { ++ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) { + ap->herror(host); + return (-1); + } +- memcpy((char *) &req.arp_netmask, (char *) &sa, ++ memcpy((char *) &req.arp_netmask, (char *) &ss, + sizeof(struct sockaddr)); + flags |= ATF_NETMASK; + } +@@ -519,7 +519,7 @@ static void arp_disp(char *name, char *i + static int arp_show(char *name) + { + char host[100]; +- struct sockaddr sa; ++ struct sockaddr_storage ss; + char ip[100]; + char hwa[100]; + char mask[100]; +@@ -535,11 +535,11 @@ static int arp_show(char *name) + if (name != NULL) { + /* Resolve the host name. */ + safe_strncpy(host, name, (sizeof host)); +- if (ap->input(0, host, &sa) < 0) { ++ if (ap->input(0, host, (struct sockaddr*)&ss) < 0) { + ap->herror(host); + return (-1); + } +- safe_strncpy(host, ap->sprint(&sa, 1), sizeof(host)); ++ safe_strncpy(host, ap->sprint((struct sockaddr*)&ss, 1), sizeof(host)); + } + /* Open the PROCps kernel table. */ + if ((fp = fopen(_PATH_PROCNET_ARP, "r")) == NULL) { +@@ -575,10 +575,11 @@ static int arp_show(char *name) + if (opt_n) + hostname = "?"; + else { +- if (ap->input(0, ip, &sa) < 0) ++ if (ap->input(0, ip, (struct sockaddr*)&ss) < 0) + hostname = ip; + else +- hostname = ap->sprint(&sa, opt_n | 0x8000); ++ hostname = ap->sprint((struct sockaddr*)&ss, ++ opt_n | 0x8000); + if (strcmp(hostname, ip) == 0) + hostname = "?"; + } + diff --git a/net-tools-1.60-compoundstatement.diff b/net-tools-1.60-compoundstatement.diff new file mode 100644 index 0000000..36d7a47 --- /dev/null +++ b/net-tools-1.60-compoundstatement.diff @@ -0,0 +1,44 @@ +--- net-tools-1.60/hostname.c ++++ net-tools-1.60/hostname.c +@@ -32,6 +32,7 @@ + */ + #include + #include ++#include + #include + #include + #include +@@ -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. */ diff --git a/net-tools-1.60-cont-buff.patch b/net-tools-1.60-cont-buff.patch new file mode 100644 index 0000000..0c9bc8f --- /dev/null +++ b/net-tools-1.60-cont-buff.patch @@ -0,0 +1,294 @@ +# 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 +diff -uNr net-tools-1.60-unpatched/ifconfig.c net-tools-1.60/ifconfig.c +--- net-tools-1.60-unpatched/ifconfig.c 2001-04-13 20:25:18.000000000 +0200 ++++ net-tools-1.60/ifconfig.c 2004-07-30 11:49:21.735995630 +0200 +@@ -108,7 +108,7 @@ + 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 @@ + 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) +diff -uNr net-tools-1.60-unpatched/include/interface.h net-tools-1.60/include/interface.h +--- net-tools-1.60-unpatched/include/interface.h 2004-07-30 11:01:42.000000000 +0200 ++++ net-tools-1.60/include/interface.h 2004-07-30 12:13:58.028172544 +0200 +@@ -63,10 +63,10 @@ + + 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 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) +diff -uNr net-tools-1.60-unpatched/lib/interface.c net-tools-1.60/lib/interface.c +--- net-tools-1.60-unpatched/lib/interface.c 2004-07-30 11:01:42.000000000 +0200 ++++ net-tools-1.60/lib/interface.c 2004-07-30 12:01:59.537031709 +0200 +@@ -89,7 +89,7 @@ + + 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) + { +@@ -119,17 +119,17 @@ + { + 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); +@@ -145,6 +145,7 @@ + while ((ife = int_list) != NULL) { + int_list = ife->next; + free(ife); ++ int_last = NULL; + } + return 0; + } +@@ -298,7 +299,7 @@ + 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; +@@ -306,10 +307,12 @@ + 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) { +@@ -369,9 +372,9 @@ + 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; +@@ -891,3 +894,26 @@ + 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; ++} ++ +diff -uNr net-tools-1.60-unpatched/netstat.c net-tools-1.60/netstat.c +--- net-tools-1.60-unpatched/netstat.c 2001-04-15 16:41:17.000000000 +0200 ++++ net-tools-1.60/netstat.c 2004-07-30 11:43:43.415346672 +0200 +@@ -149,9 +149,24 @@ + 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) { \ +@@ -249,6 +264,77 @@ + /* 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); +@@ -1452,10 +1538,20 @@ + 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_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 { +@@ -1582,6 +1678,7 @@ + flag_lst++; + break; + case 'c': ++ flag_cacheof = 1; + flag_cnt++; + break; + diff --git a/net-tools-1.60-errors.patch b/net-tools-1.60-errors.patch new file mode 100644 index 0000000..4b43f86 --- /dev/null +++ b/net-tools-1.60-errors.patch @@ -0,0 +1,111 @@ +--- 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 { diff --git a/net-tools-1.60-if_tr.diff b/net-tools-1.60-if_tr.diff new file mode 100644 index 0000000..562a99e --- /dev/null +++ b/net-tools-1.60-if_tr.diff @@ -0,0 +1,11 @@ +--- net-tools-1.60/lib/tr.c ++++ net-tools-1.60/lib/tr.c +@@ -20,7 +20,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include diff --git a/net-tools-1.60-interface_stack.patch b/net-tools-1.60-interface_stack.patch new file mode 100644 index 0000000..a06703e --- /dev/null +++ b/net-tools-1.60-interface_stack.patch @@ -0,0 +1,68 @@ +--- lib/interface.c-old 2005-12-30 11:08:15.000000000 -0800 ++++ lib/interface.c 2005-12-30 11:17:02.000000000 -0800 +@@ -201,10 +201,11 @@ + return err; + } + +-static char *get_name(char *name, char *p) ++static char *get_name(char **namep, char *p) + { + while (isspace(*p)) + p++; ++ char *name = *namep = p; + while (*p) { + if (isspace(*p)) + break; +@@ -305,9 +306,10 @@ + { + static int proc_read; + FILE *fh; +- char buf[512]; + struct interface *ife; + int err; ++ char *line = NULL; ++ size_t linelen = 0; + + if (proc_read) + return 0; +@@ -320,8 +322,11 @@ + _PATH_PROCNET_DEV, strerror(errno)); + return if_readconf(); + } +- fgets(buf, sizeof buf, fh); /* eat line */ +- fgets(buf, sizeof buf, fh); ++ if (getline(&line, &linelen, fh) == -1 /* eat line */ ++ || getline(&line, &linelen, fh) == -1) { ++ err = -1; ++ goto out; ++ } + + #if 0 /* pretty, but can't cope with missing fields */ + fmt = proc_gen_fmt(_PATH_PROCNET_DEV, 1, fh, +@@ -346,13 +351,13 @@ + if (!fmt) + return -1; + #else +- procnetdev_vsn = procnetdev_version(buf); ++ procnetdev_vsn = procnetdev_version(line); + #endif + + err = 0; +- while (fgets(buf, sizeof buf, fh)) { +- char *s, name[IFNAMSIZ]; +- s = get_name(name, buf); ++ while (getline(&line, &linelen, fh) != -1) { ++ char *s, *name; ++ s = get_name(&name, line); + ife = add_interface(name); + get_dev_fields(s, ife); + ife->statistics_valid = 1; +@@ -368,6 +373,8 @@ + #if 0 + free(fmt); + #endif ++ out: ++ free(line); + fclose(fh); + return err; + } diff --git a/net-tools-1.60-krn26.dif b/net-tools-1.60-krn26.dif new file mode 100644 index 0000000..ebcfcef --- /dev/null +++ b/net-tools-1.60-krn26.dif @@ -0,0 +1,22 @@ +--- 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")) { diff --git a/net-tools-1.60-long_to_int.diff b/net-tools-1.60-long_to_int.diff new file mode 100644 index 0000000..bc3edf5 --- /dev/null +++ b/net-tools-1.60-long_to_int.diff @@ -0,0 +1,20 @@ +--- 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 diff --git a/net-tools-1.60-miioff.diff b/net-tools-1.60-miioff.diff new file mode 100644 index 0000000..fd712b1 --- /dev/null +++ b/net-tools-1.60-miioff.diff @@ -0,0 +1,8 @@ +--- 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 diff --git a/net-tools-1.60-multilinestr.diff b/net-tools-1.60-multilinestr.diff new file mode 100644 index 0000000..8e9294c --- /dev/null +++ b/net-tools-1.60-multilinestr.diff @@ -0,0 +1,29 @@ +--- 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) diff --git a/net-tools-1.60-nameif.diff b/net-tools-1.60-nameif.diff new file mode 100644 index 0000000..7bbe4eb --- /dev/null +++ b/net-tools-1.60-nameif.diff @@ -0,0 +1,47 @@ +--- 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); + } + diff --git a/net-tools-1.60-netstat-output.patch b/net-tools-1.60-netstat-output.patch new file mode 100644 index 0000000..7c74d0e --- /dev/null +++ b/net-tools-1.60-netstat-output.patch @@ -0,0 +1,215 @@ +diff -urN net-tools-1.60/statistics.c net-tools-1.60-patch/statistics.c +--- net-tools-1.60/statistics.c 2001-02-02 10:01:23.000000000 -0800 ++++ net-tools-1.60-patch/statistics.c 2004-06-15 11:09:44.000000000 -0700 +@@ -63,54 +63,54 @@ + struct entry Iptab[] = + { + {"Forwarding", N_("Forwarding is %s"), i_forward | I_STATIC}, +- {"DefaultTTL", N_("Default TTL is %u"), number | I_STATIC}, +- {"InReceives", N_("%u total packets received"), number}, +- {"InHdrErrors", N_("%u with invalid headers"), opt_number}, +- {"InAddrErrors", N_("%u with invalid addresses"), opt_number}, +- {"ForwDatagrams", N_("%u forwarded"), number}, +- {"InUnknownProtos", N_("%u with unknown protocol"), opt_number}, +- {"InDiscards", N_("%u incoming packets discarded"), number}, +- {"InDelivers", N_("%u incoming packets delivered"), number}, +- {"OutRequests", N_("%u requests sent out"), number}, /*? */ +- {"OutDiscards", N_("%u outgoing packets dropped"), opt_number}, +- {"OutNoRoutes", N_("%u dropped because of missing route"), opt_number}, +- {"ReasmTimeout", N_("%u fragments dropped after timeout"), opt_number}, +- {"ReasmReqds", N_("%u reassemblies required"), opt_number}, /* ? */ +- {"ReasmOKs", N_("%u packets reassembled ok"), opt_number}, +- {"ReasmFails", N_("%u packet reassembles failed"), opt_number}, +- {"FragOKs", N_("%u fragments received ok"), opt_number}, +- {"FragFails", N_("%u fragments failed"), opt_number}, +- {"FragCreates", N_("%u fragments created"), opt_number} ++ {"DefaultTTL", N_("Default TTL is %lu"), number | I_STATIC}, ++ {"InReceives", N_("%lu total packets received"), number}, ++ {"InHdrErrors", N_("%lu with invalid headers"), opt_number}, ++ {"InAddrErrors", N_("%lu with invalid addresses"), opt_number}, ++ {"ForwDatagrams", N_("%lu forwarded"), number}, ++ {"InUnknownProtos", N_("%lu with unknown protocol"), opt_number}, ++ {"InDiscards", N_("%lu incoming packets discarded"), number}, ++ {"InDelivers", N_("%lu incoming packets delivered"), number}, ++ {"OutRequests", N_("%lu requests sent out"), number}, /*? */ ++ {"OutDiscards", N_("%lu outgoing packets dropped"), opt_number}, ++ {"OutNoRoutes", N_("%lu dropped because of missing route"), opt_number}, ++ {"ReasmTimeout", N_("%lu fragments dropped after timeout"), opt_number}, ++ {"ReasmReqds", N_("%lu reassemblies required"), opt_number}, /* ? */ ++ {"ReasmOKs", N_("%lu packets reassembled ok"), opt_number}, ++ {"ReasmFails", N_("%lu packet reassembles failed"), opt_number}, ++ {"FragOKs", N_("%lu fragments received ok"), opt_number}, ++ {"FragFails", N_("%lu fragments failed"), opt_number}, ++ {"FragCreates", N_("%lu fragments created"), opt_number} + }; + + struct entry Icmptab[] = + { +- {"InMsgs", N_("%u ICMP messages received"), number}, +- {"InErrors", N_("%u input ICMP message failed."), number}, +- {"InDestUnreachs", N_("destination unreachable: %u"), i_inp_icmp | I_TITLE}, +- {"InTimeExcds", N_("timeout in transit: %u"), i_inp_icmp | I_TITLE}, +- {"InParmProbs", N_("wrong parameters: %u"), i_inp_icmp | I_TITLE}, /*? */ +- {"InSrcQuenchs", N_("source quenches: %u"), i_inp_icmp | I_TITLE}, +- {"InRedirects", N_("redirects: %u"), i_inp_icmp | I_TITLE}, +- {"InEchos", N_("echo requests: %u"), i_inp_icmp | I_TITLE}, +- {"InEchoReps", N_("echo replies: %u"), i_inp_icmp | I_TITLE}, +- {"InTimestamps", N_("timestamp request: %u"), i_inp_icmp | I_TITLE}, +- {"InTimestampReps", N_("timestamp reply: %u"), i_inp_icmp | I_TITLE}, +- {"InAddrMasks", N_("address mask request: %u"), i_inp_icmp | I_TITLE}, /*? */ +- {"InAddrMaskReps", N_("address mask replies: %u"), i_inp_icmp | I_TITLE}, /*? */ +- {"OutMsgs", N_("%u ICMP messages sent"), number}, +- {"OutErrors", N_("%u ICMP messages failed"), number}, +- {"OutDestUnreachs", N_("destination unreachable: %u"), i_outp_icmp | I_TITLE}, +- {"OutTimeExcds", N_("time exceeded: %u"), i_outp_icmp | I_TITLE}, +- {"OutParmProbs", N_("wrong parameters: %u"), i_outp_icmp | I_TITLE}, /*? */ +- {"OutSrcQuenchs", N_("source quench: %u"), i_outp_icmp | I_TITLE}, +- {"OutRedirects", N_("redirect: %u"), i_outp_icmp | I_TITLE}, +- {"OutEchos", N_("echo request: %u"), i_outp_icmp | I_TITLE}, +- {"OutEchoReps", N_("echo replies: %u"), i_outp_icmp | I_TITLE}, +- {"OutTimestamps", N_("timestamp requests: %u"), i_outp_icmp | I_TITLE}, +- {"OutTimestampReps", N_("timestamp replies: %u"), i_outp_icmp | I_TITLE}, +- {"OutAddrMasks", N_("address mask requests: %u"), i_outp_icmp | I_TITLE}, +- {"OutAddrMaskReps", N_("address mask replies: %u"), i_outp_icmp | I_TITLE}, ++ {"InMsgs", N_("%lu ICMP messages received"), number}, ++ {"InErrors", N_("%lu input ICMP message failed."), number}, ++ {"InDestUnreachs", N_("destination unreachable: %lu"), i_inp_icmp | I_TITLE}, ++ {"InTimeExcds", N_("timeout in transit: %lu"), i_inp_icmp | I_TITLE}, ++ {"InParmProbs", N_("wrong parameters: %lu"), i_inp_icmp | I_TITLE}, /*? */ ++ {"InSrcQuenchs", N_("source quenches: %lu"), i_inp_icmp | I_TITLE}, ++ {"InRedirects", N_("redirects: %lu"), i_inp_icmp | I_TITLE}, ++ {"InEchos", N_("echo requests: %lu"), i_inp_icmp | I_TITLE}, ++ {"InEchoReps", N_("echo replies: %lu"), i_inp_icmp | I_TITLE}, ++ {"InTimestamps", N_("timestamp request: %lu"), i_inp_icmp | I_TITLE}, ++ {"InTimestampReps", N_("timestamp reply: %lu"), i_inp_icmp | I_TITLE}, ++ {"InAddrMasks", N_("address mask request: %lu"), i_inp_icmp | I_TITLE}, /*? */ ++ {"InAddrMaskReps", N_("address mask replies: %lu"), i_inp_icmp | I_TITLE}, /*? */ ++ {"OutMsgs", N_("%lu ICMP messages sent"), number}, ++ {"OutErrors", N_("%lu ICMP messages failed"), number}, ++ {"OutDestUnreachs", N_("destination unreachable: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutTimeExcds", N_("time exceeded: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutParmProbs", N_("wrong parameters: %lu"), i_outp_icmp | I_TITLE}, /*? */ ++ {"OutSrcQuenchs", N_("source quench: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutRedirects", N_("redirect: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutEchos", N_("echo request: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutEchoReps", N_("echo replies: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutTimestamps", N_("timestamp requests: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutTimestampReps", N_("timestamp replies: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutAddrMasks", N_("address mask requests: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutAddrMaskReps", N_("address mask replies: %lu"), i_outp_icmp | I_TITLE}, + }; + + struct entry Tcptab[] = +@@ -119,71 +119,71 @@ + {"RtoMin", "", number}, + {"RtoMax", "", number}, + {"MaxConn", "", number}, +- {"ActiveOpens", N_("%u active connections openings"), number}, +- {"PassiveOpens", N_("%u passive connection openings"), number}, +- {"AttemptFails", N_("%u failed connection attempts"), number}, +- {"EstabResets", N_("%u connection resets received"), number}, +- {"CurrEstab", N_("%u connections established"), number}, +- {"InSegs", N_("%u segments received"), number}, +- {"OutSegs", N_("%u segments send out"), number}, +- {"RetransSegs", N_("%u segments retransmited"), number}, +- {"InErrs", N_("%u bad segments received."), number}, +- {"OutRsts", N_("%u resets sent"), number}, ++ {"ActiveOpens", N_("%lu active connections openings"), number}, ++ {"PassiveOpens", N_("%lu passive connection openings"), number}, ++ {"AttemptFails", N_("%lu failed connection attempts"), number}, ++ {"EstabResets", N_("%lu connection resets received"), number}, ++ {"CurrEstab", N_("%lu connections established"), number}, ++ {"InSegs", N_("%lu segments received"), number}, ++ {"OutSegs", N_("%lu segments send out"), number}, ++ {"RetransSegs", N_("%lu segments retransmited"), number}, ++ {"InErrs", N_("%lu bad segments received."), number}, ++ {"OutRsts", N_("%lu resets sent"), number}, + }; + + struct entry Udptab[] = + { +- {"InDatagrams", N_("%u packets received"), number}, +- {"NoPorts", N_("%u packets to unknown port received."), number}, +- {"InErrors", N_("%u packet receive errors"), number}, +- {"OutDatagrams", N_("%u packets sent"), number}, ++ {"InDatagrams", N_("%lu packets received"), number}, ++ {"NoPorts", N_("%lu packets to unknown port received."), number}, ++ {"InErrors", N_("%lu packet receive errors"), number}, ++ {"OutDatagrams", N_("%lu packets sent"), number}, + }; + + struct entry Tcpexttab[] = + { +- {"SyncookiesSent", N_("%u SYN cookies sent"), opt_number}, +- {"SyncookiesRecv", N_("%u SYN cookies received"), opt_number}, +- {"SyncookiesFailed", N_("%u invalid SYN cookies received"), opt_number}, ++ {"SyncookiesSent", N_("%lu SYN cookies sent"), opt_number}, ++ {"SyncookiesRecv", N_("%lu SYN cookies received"), opt_number}, ++ {"SyncookiesFailed", N_("%lu invalid SYN cookies received"), opt_number}, + +- { "EmbryonicRsts", N_("%u resets received for embryonic SYN_RECV sockets"), ++ { "EmbryonicRsts", N_("%lu resets received for embryonic SYN_RECV sockets"), + opt_number }, +- { "PruneCalled", N_("%u packets pruned from receive queue because of socket" ++ { "PruneCalled", N_("%lu packets pruned from receive queue because of socket" + " buffer overrun"), opt_number }, + /* obsolete: 2.2.0 doesn't do that anymore */ +- { "RcvPruned", N_("%u packets pruned from receive queue"), opt_number }, +- { "OfoPruned", N_("%u packets dropped from out-of-order queue because of" ++ { "RcvPruned", N_("%lu packets pruned from receive queue"), opt_number }, ++ { "OfoPruned", N_("%lu packets dropped from out-of-order queue because of" + " socket buffer overrun"), opt_number }, +- { "OutOfWindowIcmps", N_("%u ICMP packets dropped because they were " ++ { "OutOfWindowIcmps", N_("%lu ICMP packets dropped because they were " + "out-of-window"), opt_number }, +- { "LockDroppedIcmps", N_("%u ICMP packets dropped because" ++ { "LockDroppedIcmps", N_("%lu ICMP packets dropped because" + " socket was locked"), opt_number }, +- { "TW", N_("%u TCP sockets finished time wait in fast timer"), opt_number }, +- { "TWRecycled", N_("%u time wait sockets recycled by time stamp"), opt_number }, +- { "TWKilled", N_("%u TCP sockets finished time wait in slow timer"), opt_number }, +- { "PAWSPassive", N_("%u passive connections rejected because of" ++ { "TW", N_("%lu TCP sockets finished time wait in fast timer"), opt_number }, ++ { "TWRecycled", N_("%lu time wait sockets recycled by time stamp"), opt_number }, ++ { "TWKilled", N_("%lu TCP sockets finished time wait in slow timer"), opt_number }, ++ { "PAWSPassive", N_("%lu passive connections rejected because of" + " time stamp"), opt_number }, +- { "PAWSActive", N_("%u active connections rejected because of " ++ { "PAWSActive", N_("%lu active connections rejected because of " + "time stamp"), opt_number }, +- { "PAWSEstab", N_("%u packets rejects in established connections because of" ++ { "PAWSEstab", N_("%lu packets rejects in established connections because of" + " timestamp"), opt_number }, +- { "DelayedACKs", N_("%u delayed acks sent"), opt_number }, +- { "DelayedACKLocked", N_("%u delayed acks further delayed because of" ++ { "DelayedACKs", N_("%lu delayed acks sent"), opt_number }, ++ { "DelayedACKLocked", N_("%lu delayed acks further delayed because of" + " locked socket"), opt_number }, +- { "DelayedACKLost", N_("Quick ack mode was activated %u times"), opt_number }, +- { "ListenOverflows", N_("%u times the listen queue of a socket overflowed"), ++ { "DelayedACKLost", N_("Quick ack mode was activated %lu times"), opt_number }, ++ { "ListenOverflows", N_("%lu times the listen queue of a socket overflowed"), + opt_number }, +- { "ListenDrops", N_("%u SYNs to LISTEN sockets ignored"), opt_number }, +- { "TCPPrequeued", N_("%u packets directly queued to recvmsg prequeue."), ++ { "ListenDrops", N_("%lu SYNs to LISTEN sockets ignored"), opt_number }, ++ { "TCPPrequeued", N_("%lu packets directly queued to recvmsg prequeue."), + opt_number }, +- { "TCPDirectCopyFromBacklog", N_("%u packets directly received" ++ { "TCPDirectCopyFromBacklog", N_("%lu packets directly received" + " from backlog"), opt_number }, +- { "TCPDirectCopyFromPrequeue", N_("%u packets directly received" ++ { "TCPDirectCopyFromPrequeue", N_("%lu packets directly received" + " from prequeue"), opt_number }, +- { "TCPPrequeueDropped", N_("%u packets dropped from prequeue"), opt_number }, +- { "TCPHPHits", N_("%u packets header predicted"), number }, +- { "TCPHPHitsToUser", N_("%u packets header predicted and " ++ { "TCPPrequeueDropped", N_("%lu packets dropped from prequeue"), opt_number }, ++ { "TCPHPHits", N_("%lu packets header predicted"), number }, ++ { "TCPHPHitsToUser", N_("%lu packets header predicted and " + "directly queued to user"), opt_number }, +- { "SockMallocOOM", N_("Ran %u times out of system memory during " ++ { "SockMallocOOM", N_("Ran %lu times out of system memory during " + "packet sending"), opt_number }, + }; + diff --git a/net-tools-1.60-netstat-p.patch b/net-tools-1.60-netstat-p.patch new file mode 100644 index 0000000..9e2dcb9 --- /dev/null +++ b/net-tools-1.60-netstat-p.patch @@ -0,0 +1,67 @@ +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) + diff --git a/net-tools-1.60-netstat.8.diff b/net-tools-1.60-netstat.8.diff new file mode 100644 index 0000000..ef7759e --- /dev/null +++ b/net-tools-1.60-netstat.8.diff @@ -0,0 +1,24 @@ +--- 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" diff --git a/net-tools-1.60-numericstuff.diff b/net-tools-1.60-numericstuff.diff new file mode 100644 index 0000000..6516d3c --- /dev/null +++ b/net-tools-1.60-numericstuff.diff @@ -0,0 +1,49 @@ +--- 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, ":"); diff --git a/net-tools-1.60-sctp-quiet b/net-tools-1.60-sctp-quiet new file mode 100644 index 0000000..f3a1071 --- /dev/null +++ b/net-tools-1.60-sctp-quiet @@ -0,0 +1,13 @@ +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; diff --git a/net-tools-1.60-sctp.patch b/net-tools-1.60-sctp.patch new file mode 100644 index 0000000..ff22091 --- /dev/null +++ b/net-tools-1.60-sctp.patch @@ -0,0 +1,644 @@ + 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=0 && 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, _(" ={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom\n")); ++ fprintf(stderr, _(" ={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom --sctp\n")); + fprintf(stderr, _(" =Use '-A ' or '--'; 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" diff --git a/net-tools-1.60-snmp-counter-overflow.patch b/net-tools-1.60-snmp-counter-overflow.patch new file mode 100644 index 0000000..1e47427 --- /dev/null +++ b/net-tools-1.60-snmp-counter-overflow.patch @@ -0,0 +1,13 @@ +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; + diff --git a/net-tools-1.60-sockios-SIOCGMIIPHY.diff b/net-tools-1.60-sockios-SIOCGMIIPHY.diff new file mode 100644 index 0000000..0bf5821 --- /dev/null +++ b/net-tools-1.60-sockios-SIOCGMIIPHY.diff @@ -0,0 +1,10 @@ +--- net-tools-1.60/mii-tool.c ++++ net-tools-1.60/mii-tool.c +@@ -46,6 +46,7 @@ + #include + #include + #include ++#include + #ifndef __GLIBC__ + #include + #include diff --git a/net-tools-1.60-strictaliasing.diff b/net-tools-1.60-strictaliasing.diff new file mode 100644 index 0000000..d2981c0 --- /dev/null +++ b/net-tools-1.60-strictaliasing.diff @@ -0,0 +1,38 @@ +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) { diff --git a/net-tools-1.60.dif b/net-tools-1.60.dif new file mode 100644 index 0000000..9e00916 --- /dev/null +++ b/net-tools-1.60.dif @@ -0,0 +1,126 @@ +--- Makefile ++++ Makefile 2006/07/24 07:44:14 +@@ -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 2006/07/24 07:44:14 +@@ -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 2006/07/24 07:44:14 +@@ -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 2006/07/24 07:44:14 +@@ -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 2006/07/24 07:44:14 +@@ -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; +--- netstat.c ++++ netstat.c 2006/07/24 07:44:14 +@@ -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 +--- po/de.po ++++ po/de.po 2006/07/24 07:48:22 +@@ -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 diff --git a/net-tools-1.60.tar.bz2 b/net-tools-1.60.tar.bz2 new file mode 100644 index 0000000..e1a7ef1 --- /dev/null +++ b/net-tools-1.60.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f928b906b05a5c619e37dc9ffe7a795affeae6d20b2e3fc5628613745e28091c +size 195181 diff --git a/net-tools.changes b/net-tools.changes new file mode 100644 index 0000000..60367ae --- /dev/null +++ b/net-tools.changes @@ -0,0 +1,388 @@ +------------------------------------------------------------------- +Tue Sep 26 16:02:23 CEST 2006 - ms@suse.de + +- fixed stack overflow when using traceroute -q [n]>=10 (#200508) + +------------------------------------------------------------------- +Mon Jul 24 09:50:54 CEST 2006 - ms@suse.de + +- fixed german translation for route -C (#194357) + +------------------------------------------------------------------- +Thu Jul 20 10:24:51 CEST 2006 - ms@suse.de + +- replaced static HZ define to dynamic: + #ifndef HZ + #define HZ sysconf(_SC_CLK_TCK) + #endif + +------------------------------------------------------------------- +Wed May 24 21:32:23 CEST 2006 - schwab@suse.de + +- Don't strip binaries. + +------------------------------------------------------------------- +Wed May 17 15:01:39 CEST 2006 - ms@suse.de + +- added patch from Olaf Kirch. Do not display SCTP sockets + if /proc/net/sctp/eps couldn't be opened (#159686) + +------------------------------------------------------------------- +Tue Mar 21 12:28:39 CET 2006 - okir@suse.de + +- Display SCTP sockets correctly [#159686 - LTC22492] + +------------------------------------------------------------------- +Mon Mar 20 12:36:32 CET 2006 - hvogel@suse.de + +- fix netstat -p segfault [#159069] + +------------------------------------------------------------------- +Mon Feb 20 12:00:24 CET 2006 - hvogel@suse.de + +- fix netstat output not to bit-wrap [#149563] + +------------------------------------------------------------------- +Mon Feb 6 12:10:13 CET 2006 - hvogel@suse.de + +- add snmp counter overflow patch by ak [#148350] + +------------------------------------------------------------------- +Wed Feb 1 19:01:28 CET 2006 - hvogel@suse.de + +- fix arp causing unaligned access [#146422] + patch from Arthur D. Kepner + +------------------------------------------------------------------- +Wed Jan 25 21:30:37 CET 2006 - mls@suse.de + +- converted neededforbuild to BuildRequires + +------------------------------------------------------------------- +Wed Jan 11 15:10:08 CET 2006 - mmj@suse.de + +- Add patch from fedora to avoid stack smashing [#142461] + +------------------------------------------------------------------- +Mon Dec 19 15:55:15 CET 2005 - mmj@suse.de + +- Update to traceroute-1.0.4 + +------------------------------------------------------------------- +Mon Dec 19 11:03:09 CET 2005 - mmj@suse.de + +- Update to traceroute-1.0.3 + +------------------------------------------------------------------- +Fri Dec 16 11:46:37 CET 2005 - mmj@suse.de + +- Use ICMP6_DST_UNREACH_BEYONDSCOPE instead of + ICMP6_DST_UNREACH_NOTNEIGHBOR on newer glibc + +------------------------------------------------------------------- +Tue Sep 27 10:07:31 CEST 2005 - mmj@suse.de + +- Fix strict aliasing issues + +------------------------------------------------------------------- +Mon Aug 29 15:42:16 CEST 2005 - mmj@suse.de + +- Correct netstat.8 [#104487] + +------------------------------------------------------------------- +Wed Jul 6 14:13:10 CEST 2005 - mmj@suse.de + +- Fix missing decl in nstrcmp.c + +------------------------------------------------------------------- +Mon Jun 20 10:30:50 CEST 2005 - mmj@suse.de + +- compile with -fpie, link with -pie +- don't strip explicitly + +------------------------------------------------------------------- +Mon Jun 13 16:23:38 CEST 2005 - ro@suse.de + +- include netinet/if_tr.h instead of linux/if_tr.h + +------------------------------------------------------------------- +Wed Jan 5 12:42:56 CET 2005 - mmj@suse.de + +- Fix --numeric-ports to not imply --numeric [#45609] + +------------------------------------------------------------------- +Wed Dec 8 00:33:03 CET 2004 - mmj@suse.de + +- Include linux/sockios.h to get the right ioctl [#48873]. This bug + is in mii-tool which is not included anymore, but better not risk + ever re-adding buggy stuff. + +------------------------------------------------------------------- +Thu Dec 2 10:09:01 CET 2004 - mmj@suse.de + +- Fix nameif segfault [#48749] + +------------------------------------------------------------------- +Mon Aug 9 14:39:20 CEST 2004 - mmj@suse.de + +- Remove mii-tool everywhere [#43343] + +------------------------------------------------------------------- +Fri Jul 30 12:36:59 CEST 2004 - fdg@suse.de + +- fixed the -ic option without destroying the ifconfig buffer + regarding to bug #42932 + +------------------------------------------------------------------- +Mon May 24 14:26:50 CEST 2004 - meissner@suse.de + +- also print unsigned long longs (last patch updated). + +------------------------------------------------------------------- +Mon May 24 13:58:36 CEST 2004 - meissner@suse.de + +- Always read 64bit values from /proc/net/dev, so we can + use 32bit userland to read from 64bit kernel. #40951/LTC#8726 + +------------------------------------------------------------------- +Fri Mar 5 09:17:31 CET 2004 - hare@suse.de + +- Fixed return values for non-existing interfaces in nameif. + +------------------------------------------------------------------- +Thu Feb 26 10:54:31 CET 2004 - hare@suse.de + +- Add -r option to nameif to allow renaming of + interfaces. + +------------------------------------------------------------------- +Thu Jan 29 17:33:30 CET 2004 - hare@suse.de + +- Cool. The last change effectively broke route(1). + -> replaced return; with break; + +------------------------------------------------------------------- +Sun Jan 18 16:53:42 CET 2004 - mmj@suse.de + +- Fix compound statement calls, and add a missing include + +------------------------------------------------------------------- +Wed Oct 15 12:54:44 CEST 2003 - mmj@suse.de + +- Don't build as root + +------------------------------------------------------------------- +Mon Oct 13 13:47:23 CEST 2003 - mmj@suse.de + +- Fix 32 vs. 64-bit programming mistakes [#32089] + +------------------------------------------------------------------- +Mon Aug 18 20:17:55 CEST 2003 - mmj@suse.de + +- Fix from mmeissner for nstrcmp.c to handle alias interfaces, + even without standard names. (eth1:1 vs eth1:2, also + eth1:blubber vs eth1:1) [#28985] + +------------------------------------------------------------------- +Mon Jul 14 10:14:54 CEST 2003 - mmj@suse.de + +- Add fix from okir for traceroute -S [#27573] + +------------------------------------------------------------------- +Wed Jun 18 16:06:33 CEST 2003 - ro@suse.de + +- added non-en manpage directories to filelist + +------------------------------------------------------------------- +Mon May 19 15:56:07 CEST 2003 - mmj@suse.de + +- Use a better and more tested nstrcmp.c [#26950] + +------------------------------------------------------------------- +Wed May 14 00:28:10 CEST 2003 - ro@suse.de + +- fix build with 2.5 kernel includes + +------------------------------------------------------------------- +Tue May 13 10:48:01 CEST 2003 - mmj@suse.de + +- Package man-pages in several languages + +------------------------------------------------------------------- +Wed Mar 5 15:28:48 CET 2003 - mmj@suse.de + +- Add missing xinetd file [#24676] + +------------------------------------------------------------------- +Tue Nov 26 10:40:28 CET 2002 - mmj@suse.de + +- Fix traceroute 6 segfault [#21975] + +------------------------------------------------------------------- +Fri Nov 15 12:53:03 CET 2002 - okir@suse.de + +- Upgraded to new traceroute to fix #20358 + +------------------------------------------------------------------- +Mon Nov 11 10:22:04 CET 2002 - mmj@suse.de + +- Fix multi string literals + +------------------------------------------------------------------- +Thu Jul 25 18:22:48 CEST 2002 - mmj@suse.de + +- Added traceroute from Olaf Kirch, which is much more secure and + also IPv6 capable. + +------------------------------------------------------------------- +Tue Apr 16 14:40:37 CEST 2002 - mmj@suse.de + +- Do not pack translated manpages. Should go to other package. + +------------------------------------------------------------------- +Mon Mar 4 10:15:43 MET 2002 - mmj@suse.de + +- unvollsändig -> unvollständig in German locale. [Bug #14371] + +------------------------------------------------------------------- +Wed Feb 6 12:43:56 CET 2002 - mmj@suse.de + +- Removed yp and nis stuff from manpages. + +------------------------------------------------------------------- +Sat Aug 25 13:54:05 CEST 2001 - kukuk@suse.de + +- Replace last patch by a newer one from ak@suse.de + +------------------------------------------------------------------- +Mon Aug 20 18:33:41 CEST 2001 - kukuk@suse.de + +- Add fix for truncated IP addresses [Bug #9737] + +------------------------------------------------------------------- +Wed Apr 25 19:09:43 CEST 2001 - kukuk@suse.de + +- Update to net-tools-1.60: + * lot of locale fixes + * IPv6 fixes + * use secure strcpy + +------------------------------------------------------------------- +Tue Apr 17 11:57:30 CEST 2001 - ro@suse.de + +- added provides for net_tool + +------------------------------------------------------------------- +Sun Mar 4 19:07:28 CET 2001 - bk@suse.de + +- Update to 1.59(many fixes and improvements and new program nameif) +- enabled gettext support and added locales +- added ipmaddr and iptunnel tools +- enabled FDDI and HIPPI support +- use optimisation flags +- added international man pages +- spec file changes to make use of wildcards in the filelist + +------------------------------------------------------------------- +Fri Oct 20 18:47:45 CEST 2000 - kukuk@suse.de + +- Rename from net_tool to net-tools + +------------------------------------------------------------------- +Sun Jun 25 23:16:19 CEST 2000 - bk@suse.de + +- s390: removed not needed files + +------------------------------------------------------------------- +Sat Jun 3 15:33:26 CEST 2000 - kukuk@suse.de + +- Update to 1.56 + +------------------------------------------------------------------- +Thu May 25 17:52:34 CEST 2000 - kukuk@suse.de + +- Update to 1.55 (contains all fixes) + +------------------------------------------------------------------- +Thu May 18 15:28:40 CEST 2000 - kukuk@suse.de + +- Add oh2bns patch (bug #2864) + +------------------------------------------------------------------- +Wed Feb 9 15:36:40 CET 2000 - kukuk@suse.de + +- Add ifconfig manual pages from Andi Kleen + +------------------------------------------------------------------- +Wed Feb 2 18:15:19 CET 2000 - kukuk@suse.de + +- Fix PPP initialisation + +------------------------------------------------------------------- +Wed Feb 2 14:48:03 CET 2000 - kukuk@suse.de + +- Update to 1.54, move /usr/man -> /usr/share/man + +------------------------------------------------------------------- +Mon Jan 3 15:12:23 CET 2000 - kukuk@suse.de + +- Enable IPv6 support +- Fix arp/ethers parsing + +------------------------------------------------------------------- +Tue Oct 12 11:13:20 CEST 1999 - garloff@suse.de + +- gateways and targets of PtP routes (host flag) are hosts, not + networks. Change name lookup accordingly. + +------------------------------------------------------------------- +Mon Sep 13 17:23:57 CEST 1999 - bs@suse.de + +- ran old prepare_spec on spec file to switch to new prepare_spec. + +------------------------------------------------------------------- +Mon Aug 30 11:16:50 MEST 1999 - kukuk@suse.de + +- Update to 1.53, remove ypdomainname and nisdomainname + +------------------------------------------------------------------- +Sat Jun 26 19:31:07 MEST 1999 - kukuk@suse.de + +- update from jurix to 1.52 + +------------------------------------------------------------------- +Tue Mar 9 23:46:41 MET 1999 - ro@suse.de + +- update to 1.50 +- included slattach and its manpage in filelist + +------------------------------------------------------------------- +Wed Oct 28 11:29:46 MET 1998 - ro@suse.de + +- update to 1.46 / removed incorporated changes from .dif + +------------------------------------------------------------------- +Sat Sep 19 19:38:31 MEST 1998 - ro@suse.de + +- define _GNU_SOURCE where getopt_long is used + +------------------------------------------------------------------- +Tue Sep 1 15:42:30 MEST 1998 - ro@suse.de + +- fixed problems with inluding own ipx.h under glibc + +------------------------------------------------------------------- +Wed Jun 24 15:50:34 MEST 1998 - ro@suse.de + +- added include linux/timer.h before including linux/ip_fw.h + +------------------------------------------------------------------- +Mon Oct 27 16:53:41 MET 1997 - ro@suse.de + +- added ADD_LANG in Makefile to avoid error + +------------------------------------------------------------------- +whenever-whenever - florian@suse.de + +new version 1.32-alpha +mv /sbin/arp /usr/sbin/arp diff --git a/net-tools.spec b/net-tools.spec new file mode 100644 index 0000000..1400c73 --- /dev/null +++ b/net-tools.spec @@ -0,0 +1,327 @@ +# +# spec file for package net-tools (Version 1.60) +# +# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. +# This file and all modifications and additions to the pristine +# package are under the same license as the package itself. +# +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + +# norootforbuild + +Name: net-tools +URL: http://www.tazenda.demon.co.uk/phil/net-tools/ +License: GPL +Group: Productivity/Networking/Other +Provides: traceroute net_tool +Provides: iputils:/usr/sbin/traceroute6 +Provides: iputils:/usr/share/man/man8/traceroute6.1.gz +Obsoletes: traceroute net_tool +Autoreqprov: on +Version: 1.60 +Release: 592 +Summary: Important Programs for Networking +BuildRoot: %{_tmppath}/%{name}-%{version}-build +Source: net-tools-%{version}.tar.bz2 +Source1: ftp://ftp.lst.de/pub/people/okir/traceroute/traceroute-1.0.4.tar.bz2 +Source2: netstat.xinetd +Source3: nstrcmp.c +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 +Patch17: traceroute-LDOPTS.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: traceroute-strip.diff +Patch28: traceroute-maxprobes.diff + +%description +This package contains essential programs for network administration and +maintenance: netstat, hostname, arp, ifconfig, rarp, and route. + + + +Authors: +-------- + Fred N. van Kempen + Bernd Eckenfels + Fred Baumgarten + Peter Tobias + Olaf Kirch + +%prep +%setup -q -a1 +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 +cd traceroute-* +%patch17 -p2 +%patch27 -p1 +%patch28 -p1 +cd .. +%patch18 -p1 +%patch19 -p1 +%patch20 +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 + +%build +make config +make COPTS="-D_GNU_SOURCE $RPM_OPT_FLAGS" LOPTS="" +cd traceroute-* +make CCOPTS="$RPM_OPT_FLAGS -fpie" LDOPTS="-pie" +cd .. + +%install +install -d -m 755 $RPM_BUILD_ROOT/etc/xinetd.d +install -m 644 %{S:2} $RPM_BUILD_ROOT/etc/xinetd.d/netstat +make install BASEDIR=$RPM_BUILD_ROOT +for tool in \ +%ifarch s390 + plipconfig slattach \ +%endif + nisdomainname ypdomainname mii-tool +do + rm -f $RPM_BUILD_ROOT/*bin/$tool + rm -f $RPM_BUILD_ROOT/%{_mandir}/man*/$tool.* + rm -f $RPM_BUILD_ROOT/%{_mandir}/*/man*/$tool.* +done +cd traceroute-* +mkdir -p $RPM_BUILD_ROOT/usr/sbin +make DESTDIR=$RPM_BUILD_ROOT CCOPTS="$RPM_OPT_FLAGS" install +cp traceroute.1 $RPM_BUILD_ROOT/%{_mandir}/man1/ +ln -s traceroute.1 $RPM_BUILD_ROOT/%{_mandir}/man1/traceroute6.1 +cd .. + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root) +/bin/* +/sbin/* +/usr/sbin/* +%_mandir/man*/* +%_datadir/locale/*/LC_MESSAGES/net-tools.mo +%config(noreplace) /etc/xinetd.d/netstat +%dir %lang(de_DE) %_mandir/de_DE +%dir %lang(de_DE) %_mandir/de_DE/man* +%lang(de_DE) %doc %_mandir/de_DE/man*/* +%dir %lang(fr_FR) %_mandir/fr_FR +%dir %lang(fr_FR) %_mandir/fr_FR/man* +%lang(fr_FR) %doc %_mandir/fr_FR/man*/* +%dir %lang(pt_BR) %_mandir/pt_BR +%dir %lang(pt_BR) %_mandir/pt_BR/man* +%lang(pt_BR) %doc %_mandir/pt_BR/man*/* + +%changelog -n net-tools +* Tue Sep 26 2006 - ms@suse.de +- fixed stack overflow when using traceroute -q [n]>=10 (#200508) +* Mon Jul 24 2006 - ms@suse.de +- fixed german translation for route -C (#194357) +* Thu Jul 20 2006 - ms@suse.de +- replaced static HZ define to dynamic: + [#]ifndef HZ + [#]define HZ sysconf(_SC_CLK_TCK) + [#]endif +* Wed May 24 2006 - schwab@suse.de +- Don't strip binaries. +* Wed May 17 2006 - ms@suse.de +- added patch from Olaf Kirch. Do not display SCTP sockets + if /proc/net/sctp/eps couldn't be opened (#159686) +* Tue Mar 21 2006 - okir@suse.de +- Display SCTP sockets correctly [#159686 - LTC22492] +* Mon Mar 20 2006 - hvogel@suse.de +- fix netstat -p segfault [#159069] +* Mon Feb 20 2006 - hvogel@suse.de +- fix netstat output not to bit-wrap [#149563] +* Mon Feb 06 2006 - hvogel@suse.de +- add snmp counter overflow patch by ak [#148350] +* Wed Feb 01 2006 - hvogel@suse.de +- fix arp causing unaligned access [#146422] + patch from Arthur D. Kepner +* Wed Jan 25 2006 - mls@suse.de +- converted neededforbuild to BuildRequires +* Wed Jan 11 2006 - mmj@suse.de +- Add patch from fedora to avoid stack smashing [#142461] +* Mon Dec 19 2005 - mmj@suse.de +- Update to traceroute-1.0.4 +* Mon Dec 19 2005 - mmj@suse.de +- Update to traceroute-1.0.3 +* Fri Dec 16 2005 - mmj@suse.de +- Use ICMP6_DST_UNREACH_BEYONDSCOPE instead of + ICMP6_DST_UNREACH_NOTNEIGHBOR on newer glibc +* Tue Sep 27 2005 - mmj@suse.de +- Fix strict aliasing issues +* Mon Aug 29 2005 - mmj@suse.de +- Correct netstat.8 [#104487] +* Wed Jul 06 2005 - mmj@suse.de +- Fix missing decl in nstrcmp.c +* Mon Jun 20 2005 - mmj@suse.de +- compile with -fpie, link with -pie +- don't strip explicitly +* Mon Jun 13 2005 - ro@suse.de +- include netinet/if_tr.h instead of linux/if_tr.h +* Wed Jan 05 2005 - mmj@suse.de +- Fix --numeric-ports to not imply --numeric [#45609] +* Wed Dec 08 2004 - mmj@suse.de +- Include linux/sockios.h to get the right ioctl [#48873]. This bug + is in mii-tool which is not included anymore, but better not risk + ever re-adding buggy stuff. +* Thu Dec 02 2004 - mmj@suse.de +- Fix nameif segfault [#48749] +* Mon Aug 09 2004 - mmj@suse.de +- Remove mii-tool everywhere [#43343] +* Fri Jul 30 2004 - fdg@suse.de +- fixed the -ic option without destroying the ifconfig buffer + regarding to bug #42932 +* Mon May 24 2004 - meissner@suse.de +- also print unsigned long longs (last patch updated). +* Mon May 24 2004 - meissner@suse.de +- Always read 64bit values from /proc/net/dev, so we can + use 32bit userland to read from 64bit kernel. #40951/LTC#8726 +* Fri Mar 05 2004 - hare@suse.de +- Fixed return values for non-existing interfaces in nameif. +* Thu Feb 26 2004 - hare@suse.de +- Add -r option to nameif to allow renaming of + interfaces. +* Thu Jan 29 2004 - hare@suse.de +- Cool. The last change effectively broke route(1). +-> replaced return; with break; +* Sun Jan 18 2004 - mmj@suse.de +- Fix compound statement calls, and add a missing include +* Wed Oct 15 2003 - mmj@suse.de +- Don't build as root +* Mon Oct 13 2003 - mmj@suse.de +- Fix 32 vs. 64-bit programming mistakes [#32089] +* Mon Aug 18 2003 - mmj@suse.de +- Fix from mmeissner for nstrcmp.c to handle alias interfaces, + even without standard names. (eth1:1 vs eth1:2, also + eth1:blubber vs eth1:1) [#28985] +* Mon Jul 14 2003 - mmj@suse.de +- Add fix from okir for traceroute -S [#27573] +* Wed Jun 18 2003 - ro@suse.de +- added non-en manpage directories to filelist +* Mon May 19 2003 - mmj@suse.de +- Use a better and more tested nstrcmp.c [#26950] +* Wed May 14 2003 - ro@suse.de +- fix build with 2.5 kernel includes +* Tue May 13 2003 - mmj@suse.de +- Package man-pages in several languages +* Wed Mar 05 2003 - mmj@suse.de +- Add missing xinetd file [#24676] +* Tue Nov 26 2002 - mmj@suse.de +- Fix traceroute 6 segfault [#21975] +* Fri Nov 15 2002 - okir@suse.de +- Upgraded to new traceroute to fix #20358 +* Mon Nov 11 2002 - mmj@suse.de +- Fix multi string literals +* Thu Jul 25 2002 - mmj@suse.de +- Added traceroute from Olaf Kirch, which is much more secure and + also IPv6 capable. +* Tue Apr 16 2002 - mmj@suse.de +- Do not pack translated manpages. Should go to other package. +* Mon Mar 04 2002 - mmj@suse.de +- unvollsändig -> unvollständig in German locale. [Bug #14371] +* Wed Feb 06 2002 - mmj@suse.de +- Removed yp and nis stuff from manpages. +* Sat Aug 25 2001 - kukuk@suse.de +- Replace last patch by a newer one from ak@suse.de +* Mon Aug 20 2001 - kukuk@suse.de +- Add fix for truncated IP addresses [Bug #9737] +* Wed Apr 25 2001 - kukuk@suse.de +- Update to net-tools-1.60: + * lot of locale fixes + * IPv6 fixes + * use secure strcpy +* Tue Apr 17 2001 - ro@suse.de +- added provides for net_tool +* Sun Mar 04 2001 - bk@suse.de +- Update to 1.59(many fixes and improvements and new program nameif) +- enabled gettext support and added locales +- added ipmaddr and iptunnel tools +- enabled FDDI and HIPPI support +- use optimisation flags +- added international man pages +- spec file changes to make use of wildcards in the filelist +* Fri Oct 20 2000 - kukuk@suse.de +- Rename from net_tool to net-tools +* Sun Jun 25 2000 - bk@suse.de +- s390: removed not needed files +* Sat Jun 03 2000 - kukuk@suse.de +- Update to 1.56 +* Thu May 25 2000 - kukuk@suse.de +- Update to 1.55 (contains all fixes) +* Thu May 18 2000 - kukuk@suse.de +- Add oh2bns patch (bug #2864) +* Wed Feb 09 2000 - kukuk@suse.de +- Add ifconfig manual pages from Andi Kleen +* Wed Feb 02 2000 - kukuk@suse.de +- Fix PPP initialisation +* Wed Feb 02 2000 - kukuk@suse.de +- Update to 1.54, move /usr/man -> /usr/share/man +* Mon Jan 03 2000 - kukuk@suse.de +- Enable IPv6 support +- Fix arp/ethers parsing +* Tue Oct 12 1999 - garloff@suse.de +- gateways and targets of PtP routes (host flag) are hosts, not + networks. Change name lookup accordingly. +* Mon Sep 13 1999 - bs@suse.de +- ran old prepare_spec on spec file to switch to new prepare_spec. +* Mon Aug 30 1999 - kukuk@suse.de +- Update to 1.53, remove ypdomainname and nisdomainname +* Sat Jun 26 1999 - kukuk@suse.de +- update from jurix to 1.52 +* Tue Mar 09 1999 - ro@suse.de +- update to 1.50 +- included slattach and its manpage in filelist +* Wed Oct 28 1998 - ro@suse.de +- update to 1.46 / removed incorporated changes from .dif +* Sat Sep 19 1998 - ro@suse.de +- define _GNU_SOURCE where getopt_long is used +* Tue Sep 01 1998 - ro@suse.de +- fixed problems with inluding own ipx.h under glibc +* Wed Jun 24 1998 - ro@suse.de +- added include linux/timer.h before including linux/ip_fw.h +* Mon Oct 27 1997 - ro@suse.de +- added ADD_LANG in Makefile to avoid error + whenever-whenever - florian@suse.de + new version 1.32-alpha + mv /sbin/arp /usr/sbin/arp diff --git a/netstat-trunc.dif b/netstat-trunc.dif new file mode 100644 index 0000000..3155e10 --- /dev/null +++ b/netstat-trunc.dif @@ -0,0 +1,68 @@ +--- 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; /* ?;) */ + } + + diff --git a/netstat.xinetd b/netstat.xinetd new file mode 100644 index 0000000..13002b3 --- /dev/null +++ b/netstat.xinetd @@ -0,0 +1,16 @@ +# 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 +} + diff --git a/nstrcmp.c b/nstrcmp.c new file mode 100644 index 0000000..c8053a6 --- /dev/null +++ b/nstrcmp.c @@ -0,0 +1,51 @@ +/* + * 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 +#include +#include +#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); +} diff --git a/ready b/ready new file mode 100644 index 0000000..473a0f4 diff --git a/traceroute-1.0.4.tar.bz2 b/traceroute-1.0.4.tar.bz2 new file mode 100644 index 0000000..21980c4 --- /dev/null +++ b/traceroute-1.0.4.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0247941b178849a93eba605622abbedd68c71992e06c3afec66d50f8a7a3e054 +size 15949 diff --git a/traceroute-LDOPTS.diff b/traceroute-LDOPTS.diff new file mode 100644 index 0000000..1739bc8 --- /dev/null +++ b/traceroute-LDOPTS.diff @@ -0,0 +1,16 @@ +--- net-tools-1.60/traceroute-0.6.3/Makefile ++++ net-tools-1.60/traceroute-0.6.3/Makefile +@@ -1,6 +1,7 @@ + CCOPTS = -g + CFLAGS = -Wall -D_BSD_SOURCE $(CCOPTS) + LDFLAGS = $(CCOPTS) ++LDOPTS = + OBJS = traceroute.o utils.o + BINARY = traceroute + BINARY6 = traceroute6 +@@ -16,4 +17,4 @@ + ln -s $(BINARY) $(DESTDIR)$(BINDIR)/$(BINARY6) + + traceroute: $(OBJS) +- $(CC) $(LDFLAGS) -o $@ $(OBJS) ++ $(CC) $(LDOPTS) $(LDFLAGS) -o $@ $(OBJS) diff --git a/traceroute-maxprobes.diff b/traceroute-maxprobes.diff new file mode 100644 index 0000000..cdbb5b2 --- /dev/null +++ b/traceroute-maxprobes.diff @@ -0,0 +1,20 @@ +--- net-tools-1.60/traceroute.c 26 Sep 2006 13:31:05 -0000 1.22 ++++ net-tools-1.60/traceroute.c 26 Sep 2006 13:27:00 -0000 +@@ -54,7 +54,7 @@ + #endif + + #define MAXHOPS 255 +-#define MAXPROBES 6 ++#define MAXPROBES 11 + #define MAXGATEWAYS 9 + + struct hop { +@@ -226,7 +226,7 @@ + break; + + case 'q': +- opt_retries = getnum("retry", optarg, 1, 1024); ++ opt_retries = getnum("retry", optarg, 1, MAXPROBES - 1); + break; + + case 'r': diff --git a/traceroute-strip.diff b/traceroute-strip.diff new file mode 100644 index 0000000..fbaaec4 --- /dev/null +++ b/traceroute-strip.diff @@ -0,0 +1,11 @@ +--- traceroute-1.0.4/Makefile ++++ traceroute-1.0.4/Makefile +@@ -13,7 +13,7 @@ + rm -f $(BINARY) $(OBJS) + + install: traceroute +- install -s -m 555 $(BINARY) $(DESTDIR)$(BINDIR) ++ install -m 555 $(BINARY) $(DESTDIR)$(BINDIR) + ln -s $(BINARY) $(DESTDIR)$(BINDIR)/$(BINARY6) + + traceroute: $(OBJS)