summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordenny <denny@openbsd.org>1997-07-23 04:38:32 +0000
committerdenny <denny@openbsd.org>1997-07-23 04:38:32 +0000
commita8e7354d23e155b893743b1db16d7133f41c178f (patch)
tree8e095a9516d8bd8981ca2b9a9bb22de4c0ceb87f
parentAdd netatalk files. (diff)
downloadwireguard-openbsd-a8e7354d23e155b893743b1db16d7133f41c178f.tar.xz
wireguard-openbsd-a8e7354d23e155b893743b1db16d7133f41c178f.zip
Add AppleTalk support. TODO: route.c does not handle netranges.
-rw-r--r--usr.bin/netstat/Makefile4
-rw-r--r--usr.bin/netstat/if.c8
-rw-r--r--usr.bin/netstat/main.c22
-rw-r--r--usr.bin/netstat/netstat.h8
-rw-r--r--usr.bin/netstat/route.c15
5 files changed, 47 insertions, 10 deletions
diff --git a/usr.bin/netstat/Makefile b/usr.bin/netstat/Makefile
index 7f04105b745..f165a4a5121 100644
--- a/usr.bin/netstat/Makefile
+++ b/usr.bin/netstat/Makefile
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile,v 1.3 1996/08/16 09:29:31 mickey Exp $
+# $OpenBSD: Makefile,v 1.4 1997/07/23 04:38:32 denny Exp $
# $NetBSD: Makefile,v 1.11 1995/10/03 21:42:34 thorpej Exp $
PROG= netstat
SRCS= if.c inet.c ipx.c iso.c main.c mbuf.c mroute.c ns.c route.c \
- tp_astring.c unix.c
+ tp_astring.c unix.c atalk.c
.PATH: ${.CURDIR}/../../sys/netiso
BINGRP= kmem
BINMODE=2555
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c
index 0dabb9608f0..72d81acee5e 100644
--- a/usr.bin/netstat/if.c
+++ b/usr.bin/netstat/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.14 1997/06/30 03:11:53 millert Exp $ */
+/* $OpenBSD: if.c,v 1.15 1997/07/23 04:38:33 denny Exp $ */
/* $NetBSD: if.c,v 1.16.4.2 1996/06/07 21:46:46 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
#else
-static char *rcsid = "$OpenBSD: if.c,v 1.14 1997/06/30 03:11:53 millert Exp $";
+static char *rcsid = "$OpenBSD: if.c,v 1.15 1997/07/23 04:38:33 denny Exp $";
#endif
#endif /* not lint */
@@ -208,6 +208,10 @@ intpr(interval, ifnetaddr)
ipx_phost((struct sockaddr *)sipx));
}
break;
+ case AF_APPLETALK:
+ printf("atlk:%-12s",atalk_print(sa,0x10) );
+ printf("%-12s ",atalk_print(sa,0x0b) );
+ break;
case AF_NS:
{
struct sockaddr_ns *sns =
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index bb87ed2d254..6ceb6764e2c 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.11 1997/06/29 20:18:01 millert Exp $ */
+/* $OpenBSD: main.c,v 1.12 1997/07/23 04:38:33 denny Exp $ */
/* $NetBSD: main.c,v 1.9 1996/05/07 02:55:02 thorpej Exp $ */
/*
@@ -44,7 +44,7 @@ char copyright[] =
#if 0
static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94";
#else
-static char *rcsid = "$OpenBSD: main.c,v 1.11 1997/06/29 20:18:01 millert Exp $";
+static char *rcsid = "$OpenBSD: main.c,v 1.12 1997/07/23 04:38:33 denny Exp $";
#endif
#endif /* not lint */
@@ -147,6 +147,10 @@ struct nlist nl[] = {
{ "_espstat"},
#define N_IP4STAT 38
{ "_ip4stat"},
+#define N_DDPSTAT 39
+ { "_ddpstat"},
+#define N_DDPCB 40
+ { "_ddpcb"},
{ ""},
};
@@ -213,7 +217,14 @@ struct protox isoprotox[] = {
0, 0 }
};
-struct protox *protoprotox[] = { protox, ipxprotox, nsprotox, isoprotox, NULL };
+struct protox atalkprotox[] = {
+ { N_DDPCB, N_DDPSTAT, 1, atalkprotopr,
+ ddp_stats, "ddp" },
+ { -1, -1, 0, 0,
+ 0, 0 }
+};
+
+struct protox *protoprotox[] = { protox, ipxprotox, nsprotox, isoprotox, atalkprotox, NULL };
static void printproto __P((struct protox *, char *));
static void usage __P((void));
@@ -263,6 +274,8 @@ main(argc, argv)
af = AF_ISO;
else if (strcmp(optarg, "encap") == 0)
af = AF_ENCAP;
+ else if (strcmp(optarg, "atalk") == 0)
+ af = AF_APPLETALK;
else {
(void)fprintf(stderr,
"%s: %s: unknown address family\n",
@@ -429,6 +442,9 @@ main(argc, argv)
printproto(tp, tp->pr_name);
if ((af == AF_UNIX || af == AF_UNSPEC) && !sflag)
unixpr(nl[N_UNIXSW].n_value);
+ if (af == AF_APPLETALK || af == AF_UNSPEC)
+ for (tp = atalkprotox; tp->pr_name; tp++)
+ printproto(tp, tp->pr_name);
exit(0);
}
diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h
index 83220dac7c2..68ac481a183 100644
--- a/usr.bin/netstat/netstat.h
+++ b/usr.bin/netstat/netstat.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: netstat.h,v 1.9 1997/07/04 04:31:32 millert Exp $ */
+/* $OpenBSD: netstat.h,v 1.10 1997/07/23 04:38:34 denny Exp $ */
/* $NetBSD: netstat.h,v 1.6 1996/05/07 02:55:05 thorpej Exp $ */
/*
@@ -123,3 +123,9 @@ void tp_stats __P((caddr_t, caddr_t));
void mroutepr __P((u_long, u_long, u_long, u_long));
void mrt_stats __P((u_long, u_long));
+
+void atalkprotopr __P((u_long, char *));
+void ddp_stats __P((u_long, char *));
+char *atalk_print __P((const struct sockaddr *, int));
+char *atalk_print2 __P((const struct sockaddr *,
+ const struct sockaddr *, int));
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index a33d9166f92..a646d35e29a 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.17 1997/07/14 00:34:27 angelos Exp $ */
+/* $OpenBSD: route.c,v 1.18 1997/07/23 04:38:34 denny Exp $ */
/* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
#else
-static char *rcsid = "$OpenBSD: route.c,v 1.17 1997/07/14 00:34:27 angelos Exp $";
+static char *rcsid = "$OpenBSD: route.c,v 1.18 1997/07/23 04:38:34 denny Exp $";
#endif
#endif /* not lint */
@@ -60,6 +60,8 @@ static char *rcsid = "$OpenBSD: route.c,v 1.17 1997/07/14 00:34:27 angelos Exp $
#include <netipx/ipx.h>
+#include <netatalk/at.h>
+
#include <sys/sysctl.h>
#include <limits.h>
@@ -195,6 +197,9 @@ pr_family(af)
case AF_ENCAP:
afname = "Encap";
break;
+ case AF_APPLETALK:
+ afname = "AppleTalk";
+ break;
default:
afname = NULL;
break;
@@ -451,6 +456,12 @@ p_sockaddr(sa, flags, width)
break;
}
+ case AF_APPLETALK:
+ {
+ /* XXX could do better */
+ cp = atalk_print(sa,11);
+ break;
+ }
default:
{
register u_char *s = (u_char *)sa->sa_data, *slim;