summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1996-07-09 02:38:13 +0000
committerjulian <julian@FreeBSD.org>1996-07-09 02:38:13 +0000
commit37f1fda73bb57146d5448c106944e20efc42c06e (patch)
treed2f5c210d1fab7e79214fdaec713d46617bd64d0 /sbin
parent1fe8db25ff0115367f48d7f665feda412b9f2f4b (diff)
downloadFreeBSD-src-37f1fda73bb57146d5448c106944e20efc42c06e.zip
FreeBSD-src-37f1fda73bb57146d5448c106944e20efc42c06e.tar.gz
Submitted by: Archie@whistle.com
Obtained from: Whistle Communications patches to allow ifconfig to work with appletalk addresses etc.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ifconfig/ifconfig.85
-rw-r--r--sbin/ifconfig/ifconfig.c57
2 files changed, 60 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 2bdaa23..96fc6c4 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
-.\" $Id: ifconfig.8,v 1.6 1996/02/06 20:35:51 wollman Exp $
+.\" $Id: ifconfig.8,v 1.7 1996/02/13 17:30:26 wollman Exp $
.\"
.Dd February 13, 1996
.Dt IFCONFIG 8
@@ -108,7 +108,8 @@ Since an interface can receive transmissions in differing protocols
with different naming schemes, specifying the address family is recommended.
The address or protocol families currently
supported are
-.Dq inet
+.Dq inet ,
+.Dq atalk ,
.\" .Dq iso ,
and
.Dq ipx .
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index c578c6a..0fdb953 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -68,6 +68,8 @@ static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
+#include <netatalk/at.h>
+
#ifdef NS
#define NSIP
#include <netns/ns.h>
@@ -175,6 +177,7 @@ struct cmd {
*/
int in_status(), in_getaddr();
int ipx_status(), ipx_getaddr();
+int at_status(), at_getaddr();
#ifdef NS
int xns_status(), xns_getaddr();
#endif
@@ -199,6 +202,8 @@ struct afswtch {
SIOCDIFADDR, SIOCAIFADDR, C(ridreq), C(addreq) },
{ "ipx", AF_IPX, ipx_status, ipx_getaddr,
SIOCDIFADDR, SIOCAIFADDR, C(ridreq), C(addreq) },
+ { "atalk", AF_APPLETALK, at_status, at_getaddr,
+ SIOCDIFADDR, SIOCAIFADDR, C(ridreq), C(addreq) },
#ifdef NS
{ "ns", AF_NS, xns_status, xns_getaddr,
SIOCDIFADDR, SIOCAIFADDR, C(ridreq), C(addreq) },
@@ -758,6 +763,35 @@ ipx_status(force)
}
+at_status(force)
+ int force;
+{
+ struct sockaddr_at *sat, null_sat;
+
+ memset(&null_sat, 0, sizeof(null_sat));
+
+ sat = (struct sockaddr_at *)info.rti_info[RTAX_IFA];
+ if (!sat || sat->sat_family != AF_APPLETALK) {
+ if (!force)
+ return;
+ /* warnx("%s has no AF_APPLETALK IFA address!", name); */
+ sat = &null_sat;
+ }
+ printf("\tatalk %d.%d ",
+ ntohs(sat->sat_addr.s_net), sat->sat_addr.s_node);
+
+ if (flags & IFF_POINTOPOINT) {
+ /* note RTAX_BRD overlap with IFF_BROADCAST */
+ sat = (struct sockaddr_at *)info.rti_info[RTAX_BRD];
+ if (!sat)
+ sat = &null_sat;
+ printf("--> %d.%d ",
+ ntohs(sat->sat_addr.s_net), sat->sat_addr.s_node);
+ }
+
+ putchar('\n');
+}
+
#ifdef NS
xns_status(force)
int force;
@@ -953,6 +987,29 @@ char *addr;
printf("Attempt to set IPX netmask will be ineffectual\n");
}
+#define SATALK(x) ((struct sockaddr_at *) &(x))
+struct sockaddr_at *atalktab[] = {
+SATALK(ridreq.ifr_addr), SATALK(addreq.ifra_addr),
+SATALK(addreq.ifra_mask), SATALK(addreq.ifra_broadaddr)};
+
+at_getaddr(addr, which)
+char *addr;
+{
+ struct sockaddr_at *sat = atalktab[which];
+ u_int net, node;
+
+ sat->sat_family = AF_IPX;
+ sat->sat_len = sizeof(*sat);
+ if (sscanf(addr, "%u.%u", &net, &node) != 2
+ /* || net == 0 || net > 0xffff || node == 0 || node > 0xfe */ )
+ errx(1, "%s: bad value", addr);
+ sat->sat_addr.s_net = htons(net);
+ sat->sat_addr.s_node = node;
+ if (which == MASK)
+ printf("Attempt to set AppleTalk netmask"
+ " will be ineffectual\n");
+}
+
#ifdef NS
#define SNS(x) ((struct sockaddr_ns *) &(x))
struct sockaddr_ns *snstab[] = {
OpenPOWER on IntegriCloud