Commit e09efd1b authored by Martina Ferrari's avatar Martina Ferrari

Merge remote-tracking branch 'upstream/master' into upstream

parents f68f8a8e 73cef8a8
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.
......
......@@ -5,14 +5,10 @@
# NET-3 Networking Distribution for the LINUX operating
# system.
#
# Version: 2001-02-13
#
# Author: Bernd Eckenfels <net-tools@lina.inka.de>
# Copyright 1995-1996 Bernd Eckenfels, Germany
#
# URLs: ftp://ftp.inka.de/pub/comp/Linux/networking/NetTools/
# ftp://ftp.linux.org.uk/pub/linux/Networking/PROGRAMS/NetTools/
# http://www.inka.de/sites/lina/linux/NetTools/index_en.html
# URLs: http://net-tools.sourceforge.net/
#
# Based on: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
# Copyright 1988-1993 MicroWalt Corporation
......@@ -22,55 +18,16 @@
# Alan Cox <A.Cox@swansea.ac.uk>
# Copyright 1993-1994 Swansea University Computer Society
#
# Be careful!
# Be careful!
# This Makefile doesn't describe complete dependencies for all include files.
# If you change include files you might need to do make clean.
#
# {1.20} Bernd Eckenfels: Even more modifications for the new
# package layout
# {1.21} Bernd Eckenfels: Check if config.in is newer than
# config.status
# {1.22} Bernd Eckenfels: Include ypdomainname and nisdomainame
#
# 1.3.50-BETA6 private Release
#
#960125 {1.23} Bernd Eckenfels: Peter Tobias' rewrite for
# makefile-based installation
# 1.3.50-BETA6a private Release
#
#960201 {1.24} Bernd Eckenfels: net-features.h added
#
#960201 1.3.50-BETA6b private Release
#
#960203 1.3.50-BETA6c private Release
#
#960204 1.3.50-BETA6d private Release
#
#960204 {1.25} Bernd Eckenfels: DISTRIBUTION added
#
#960205 1.3.50-BETA6e private Release
#
#960206 {1.26} Bernd Eckenfels: afrt.o removed (cleaner solution)
#
#960215 1.3.50-BETA6f Release
#
#960216 {1.30} Bernd Eckenfels: net-lib support
#960322 {1.31} Bernd Eckenfels: moveable netlib, TOPDIR
#960424 {1.32} Bernd Eckenfels: included the URLs in the Comment
#
#960514 1.31-alpha release
#
#960518 {1.33} Bernd Eckenfels: -I/usr/src/linux/include comment added
#
# This program is free software; you can redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at
# your option) any later version.
# If you change include files you might need to do make clean.
#
# set the base of the Installation
# set the base of the Installation
# BASEDIR = /mnt
BASEDIR ?= $(DESTDIR)
BINDIR ?= /bin
SBINDIR ?= /sbin
# path to the net-lib support library. Default: lib
NET_LIB_PATH = lib
......@@ -87,21 +44,27 @@ PROGS += mii-tool
endif
# Compiler and Linker Options
# You may need to uncomment and edit these if you are using libc5 and IPv6.
COPTS = -D_GNU_SOURCE -O2 -Wall -g # -I/usr/inet6/include
ifeq ($(origin LOPTS), undefined)
LOPTS =
endif
RESLIB = # -L/usr/inet6/lib -linet6
CFLAGS ?= -O2 -g
CFLAGS += -Wall
CFLAGS += -fno-strict-aliasing # code needs a lot of work before strict aliasing is safe
CPPFLAGS += -D_GNU_SOURCE
# Turn on transparent support for LFS
CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
ifeq ($(HAVE_AFDECnet),1)
DNLIB = -ldnet
endif
ifeq ($(origin CC), undefined)
CC = gcc
endif
LD = $(CC)
PKG_CONFIG ?= pkg-config
# -------- end of user definitions --------
MAINTAINER = Philip.Blundell@pobox.com
RELEASE = 1.60
MAINTAINER = net-tools-devel@lists.sourceforge.net
RELEASE = 2.10-alpha
.EXPORT_ALL_VARIABLES:
......@@ -113,22 +76,22 @@ endif
NET_LIB = $(NET_LIB_PATH)/lib$(NET_LIB_NAME).a
CFLAGS = $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH)
LDFLAGS = $(LOPTS) -L$(NET_LIB_PATH)
ifeq ($(HAVE_SELINUX),1)
SE_PC_CFLAGS := $(shell $(PKG_CONFIG) --cflags libselinux)
SE_PC_LIBS := $(shell $(PKG_CONFIG) --libs libselinux || echo -lselinux)
SELIB = $(SE_PC_LIBS)
CPPFLAGS += $(SE_PC_CFLAGS)
endif
SUBDIRS = man/ $(NET_LIB_PATH)/
CPPFLAGS += -I. -I$(TOPDIR)/include -I$(NET_LIB_PATH)
LDFLAGS += -L$(NET_LIB_PATH)
ifeq ($(origin CC), undefined)
CC = gcc
endif
LD = $(CC)
SUBDIRS = man/ $(NET_LIB_PATH)/
NLIB = -l$(NET_LIB_NAME)
MDEFINES = COPTS='$(COPTS)' LOPTS='$(LOPTS)' TOPDIR='$(TOPDIR)'
%.o: %.c config.h version.h intl.h net-features.h $<
$(CC) $(CFLAGS) -c $<
%.o: %.c config.h version.h intl.h lib/net-features.h $<
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
all: config.h version.h subdirs $(PROGS)
......@@ -139,27 +102,36 @@ install: all savebin installbin installdata
update: all installbin installdata
mostlyclean:
rm -f *.o DEADJOE config.new *~ *.orig lib/*.o
rm -f -- *.o DEADJOE config.new *~ *.orig lib/*.o
clean: mostlyclean
rm -f $(PROGS)
rm -f -- $(PROGS)
@for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean) ; done
@cd po && $(MAKE) clean
cleanconfig:
rm -f config.h
rm -f -- config.h
clobber: clean
rm -f $(PROGS) config.h version.h config.status config.make
rm -f -- $(PROGS) config.h version.h config.status config.make
@for i in $(SUBDIRS); do (cd $$i && $(MAKE) clobber) ; done
dist: clobber
@echo Creating net-tools-$(RELEASE) in ..
@tar -cvz -f ../net-tools-$(RELEASE).tar.gz -C .. net-tools
dist:
rm -rf -- net-tools-$(RELEASE)
git archive --prefix=net-tools-$(RELEASE)/ HEAD | tar xf -
$(MAKE) -C net-tools-$(RELEASE)/po $@
tar cf - net-tools-$(RELEASE)/ | xz > net-tools-$(RELEASE).tar.xz
rm -rf -- net-tools-$(RELEASE)
distcheck: dist
tar xf net-tools-$(RELEASE).tar.xz
yes "" | $(MAKE) -C net-tools-$(RELEASE) config
$(MAKE) -C net-tools-$(RELEASE)
rm -rf -- net-tools-$(RELEASE)
@printf "\nThe tarball is ready to go:\n%s\n" "`du -b net-tools-$(RELEASE).tar.xz`"
config.h: config.in Makefile
config.h: config.in Makefile
@echo "Configuring the Linux net-tools (NET-3 Base Utilities)..." ; echo
@if [ config.status -nt config.in ]; \
then ./configure.sh config.status; \
......@@ -175,85 +147,91 @@ $(NET_LIB): config.h version.h intl.h libdir
i18n.h: i18ndir
libdir:
@$(MAKE) -C $(NET_LIB_PATH) $(MDEFINES)
libdir: version.h
@$(MAKE) -C $(NET_LIB_PATH)
i18ndir:
@$(MAKE) -C po
subdirs:
@for i in $(SUBDIRS); do $(MAKE) -C $$i $(MDEFINES) ; done
# use libdir target for lib/ to avoid parallel build issues
subdirs: libdir
@for i in $(SUBDIRS:$(NET_LIB_PATH)/=); do $(MAKE) -C $$i || exit $$? ; done
ifconfig: $(NET_LIB) ifconfig.o
$(CC) $(LDFLAGS) -o ifconfig ifconfig.o $(NLIB) $(RESLIB)
nameif: nameif.o
$(CC) $(LDFLAGS) -o nameif nameif.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ ifconfig.o $(NLIB)
nameif: $(NET_LIB) nameif.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ nameif.o $(NLIB)
hostname: hostname.o
$(CC) $(LDFLAGS) -o hostname hostname.o $(DNLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ hostname.o $(DNLIB)
route: $(NET_LIB) route.o
$(CC) $(LDFLAGS) -o route route.o $(NLIB) $(RESLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ route.o $(NLIB)
arp: $(NET_LIB) arp.o
$(CC) $(LDFLAGS) -o arp arp.o $(NLIB) $(RESLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ arp.o $(NLIB)
rarp: $(NET_LIB) rarp.o
$(CC) $(LDFLAGS) -o rarp rarp.o $(NLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ rarp.o $(NLIB)
slattach: $(NET_LIB) slattach.o
$(CC) $(LDFLAGS) -o slattach slattach.o $(NLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ slattach.o $(NLIB)
plipconfig: $(NET_LIB) plipconfig.o
$(CC) $(LDFLAGS) -o plipconfig plipconfig.o $(NLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ plipconfig.o $(NLIB)
netstat: $(NET_LIB) netstat.o statistics.o
$(CC) $(LDFLAGS) -o netstat netstat.o statistics.o $(NLIB) $(RESLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ netstat.o statistics.o $(NLIB) $(SELIB)
iptunnel: $(NET_LIB) iptunnel.o
$(CC) $(LDFLAGS) -o iptunnel iptunnel.o $(NLIB) $(RESLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ iptunnel.o $(NLIB)
ipmaddr: $(NET_LIB) ipmaddr.o
$(CC) $(LDFLAGS) -o ipmaddr ipmaddr.o $(NLIB) $(RESLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ ipmaddr.o $(NLIB)
mii-tool: mii-tool.o
$(CC) $(LDFLAGS) -o mii-tool mii-tool.o
mii-tool: $(NET_LIB) mii-tool.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ mii-tool.o $(NLIB)
installbin:
install -m 0755 -d ${BASEDIR}/sbin
install -m 0755 -d ${BASEDIR}/bin
install -m 0755 arp ${BASEDIR}/sbin
install -m 0755 hostname ${BASEDIR}/bin
install -m 0755 ifconfig ${BASEDIR}/sbin
install -m 0755 nameif ${BASEDIR}/sbin
install -m 0755 netstat ${BASEDIR}/bin
install -m 0755 plipconfig $(BASEDIR)/sbin
install -m 0755 rarp ${BASEDIR}/sbin
install -m 0755 route ${BASEDIR}/sbin
install -m 0755 slattach $(BASEDIR)/sbin
@echo
@echo "######################################################"
@echo "Notice: ifconfig and route are now installed into /bin"
@echo "######################################################"
@echo
install -m 0755 -d ${BASEDIR}${SBINDIR}
install -m 0755 -d ${BASEDIR}${BINDIR}
install -m 0755 arp ${BASEDIR}${SBINDIR}
install -m 0755 hostname ${BASEDIR}${BINDIR}
install -m 0755 ifconfig ${BASEDIR}${BINDIR}
install -m 0755 nameif ${BASEDIR}${SBINDIR}
install -m 0755 netstat ${BASEDIR}${BINDIR}
install -m 0755 plipconfig $(BASEDIR)${SBINDIR}
install -m 0755 rarp ${BASEDIR}${SBINDIR}
install -m 0755 route ${BASEDIR}${BINDIR}
install -m 0755 slattach $(BASEDIR)${SBINDIR}
ifeq ($(HAVE_IP_TOOLS),1)
install -m 0755 ipmaddr $(BASEDIR)/sbin
install -m 0755 iptunnel $(BASEDIR)/sbin
install -m 0755 ipmaddr $(BASEDIR)${SBINDIR}
install -m 0755 iptunnel $(BASEDIR)${SBINDIR}
endif
ifeq ($(HAVE_MII),1)
install -m 0755 mii-tool $(BASEDIR)/sbin
install -m 0755 mii-tool $(BASEDIR)${SBINDIR}
endif
ln -fs hostname $(BASEDIR)/bin/dnsdomainname
ln -fs hostname $(BASEDIR)/bin/ypdomainname
ln -fs hostname $(BASEDIR)/bin/nisdomainname
ln -fs hostname $(BASEDIR)/bin/domainname
ln -fs hostname $(BASEDIR)${BINDIR}/dnsdomainname
ln -fs hostname $(BASEDIR)${BINDIR}/ypdomainname
ln -fs hostname $(BASEDIR)${BINDIR}/nisdomainname
ln -fs hostname $(BASEDIR)${BINDIR}/domainname
ifeq ($(HAVE_AFDECnet),1)
ln -fs hostname $(BASEDIR)/bin/nodename
ln -fs hostname $(BASEDIR)${BINDIR}/nodename
endif
savebin:
@for i in ${BASEDIR}/sbin/arp ${BASEDIR}/sbin/ifconfig \
${BASEDIR}/bin/netstat \
${BASEDIR}/sbin/rarp ${BASEDIR}/sbin/route \
${BASEDIR}/bin/hostname ${BASEDIR}/bin/ypdomainname \
${BASEDIR}/bin/dnsdomainname ${BASEDIR}/bin/nisdomainname \
${BASEDIR}/bin/domainname ; do \
@for i in ${BASEDIR}${SBINDIR}/arp ${BASEDIR}${SBINDIR}/ifconfig \
${BASEDIR}${BINDIR}/netstat \
${BASEDIR}${SBINDIR}/rarp ${BASEDIR}${SBINDIR}/route \
${BASEDIR}${BINDIR}/hostname ${BASEDIR}${BINDIR}/ypdomainname \
${BASEDIR}${BINDIR}/dnsdomainname ${BASEDIR}${BINDIR}/nisdomainname \
${BASEDIR}${BINDIR}/domainname ; do \
[ -f $$i ] && cp -f $$i $$i.old ; done ; echo Saved.
installdata:
......
......@@ -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;