Commit b72719fc authored by Phil Blundell's avatar Phil Blundell

A whole pile of fixes from Bernd, plus a fix for an arp

problem reported by Klaus Kudielka <kudielka@ieee.org>.
Also an ifconfig patch for alias deletion from
Roman Sulzhyk <roman@staff.prodigy.com>.  I'm not too happy
with this one but I put it in anyway.  Andi, see what you
think (look at ifconfig.c about line 1100).  Is there really
no better way to delete an alias?
parent 432c72d7
...@@ -87,7 +87,7 @@ RESLIB = # -L/usr/inet6/lib -linet6 ...@@ -87,7 +87,7 @@ RESLIB = # -L/usr/inet6/lib -linet6
# -------- end of user definitions -------- # -------- end of user definitions --------
MAINTAINER = Philip.Blundell@pobox.com MAINTAINER = Philip.Blundell@pobox.com
RELEASE = 1.49 RELEASE = 1.50
.EXPORT_ALL_VARIABLES: .EXPORT_ALL_VARIABLES:
...@@ -99,7 +99,7 @@ endif ...@@ -99,7 +99,7 @@ endif
NET-LIB = $(NET_LIB_PATH)/lib$(NET_LIB_NAME).a NET-LIB = $(NET_LIB_PATH)/lib$(NET_LIB_NAME).a
CFLAGS = $(COPTS) -I. -I./include/ -I$(NET_LIB_PATH) CFLAGS = $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH)
LDFLAGS = $(LOPTS) -L$(NET_LIB_PATH) LDFLAGS = $(LOPTS) -L$(NET_LIB_PATH)
SUBDIRS = man/ $(NET_LIB_PATH)/ SUBDIRS = man/ $(NET_LIB_PATH)/
...@@ -136,7 +136,7 @@ clobber: clean ...@@ -136,7 +136,7 @@ clobber: clean
dist: clobber dist: clobber
@echo Creating net-tools-$(RELEASE) in .. @echo Creating net-tools-$(RELEASE) in ..
@tar -cvz -f ../net-tools-$(RELEASE).tar.gz -C .. net-tools @tar -cvz -f ../net-tools-$(RELEASE).tar.gz -C .. net-tools-${RELEASE}
config.h: config.in Makefile config.h: config.in Makefile
......
...@@ -28,7 +28,14 @@ Contents: ...@@ -28,7 +28,14 @@ Contents:
Notes Notes
----- -----
This is net-tools 1.49. Notable changes since 1.48 include: This is net-tools 1.50. Notable changes since 1.49 include:
- netstat supports a new option `--listening' to show only listening
sockets.
- netstat -s is improved.
- route/netstat -r display the routing cache correctly.
Notable changes since 1.48 include:
- IP masquerading support is now selectable. - IP masquerading support is now selectable.
- The -t and -u switches to netstat now work as expected. - The -t and -u switches to netstat now work as expected.
...@@ -72,16 +79,23 @@ route/netstat -r do not yet support different AF cleanly. IPX/DDP/AX25 ...@@ -72,16 +79,23 @@ route/netstat -r do not yet support different AF cleanly. IPX/DDP/AX25
people, please feel free to add the code. people, please feel free to add the code.
ifconfig now supports changing media types for interfaces. This requires ifconfig now supports changing media types for interfaces. This requires
a recent 2.1.x kernel, and many devices do not support it yet. a recent 2.1.x or 2.2.x kernel, and many devices do not support it yet.
The documentation is slimmed down. I think most of it was out of The documentation is slimmed down. I think most of it was out of
date. date.
Some configuration options require recent 2.1.x kernels and/or particular The tools now support the layout of the 2.2.0 /proc files (Bernd Eckenfels).
versions of the C library. The defaults should be safe for all common
environments but some of the more esoteric hardware and protocol families Some configuration options require recent 2.1.x or 2.2.x kernels
may be more touchy. Feel free to send patches if you have problems. and/or particular versions of the C library. The defaults should be
safe for 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.
Phil Blundell Phil Blundell
philb@gnu.org philb@gnu.org
11th December 1998 11th December 1998
Bernd Eckenfels
net-tools@lina.inka.de
1999-01-02
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* NET-3 Networking Distribution for the LINUX operating * NET-3 Networking Distribution for the LINUX operating
* system. * system.
* *
* Version: $Id: arp.c,v 1.10 1998/11/17 15:16:09 freitag Exp $ * Version: $Id: arp.c,v 1.11 1999/01/05 20:52:54 philip Exp $
* *
* Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de> * Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de>
* *
...@@ -41,7 +41,8 @@ ...@@ -41,7 +41,8 @@
*970925 {1.82} Bernd Eckenfels : include fix for libc6 *970925 {1.82} Bernd Eckenfels : include fix for libc6
*980213 (1.83) Phil Blundell: set ATF_COM on new entries *980213 (1.83) Phil Blundell: set ATF_COM on new entries
*980629 (1.84) Arnaldo Carvalho de Melo: gettext instead of catgets *980629 (1.84) Arnaldo Carvalho de Melo: gettext instead of catgets
* *990101 {1.85} Bernd Eckenfels fixed usage and return codes
*990105 (1.86) Phil Blundell: don't ignore EINVAL in arp_set
* *
* This program is free software; you can redistribute it * This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General * and/or modify it under the terms of the GNU General
...@@ -77,7 +78,7 @@ ...@@ -77,7 +78,7 @@
#define FEATURE_ARP #define FEATURE_ARP
#include "lib/net-features.h" #include "lib/net-features.h"
char *Release = RELEASE, *Version = "arp 1.84 (1998-06-29)"; char *Release = RELEASE, *Version = "arp 1.85 (1999-01-05)";
int opt_n = 0; /* do not resolve addresses */ int opt_n = 0; /* do not resolve addresses */
int opt_N = 0; /* use symbolic names */ int opt_N = 0; /* use symbolic names */
...@@ -366,10 +367,8 @@ static int arp_set(char **args) ...@@ -366,10 +367,8 @@ static int arp_set(char **args)
if (opt_v) if (opt_v)
fprintf(stderr, "arp: SIOCSARP()\n"); fprintf(stderr, "arp: SIOCSARP()\n");
if (ioctl(sockfd, SIOCSARP, &req) < 0) { if (ioctl(sockfd, SIOCSARP, &req) < 0) {
if (errno != EINVAL) { perror("SIOCSARP");
perror("SIOCSARP"); return (-1);
return (-1);
}
} }
return (0); return (0);
} }
...@@ -597,18 +596,31 @@ static int arp_show(char *name) ...@@ -597,18 +596,31 @@ static int arp_show(char *name)
static void version(void) static void version(void)
{ {
fprintf(stderr, "%s\n%s\n%s\n", Release, Version, Features); fprintf(stderr, "%s\n%s\n%s\n", Release, Version, Features);
exit(-1); exit(E_VERSION);
} }
static void usage(void) static void usage(void)
{ {
fprintf(stderr, _("Usage: arp [-vn] [-H type] [-i if] -a [hostname]\n")); fprintf(stderr, _("Usage:\n arp [-vn] [<HW>] [-i <if>] [-a] [<hostname>] <-Display ARP cache\n"));
fprintf(stderr, _(" arp [-v] [-i if] -d hostname [pub][nopub]\n")); fprintf(stderr, _(" arp [-v] [-i <if>] -d <hostname> [pub][nopub] <-Delete ARP entry\n"));
fprintf(stderr, _(" arp [-v] [-H type] [-i if] -s hostname hw_addr [temp][nopub]\n")); fprintf(stderr, _(" arp [-vnD] [<HW>] [-i <if>] -f <filename> <-Add entry from file\n"));
fprintf(stderr, _(" arp [-v] [-H type] [-i if] -s hostname hw_addr [netmask nm] pub\n")); fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -s <hostname> <hwaddr> [temp][nopub] <-Add entry\n"));
fprintf(stderr, _(" arp [-v] [-H type] [-i if] -Ds hostname if [netmask nm] pub\n")); fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -s <hostname> <hwaddr> [netmask <nm>] pub <-''-\n"));
fprintf(stderr, _(" arp [-vnD] [-H type] [-i if] -f filename\n")); fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -Ds <hostname> <if> [netmask <nm>] pub <-''-\n\n"));
exit(-1);
fprintf(stderr, _(" -a display (all) hosts in alternative (BSD) 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"));
fprintf(stderr, _(" -n, --numeric dont resolve names\n"));
fprintf(stderr, _(" -i, --device specify network interface (e.g. eth0)\n"));
fprintf(stderr, _(" -D, --use-device read <hwaddr> from given device\n"));
fprintf(stderr, _(" -f, --file read new entries from file\n\n"));
fprintf(stderr, _(" <HW>=Use '-H <hw>' to specify hardware address type. Default: %s\n"), DFLT_HW);
fprintf(stderr, _(" List of possible hardware types (which support ARP):\n"));
print_hwlist(1); /* 1 = ARPable */
exit(E_USAGE);
} }
int main(int argc, char **argv) int main(int argc, char **argv)
......
...@@ -180,7 +180,7 @@ static void setfilename(char *name, int what) ...@@ -180,7 +180,7 @@ static void setfilename(char *name, int what)
static void version(void) static void version(void)
{ {
fprintf(stderr, "%s\n%s\n", Release, Version); fprintf(stderr, "%s\n%s\n", Release, Version);
exit(-1); exit(5); /* E_VERSION */
} }
static void usage(void) static void usage(void)
...@@ -203,7 +203,7 @@ static void usage(void) ...@@ -203,7 +203,7 @@ static void usage(void)
fprintf(stderr, _(" Unless you are using bind or NIS for host lookups you can change the\n")); fprintf(stderr, _(" Unless you are using bind or NIS for host lookups you can change the\n"));
fprintf(stderr, _(" FQDN (Fully Qualified Domain Name) and the DNS domain name (which is\n")); fprintf(stderr, _(" FQDN (Fully Qualified Domain Name) and the DNS domain name (which is\n"));
fprintf(stderr, _(" part of the FQDN) in the /etc/hosts file.\n")); fprintf(stderr, _(" part of the FQDN) in the /etc/hosts file.\n"));
exit(-1); exit(4); /* E_USAGE */
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* that either displays or sets the characteristics of * that either displays or sets the characteristics of
* one or more of the system's networking interfaces. * one or more of the system's networking interfaces.
* *
* Version: $Id: ifconfig.c,v 1.25 1998/12/06 16:17:44 philip Exp $ * Version: $Id: ifconfig.c,v 1.26 1999/01/05 20:52:58 philip Exp $
* *
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* and others. Copyright 1993 MicroWalt Corporation * and others. Copyright 1993 MicroWalt Corporation
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
* 10/1998 - Andi Kleen. Use interface list primitives. * 10/1998 - Andi Kleen. Use interface list primitives.
*/ */
#define DFLT_AF "inet"
#include "config.h" #include "config.h"
#include <features.h> #include <features.h>
...@@ -107,7 +109,7 @@ static const char *if_port_text[][4] = ...@@ -107,7 +109,7 @@ static const char *if_port_text[][4] =
#include "sockets.h" #include "sockets.h"
#include "util.h" #include "util.h"
char *Release = RELEASE, *Version = "ifconfig 1.37 (1998-12-05)"; char *Release = RELEASE, *Version = "ifconfig 1.38 (1999-01-05)";
int opt_a = 0; /* show all interfaces */ int opt_a = 0; /* show all interfaces */
int opt_i = 0; /* show the statistics */ int opt_i = 0; /* show the statistics */
...@@ -418,42 +420,42 @@ static int clr_flag(char *ifname, short flag) ...@@ -418,42 +420,42 @@ static int clr_flag(char *ifname, short flag)
static void usage(void) static void usage(void)
{ {
fprintf(stderr, _("Usage: ifconfig [-a] [-i] [-v] interface\n")); fprintf(stderr, _("Usage:\n ifconfig [-a] [-i] [-v] <interface> [[<AF>] <address>]\n"));
fprintf(stderr, _(" [[family] address]\n"));
/* XXX: it would be useful to have the add/del syntax even without IPv6. /* XXX: it would be useful to have the add/del syntax even without IPv6.
the 2.1 interface address lists make this natural */ the 2.1 interface address lists make this natural */
#ifdef HAVE_AFINET6 #ifdef HAVE_AFINET6
fprintf(stderr, _(" [add address[/prefixlen]]\n")); fprintf(stderr, _(" [add <address>[/<prefixlen>]]\n"));
#ifdef SIOCDIFADDR #ifdef SIOCDIFADDR
fprintf(stderr, _(" [del address[/prefixlen]]\n")); fprintf(stderr, _(" [del <address>[/<prefixlen>]]\n"));
#endif #endif
/* XXX the kernel supports tunneling even without ipv6 */ /* XXX the kernel supports tunneling even without ipv6 */
fprintf(stderr, _(" [tunnel aa.bb.cc.dd]\n"));
#endif #endif
#if HAVE_AFINET #if HAVE_AFINET
fprintf(stderr, _(" [[-]broadcast [aa.bb.cc.dd]]\n")); fprintf(stderr, _(" [[-]broadcast [<address>]] [[-]pointopoint [<address>]]\n"));
fprintf(stderr, _(" [[-]pointopoint [aa.bb.cc.dd]]\n")); fprintf(stderr, _(" [netmask <address>] [dstaddr <address>] [tunnel <adress>]\n"));
fprintf(stderr, _(" [netmask aa.bb.cc.dd]\n"));
fprintf(stderr, _(" [dstaddr aa.bb.cc.dd]\n"));
#endif #endif
fprintf(stderr, _(" [hw class address]\n"));
fprintf(stderr, _(" [metric NN] [mtu NN]\n"));
#ifdef SIOCSKEEPALIVE #ifdef SIOCSKEEPALIVE
fprintf(stderr, _(" [outfill NN] [keepalive NN]\n")); fprintf(stderr, _(" [outfill <NN>] [keepalive <NN>]\n"));
#endif #endif
fprintf(stderr, _(" [[-]trailers] [[-]arp]\n")); fprintf(stderr, _(" [hw <HW> <address>] [metric <NN>] [mtu <NN>]\n"));
fprintf(stderr, _(" [[-]allmulti] [[-]promisc]\n")); fprintf(stderr, _(" [[-]trailers] [[-]arp] [[-]allmulti]\n"));
fprintf(stderr, _(" [multicast]\n")); fprintf(stderr, _(" [multicast] [[-]promisc]\n"));
fprintf(stderr, _(" [mem_start NN] [io_addr NN] [irq NN]\n")); fprintf(stderr, _(" [mem_start <NN>] [io_addr <NN>] [irq <NN>] [media <type>]\n"));
fprintf(stderr, _(" [media type]\n"));
#ifdef HAVE_TXQUEUELEN #ifdef HAVE_TXQUEUELEN
fprintf(stderr, _(" [txqueuelen len]\n")); fprintf(stderr, _(" [txqueuelen len]\n"));
#endif #endif
#ifdef HAVE_DYNAMIC #ifdef HAVE_DYNAMIC
fprintf(stderr, _(" [[-]dynamic]\n")); fprintf(stderr, _(" [[-]dynamic]\n"));
#endif #endif
fprintf(stderr, _(" [up] [down] ...\n")); fprintf(stderr, _(" [up|down] ...\n\n"));
exit(1);
fprintf(stderr, _(" <HW>=Hardware Type.\n"));
fprintf(stderr, _(" List of possible hardware types:\n"));
print_hwlist(0); /* 1 = ARPable */
fprintf(stderr, _(" <AF>=Address family. Default: %s\n"), DFLT_AF);
fprintf(stderr, _(" List of possible address families:\n"));
print_aflist(0); /* 1 = routeable */
exit(E_USAGE);
} }
static void version(void) static void version(void)
...@@ -543,7 +545,7 @@ int main(int argc, char **argv) ...@@ -543,7 +545,7 @@ int main(int argc, char **argv)
} }
/* The next argument is either an address family name, or an option. */ /* The next argument is either an address family name, or an option. */
if ((ap = get_aftype(*spp)) == NULL) if ((ap = get_aftype(*spp)) == NULL)
ap = get_aftype("inet"); ap = get_aftype(DFLT_AF);
else { else {
/* XXX: should print the current setup if no args left, but only /* XXX: should print the current setup if no args left, but only
for this family */ for this family */
...@@ -1089,7 +1091,23 @@ int main(int argc, char **argv) ...@@ -1089,7 +1091,23 @@ int main(int argc, char **argv)
goterr = 1; goterr = 1;
} }
} }
goterr |= set_flag(ifr.ifr_name, (IFF_UP | IFF_RUNNING)); /*
* Don't do the set_flag() if the address is an alias with a - at the
* end, since it's deleted already! - Roman
*
* Should really use regex.h here, not sure though how well it'll go
* with the cross-platform support etc.
*/
{
char *ptr;
short int found_colon = 0;
for (ptr = ifr.ifr_name; *ptr; ptr++ )
if (*ptr == ':') found_colon++;
if (!(found_colon && *(ptr - 1) == '-'))
goterr |= set_flag(ifr.ifr_name, (IFF_UP | IFF_RUNNING));
}
spp++; spp++;
} }
......
...@@ -29,7 +29,7 @@ OBJS = $(sort $(VARIA) $(AFOBJS) $(HWOBJS) \ ...@@ -29,7 +29,7 @@ OBJS = $(sort $(VARIA) $(AFOBJS) $(HWOBJS) \
# This can be overwritten by the TOPLEVEL Makefile # This can be overwritten by the TOPLEVEL Makefile
TOPDIR=.. TOPDIR=..
CFLAGS += -I$(TOPDIR) -I$(TOPDIR)/include # -fPIC CFLAGS += -I$(TOPDIR) -idirafter $(TOPDIR)/include # -fPIC
SONAME=libnet-tools.so.0 SONAME=libnet-tools.so.0
.SUFFIXES: .a .so .SUFFIXES: .a .so
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* lib/af.c This file contains the top-level part of the protocol * lib/af.c This file contains the top-level part of the protocol
* support functions module for the NET-2 base distribution. * support functions module for the NET-2 base distribution.
* *
* Version: $Id: af.c,v 1.9 1998/12/01 09:30:30 philip Exp $ * Version: $Id: af.c,v 1.10 1999/01/05 20:53:18 philip Exp $
* *
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* Copyright 1993 MicroWalt Corporation * Copyright 1993 MicroWalt Corporation
...@@ -291,3 +291,26 @@ int aftrans_opt(const char *arg) ...@@ -291,3 +291,26 @@ int aftrans_opt(const char *arg)
return (0); return (0);
} }
/* type: 0=all, 1=getroute */
void print_aflist(int type) {
int count = 0;
char * txt;
struct aftype **afp;
if (!sVafinit)
afinit();
afp = aftypes;
while (*afp != NULL) {
if ((type == 1 && ((*afp)->rprint == NULL)) || ((*afp)->af == 0)) {
afp++; continue;
}
if ((count % 3) == 0) fprintf(stderr,count?"\n ":" ");
txt = (*afp)->name; if (!txt) txt = "..";
fprintf(stderr,"%s (%s) ",txt,(*afp)->title);
count++;
afp++;
}
fprintf(stderr,"\n");
}
/* /*
* lib/ash.c This file contains an implementation of the Ash * lib/ash.c This file contains an implementation of the Ash
* support functions for the NET-2 base distribution. * support functions for the NET-2 base distribution.
* $Id: ash.c,v 1.8 1998/11/26 10:16:38 philip Exp $ * $Id: ash.c,v 1.9 1999/01/05 20:53:20 philip Exp $
*/ */
#include "config.h" #include "config.h"
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
#include "util.h" #include "util.h"
#ifndef ARPHRD_ASH #ifndef ARPHRD_ASH
#error No support for Ash on this system #warning "No definition of ARPHRD_ASH in <net/if_arp.h>, using private value 517"
#define ARPHRD_ASH 517
#endif #endif
#define ASH_ALEN 64 #define ASH_ALEN 64
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* lib/ax25_gr.c This file contains an implementation of the "AX.25" * lib/ax25_gr.c This file contains an implementation of the "AX.25"
* route print support functions. * route print support functions.
* *
* Version: $Id: ax25_gr.c,v 1.3 1998/11/15 20:09:22 freitag Exp $ * Version: $Id: ax25_gr.c,v 1.4 1999/01/05 20:53:21 philip Exp $
* *
* Author: Bernd Eckenfels, <ecki@lina.inka.de> * Author: Bernd Eckenfels, <ecki@lina.inka.de>
* Copyright 1999 Bernd Eckenfels, Germany * Copyright 1999 Bernd Eckenfels, Germany
...@@ -43,6 +43,7 @@ int AX25_rprint(int options) ...@@ -43,6 +43,7 @@ int AX25_rprint(int options)
int use; int use;
if (f == NULL) { if (f == NULL) {
perror(_PATH_PROCNET_AX25_ROUTE);
printf(_("AX.25 not configured in this system.\n")); /* xxx */ printf(_("AX.25 not configured in this system.\n")); /* xxx */
return 1; return 1;
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* support functions for the net-tools. * support functions for the net-tools.
* (NET-3 base distribution). * (NET-3 base distribution).
* *
* Version: $Id: econet.c,v 1.5 1998/11/18 10:32:06 philip Exp $ * Version: $Id: econet.c,v 1.6 1999/01/05 20:53:23 philip Exp $
* *
* Author: Philip Blundell <philb@gnu.org> * Author: Philip Blundell <philb@gnu.org>
* *
...@@ -24,14 +24,15 @@ ...@@ -24,14 +24,15 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <stdio.h> #include <stdio.h>
#ifndef _NETECONET_EC_H
#include <linux/if_ec.h>
#endif
#include "version.h" #include "version.h"
#include "net-support.h" #include "net-support.h"
#include "pathnames.h" #include "pathnames.h"
#include "intl.h" #include "intl.h"
#ifndef _NETECONET_EC_H
#include <linux/if_ec.h>
#endif
/* Display an Econet address */ /* Display an Econet address */
static char * static char *
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* This file contains the HDLC/LAPB support for the NET-2 base * This file contains the HDLC/LAPB support for the NET-2 base
* distribution. * distribution.
* *
* Version: $Id: hdlclapb.c,v 1.3 1998/11/15 20:09:55 freitag Exp $ * Version: $Id: hdlclapb.c,v 1.4 1999/01/05 20:53:26 philip Exp $
* *
* Original Author: * Original Author:
* Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
...@@ -36,6 +36,16 @@ ...@@ -36,6 +36,16 @@
#include "net-support.h" #include "net-support.h"
#include "pathnames.h" #include "pathnames.h"
#ifndef ARPHRD_HDLC
#warning "No definition of ARPHRD_HDLC in <net/if_arp.h>, using private value 513"
#define ARPHRD_HDLC 513
#endif
#ifndef ARPHRD_LAPB
#warning "No definition of ARPHRD_HDLC in <net/if_arp.h>, using private value 516"
#define ARPHRD_LAPB 516
#endif
struct hwtype hdlc_hwtype = struct hwtype hdlc_hwtype =
{ {
"hdlc", NULL, /*"(Cisco) HDLC", */ ARPHRD_HDLC, 0, "hdlc", NULL, /*"(Cisco) HDLC", */ ARPHRD_HDLC, 0,
......
...@@ -21,10 +21,6 @@ ...@@ -21,10 +21,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <net/if_arp.h> #include <net/if_arp.h>
#ifndef ARPHRD_HIPPI
#error "No HIPPI Support in your current Kernelsource Tree."
#error "Disable HW Type HIPPI"
#endif
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
...@@ -41,6 +37,10 @@ ...@@ -41,6 +37,10 @@
*/ */
#define HIPPI_ALEN 6 /* Bytes in one HIPPI hw-addr */ #define HIPPI_ALEN 6 /* Bytes in one HIPPI hw-addr */
#ifndef ARPHRD_HIPPI
#define ARPHRD_HIPPI 780
#warning "ARPHRD_HIPPI is not defined in <net/if_arp.h>. Using private value 708"
#endif
extern struct hwtype hippi_hwtype; extern struct hwtype hippi_hwtype;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* lib/hw.c This file contains the top-level part of the hardware * lib/hw.c This file contains the top-level part of the hardware
* support functions module. * support functions module.
* *
* Version: $Id: hw.c,v 1.9 1998/11/16 15:13:48 philip Exp $ * Version: $Id: hw.c,v 1.10 1999/01/05 20:53:31 philip Exp $
* *
* Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de> * Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de>
* *
...@@ -214,3 +214,26 @@ struct hwtype *get_hwntype(int type) ...@@ -214,3 +214,26 @@ struct hwtype *get_hwntype(int type)
} }
return (NULL); return (NULL);
} }
/* type: 0=all, 1=ARPable */
void print_hwlist(int type) {
int count = 0;
char * txt;
struct hwtype **hwp;
if (!sVhwinit)
hwinit();
hwp = hwtypes;
while (*hwp != NULL) {
if (((type == 1) && ((*hwp)->alen == 0)) || ((*hwp)->type == -1)) {
hwp++; continue;
}
if ((count % 3) == 0) fprintf(stderr,count?"\n ":" ");
txt = (*hwp)->name; if (!txt) txt = "..";
fprintf(stderr,"%s (%s) ",txt,(*hwp)->title);
count++;
hwp++;
}
fprintf(stderr,"\n");
}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* support functions for the net-tools. * support functions for the net-tools.
* (NET-3 base distribution). * (NET-3 base distribution).
* *
* Version: $Id: inet.c,v 1.7 1998/11/19 13:01:58 philip Exp $ * Version: $Id: inet.c,v 1.8 1999/01/05 20:53:33 philip Exp $
* *
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* Copyright 1993 MicroWalt Corporation * Copyright 1993 MicroWalt Corporation
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*960217 {1.24} Bernd Eckenfels : get_sname *960217 {1.24} Bernd Eckenfels : get_sname
*960219 {1.25} Bernd Eckenfels : extern int h_errno *960219 {1.25} Bernd Eckenfels : extern int h_errno
*960329 {1.26} Bernd Eckenfels : resolve 255.255.255.255 *960329 {1.26} Bernd Eckenfels : resolve 255.255.255.255
*980101 {1.27} Bernd Eckenfels : resolve raw sockets in /etc/protocols
* *
* This program is free software; you can redistribute it * This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General * and/or modify it under the terms of the GNU General
...@@ -312,6 +313,7 @@ static struct service *searchlist(struct service *servicebase, int number) ...@@ -312,6 +313,7 @@ static struct service *searchlist(struct service *servicebase, int number)
static int read_services(void) static int read_services(void)
{ {
struct servent *se; struct servent *se;
struct protoent *pe;
struct service *item; struct service *item;
setservent(1); setservent(1);
...@@ -333,6 +335,17 @@ static int read_services(void) ...@@ -333,6 +335,17 @@ static int read_services(void)
} }
} }
endservent(); endservent();
setprotoent(1);
while ((pe = getprotoent())) {
/* Allocate a service entry. */
item = (struct service *) malloc(sizeof(struct service));
if (item == NULL)
perror("netstat");
item->name = strdup(pe->p_name);
item->number = htons(pe->p_proto);
add2list(&raw_name, item);
}
endprotoent();
return (0); return (0);
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#include <net/route.h> /* #include <net/route.h> realy broken */
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <netdb.h> #include <netdb.h>
...@@ -71,10 +71,12 @@ int rprint_fib6(int ext, int numeric) ...@@ -71,10 +71,12 @@ int rprint_fib6(int ext, int numeric)
struct sockaddr_in6 saddr6, snaddr6; struct sockaddr_in6 saddr6, snaddr6;
int num, iflags, metric, refcnt, use, prefix_len, slen; int num, iflags, metric, refcnt, use, prefix_len, slen;
FILE *fp = fopen(_PATH_PROCNET_ROUTE6, "r"); FILE *fp = fopen(_PATH_PROCNET_ROUTE6, "r");
char addr6p[8][5], saddr6p[8][5], naddr6p[8][5]; char addr6p[8][5], saddr6p[8][5], naddr6p[8][5];
if (!fp) { if (!fp) {
ESYSNOT("getroute", "INET6 FIB"); perror(_PATH_PROCNET_ROUTE6);
printf(_("INET6 (IPv6) not configured in this system.\n"));
return 1; return 1;
} }
printf(_("Kernel IPv6 routing table\n")); printf(_("Kernel IPv6 routing table\n"));
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#include <net/route.h> /* #include <net/route.h> realy broken */
#include <net/if.h> #include <net/if.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <ctype.h> #include <ctype.h>
......
This diff is collapsed.
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#include <net/route.h> #include <net/route.h> /* realy broken */
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
......
...@@ -38,22 +38,24 @@ int IPX_rprint(int options) ...@@ -38,22 +38,24 @@ int IPX_rprint(int options)
char net[128], router_net[128]; char net[128], router_net[128];
char router_node[128]; char router_node[128];
int num; int num;
FILE *fp; FILE *fp = fopen(_PATH_PROCNET_IPX_ROUTE, "r");
struct aftype *ap; struct aftype *ap;
struct sockaddr sa; struct sockaddr sa;
printf(_("Kernel IPX routing table\n")); /* xxx */
if ((ap = get_afntype(AF_IPX)) == NULL) { if ((ap = get_afntype(AF_IPX)) == NULL) {
EINTERN("lib/ipx_rt.c", "AF_IPX missing"); EINTERN("lib/ipx_rt.c", "AF_IPX missing");
return (-1); return (-1);
} }
printf(_("Destination Router Net Router Node\n"));
if ((fp = fopen(_PATH_PROCNET_IPX_ROUTE, "r")) == NULL) { if (!fp) {
perror(_PATH_PROCNET_IPX_ROUTE); perror(_PATH_PROCNET_IPX_ROUTE);
return (-1); printf(_("IPX not configured in this system.\n"));
return 1;
} }
printf(_("Kernel IPX routing table\n")); /* xxx */
printf(_("Destination Router Net Router Node\n"));
fgets(buff, 1023, fp); fgets(buff, 1023, fp);
while (fgets(buff, 1023, fp)) { while (fgets(buff, 1023, fp)) {
......
...@@ -43,10 +43,6 @@ ...@@ -43,10 +43,6 @@
#define HAVE_RTF_REJECT 1 #define HAVE_RTF_REJECT 1
#endif #endif
#ifdef RTMSG_NEWROUTE /* netstat */
#define HAVE_RT_NETLINK 1
#endif
/* compose the feature information string */ /* compose the feature information string */
#if defined (FEATURE_ARP) || defined (FEATURE_ROUTE) || defined (FEATURE_NETSTAT) #if defined (FEATURE_ARP) || defined (FEATURE_ROUTE) || defined (FEATURE_NETSTAT)
...@@ -104,13 +100,6 @@ static char *Features = ...@@ -104,13 +100,6 @@ static char *Features =
#endif #endif
"RTF_REJECT " "RTF_REJECT "
#if HAVE_RT_NETLINK
"+"
#else
"-"
#endif
"RT_NETLINK "
#if HAVE_FW_MASQUERADE #if HAVE_FW_MASQUERADE
"+" "+"
#else #else
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* NET-3 Networking Distribution for the LINUX operating * NET-3 Networking Distribution for the LINUX operating
* system. (net-tools, net-drivers) * system. (net-tools, net-drivers)
* *
* Version: lib/net-support.h 1.34 (1996-04-13) * Version: lib/net-support.h 1.35 (1996-01-01)
* *
* Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de> * Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de>
* *
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
*960219 {1.32} Bernd Eckenfels: type for ap->input() *960219 {1.32} Bernd Eckenfels: type for ap->input()
*960322 {1.33} Bernd Eckenfels: activate_ld and const in get_hwtype *960322 {1.33} Bernd Eckenfels: activate_ld and const in get_hwtype
*960413 {1.34} Bernd Eckenfels: new RTACTION suport *960413 {1.34} Bernd Eckenfels: new RTACTION suport
*990101 {1.35} Bernd Eckenfels: print_(hw|af)list support, added kerneldefines
* *
* This program is free software; you can redistribute it * This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General * and/or modify it under the terms of the GNU General
...@@ -68,8 +69,10 @@ struct hwtype { ...@@ -68,8 +69,10 @@ struct hwtype {
extern struct hwtype *get_hwtype(const char *name); extern struct hwtype *get_hwtype(const char *name);
extern struct hwtype *get_hwntype(int type); extern struct hwtype *get_hwntype(int type);
extern void print_hwlist(int type);
extern struct aftype *get_aftype(const char *name); extern struct aftype *get_aftype(const char *name);
extern struct aftype *get_afntype(int type); extern struct aftype *get_afntype(int type);
extern void print_aflist(int type);
extern int getargs(char *string, char *arguments[]); extern int getargs(char *string, char *arguments[]);
...@@ -158,4 +161,76 @@ extern char afname[]; ...@@ -158,4 +161,76 @@ extern char afname[];
#define E_INTERN 2 #define E_INTERN 2
#define E_NOSUPP 1 #define E_NOSUPP 1
/* ========== Kernel Defines =============
* Since it is not a good idea to depend on special kernel sources for the headers
* and since the libc6 Headers are not always up to date, we keep a copy of the
* most often used Flags in this file. We realy need a way to keep them up-to-date.
* Perhaps anybody knows how the glibc2 folk is doing it? -ecki
*/
/* Keep this ins sync with /usr/src/linux/include/linux/rtnetlink.h */
#define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */
#define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */
#define RTNH_F_ONLINK 4 /* Gateway is forced on link */
/* Keep this in sync with /usr/src/linux/include/linux/in_route.h */
#define RTCF_DEAD RTNH_F_DEAD
#define RTCF_ONLINK RTNH_F_ONLINK
/* #define RTCF_NOPMTUDISC RTM_F_NOPMTUDISC */
#define RTCF_NOTIFY 0x00010000
#define RTCF_DIRECTDST 0x00020000
#define RTCF_REDIRECTED 0x00040000
#define RTCF_TPROXY 0x00080000
#define RTCF_FAST 0x00200000
#define RTCF_MASQ 0x00400000
#define RTCF_SNAT 0x00800000
#define RTCF_DOREDIRECT 0x01000000
#define RTCF_DIRECTSRC 0x04000000
#define RTCF_DNAT 0x08000000
#define RTCF_BROADCAST 0x10000000
#define RTCF_MULTICAST 0x20000000
#define RTCF_REJECT 0x40000000
#define RTCF_LOCAL 0x80000000
/* Keep this in sync with /usr/src/linux/include/linux/ipv6_route.h */
#ifndef RTF_DEFAULT
#define RTF_DEFAULT 0x00010000 /* default - learned via ND */
#endif
#define RTF_ALLONLINK 0x00020000 /* fallback, no routers on link */
#ifndef RTF_ADDRCONF
#define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */
#endif
#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */
#define RTF_EXPIRES 0x00400000
#define RTF_CACHE 0x01000000 /* cache entry */
#define RTF_FLOW 0x02000000 /* flow significant route */
#define RTF_POLICY 0x04000000 /* policy route */
#define RTF_LOCAL 0x80000000
/* Keep this in sync with /usr/src/linux/include/linux/route.h */
#define RTF_UP 0x0001 /* route usable */
#define RTF_GATEWAY 0x0002 /* destination is a gateway */
#define RTF_HOST 0x0004 /* host entry (net otherwise) */
#define RTF_REINSTATE 0x0008 /* reinstate route after tmout */
#define RTF_DYNAMIC 0x0010 /* created dyn. (by redirect) */
#define RTF_MODIFIED 0x0020 /* modified dyn. (by redirect) */
#define RTF_MTU 0x0040 /* specific MTU for this route */
#ifndef RTF_MSS
#define RTF_MSS RTF_MTU /* Compatibility :-( */
#endif
#define RTF_WINDOW 0x0080 /* per route window clamping */
#define RTF_IRTT 0x0100 /* Initial round trip time */
#define RTF_REJECT 0x0200 /* Reject route */
/* this is a 2.0.36 flag from /usr/src/linux/include/linux/route.h */
#define RTF_NOTCACHED 0x0400 /* this route isn't cached */
#ifdef HAVE_AFECONET
#ifndef AF_ECONET
#define AF_ECONET 19 /* Acorn Econet */
#endif
#endif
/* End of lib/support.h */ /* End of lib/support.h */
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* lib/netrom_gr.c This file contains an implementation of the NET/ROM * lib/netrom_gr.c This file contains an implementation of the NET/ROM
* route support functions. * route support functions.
* *
* Version: $Id: netrom_gr.c,v 1.3 1998/11/15 20:11:29 freitag Exp $ * Version: $Id: netrom_gr.c,v 1.4 1999/01/05 20:53:55 philip Exp $
* *
* Author: Bernd Eckenfels, <ecki@lina.inka.de> * Author: Bernd Eckenfels, <ecki@lina.inka.de>
* Copyright 1999 Bernd Eckenfels, Germany * Copyright 1999 Bernd Eckenfels, Germany
...@@ -39,12 +39,17 @@ int NETROM_rprint(int options) ...@@ -39,12 +39,17 @@ int NETROM_rprint(int options)
/*int ext = options & FLAG_EXT; /*int ext = options & FLAG_EXT;
int numeric = options & FLAG_NUM; */ int numeric = options & FLAG_NUM; */
f1 = fopen(_PATH_PROCNET_NR_NODES, "r");
if (!f1) perror(_PATH_PROCNET_NR_NODES);
f2 = fopen(_PATH_PROCNET_NR_NEIGH, "r");
if (!f2) perror(_PATH_PROCNET_NR_NEIGH);
if (f1 == NULL || f2 == NULL) { if (f1 == NULL || f2 == NULL) {
printf(_("NET/ROM not configured in this system.\n")); /* xxx */ printf(_("NET/ROM not configured in this system.\n"));
return 1; return 1;
} }
printf(_("Kernel NET/ROM routing table\n")); /* xxx */ printf(_("Kernel NET/ROM routing table\n"));
printf(_("Destination Mnemonic Quality Neighbour Iface\n")); /* xxx */ printf(_("Destination Mnemonic Quality Neighbour Iface\n"));
fgets(buffer, 256, f1); fgets(buffer, 256, f1);
while (fgets(buffer, 256, f1)) { while (fgets(buffer, 256, f1)) {
buffer[9] = 0; buffer[9] = 0;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#include <net/route.h> /* #include <net/route.h> realy broken */
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
......
/* Tolerant /proc file parser. Copyright 1998 Andi Kleen */ /* Tolerant /proc file parser. Copyright 1998 Andi Kleen */
/* $Id: proc.c,v 1.3 1998/11/15 20:11:55 freitag Exp $ */ /* $Id: proc.c,v 1.4 1999/01/05 20:54:00 philip Exp $ */
/* Fixme: cannot currently cope with removed fields */ /* Fixme: cannot currently cope with removed fields */
#include <string.h> #include <string.h>
...@@ -48,3 +48,27 @@ char *proc_gen_fmt(char *name, int more, FILE * fh,...) ...@@ -48,3 +48,27 @@ char *proc_gen_fmt(char *name, int more, FILE * fh,...)
} }
return strdup(format); return strdup(format);
} }
/*
* this will generate a bitmask of present/missing fields in the header of
* a /proc file.
*/
int proc_guess_fmt(char *name, FILE *fh, ...)
{
char buf[512];
char *tmp;
int flag = 0;
va_list ap;
if (!fgets(buf, (sizeof buf) - 1, fh))
return -1;
strcat(buf, "\0");
va_start(ap, fh);
while((tmp = va_arg(ap, char *))) {
int f = va_arg(ap, int);
if (strstr(buf,tmp) != 0)
flag |= f;
}
va_end(ap);
return flag;
}
...@@ -2,3 +2,4 @@ ...@@ -2,3 +2,4 @@
/* Generate a suitable scanf format for a column title line */ /* Generate a suitable scanf format for a column title line */
char *proc_gen_fmt(char *name, int more, FILE * fh,...); char *proc_gen_fmt(char *name, int more, FILE * fh,...);
int proc_guess_fmt(char *name, FILE* fh,...);
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* lib/rose.c This file contains an implementation of the "ROSE" * lib/rose.c This file contains an implementation of the "ROSE"
* support functions for the NET-2 base distribution. * support functions for the NET-2 base distribution.
* *
* Version: $Id: rose.c,v 1.5 1998/11/15 20:12:00 freitag Exp $ * Version: $Id: rose.c,v 1.6 1999/01/05 20:54:04 philip Exp $
* *
* Author: Terry Dawson, VK2KTJ, <terry@perf.no.itg.telstra.com.au> * Author: Terry Dawson, VK2KTJ, <terry@perf.no.itg.telstra.com.au>
* based on ax25.c by: * based on ax25.c by:
...@@ -35,8 +35,18 @@ ...@@ -35,8 +35,18 @@
#include "pathnames.h" #include "pathnames.h"
#include "intl.h" #include "intl.h"
#if __GLIBC__ >= 2 #ifndef _NETROSE_ROSE_H
#include <netrose/rose.h> #include <linux/ax25.h>
#include <linux/rose.h>
/* this will check for the broken #define PF_ROSE AF_ROSE define in some older kernel headers */
#undef AF_ROSE
#if PF_ROSE == AF_ROSE
#warning "Your <linux/rose.h> is broken and defines PF_ROSE, better remove the define in /usr/include/linux/rose.h (using private define for PF_ROSE meanwhile)"
#undef PF_ROSE
#define PF_ROSE 11 /* Amateur Radio X.25 PLP */
#endif
/* now restore the value of AF_ROSE (which had to be deleted to catch the case where #define AF_ROSE PF_ROSE) */
#define AF_ROSE PF_ROSE
#endif #endif
static char ROSE_errmsg[128]; static char ROSE_errmsg[128];
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* lib/rose_gr.c This file contains an implementation of the "ROSE" * lib/rose_gr.c This file contains an implementation of the "ROSE"
* route print support functions. * route print support functions.
* *
* Version: $Id: rose_gr.c,v 1.3 1998/11/15 20:12:03 freitag Exp $ * Version: $Id: rose_gr.c,v 1.4 1999/01/05 20:54:07 philip Exp $
* *
* Author: Terry Dawson, VK2KTJ, <terry@perf.no.itg.telstra.com.au> * Author: Terry Dawson, VK2KTJ, <terry@perf.no.itg.telstra.com.au>
* based on ax25_gr.c by: * based on ax25_gr.c by:
...@@ -41,16 +41,18 @@ ...@@ -41,16 +41,18 @@
int ROSE_rprint(int options) int ROSE_rprint(int options)
{ {
FILE *f = fopen(_PATH_PROCNET_ROSE_ROUTE, "r"); FILE *f = NULL;
char buffer[256]; char buffer[256];
int use; int use;
f=fopen(_PATH_PROCNET_ROSE_ROUTE, "r");
if (f == NULL) { if (f == NULL) {
perror(_PATH_PROCNET_ROSE_ROUTE);
printf(_("ROSE not configured in this system.\n")); /* xxx */ printf(_("ROSE not configured in this system.\n")); /* xxx */
return 1; return 1;
} }
printf(_("Kernel ROSE routing table\n")); /* xxx */ printf(_("Kernel ROSE routing table\n"));
printf(_("Destination Iface Use\n")); /* xxx */ printf(_("Destination Iface Use\n"));
fgets(buffer, 256, f); fgets(buffer, 256, f);
while (fgets(buffer, 256, f)) { while (fgets(buffer, 256, f)) {
buffer[9] = 0; buffer[9] = 0;
......
/* /*
* lib/sit.c This file contains the SIT HW-type support. * lib/sit.c This file contains the SIT HW-type support.
* *
* Version: $Id: sit.c,v 1.3 1998/11/15 20:12:12 freitag Exp $ * Version: $Id: sit.c,v 1.4 1999/01/05 20:54:08 philip Exp $
* *
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* Copyright 1993 MicroWalt Corporation * Copyright 1993 MicroWalt Corporation
...@@ -33,6 +33,11 @@ ...@@ -33,6 +33,11 @@
#include "net-support.h" #include "net-support.h"
#include "pathnames.h" #include "pathnames.h"
#ifndef ARPHRD_SIT
#warning "No definition of ARPHRD_SIT in <net/if_arp.h>, using private value 776"
#define ARPHRD_SIT 776
#endif
struct hwtype sit_hwtype = struct hwtype sit_hwtype =
{ {
"sit", NULL, /*"IPv6-in-IPv4", */ ARPHRD_SIT, 0, "sit", NULL, /*"IPv6-in-IPv4", */ ARPHRD_SIT, 0,
......
.TH ARP 8 "15 May 1996" "net-tools" "Linux Programmer's Manual" .TH ARP 8 "5 Jan 1999" "net-tools" "Linux Programmer's Manual"
.SH NAME .SH NAME
arp \- manipulate the system ARP cache arp \- manipulate the system ARP cache
.SH SYNOPSIS .SH SYNOPSIS
...@@ -93,10 +93,12 @@ Use the interface ...@@ -93,10 +93,12 @@ Use the interface
hardware address. hardware address.
.TP .TP
.B "\-i If, \-\-device If" .B "\-i If, \-\-device If"
Select an Interface. When dumping the ARP cache only entries matching the Select an interface. When dumping the ARP cache only entries matching
Interface will be printed. Setting a permanent or temp ARP entry will be the specified interface will be printed. When setting a permanent or
used on the specified device. If no device is given, the kernels guess the .B temp
device from the routing table. For ARP entry this interface will be associated with the entry; if this
option is not used, the kernel will guess based on the routing
table. For
.B pub .B pub
entries the specified interface is the interface on which ARP requests will entries the specified interface is the interface on which ARP requests will
be answered. be answered.
...@@ -118,11 +120,16 @@ the ...@@ -118,11 +120,16 @@ the
.BR pub lish .BR pub lish
flag set a flag set a
.B netmask .B netmask
may be specified to proxy arp for may be specified to proxy arp for entire subnets. This is not good
entire subnets. Proxy arp for routing entire networks is not a good practice, but is supported by older kernels because it can be
protocol, but its sometimes useful so supported. If the useful. If the
.B temp .B temp
flag is not supplied entries will be permanent stored into the ARP cache. flag is not supplied entries will be permanent stored into the ARP
cache.
.br
.B NOTE:
As of kernel 2.2.0 it is no longer possible to set an ARP entry for an
entire subnet.
.TP .TP
.B "\-f filename, \-\-file filename" .B "\-f filename, \-\-file filename"
Similar to the Similar to the
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* that maintains the kernel's RARP cache. It is derived * that maintains the kernel's RARP cache. It is derived
* from Fred N. van Kempen's arp command. * from Fred N. van Kempen's arp command.
* *
* Version: $Id: rarp.c,v 1.4 1998/11/15 20:08:12 freitag Exp $ * Version: $Id: rarp.c,v 1.5 1999/01/05 20:53:02 philip Exp $
* *
* Usage: rarp -d hostname Delete entry * Usage: rarp -d hostname Delete entry
* rarp -s hostname ethernet_address Add entry * rarp -s hostname ethernet_address Add entry
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
* *
* Rewritten: Phil Blundell <Philip.Blundell@pobox.com> 1997-08-03 * Rewritten: Phil Blundell <Philip.Blundell@pobox.com> 1997-08-03
* gettext instead of catgets: Arnaldo Carvalho de Melo <acme@conectiva.com.br> 1998-06-29 * gettext instead of catgets: Arnaldo Carvalho de Melo <acme@conectiva.com.br> 1998-06-29
* 1998-01-01 Bernd Eckenfels reorganised usage()
* *
*/ */
...@@ -31,6 +32,8 @@ ...@@ -31,6 +32,8 @@
#include <unistd.h> #include <unistd.h>
#include <getopt.h> #include <getopt.h>
#define DFLT_HW "ether"
#include "config.h" #include "config.h"
#include "intl.h" #include "intl.h"
#include "net-support.h" #include "net-support.h"
...@@ -170,11 +173,15 @@ static int display_cache(void) ...@@ -170,11 +173,15 @@ static int display_cache(void)
static void usage(void) static void usage(void)
{ {
fprintf(stderr, _("Usage: rarp -a list entries in cache.\n")); fprintf(stderr, _("Usage: rarp -a list entries in cache.\n"));
fprintf(stderr, _(" rarp -d hostname delete entry from cache.\n")); fprintf(stderr, _(" rarp -d <hostname> delete entry from cache.\n"));
fprintf(stderr, _(" rarp [-t hwtype] -s hostname hwaddr add entry to cache.\n")); fprintf(stderr, _(" rarp [<HW>] -s <hostname> <hwaddr> add entry to cache.\n"));
fprintf(stderr, _(" rarp -f add entries from ethers.\n")); fprintf(stderr, _(" rarp -f add entries from /etc/ethers.\n"));
fprintf(stderr, _(" rarp -V display program version.\n")); fprintf(stderr, _(" rarp -V display program version.\n\n"));
exit(-1);
fprintf(stderr, _(" <HW>=Use '-H <hw>' to specify hardware address type. Default: %s\n"), DFLT_HW);
fprintf(stderr, _(" List of possible hardware types (which support ARP):\n"));
print_hwlist(1); /* 1 = ARPable */
exit(E_USAGE);
} }
#define MODE_DISPLAY 1 #define MODE_DISPLAY 1
...@@ -205,13 +212,11 @@ int main(int argc, char **argv) ...@@ -205,13 +212,11 @@ int main(int argc, char **argv)
textdomain("net-tools"); textdomain("net-tools");
#endif #endif
#if HAVE_HWETHER
/* Get a default hardware type. */ /* Get a default hardware type. */
hardware = get_hwtype("ether"); hardware = get_hwtype(DFLT_HW);
#endif
do { do {
c = getopt_long(argc, argv, "-ht:adsVvf", longopts, NULL); c = getopt_long(argc, argv, "-ht:aHdsVvf", longopts, NULL);
switch (c) { switch (c) {
case EOF: case EOF:
break; break;
...@@ -219,7 +224,7 @@ int main(int argc, char **argv) ...@@ -219,7 +224,7 @@ int main(int argc, char **argv)
usage(); usage();
case 'V': case 'V':
fprintf(stderr, version_string); fprintf(stderr, version_string);
exit(1); exit(E_VERSION);
break; break;
case 'v': case 'v':
verbose++; verbose++;
...@@ -237,6 +242,7 @@ int main(int argc, char **argv) ...@@ -237,6 +242,7 @@ int main(int argc, char **argv)
case 'f': case 'f':
mode = MODE_ETHERS; mode = MODE_ETHERS;
break; break;
case 'H':
case 't': case 't':
if (optarg) { if (optarg) {
hardware = get_hwtype(optarg); hardware = get_hwtype(optarg);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* route This file contains an implementation of the command * route This file contains an implementation of the command
* that manages the IP routing table in the kernel. * that manages the IP routing table in the kernel.
* *
* Version: $Id: route.c,v 1.3 1998/11/15 20:08:17 freitag Exp $ * Version: $Id: route.c,v 1.4 1999/01/05 20:53:04 philip Exp $
* *
* Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de> * Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de>
* *
...@@ -32,13 +32,14 @@ ...@@ -32,13 +32,14 @@
*960426 {1.92} Bernd Eckenfels: FLAG_SYM/-N support *960426 {1.92} Bernd Eckenfels: FLAG_SYM/-N support
*960823 {x.xx} Frank Strauss: INET6 stuff *960823 {x.xx} Frank Strauss: INET6 stuff
*980629 {1.95} Arnaldo Carvalho de Melo: gettext instead of catgets *980629 {1.95} Arnaldo Carvalho de Melo: gettext instead of catgets
*990101 {1.96} Bernd Eckenfels: fixed usage and FLAG_CACHE Output
* *
*/ */
#include <sys/types.h> #include <sys/types.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <net/if.h> #include <net/if.h>
#include <net/route.h> /* #include <net/route.h> realy broken */
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>
...@@ -64,7 +65,7 @@ ...@@ -64,7 +65,7 @@
#define FEATURE_ROUTE #define FEATURE_ROUTE
#include "lib/net-features.h" /* needs some of the system includes above! */ #include "lib/net-features.h" /* needs some of the system includes above! */
char *Release = RELEASE, *Version = "route 1.95 (1998-06-29)"; char *Release = RELEASE, *Version = "route 1.96 (1999-01-01-)";
int opt_n = 0; /* numerical output flag */ int opt_n = 0; /* numerical output flag */
int opt_v = 0; /* debugging output flag */ int opt_v = 0; /* debugging output flag */
...@@ -75,12 +76,22 @@ struct aftype *ap; /* current address family */ ...@@ -75,12 +76,22 @@ struct aftype *ap; /* current address family */
static void usage(void) static void usage(void)
{ {
fprintf(stderr, _("Usage: route [-nNvee] [-FC] [Address_families] List kernel routing tables\n")); fprintf(stderr, _("Usage: route [-nNvee] [-FC] [<AF>] List kernel routing tables\n"));
fprintf(stderr, _(" route {-V|--version} Display command version and exit.\n"));
fprintf(stderr, _(" route {-h|--help} [Address_family] Usage Syntax for specified AF.\n"));
fprintf(stderr, _(" route [-v] [-FC] {add|del|flush} ... Modify routing table for AF.\n\n")); fprintf(stderr, _(" route [-v] [-FC] {add|del|flush} ... Modify routing table for AF.\n\n"));
fprintf(stderr, _(" Address_families: inet,inet6,ddp,ipx,netrom,ax25\n"));
fprintf(stderr, _(" specify AF: -A af1,af2.. or --af1 --af2 or af_route\n")); fprintf(stderr, _(" route {-h|--help} [<AF>] Detailed usage syntax for specified AF.\n"));
fprintf(stderr, _(" route {-V|--version} Display version/author and exit.\n\n"));
fprintf(stderr, _(" -v, --verbose be verbose\n"));
fprintf(stderr, _(" -n, --numeric dont resolve names\n"));
fprintf(stderr, _(" -N, --symbolic resolve hardware names\n"));
fprintf(stderr, _(" -e, --extend display other/more informations\n"));
fprintf(stderr, _(" -F, --fib display Forwarding Infomation Base (default)\n"));
fprintf(stderr, _(" -C, --cache display routing cache instead of FIB\n\n"));
fprintf(stderr, _(" <AF>=Use '-A <af>' or '--<af>' Default: %s\n"), DFLT_AF);
fprintf(stderr, _(" List of possible address families (which support routing):\n"));
print_aflist(1); /* 1 = routeable */
exit(E_USAGE); exit(E_USAGE);
} }
......
/* Copyright '97 by Andi Kleen. Subject to the GPL. */ /* Copyright '97 by Andi Kleen. Subject to the GPL. */
/* $Id: statistics.c,v 1.9 1998/11/15 20:08:30 freitag Exp $ */ /* $Id: statistics.c,v 1.10 1999/01/05 20:53:05 philip Exp $ */
/* 19980630 - i18n - Arnaldo Carvalho de Melo <acme@conectiva.com.br> */ /* 19980630 - i18n - Arnaldo Carvalho de Melo <acme@conectiva.com.br> */
/* 19981113 - i18n fixes - Arnaldo Carvalho de Melo <acme@conectiva.com.br> */ /* 19981113 - i18n fixes - Arnaldo Carvalho de Melo <acme@conectiva.com.br> */
/* 19990101 - added net/netstat, -t, -u, -w supprt - Bernd Eckenfels */
/* /*
XXX: rewrite to 2 pass to support /proc/net/netstat too XXX: add some long-text to TcpExtt
support -t -u
*/ */
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
...@@ -22,7 +21,7 @@ ...@@ -22,7 +21,7 @@
#define UFWARN(x) #define UFWARN(x)
#endif #endif
int print_static; int print_static,f_raw,f_tcp,f_udp;
enum State { enum State {
number = 0, i_forward, i_inp_icmp, i_outp_icmp, i_rto_alg number = 0, i_forward, i_inp_icmp, i_outp_icmp, i_rto_alg
...@@ -105,9 +104,9 @@ struct entry Icmptab[] = ...@@ -105,9 +104,9 @@ struct entry Icmptab[] =
{"OutRedirects", N_("redirect: %d"), i_outp_icmp | I_TITLE}, {"OutRedirects", N_("redirect: %d"), i_outp_icmp | I_TITLE},
{"OutEchos", N_("echo request: %d"), i_outp_icmp | I_TITLE}, {"OutEchos", N_("echo request: %d"), i_outp_icmp | I_TITLE},
{"OutEchoReps", N_("echo replies: %d"), i_outp_icmp | I_TITLE}, {"OutEchoReps", N_("echo replies: %d"), i_outp_icmp | I_TITLE},
{"OutTimestamps", N_("timestamp requests: %d"), i_outp_icmp | I_TITLE}, {"OutTimestamps", N_("timestamp requests: %d"), i_outp_icmp | I_TITLE},
{"OutTimestampReps", N_("timestamp replies: %d"), i_outp_icmp | I_TITLE}, {"OutTimestampReps", N_("timestamp replies: %d"), i_outp_icmp | I_TITLE},
{"OutAddrMasks", N_("address mask requests: %d"), i_outp_icmp | I_TITLE}, {"OutAddrMasks", N_("address mask requests: %d"), i_outp_icmp | I_TITLE},
{"OutAddrMaskReps", N_("address mask replies: %d"), i_outp_icmp | I_TITLE}, {"OutAddrMaskReps", N_("address mask replies: %d"), i_outp_icmp | I_TITLE},
}; };
...@@ -137,6 +136,20 @@ struct entry Udptab[] = ...@@ -137,6 +136,20 @@ struct entry Udptab[] =
{"OutDatagrams", N_("%d packets send"), number}, {"OutDatagrams", N_("%d packets send"), number},
}; };
struct entry Tcpexttab[] =
{
{"SyncookiesSent", N_("%d SYN cookies sent"), number},
{"SyncookiesRecv", N_("%d SYN cookies received"), number},
{"SyncookiesFailed", N_("%d SYN cookies failed"), number},
/* XXX */
/* EmbryonicRsts
PruneCalled
RcvPruned
OfoPruned
OutOfWindowIcmps
LockDroppedIcmps */
};
struct tabtab { struct tabtab {
char *title; char *title;
struct entry *tab; struct entry *tab;
...@@ -149,6 +162,7 @@ struct tabtab snmptabs[] = ...@@ -149,6 +162,7 @@ struct tabtab snmptabs[] =
{"Icmp", Icmptab, sizeof(Icmptab)}, {"Icmp", Icmptab, sizeof(Icmptab)},
{"Tcp", Tcptab, sizeof(Tcptab)}, {"Tcp", Tcptab, sizeof(Tcptab)},
{"Udp", Udptab, sizeof(Udptab)}, {"Udp", Udptab, sizeof(Udptab)},
{"TcpExt", Tcpexttab, sizeof(Tcpexttab)},
{NULL} {NULL}
}; };
...@@ -173,6 +187,7 @@ void printval(struct tabtab *tab, char *title, int val) ...@@ -173,6 +187,7 @@ void printval(struct tabtab *tab, char *title, int val)
int type; int type;
char buf[512]; char buf[512];
/* printf("key: %s value: %d\n",title,val); */
key.title = title; key.title = title;
ent = bsearch(&key, tab->tab, tab->size / sizeof(struct entry), ent = bsearch(&key, tab->tab, tab->size / sizeof(struct entry),
sizeof(struct entry), cmpentries); sizeof(struct entry), cmpentries);
...@@ -225,6 +240,11 @@ struct tabtab *newtable(struct tabtab *tabs, char *title) ...@@ -225,6 +240,11 @@ struct tabtab *newtable(struct tabtab *tabs, char *title)
for (t = tabs; t->title; t++) for (t = tabs; t->title; t++)
if (!strcmp(title, t->title)) { if (!strcmp(title, t->title)) {
if (
(((t->tab==Iptab) ||(t->tab==Icmptab)) &&f_raw) ||
(((t->tab==Tcptab)||(t->tab==Tcpexttab))&&f_tcp) ||
( (t->tab==Udptab) &&f_udp)
)
printf("%s:\n", _(title)); printf("%s:\n", _(title));
state = normal; state = normal;
return t; return t;
...@@ -232,17 +252,11 @@ struct tabtab *newtable(struct tabtab *tabs, char *title) ...@@ -232,17 +252,11 @@ struct tabtab *newtable(struct tabtab *tabs, char *title)
return NULL; return NULL;
} }
void parsesnmp()
void process_fd(FILE *f)
{ {
FILE *f;
char buf1[512], buf2[512]; char buf1[512], buf2[512];
char *sp, *np, *p; char *sp, *np, *p;
f = fopen("/proc/net/snmp", "r");
if (!f) {
perror(_("cannot open /proc/net/snmp"));
return;
}
while (fgets(buf1, sizeof buf1, f)) { while (fgets(buf1, sizeof buf1, f)) {
int endflag; int endflag;
struct tabtab *tab; struct tabtab *tab;
...@@ -275,20 +289,58 @@ void parsesnmp() ...@@ -275,20 +289,58 @@ void parsesnmp()
endflag = 1; endflag = 1;
*p = '\0'; *p = '\0';
if (*sp != '\0') /* XXX */ /* printf("f: %d %d %d %p %p %p %p %p\n",f_raw, f_tcp, f_udp, Iptab, Icmptab, Tcptab, Tcpexttab, Udptab, tab); */
if (*sp != '\0') { /* XXX */
if (
(((tab->tab==Iptab) ||(tab->tab==Icmptab)) &&f_raw) ||
(((tab->tab==Tcptab)||(tab->tab==Tcpexttab))&&f_tcp) ||
( (tab->tab==Udptab) &&f_udp)
)
printval(tab, sp, strtoul(np, &np, 10)); printval(tab, sp, strtoul(np, &np, 10));
}
sp = p + 1; sp = p + 1;
} }
} }
return;
formaterr:
perror(_("error parsing /proc/net/snmp"));
return;
}
void parsesnmp(int flag_raw, int flag_tcp, int flag_udp)
{
FILE *f;
f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp;
f = fopen("/proc/net/snmp", "r");
if (!f) {
perror(_("cannot open /proc/net/snmp"));
return;
}
process_fd(f);
if (ferror(f)) if (ferror(f))
perror("/proc/net/snmp"); perror("/proc/net/snmp");
fclose(f); fclose(f);
return;
formaterr: f = fopen("/proc/net/netstat", "r");
perror(_("error parsing /proc/net/snmp"));
if (f) {
process_fd(f);
if (ferror(f))
perror("/proc/net/netstat");
fclose(f);
}
return; return;
} }
void inittab() void inittab()
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment