From:	CSBVAX::CSBVAX::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 24-MAR-1989 17:20
To:	MRGATE::"ARISIA::EVERHART"
Subj:	Ethernet address -> DECnet address


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Fri, 24 MAR 89 14:02:23 PDT
Received: from hqhsd.brooks.af.mil by KL.SRI.COM with TCP; Fri, 24 Mar 89 13:43:48 PST
Date: 24 Mar 89 15:31:00 CST
From: "Jonathan L Wilson" <wilsonjl@hqhsd.brooks.af.mil>
Subject: Ethernet address -> DECnet address
To: "info-vax" <info-vax@kl.sri.com>


Here's a DCL hack that I wrote yesterday after investigating a strange address
that showed up in LAN Traffic Monitor. Given the Ethernet address of a DECnet
system, it computes the DECnet address and SCSSYSTEMID of the system concerned. 
Note that this does not work with physical addresses - like those of terminal
servers, bridges, TCP/IP-only nodes, etc. 

Given the methodology here, it's simple to go the reverse route, DECnet address
to Ethernet address, should you ever need to.


Jonathan L Wilson 
TRW Defense Systems Group 
MILNET: WILSONJL@HQHSD.BROOKS.AF.MIL 
Phone:  (512) 536 2236   
Standard disclaimer applies.


$! ENET_DECNET.COM converts a DECnet node's Ethernet address to its
$! DECnet address. 
$!
$! Jonathan L Wilson/TRW 23-Mar-1989
$!
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$!
$GET_P1:
$	if (p1 .eqs. "") then inquire/nopunct p1 "Ethernet address: "
$	if (p1 .eqs. "") then goto GET_P1
$	p1 = f$edit(p1,"TRIM,UPCASE,COLLAPSE")
$!
$!Check address - std addresses begin with AA-00-04-00
$!
$	if (f$extract(0,12,p1) .nes. "AA-00-04-00-")
$	  then
$	    write sys$output "''p1' is not a standard DECnet Ethernet address"
$	    EXIT
$	endif
$!
$!Extract the last two bytes of address and swap them
$!
$	last2 = p1 - "AA-00-04-00-"
$	least = f$extract(0,2,last2)
$	most = f$extract(3,2,last2)
$!
$!Get SCSSYSTEMID value (last two bytes of address, swapped and converted to 
$!  decimal)
$!
$	scssystemid = %X'most''least'
$!
$!Get address 
$!
$	area = scssystemid / 1024
$	node = scssystemid - (1024 * area)
$!
$!Display results
$!
$	write sys$output ""
$	write sys$output "For Ethernet address ''p1':"
$	write sys$output "DECnet address = ''area'.''node'"
$	write sys$output "SCSSYSTEMID    = ",scssystemid
$	write sys$output ""
$!
$	EXIT


