Commit dbc1e63e authored by Phil Blundell's avatar Phil Blundell

Remove `sprint' member from struct hwtype. As far as I can see

it served no useful purpose.  Please check I didn't break your
favourite hardware type in the process.
Add derisory support for Ash protocols.
parent 0955945b
...@@ -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.13 1999/06/12 23:04:14 philip Exp $ * Version: $Id: arp.c,v 1.14 1999/09/27 11:00:42 philip Exp $
* *
* Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de> * Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de>
* *
...@@ -245,10 +245,10 @@ static int arp_getdevhw(char *ifname, struct sockaddr *sa, struct hwtype *hw) ...@@ -245,10 +245,10 @@ static int arp_getdevhw(char *ifname, struct sockaddr *sa, struct hwtype *hw)
memcpy((char *) sa, (char *) &(ifr.ifr_hwaddr), sizeof(struct sockaddr)); memcpy((char *) sa, (char *) &(ifr.ifr_hwaddr), sizeof(struct sockaddr));
if (opt_v) { if (opt_v) {
if (!(xhw = get_hwntype(ifr.ifr_hwaddr.sa_family)) || (xhw->sprint == 0)) { if (!(xhw = get_hwntype(ifr.ifr_hwaddr.sa_family)) || (xhw->print == 0)) {
xhw = get_hwntype(-1); xhw = get_hwntype(-1);
} }
fprintf(stderr, _("arp: device `%s' has HW address %s `%s'.\n"), ifname, xhw->name, xhw->sprint(&ifr.ifr_hwaddr)); fprintf(stderr, _("arp: device `%s' has HW address %s `%s'.\n"), ifname, xhw->name, xhw->print((char *)&ifr.ifr_hwaddr.sa_data));
} }
return (0); return (0);
} }
...@@ -615,6 +615,7 @@ static void usage(void) ...@@ -615,6 +615,7 @@ static void usage(void)
fprintf(stderr, _(" -n, --numeric dont resolve names\n")); fprintf(stderr, _(" -n, --numeric dont resolve names\n"));
fprintf(stderr, _(" -i, --device specify network interface (e.g. eth0)\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, _(" -D, --use-device read <hwaddr> from given device\n"));
fprintf(stderr, _(" -A, -p, --protocol specify protocol family\n"));
fprintf(stderr, _(" -f, --file read new entries from file\n\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, _(" <HW>=Use '-H <hw>' to specify hardware address type. Default: %s\n"), DFLT_HW);
......
...@@ -57,6 +57,7 @@ bool 'NET/ROM (packet radio) protocol family' HAVE_AFNETROM y ...@@ -57,6 +57,7 @@ bool 'NET/ROM (packet radio) protocol family' HAVE_AFNETROM y
bool 'Rose (packet radio) protocol family' HAVE_AFROSE n bool 'Rose (packet radio) protocol family' HAVE_AFROSE n
bool 'Econet protocol family' HAVE_AFECONET n bool 'Econet protocol family' HAVE_AFECONET n
bool 'DECnet protocol family' HAVE_AFDECnet n bool 'DECnet protocol family' HAVE_AFDECnet n
bool 'Ash protocol family' HAVE_AFASH n
* *
* *
* Device Hardware types. * Device Hardware types.
......
...@@ -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.11 1999/04/18 20:28:42 philip Exp $ * Version: $Id: af.c,v 1.12 1999/09/27 11:00:44 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
...@@ -27,14 +27,15 @@ ...@@ -27,14 +27,15 @@
#include "intl.h" #include "intl.h"
#include "util.h" #include "util.h"
int flag_unx = 0; int flag_unx;
int flag_ipx = 0; int flag_ipx;
int flag_ax25 = 0; int flag_ax25;
int flag_ddp = 0; int flag_ddp;
int flag_netrom = 0; int flag_netrom;
int flag_inet = 0; int flag_inet;
int flag_inet6 = 0; int flag_inet6;
int flag_econet = 0; int flag_econet;
int flag_ash;
struct aftrans_t { struct aftrans_t {
...@@ -79,6 +80,9 @@ struct aftrans_t { ...@@ -79,6 +80,9 @@ struct aftrans_t {
{ {
"econet", "ec", &flag_econet "econet", "ec", &flag_econet
}, },
{
"ash", "ash", &flag_ash
},
{ {
0, 0, 0 0, 0, 0
} }
...@@ -96,6 +100,7 @@ extern struct aftype ipx_aftype; ...@@ -96,6 +100,7 @@ extern struct aftype ipx_aftype;
extern struct aftype ddp_aftype; extern struct aftype ddp_aftype;
extern struct aftype ec_aftype; extern struct aftype ec_aftype;
extern struct aftype rose_aftype; extern struct aftype rose_aftype;
extern struct aftype ash_aftype;
static short sVafinit = 0; static short sVafinit = 0;
...@@ -127,6 +132,9 @@ struct aftype *aftypes[] = ...@@ -127,6 +132,9 @@ struct aftype *aftypes[] =
#endif #endif
#if HAVE_AFECONET #if HAVE_AFECONET
&ec_aftype, &ec_aftype,
#endif
#if HAVE_AFASH
&ash_aftype,
#endif #endif
&unspec_aftype, &unspec_aftype,
NULL NULL
...@@ -161,6 +169,9 @@ void afinit() ...@@ -161,6 +169,9 @@ void afinit()
#endif #endif
#if HAVE_AFROSE #if HAVE_AFROSE
rose_aftype.title = _("AMPR ROSE"); rose_aftype.title = _("AMPR ROSE");
#endif
#if HAVE_AFASH
ash_aftype.title = _("Ash");
#endif #endif
sVafinit = 1; sVafinit = 1;
} }
......
/* /*
* 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.10 1999/04/04 21:37:02 philip Exp $ * $Id: ash.c,v 1.11 1999/09/27 11:00:45 philip Exp $
*/ */
#include "config.h" #include "config.h"
#if HAVE_HWASH #if HAVE_HWASH || HAVE_AFASH
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
...@@ -22,17 +22,17 @@ ...@@ -22,17 +22,17 @@
#include "intl.h" #include "intl.h"
#include "util.h" #include "util.h"
#ifndef ARPHRD_ASH
#warning "No definition of ARPHRD_ASH in <net/if_arp.h>, using private value 517"
#define ARPHRD_ASH 517
#endif
#define ASH_ALEN 64 #define ASH_ALEN 64
extern struct hwtype ash_hwtype; static unsigned char hamming[16] =
{
0x15, 0x02, 0x49, 0x5e, 0x64, 0x73, 0x38, 0x2f,
0xd0, 0xc7, 0x8c, 0x9b, 0xa1, 0xb6, 0xfd, 0xea
};
/* Display an Ash address in readable format. */ /* Display an Ash address in readable format. */
static char *pr_ash(unsigned char *ptr) static char *
pr_ash(unsigned char *ptr)
{ {
static char buff[128]; static char buff[128];
char *p = buff; char *p = buff;
...@@ -48,24 +48,17 @@ static char *pr_ash(unsigned char *ptr) ...@@ -48,24 +48,17 @@ static char *pr_ash(unsigned char *ptr)
return buff; return buff;
} }
/* Display an Ash socket address. */ #if HAVE_HWASH
static char *pr_sash(struct sockaddr *sap)
{
static char buf[64];
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return safe_strncpy(buf, "[NONE SET]", 64);
return pr_ash(sap->sa_data);
}
static unsigned char hamming[16] = #ifndef ARPHRD_ASH
{ #warning "No definition of ARPHRD_ASH in <net/if_arp.h>, using private value 517"
0x15, 0x02, 0x49, 0x5e, 0x64, 0x73, 0x38, 0x2f, #define ARPHRD_ASH 517
0xd0, 0xc7, 0x8c, 0x9b, 0xa1, 0xb6, 0xfd, 0xea #endif
};
struct hwtype ash_hwtype;
static int in_ash(char *bufp, struct sockaddr *sap) static int
in_ash(char *bufp, struct sockaddr *sap)
{ {
unsigned char *ptr; unsigned char *ptr;
unsigned int i = 0; unsigned int i = 0;
...@@ -97,12 +90,37 @@ static int in_ash(char *bufp, struct sockaddr *sap) ...@@ -97,12 +90,37 @@ static int in_ash(char *bufp, struct sockaddr *sap)
return 0; return 0;
} }
struct hwtype ash_hwtype = struct hwtype ash_hwtype =
{ {
"ash", NULL, ARPHRD_ASH, ASH_ALEN, "ash", NULL, ARPHRD_ASH, ASH_ALEN,
pr_ash, pr_sash, in_ash, NULL, pr_ash, in_ash, NULL,
1 1
}; };
#endif #endif /* HAVE_HWASH */
#if HAVE_AFASH
/* Display an Ash socket address. */
static char *
pr_sash(struct sockaddr *sap, int numeric)
{
static char buf[64];
if (sap->sa_family != AF_ASH)
return safe_strncpy(buf, "[NONE SET]", 64);
return pr_ash(sap->sa_data);
}
struct aftype ash_aftype =
{
"ash", NULL, AF_ASH, 0,
pr_ash, pr_sash, NULL, NULL,
NULL, NULL, NULL,
-1,
"/proc/sys/net/ash"
};
#endif /* HAVE_AFASH */
#endif /* HAVE_AFASH || HAVE_HWASH */
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* lib/ax25.c This file contains an implementation of the "AX.25" * lib/ax25.c This file contains an implementation of the "AX.25"
* support functions. * support functions.
* *
* Version: $Id: ax25.c,v 1.8 1998/11/19 13:01:54 philip Exp $ * Version: $Id: ax25.c,v 1.9 1999/09/27 11:00:45 philip Exp $
* *
* NOTE: I will redo this module as soon as I got the libax25.a * NOTE: I will redo this module as soon as I got the libax25.a
* library sorted out. This library contains some useful * library sorted out. This library contains some useful
...@@ -149,16 +149,6 @@ static void AX25_herror(char *text) ...@@ -149,16 +149,6 @@ static void AX25_herror(char *text)
} }
static char *AX25_hprint(struct sockaddr *sap)
{
static char buf[64];
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return safe_strncpy(buf, _("[NONE SET]"), sizeof(buf));
return (AX25_print(((struct sockaddr_ax25 *) sap)->sax25_call.ax25_call));
}
static int AX25_hinput(char *bufp, struct sockaddr *sap) static int AX25_hinput(char *bufp, struct sockaddr *sap)
{ {
if (AX25_input(0, bufp, sap) < 0) if (AX25_input(0, bufp, sap) < 0)
...@@ -193,7 +183,7 @@ static int KISS_init(int fd) ...@@ -193,7 +183,7 @@ static int KISS_init(int fd)
struct hwtype ax25_hwtype = struct hwtype ax25_hwtype =
{ {
"ax25", NULL, /*"AMPR AX.25", */ ARPHRD_AX25, 7, "ax25", NULL, /*"AMPR AX.25", */ ARPHRD_AX25, 7,
AX25_print, AX25_hprint, AX25_hinput, NULL AX25_print, AX25_hinput, NULL
}; };
struct aftype ax25_aftype = struct aftype ax25_aftype =
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* lib/ec_hw.c This file contains an implementation of the Econet * lib/ec_hw.c This file contains an implementation of the Econet
* hardware support functions. * hardware support functions.
* *
* Version: $Id: ec_hw.c,v 1.1 1999/05/16 16:41:11 philip Exp $ * Version: $Id: ec_hw.c,v 1.2 1999/09/27 11:00:46 philip Exp $
* *
* Author: Philip Blundell <philb@gnu.org> * Author: Philip Blundell <philb@gnu.org>
* *
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
struct hwtype ec_hwtype = struct hwtype ec_hwtype =
{ {
"ec", NULL /* "Econet" */, ARPHRD_ECONET, 0, "ec", NULL /* "Econet" */, ARPHRD_ECONET, 0,
NULL, NULL, NULL, NULL NULL, NULL, NULL
}; };
#endif #endif
/* /*
* lib/econet.c This file contains an implementation of the Econet * lib/econet.c This file contains an implementation of the Econet
* 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.8 1999/04/20 13:31:50 philip Exp $ * Version: $Id: econet.c,v 1.9 1999/09/27 11:00:47 philip Exp $
* *
* Author: Philip Blundell <philb@gnu.org> * Author: Philip Blundell <philb@gnu.org>
* *
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
/* Display an Econet address */ /* Display an Econet address */
static char * static char *
ec_print(unsigned char *ptr) ec_print(unsigned char *ptr)
{ {
static char buff[64]; static char buff[64];
struct ec_addr *ec = (struct ec_addr *) ptr; struct ec_addr *ec = (struct ec_addr *) ptr;
...@@ -44,7 +44,7 @@ static char * ...@@ -44,7 +44,7 @@ static char *
/* Display an Econet socket address */ /* Display an Econet socket address */
static char * static char *
ec_sprint(struct sockaddr *sap, int numeric) ec_sprint(struct sockaddr *sap, int numeric)
{ {
struct sockaddr_ec *sec = (struct sockaddr_ec *) sap; struct sockaddr_ec *sec = (struct sockaddr_ec *) sap;
...@@ -54,7 +54,8 @@ static char * ...@@ -54,7 +54,8 @@ static char *
return ec_print((unsigned char *) &sec->addr); return ec_print((unsigned char *) &sec->addr);
} }
static int ec_input(int type, char *bufp, struct sockaddr *sap) static int
ec_input(int type, char *bufp, struct sockaddr *sap)
{ {
struct sockaddr_ec *sec = (struct sockaddr_ec *) sap; struct sockaddr_ec *sec = (struct sockaddr_ec *) sap;
int net, stn; int net, stn;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* lib/ether.c This file contains an implementation of the "Ethernet" * lib/ether.c This file contains an implementation of the "Ethernet"
* support functions. * support functions.
* *
* Version: $Id: ether.c,v 1.6 1998/11/19 13:01:56 philip Exp $ * Version: $Id: ether.c,v 1.7 1999/09/27 11:00:47 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
...@@ -47,17 +47,6 @@ static char *pr_ether(unsigned char *ptr) ...@@ -47,17 +47,6 @@ static char *pr_ether(unsigned char *ptr)
} }
/* Display an Ethernet socket address. */
static char *pr_sether(struct sockaddr *sap)
{
static char buf[64];
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return safe_strncpy(buf, _("[NONE SET]"), sizeof(buf));
return (pr_ether(sap->sa_data));
}
/* Input an Ethernet address and convert to binary. */ /* Input an Ethernet address and convert to binary. */
static int in_ether(char *bufp, struct sockaddr *sap) static int in_ether(char *bufp, struct sockaddr *sap)
{ {
...@@ -141,7 +130,7 @@ static int in_ether(char *bufp, struct sockaddr *sap) ...@@ -141,7 +130,7 @@ static int in_ether(char *bufp, struct sockaddr *sap)
struct hwtype ether_hwtype = struct hwtype ether_hwtype =
{ {
"ether", NULL, /*"10Mbps Ethernet", */ ARPHRD_ETHER, ETH_ALEN, "ether", NULL, /*"10Mbps Ethernet", */ ARPHRD_ETHER, ETH_ALEN,
pr_ether, pr_sether, in_ether, NULL pr_ether, in_ether, NULL
}; };
......
/* /*
* lib/loopback.c This file contains the general hardware types. * lib/loopback.c This file contains the general hardware types.
* *
* Version: $Id: loopback.c,v 1.6 1999/04/04 21:37:04 philip Exp $ * Version: $Id: loopback.c,v 1.7 1999/09/27 11:00:48 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
...@@ -46,26 +46,14 @@ static char *pr_unspec(unsigned char *ptr) ...@@ -46,26 +46,14 @@ static char *pr_unspec(unsigned char *ptr)
return (buff); return (buff);
} }
/* Display an UNSPEC socket address. */
static char *pr_sunspec(struct sockaddr *sap)
{
static char buf[64];
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return safe_strncpy(buf, _("[NONE SET]"), sizeof(buf));
return (pr_unspec(sap->sa_data));
}
struct hwtype unspec_hwtype = struct hwtype unspec_hwtype =
{ {
"unspec", NULL, /*"UNSPEC", */ -1, 0, "unspec", NULL, /*"UNSPEC", */ -1, 0,
pr_unspec, pr_sunspec, NULL, NULL pr_unspec, NULL, NULL
}; };
struct hwtype loop_hwtype = struct hwtype loop_hwtype =
{ {
"loop", NULL, /*"Local Loopback", */ ARPHRD_LOOPBACK, 0, "loop", NULL, /*"Local Loopback", */ ARPHRD_LOOPBACK, 0,
NULL, NULL, NULL, NULL NULL, NULL, NULL
}; };
...@@ -61,7 +61,6 @@ struct hwtype { ...@@ -61,7 +61,6 @@ struct hwtype {
int type; int type;
int alen; int alen;
char *(*print) (unsigned char *); char *(*print) (unsigned char *);
char *(*sprint) (struct sockaddr *);
int (*input) (char *, struct sockaddr *); int (*input) (char *, struct sockaddr *);
int (*activate) (int fd); int (*activate) (int fd);
int suppress_null_addr; int suppress_null_addr;
......
/* /*
* lib/slip.c This file contains the SLIP HW-type support. * lib/slip.c This file contains the SLIP HW-type support.
* *
* Version: $Id: slip.c,v 1.3 1998/11/15 20:12:16 freitag Exp $ * Version: $Id: slip.c,v 1.4 1999/09/27 11:00:49 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
...@@ -37,26 +37,26 @@ ...@@ -37,26 +37,26 @@
struct hwtype slip_hwtype = struct hwtype slip_hwtype =
{ {
"slip", NULL, /*"Serial Line IP", */ ARPHRD_SLIP, 0, "slip", NULL, /*"Serial Line IP", */ ARPHRD_SLIP, 0,
NULL, NULL, NULL, NULL NULL, NULL, NULL
}; };
struct hwtype cslip_hwtype = struct hwtype cslip_hwtype =
{ {
"cslip", NULL, /*"VJ Serial Line IP", */ ARPHRD_CSLIP, 0, "cslip", NULL, /*"VJ Serial Line IP", */ ARPHRD_CSLIP, 0,
NULL, NULL, NULL, NULL NULL, NULL, NULL
}; };
struct hwtype slip6_hwtype = struct hwtype slip6_hwtype =
{ {
"slip6", NULL, /*"6-bit Serial Line IP", */ ARPHRD_SLIP6, 0, "slip6", NULL, /*"6-bit Serial Line IP", */ ARPHRD_SLIP6, 0,
NULL, NULL, NULL, NULL NULL, NULL, NULL
}; };
struct hwtype cslip6_hwtype = struct hwtype cslip6_hwtype =
{ {
"cslip6", NULL, /*"VJ 6-bit Serial Line IP", */ ARPHRD_CSLIP6, 0, "cslip6", NULL, /*"VJ 6-bit Serial Line IP", */ ARPHRD_CSLIP6, 0,
NULL, NULL, NULL, NULL NULL, NULL, NULL
}; };
struct hwtype adaptive_hwtype = struct hwtype adaptive_hwtype =
{ {
"adaptive", NULL, /*"Adaptive Serial Line IP", */ ARPHRD_ADAPT, 0, "adaptive", NULL, /*"Adaptive Serial Line IP", */ ARPHRD_ADAPT, 0,
NULL, NULL, NULL, NULL NULL, NULL, NULL
}; };
#endif /* HAVE_HWSLIP */ #endif /* HAVE_HWSLIP */
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* lib/tr.c This file contains an implementation of the "Tokenring" * lib/tr.c This file contains an implementation of the "Tokenring"
* support functions. * support functions.
* *
* Version: $Id: tr.c,v 1.5 1999/05/16 16:41:14 philip Exp $ * Version: $Id: tr.c,v 1.6 1999/09/27 11:00:49 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
...@@ -45,14 +45,6 @@ static char *pr_tr(unsigned char *ptr) ...@@ -45,14 +45,6 @@ static char *pr_tr(unsigned char *ptr)
} }
static char *pr_str(struct sockaddr *sap)
{
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return ("[NONE SET]");
return (pr_tr(sap->sa_data));
}
static int in_tr(char *bufp, struct sockaddr *sap) static int in_tr(char *bufp, struct sockaddr *sap)
{ {
unsigned char *ptr; unsigned char *ptr;
...@@ -130,7 +122,7 @@ static int in_tr(char *bufp, struct sockaddr *sap) ...@@ -130,7 +122,7 @@ static int in_tr(char *bufp, struct sockaddr *sap)
struct hwtype tr_hwtype = struct hwtype tr_hwtype =
{ {
"tr", NULL /* "16/4 Mbps Token Ring" */, ARPHRD_IEEE802, TR_ALEN, "tr", NULL /* "16/4 Mbps Token Ring" */, ARPHRD_IEEE802, TR_ALEN,
pr_tr, pr_str, in_tr, NULL pr_tr, in_tr, NULL
}; };
......
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