Commit 24d59ab0 authored by Martina Ferrari's avatar Martina Ferrari

Merge upstream/1.60+git20150829.73cef8a8

parents 9cc222c7 e09efd1b
arp hostname ifconfig ipmaddr iptunnel netstat plipconfig rarp route slattach
version.h config.make config.status config.h nameif mii-tool
.git
*.o
*.diff
*.patch
*.rej
*.orig
.gdb_history
.gdbinit
core
*.gdb
/config.h
/config.make
/config.status
/net-tools-*.tar*
/lib/libnet-tools.a
/po/*.mo
/version.h
/arp
/hostname
/ifconfig
/ipmaddr
/iptunnel
/mii-tool
/nameif
/netstat
/plipconfig
/rarp
/route
/slattach
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
......@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
......@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
......@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
......@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
......@@ -225,7 +225,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
......@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
......@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
......@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -303,16 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
......@@ -335,5 +335,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
......@@ -27,7 +27,7 @@ of the other options should work as well.
COMPILE
-------
-------
To compile simply use "make".
There should be no warnings or errors.
......
This diff is collapsed.
......@@ -17,10 +17,8 @@ Please include the output of "program --version" when reporting bugs.
Contents:
README This file.
README.ipv6 Notes for people hacking IPv6.
README This file.
INSTALLING Installation instructions.
......@@ -28,11 +26,11 @@ Contents:
TODO Some things that need to be done.
The Homepage (including CVS repository, release downloads and a form to
request enhancements) is hosted by BerliOS Developer. Please consider to
The Homepage (including Git repository, release downloads, bug tracker and
mailing list) is hosted by SourceForge.net. Please consider to
join the project if you want to contribute:
http://net-tools.berlios.de/
https://sourceforge.net/projects/net-tools/
Notes
......@@ -65,6 +63,8 @@ all common environments but some of the more esoteric hardware and
protocol families may be more touchy. Feel free to send patches if
you have problems.
For this release, the localized man pages are installed with UTF-8 encoding.
Phil Blundell
philb@gnu.org
......
Notes for IPv6
--------------
If you are using libc5, you may need to edit the Makefile so that
libinet6 is linked in and your IPv6 include files are found in the
right place. The definitions in question are at about line 91. You may
also find that the header files provided with inet6-apps are not exactly
what net-tools expects. This is not a bug in net-tools as such and will
not be fixed in future releases (though if anybody would like to contribute
a patch I would be happy to add a pointer to it here.) If you have the
option you might consider changing to glibc instead (see below) in which
case you can use the header files supplied with the C library.
If you use glibc, you should ensure that you have version 2.1 or later
installed. The 2.1 release is available from
<ftp://sourceware.cygnus.com/pub/glibc among> other places. With this
version of the C library there should be no need to edit the Makefile
or apply any patches to net-tools.
Version 2.0 of glibc has no support for IPv6; patches did exist at one
point but they are now seriously outdated. Instead you should upgrade
to glibc 2.1.
BUGS
----
"ifconfig eth0 add ..." does not currently auto-load the IPv6 module.
......@@ -34,7 +34,7 @@ make BASEDIR=$RPM_BUILD_ROOT install
strip arp ifconfig rarp route slattach plipconfig ipmaddr iptunnel
cd ../bin
strip hostname netstat
)
)
%clean
rm -rf $RPM_BUILD_ROOT
......@@ -92,7 +92,7 @@ rm -rf $RPM_BUILD_ROOT
* Fri Feb 27 1998 Jason Spangler <jasons@usemail.com>
- changed to net-tools 1.432
- removed old glibc 2.1 patch
* Wed Oct 22 1997 Erik Troan <ewt@redhat.com>
- added extra patches for glibc 2.1
......
The following people have contributed over time to the net-tools project
or to related files.
Maik Broemme
Kurt Garloff
Arnaldo Carvalho de Melo,
Lubomir Rintel (Fedora; bluetooth support updated)
(please notify net-tools@lina.inka.de if you notice some omission).
This is a TODO.
\ No newline at end of file
......@@ -23,7 +23,7 @@ TODO for net-tools
[ ] supply some informations about new features to HOWTOs
[ ] Config file only works with bash not ash.
[ ] Token ring is almost totally untested.
[ ] additional tools for IPX, AX.25 etc be bundled [ipxripd004, ipx_* tools
[ ] additional tools for IPX, AX.25 etc be bundled [ipxripd004, ipx_* tools
from caldera, axattach] into existing bins
[ ] "SIOCAX25OPTRT" [Joerg (DL1BKE)]. 1.3.75
[ ] dummy NOARP?! (2. default route for preveting hostunreachables on linedrop)
......
......@@ -8,7 +8,7 @@
* NET-3 Networking Distribution for the LINUX operating
* system.
*
* Version: $Id: arp.c,v 1.25 2005/12/04 02:57:15 ecki Exp $
* Version: $Id: arp.c,v 1.27 2009/09/06 22:50:11 vapier Exp $
*
* Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de>
*
......@@ -20,14 +20,14 @@
* Andrew Tridgell : proxy arp netmasks
* Bernd Eckenfels : -n option
* Bernd Eckenfels : Use only /proc for display
* {1.60} Bernd Eckenfels : new arpcode (-i) for 1.3.42 but works
* {1.60} Bernd Eckenfels : new arpcode (-i) for 1.3.42 but works
* with 1.2.x, too
* {1.61} Bernd Eckenfels : more verbose messages
* {1.62} Bernd Eckenfels : check -t for hw adresses and try to
* explain EINVAL (jeff)
*970125 {1.63} Bernd Eckenfels : -a print hardwarename instead of tiltle
*970201 {1.64} Bernd Eckenfels : net-features.h support
*970203 {1.65} Bernd Eckenfels : "#define" in "#if",
*970203 {1.65} Bernd Eckenfels : "#define" in "#if",
* -H|-A additional to -t|-p
*970214 {1.66} Bernd Eckenfels : Fix optarg required for -H and -A
*970412 {1.67} Bernd Eckenfels : device=""; is default
......@@ -35,7 +35,7 @@
*970517 {1.69} Bernd Eckenfels : usage() fixed
*970622 {1.70} Bernd Eckenfels : arp -d priv
*970106 {1.80} Bernd Eckenfels : new syntax without -D and with "dev <If>",
* ATF_MAGIC, ATF_DONTPUB support.
* ATF_MAGIC, ATF_DONTPUB support.
* Typo fix (Debian Bug#5728 Giuliano Procida)
*970803 {1.81} Bernd Eckenfels : removed junk comment line 1
*970925 {1.82} Bernd Eckenfels : include fix for libc6
......@@ -80,7 +80,7 @@
#define FEATURE_ARP
#include "lib/net-features.h"
char *Release = RELEASE, *Version = "arp 1.88 (2001-04-04)";
static char *Release = RELEASE;
int opt_n = 0; /* do not resolve addresses */
int opt_N = 0; /* use symbolic names */
......@@ -88,8 +88,8 @@ int opt_v = 0; /* debugging output flag */
int opt_D = 0; /* HW-address is devicename */
int opt_e = 0; /* 0=BSD output, 1=new linux */
int opt_a = 0; /* all entries, substring match */
struct aftype *ap; /* current address family */
struct hwtype *hw; /* current hardware type */
const struct aftype *ap;/* current address family */
const struct hwtype *hw;/* current hardware type */
int sockfd = 0; /* active socket descriptor */
int hw_set = 0; /* flag if hw-type was set (-H) */
char device[16] = ""; /* current device */
......@@ -178,7 +178,7 @@ static int arp_del(char **args)
if (*++args == NULL)
usage();
if (strcmp(*args, "255.255.255.255") != 0) {
strcpy(host, *args);
safe_strncpy(host, *args, (sizeof host));
if (ap->input(0, host, sa) < 0) {
ap->herror(host);
return (-1);
......@@ -197,7 +197,7 @@ static int arp_del(char **args)
if (flags == 0)
flags = 3;
strcpy(req.arp_dev, device);
safe_strncpy(req.arp_dev, device, sizeof(req.arp_dev));
/* unfortuatelly the kernel interface does not allow us to
delete private entries anlone, so we need this hack
......@@ -238,12 +238,12 @@ static int arp_del(char **args)
}
/* Get the hardware address to a specified interface name */
static int arp_getdevhw(char *ifname, struct sockaddr *sa, struct hwtype *hw)
static int arp_getdevhw(char *ifname, struct sockaddr *sa, const struct hwtype *hw)
{
struct ifreq ifr;
struct hwtype *xhw;
const struct hwtype *xhw;
strcpy(ifr.ifr_name, ifname);
safe_strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) < 0) {
fprintf(stderr, _("arp: cant get HW-Address for `%s': %s.\n"), ifname, strerror(errno));
return (-1);
......@@ -355,7 +355,7 @@ static int arp_set(char **args)
if (*++args == NULL)
usage();
if (strcmp(*args, "255.255.255.255") != 0) {
strcpy(host, *args);
safe_strncpy(host, *args, (sizeof host));
if (ap->input(0, host, sa) < 0) {
ap->herror(host);
return (-1);
......@@ -373,7 +373,7 @@ static int arp_set(char **args)
/* Fill in the remainder of the request. */
req.arp_flags = flags;
strcpy(req.arp_dev, device);
safe_strncpy(req.arp_dev, device, sizeof(req.arp_dev));
/* Call the kernel. */
if (opt_v)
......@@ -434,10 +434,10 @@ static int arp_file(char *name)
/* Print the contents of an ARP request block. */
static void arp_disp_2(char *name, int type, int arp_flags, char *hwa, char *mask, char *dev)
static void arp_disp_2(const char *name, int type, int arp_flags, const char *hwa, const char *mask, const char *dev)
{
static int title = 0;
struct hwtype *xhw;
const struct hwtype *xhw;
char flags[10];
xhw = get_hwntype(type);
......@@ -484,9 +484,9 @@ static void arp_disp_2(char *name, int type, int arp_flags, char *hwa, char *mas
}
/* Print the contents of an ARP request block. */
static void arp_disp(char *name, char *ip, int type, int arp_flags, char *hwa, char *mask, char *dev)
static void arp_disp(const char *name, const char *ip, int type, int arp_flags, const char *hwa, const char *mask, const char *dev)
{
struct hwtype *xhw;
const struct hwtype *xhw;
xhw = get_hwntype(type);
if (xhw == NULL)
......@@ -538,7 +538,7 @@ static int arp_show(char *name)
char dev[100];
int type, flags;
FILE *fp;
char *hostname;
const char *hostname;
int num, entries = 0, showed = 0;
host[0] = '\0';
......@@ -560,11 +560,11 @@ static int arp_show(char *name)
}
/* Bypass header -- read until newline */
if (fgets(line, sizeof(line), fp) != (char *) NULL) {
strcpy(mask, "-");
strcpy(dev, "-");
safe_strncpy(mask, "-", sizeof(mask));
safe_strncpy(dev, "-", sizeof(dev));
/* Read the ARP cache entries. */
for (; fgets(line, sizeof(line), fp);) {
num = sscanf(line, "%s 0x%x 0x%x %100s %100s %100s\n",
num = sscanf(line, "%s 0x%x 0x%x %99s %99s %99s\n",
ip, &type, &flags, hwa, mask, dev);
if (num < 4)
break;
......@@ -617,7 +617,7 @@ static int arp_show(char *name)
static void version(void)
{
fprintf(stderr, "%s\n%s\n%s\n", Release, Version, Features);
fprintf(stderr, "%s\n%s\n", Release, Features);
exit(E_VERSION);
}
......@@ -628,8 +628,9 @@ static void usage(void)
fprintf(stderr, _(" arp [-vnD] [<HW>] [-i <if>] -f [<filename>] <-Add entry from file\n"));
fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -s <host> <hwaddr> [temp] <-Add entry\n"));
fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -Ds <host> <if> [netmask <nm>] pub <-''-\n\n"));
fprintf(stderr, _(" -a display (all) hosts in alternative (BSD) style\n"));
fprintf(stderr, _(" -e display (all) hosts in default (Linux) style\n"));
fprintf(stderr, _(" -s, --set set a new ARP entry\n"));
fprintf(stderr, _(" -d, --delete delete a specified entry\n"));
fprintf(stderr, _(" -v, --verbose be verbose\n"));
......
#
# config.in Configure.sh source for the net-tools.
# config.in configure.sh source for the net-tools.
# This file contains the definition of what the support
# library contains. Most of all, it defines which types
# of address families and hardware we know of.
......@@ -46,7 +46,7 @@ bool 'Does your system support GNU gettext?' I18N n
*
*
* 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 y
......@@ -56,9 +56,10 @@ bool 'AX25 (packet radio) protocol family' HAVE_AFAX25 y
bool 'NET/ROM (packet radio) protocol family' HAVE_AFNETROM y
bool 'Rose (packet radio) protocol family' HAVE_AFROSE y
bool 'X.25 (CCITT) protocol family' HAVE_AFX25 y
bool 'Econet protocol family' HAVE_AFECONET y
bool 'Econet protocol family' HAVE_AFECONET n
bool 'DECnet protocol family' HAVE_AFDECnet n
bool 'Ash protocol family' HAVE_AFASH y
bool 'Bluetooth protocol family' HAVE_AFBLUETOOTH n
*
*
* Device Hardware types.
......@@ -68,8 +69,8 @@ bool 'ARCnet support' HAVE_HWARC y
bool 'SLIP (serial line) support' HAVE_HWSLIP y
bool 'PPP (serial line) support' HAVE_HWPPP y
bool 'IPIP Tunnel support' HAVE_HWTUNNEL y
bool 'STRIP (Metricom radio) support' HAVE_HWSTRIP y
bool 'Token ring (generic) support' HAVE_HWTR y
bool 'STRIP (Metricom radio) support' HAVE_HWSTRIP n
bool 'Token ring (generic) support' HAVE_HWTR n
bool 'AX25 (packet radio) support' HAVE_HWAX25 y
bool 'Rose (packet radio) support' HAVE_HWROSE y
bool 'NET/ROM (packet radio) support' HAVE_HWNETROM y
......@@ -81,7 +82,7 @@ bool 'HIPPI (generic) support' HAVE_HWHIPPI y
bool 'Ash hardware support' HAVE_HWASH y
bool '(Cisco)-HDLC/LAPB support' HAVE_HWHDLCLAPB y
bool 'IrDA support' HAVE_HWIRDA y
bool 'Econet hardware support' HAVE_HWEC y
bool 'Econet hardware support' HAVE_HWEC n
bool 'Generic EUI-64 hardware support' HAVE_HWEUI64 y
bool 'InfiniBand hardware support' HAVE_HWIB y
*
......@@ -91,3 +92,4 @@ bool 'InfiniBand hardware support' HAVE_HWIB y
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 'SELinux support' HAVE_SELINUX n
#!/usr/bin/env bash
#
# Configure.sh Generates interactively a config.h from config.in
# configure.sh Generates interactively a config.h from config.in
#
# net-tools A collection of programs that form the base set of the
# NET-3 Networking Distribution for the LINUX operating
......@@ -37,7 +37,15 @@ CONFIG=config.h
MAKECONFIG=config.make
[ -z "$BASH" ] && { echo "Configure requires bash" 1>&2; exit 1; }
[ -z "$BASH" ] && { echo "configure.sh requires bash" 1>&2; exit 1; }
cat <<EOF
######################################################
Notice: ifconfig and route are now installed into /bin
######################################################
EOF
# Disable filename globbing once and for all.
# Enable function cacheing.
......@@ -106,7 +114,7 @@ function int()
}
#
# Make sure we start out with a clean slate.
# Make sure we start out with a clean state.
#
> config.new
> ${CONFIG}
......
......@@ -6,7 +6,7 @@
* Usage: hostname [-d|-f|-s|-a|-i|-y|-n]
* hostname [-h|-V]
* hostname {name|-F file}
* dnsdmoainname
* dnsdmoainname
* nisdomainname {name|-F file}
*
* Version: hostname 1.101 (2003-10-11)
......@@ -16,7 +16,7 @@
* Changes:
* {1.90} Peter Tobias : Added -a and -i options.
* {1.91} Bernd Eckenfels : -v,-V rewritten, long_opts (major rewrite), usage.
*19960120 {1.95} Bernd Eckenfels : -y/nisdomainname - support for get/setdomainname added
*19960120 {1.95} Bernd Eckenfels : -y/nisdomainname - support for get/setdomainname added
*19960218 {1.96} Bernd Eckenfels : netinet/in.h added
*19980629 {1.97} Arnaldo Carvalho de Melo : gettext instead of catgets for i18n
*20000213 {1.99} Arnaldo Carvalho de Melo : fixed some i18n strings
......@@ -42,13 +42,19 @@
#include <arpa/inet.h>
#include "config.h"
#include "version.h"
#include "net-support.h"
#include "../intl.h"
#if HAVE_AFINET6
#include <sys/socket.h> /* for PF_INET6 */
#include <sys/types.h> /* for inet_ntop */
#endif
#if HAVE_AFDECnet
#include <netdnet/dn.h>
#endif
char *Release = RELEASE, *Version = "hostname 1.100 (2001-04-14)";
static char *Release = RELEASE;
static char *program_name;
static int opt_v;
......@@ -73,7 +79,7 @@ static void setnname(char *nname)
if (setnodename(nname, strlen(nname))) {
switch(errno) {
case EPERM:
fprintf(stderr, _("%s: you must be root to change the node name\n"), program_name);
fprintf(stderr, _("%s: you don't have permission to set the node name\n"), program_name);
break;
case EINVAL:
fprintf(stderr, _("%s: name too long\n"), program_name);
......@@ -94,7 +100,7 @@ static void sethname(char *hname)
if (sethostname(hname, strlen(hname))) {
switch (errno) {
case EPERM:
fprintf(stderr, _("%s: you must be root to change the host name\n"), program_name);
fprintf(stderr, _("%s: you don't have permission to set the host name\n"), program_name);
break;
case EINVAL:
fprintf(stderr, _("%s: name too long\n"), program_name);
......@@ -112,7 +118,7 @@ static void setdname(char *dname)
if (setdomainname(dname, strlen(dname))) {
switch (errno) {
case EPERM:
fprintf(stderr, _("%s: you must be root to change the domain name\n"), program_name);
fprintf(stderr, _("%s: you don't have permission to set the domain name\n"), program_name);
break;
case EINVAL:
fprintf(stderr, _("%s: name too long\n"), program_name);
......@@ -126,14 +132,29 @@ static void showhname(char *hname, int c)
{
struct hostent *hp;
register char *p, **alias;
struct in_addr **ip;
#if HAVE_AFINET6
char addr[INET6_ADDRSTRLEN + 1];
#else
char addr[INET_ADDRSTRLEN + 1];
#endif
socklen_t len;
char **addrp;
/* We use -1 so we can guarantee the buffer is NUL terminated. */
len = sizeof(addr) - 1;
addr[len] = '\0';
if (opt_v)
fprintf(stderr, _("Resolving `%s' ...\n"), hname);
if (!(hp = gethostbyname(hname))) {
if (
#if HAVE_AFINET6
!(hp = gethostbyname2(hname, PF_INET6)) &&
#endif
!(hp = gethostbyname(hname))) {
herror(program_name);
exit(1);
}
if (opt_v) {
fprintf(stderr, _("Result: h_name=`%s'\n"),
hp->h_name);
......@@ -143,10 +164,15 @@ static void showhname(char *hname, int c)
fprintf(stderr, _("Result: h_aliases=`%s'\n"),
*alias++);
ip = (struct in_addr **) hp->h_addr_list;
while (ip[0])
fprintf(stderr, _("Result: h_addr_list=`%s'\n"),
inet_ntoa(**ip++));
for (addrp = hp->h_addr_list; *addrp; ++addrp) {
if (inet_ntop(hp->h_addrtype, *addrp, addr, len))
fprintf(stderr, _("Result: h_addr_list=`%s'\n"), addr);
else if (errno == EAFNOSUPPORT)
fprintf(stderr, _("%s: protocol family not supported\n"),
program_name);
else if (errno == ENOSPC)
fprintf(stderr, _("%s: name too long\n"), program_name);
}
}
if (!(p = strchr(hp->h_name, '.')) && (c == 'd'))
return;
......@@ -158,8 +184,15 @@ static void showhname(char *hname, int c)
printf("\n");
break;
case 'i':
while (hp->h_addr_list[0])
printf("%s ", inet_ntoa(*(struct in_addr *) *hp->h_addr_list++));
for (addrp = hp->h_addr_list; *addrp; ++addrp) {
if (inet_ntop(hp->h_addrtype, *addrp, addr, len))
printf("%s ", addr);
else if (errno == EAFNOSUPPORT)
fprintf(stderr, _("%s: protocol family not supported\n"),
program_name);
else if (errno == ENOSPC)
fprintf(stderr, _("%s: name too long\n"), program_name);
}
printf("\n");
break;
case 'd':
......@@ -214,8 +247,8 @@ static void setfilename(char *name, int what)
static void version(void)
{
fprintf(stderr, "%s\n%s\n", Release, Version);
exit(5); /* E_VERSION */
fprintf(stderr, "%s\n", Release);
exit(E_VERSION);
}
static void usage(void)
......@@ -246,7 +279,7 @@ static void usage(void)
" FQDN (Fully Qualified Domain Name) and the DNS domain name (which is\n"
" part of the FQDN) in the /etc/hosts file.\n"));
exit(4); /* E_USAGE */
exit(E_USAGE);
}
......@@ -371,7 +404,10 @@ int main(int argc, char **argv)
setdname(argv[optind]);
break;
}
getdomainname(myname, sizeof(myname));
if (getdomainname(myname, sizeof(myname)) < 0) {
perror("getdomainname()");
exit(1);
}
if (opt_v)
fprintf(stderr, _("getdomainname()=`%s'\n"), myname);
printf("%s\n", myname);
......
This diff is collapsed.
......@@ -28,11 +28,10 @@ struct user_net_device_stats {
};
struct interface {
struct interface *next, *prev;
struct interface *next, *prev;
char name[IFNAMSIZ]; /* interface name */
short type; /* if type */
short flags; /* various flags */
int metric; /* routing metric */
int mtu; /* MTU value */
int tx_queue_len; /* transmit queue length */
struct ifmap map; /* hardware setup */
......@@ -65,16 +64,12 @@ extern int if_fetch(struct interface *ife);
extern int for_all_interfaces(int (*)(struct interface *, void *), void *);
extern int if_cache_free(void);
extern struct interface *lookup_interface(char *name);
extern struct interface *lookup_interface(const char *name);
extern int if_readlist(void);
extern int do_if_fetch(struct interface *ife);
extern int do_if_print(struct interface *ife, void *cookie);
extern int procnetdev_version(char *buf);
extern int get_dev_fields(char *bp, struct interface *ife);
extern char * get_name(char *name, char *p);
extern void ife_print(struct interface *ptr);
extern int ife_short;
......@@ -88,7 +83,7 @@ extern const char *if_port_text[][4];
#endif