aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPhil Blundell <philb@gnu.org>1999-09-27 11:00:42 +0000
committerPhil Blundell <philb@gnu.org>1999-09-27 11:00:42 +0000
commitdbc1e63ecc0376fd50c0aaee41b2c7cc1e5b4cfb (patch)
tree030a325ed189895e5745de8c6d356629355cb4d5 /lib
parentMake it compile without HAVE_HWSLIP. (diff)
downloadnet-tools-dbc1e63ecc0376fd50c0aaee41b2c7cc1e5b4cfb.tar.gz
net-tools-dbc1e63ecc0376fd50c0aaee41b2c7cc1e5b4cfb.tar.bz2
net-tools-dbc1e63ecc0376fd50c0aaee41b2c7cc1e5b4cfb.zip
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/af.c29
-rw-r--r--lib/ash.c72
-rw-r--r--lib/ax25.c14
-rw-r--r--lib/ec_hw.c4
-rw-r--r--lib/econet.c11
-rw-r--r--lib/ether.c15
-rw-r--r--lib/loopback.c18
-rw-r--r--lib/net-support.h1
-rw-r--r--lib/slip.c12
-rw-r--r--lib/tr.c12
10 files changed, 88 insertions, 100 deletions
diff --git a/lib/af.c b/lib/af.c
index 0a23605..5a16db2 100644
--- a/lib/af.c
+++ b/lib/af.c
@@ -2,7 +2,7 @@
* lib/af.c This file contains the top-level part of the protocol
* 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>
* Copyright 1993 MicroWalt Corporation
@@ -27,14 +27,15 @@
#include "intl.h"
#include "util.h"
-int flag_unx = 0;
-int flag_ipx = 0;
-int flag_ax25 = 0;
-int flag_ddp = 0;
-int flag_netrom = 0;
-int flag_inet = 0;
-int flag_inet6 = 0;
-int flag_econet = 0;
+int flag_unx;
+int flag_ipx;
+int flag_ax25;
+int flag_ddp;
+int flag_netrom;
+int flag_inet;
+int flag_inet6;
+int flag_econet;
+int flag_ash;
struct aftrans_t {
@@ -80,6 +81,9 @@ struct aftrans_t {
"econet", "ec", &flag_econet
},
{
+ "ash", "ash", &flag_ash
+ },
+ {
0, 0, 0
}
};
@@ -96,6 +100,7 @@ extern struct aftype ipx_aftype;
extern struct aftype ddp_aftype;
extern struct aftype ec_aftype;
extern struct aftype rose_aftype;
+extern struct aftype ash_aftype;
static short sVafinit = 0;
@@ -128,6 +133,9 @@ struct aftype *aftypes[] =
#if HAVE_AFECONET
&ec_aftype,
#endif
+#if HAVE_AFASH
+ &ash_aftype,
+#endif
&unspec_aftype,
NULL
};
@@ -162,6 +170,9 @@ void afinit()
#if HAVE_AFROSE
rose_aftype.title = _("AMPR ROSE");
#endif
+#if HAVE_AFASH
+ ash_aftype.title = _("Ash");
+#endif
sVafinit = 1;
}
diff --git a/lib/ash.c b/lib/ash.c
index 8f0a798..c64667c 100644
--- a/lib/ash.c
+++ b/lib/ash.c
@@ -1,12 +1,12 @@
/*
* lib/ash.c This file contains an implementation of the Ash
* 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"
-#if HAVE_HWASH
+#if HAVE_HWASH || HAVE_AFASH
#include <sys/types.h>
#include <sys/socket.h>
@@ -22,17 +22,17 @@
#include "intl.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
-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. */
-static char *pr_ash(unsigned char *ptr)
+static char *
+pr_ash(unsigned char *ptr)
{
static char buff[128];
char *p = buff;
@@ -48,24 +48,17 @@ static char *pr_ash(unsigned char *ptr)
return buff;
}
-/* Display an Ash socket address. */
-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);
-}
+#if HAVE_HWASH
-static unsigned char hamming[16] =
-{
- 0x15, 0x02, 0x49, 0x5e, 0x64, 0x73, 0x38, 0x2f,
- 0xd0, 0xc7, 0x8c, 0x9b, 0xa1, 0xb6, 0xfd, 0xea
-};
+#ifndef ARPHRD_ASH
+#warning "No definition of ARPHRD_ASH in <net/if_arp.h>, using private value 517"
+#define ARPHRD_ASH 517
+#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 int i = 0;
@@ -97,12 +90,37 @@ static int in_ash(char *bufp, struct sockaddr *sap)
return 0;
}
-
struct hwtype ash_hwtype =
{
"ash", NULL, ARPHRD_ASH, ASH_ALEN,
- pr_ash, pr_sash, in_ash, NULL,
+ pr_ash, in_ash, NULL,
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 */
diff --git a/lib/ax25.c b/lib/ax25.c
index ba0f928..11521d2 100644
--- a/lib/ax25.c
+++ b/lib/ax25.c
@@ -2,7 +2,7 @@
* lib/ax25.c This file contains an implementation of the "AX.25"
* 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
* library sorted out. This library contains some useful
@@ -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)
{
if (AX25_input(0, bufp, sap) < 0)
@@ -193,7 +183,7 @@ static int KISS_init(int fd)
struct hwtype ax25_hwtype =
{
"ax25", NULL, /*"AMPR AX.25", */ ARPHRD_AX25, 7,
- AX25_print, AX25_hprint, AX25_hinput, NULL
+ AX25_print, AX25_hinput, NULL
};
struct aftype ax25_aftype =
diff --git a/lib/ec_hw.c b/lib/ec_hw.c
index f143186..825e501 100644
--- a/lib/ec_hw.c
+++ b/lib/ec_hw.c
@@ -2,7 +2,7 @@
* lib/ec_hw.c This file contains an implementation of the Econet
* 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>
*
@@ -22,7 +22,7 @@
struct hwtype ec_hwtype =
{
"ec", NULL /* "Econet" */, ARPHRD_ECONET, 0,
- NULL, NULL, NULL, NULL
+ NULL, NULL, NULL
};
#endif
diff --git a/lib/econet.c b/lib/econet.c
index 11d074b..3fcb176 100644
--- a/lib/econet.c
+++ b/lib/econet.c
@@ -1,9 +1,9 @@
/*
- * 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.
* (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>
*
@@ -33,7 +33,7 @@
/* Display an Econet address */
static char *
- ec_print(unsigned char *ptr)
+ec_print(unsigned char *ptr)
{
static char buff[64];
struct ec_addr *ec = (struct ec_addr *) ptr;
@@ -44,7 +44,7 @@ static char *
/* Display an Econet socket address */
static char *
- ec_sprint(struct sockaddr *sap, int numeric)
+ec_sprint(struct sockaddr *sap, int numeric)
{
struct sockaddr_ec *sec = (struct sockaddr_ec *) sap;
@@ -54,7 +54,8 @@ static char *
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;
int net, stn;
diff --git a/lib/ether.c b/lib/ether.c
index 997aef2..a71aed7 100644
--- a/lib/ether.c
+++ b/lib/ether.c
@@ -2,7 +2,7 @@
* lib/ether.c This file contains an implementation of the "Ethernet"
* 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>
* Copyright 1993 MicroWalt Corporation
@@ -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. */
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 =
{
"ether", NULL, /*"10Mbps Ethernet", */ ARPHRD_ETHER, ETH_ALEN,
- pr_ether, pr_sether, in_ether, NULL
+ pr_ether, in_ether, NULL
};
diff --git a/lib/loopback.c b/lib/loopback.c
index fc39e00..0f08ac2 100644
--- a/lib/loopback.c
+++ b/lib/loopback.c
@@ -1,7 +1,7 @@
/*
* 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>
* Copyright 1993 MicroWalt Corporation
@@ -46,26 +46,14 @@ static char *pr_unspec(unsigned char *ptr)
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 =
{
"unspec", NULL, /*"UNSPEC", */ -1, 0,
- pr_unspec, pr_sunspec, NULL, NULL
+ pr_unspec, NULL, NULL
};
struct hwtype loop_hwtype =
{
"loop", NULL, /*"Local Loopback", */ ARPHRD_LOOPBACK, 0,
- NULL, NULL, NULL, NULL
+ NULL, NULL, NULL
};
diff --git a/lib/net-support.h b/lib/net-support.h
index 50ab96e..23b5f98 100644
--- a/lib/net-support.h
+++ b/lib/net-support.h
@@ -61,7 +61,6 @@ struct hwtype {
int type;
int alen;
char *(*print) (unsigned char *);
- char *(*sprint) (struct sockaddr *);
int (*input) (char *, struct sockaddr *);
int (*activate) (int fd);
int suppress_null_addr;
diff --git a/lib/slip.c b/lib/slip.c
index a37ae84..3f9d0d0 100644
--- a/lib/slip.c
+++ b/lib/slip.c
@@ -1,7 +1,7 @@
/*
* 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>
* Copyright 1993 MicroWalt Corporation
@@ -37,26 +37,26 @@
struct hwtype slip_hwtype =
{
"slip", NULL, /*"Serial Line IP", */ ARPHRD_SLIP, 0,
- NULL, NULL, NULL, NULL
+ NULL, NULL, NULL
};
struct hwtype cslip_hwtype =
{
"cslip", NULL, /*"VJ Serial Line IP", */ ARPHRD_CSLIP, 0,
- NULL, NULL, NULL, NULL
+ NULL, NULL, NULL
};
struct hwtype slip6_hwtype =
{
"slip6", NULL, /*"6-bit Serial Line IP", */ ARPHRD_SLIP6, 0,
- NULL, NULL, NULL, NULL
+ NULL, NULL, NULL
};
struct hwtype cslip6_hwtype =
{
"cslip6", NULL, /*"VJ 6-bit Serial Line IP", */ ARPHRD_CSLIP6, 0,
- NULL, NULL, NULL, NULL
+ NULL, NULL, NULL
};
struct hwtype adaptive_hwtype =
{
"adaptive", NULL, /*"Adaptive Serial Line IP", */ ARPHRD_ADAPT, 0,
- NULL, NULL, NULL, NULL
+ NULL, NULL, NULL
};
#endif /* HAVE_HWSLIP */
diff --git a/lib/tr.c b/lib/tr.c
index 700a7d7..be253e7 100644
--- a/lib/tr.c
+++ b/lib/tr.c
@@ -2,7 +2,7 @@
* lib/tr.c This file contains an implementation of the "Tokenring"
* 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>
* Copyright 1993 MicroWalt Corporation
@@ -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)
{
unsigned char *ptr;
@@ -130,7 +122,7 @@ static int in_tr(char *bufp, struct sockaddr *sap)
struct hwtype tr_hwtype =
{
"tr", NULL /* "16/4 Mbps Token Ring" */, ARPHRD_IEEE802, TR_ALEN,
- pr_tr, pr_str, in_tr, NULL
+ pr_tr, in_tr, NULL
};