diff options
author | Julian Elischer <julian@FreeBSD.org> | 1996-07-09 02:38:13 +0000 |
---|---|---|
committer | Julian Elischer <julian@FreeBSD.org> | 1996-07-09 02:38:13 +0000 |
commit | e05f2836d9a03725b1959472106f5998a95abb7e (patch) | |
tree | d2f5c210d1fab7e79214fdaec713d46617bd64d0 /sbin/ifconfig | |
parent | c9f36013e51f88b8471bac8606ee16a444e79b19 (diff) | |
download | src-e05f2836d9a03725b1959472106f5998a95abb7e.tar.gz src-e05f2836d9a03725b1959472106f5998a95abb7e.zip |
Submitted by: Archie@whistle.com
Obtained from: Whistle Communications
patches to allow ifconfig to work with appletalk addresses etc.
Notes
Notes:
svn path=/head/; revision=17022
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r-- | sbin/ifconfig/ifconfig.8 | 5 | ||||
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 57 |
2 files changed, 60 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index 2bdaa23a41fa..96fc6c4a9872 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 c578c6a683a9..0fdb9533c259 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[] = { |