From:	CSBVAX::MRGATE!info-vax-RELAY@KL.SRI.COM@SMTP 15-JUN-1988 20:52
To:	ARISIA::EVERHART
Subj:	Monitor Ethernet patch revisited


Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Sat, 11 Jun 88 14:12:34 PDT
Received: by ucbvax.Berkeley.EDU (5.59/1.28)
	id AA18378; Sat, 11 Jun 88 13:08:57 PDT
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 10 Jun 88 01:05:27 GMT
From: munnari!otc!metro!basser!natmlab!dmsadel!augean!sirius!simon@uunet.uu.net  (Simon Hackett)
Organization: University Computing Services, University of Adelaide
Subject: Monitor Ethernet patch revisited
Message-Id: <82@sirius.ua.oz>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com


Here is some documentation about the "Monitor Ethernet" patch I posted
a little while ago, for those interested in a little about how it works.
If you're not, you can skip this message...

---------------------------------------------------------------------------
VAX/VMS Monitor Utility patches for monitor classes not normally available:
---------------------------------------------------------------------------
                      Simon Hackett, March-1988

There exists a patch to modify MONITOR.EXE to allow the usage of some
un-documented monitoring classes:

VMS1 (display labels this "VMS DEVELOPMENT 1")
JOURNALING
JDEVICE
ETHERNET (requires the privilege PHY_IO to place the ethernet interface into
          "promiscuous" mode)

Unfortunately, I have no idea where this patch originated. But putting it
together with some judicious disassembly of code (and later, with the fische),
led to some enlightenment...

The patch modified longwords, but contained no explanation of what it was
doing.

At the change from VMS V4.5 to V4.6, this patch no longer worked for the
ETHERNET class.

The patch acompanying this document restores the ETHERNET class to
operation.(The old patch exited with a "bad parameter value" status during
class initialization.)

The old patch simply turned off the "disable" bit in a table of information
which exists in monitor for each of the classes of monitoring it supports.
The patch locations have remained stable between V4.5 and V4.6. Indeed the
code doesn't appear to have significantly changed. VMS's $QIOW support for
ethernet interfaces has, though.

It turns out that the change needed is to specify valid protocol value
on the $QIOW call (see the V4.6 release notes, page 2-22)

Here is the relevant part of the monitor image. It is the item list
fed to the $QIOW call which turns on naughty-naughty mode...

170E8:          .WORD   ^X18            ; list length
                .ADDRESS ^X017104       ; list address

17104:          .WORD NMA$C_PCLI_BUS    ; Buffer size
                .LONG MAX_UNABUF_SIZE (=^X05DC)
                .WORD NMA$C_PCLI_BFN    ; receive of buffers to reserve
                .LONG 0                 ; zero buffers
                .WORD NMA$C_PCLI_PRM    ; Promiscuous mode flag
                .LONG NMA$C_STATE_ON    ; On
                .WORD NMA$C_PCLI_PTY    ; protocol type
                .LONG ^X00000660        ;(This needed changing from zero)


So the additional patch (changing the 0L to %X660) restores MONITOR ETHERNET to
operational status.

To use this patch, apply it to a copy of MONITOR.EXE, define the logical
name MONITOR to point to your patched image, make sure you have PHY_IO
turned on, and that you have a healthy byte limit quota authorized for your
process, and type MONITOR ETHERNET.

The ethernet interface will only handle at most one unit operating it in
promiscuous mode. Therefore, a maximum of one user may execute MONITOR ETHERNET
at any time - multiple subsequent attempts will be rejected with a "Bad
Parameter Value" response from the $QIOW call.

notes:  I) To connect to the ethernet device, the code uses the first
successful channel it gets from the following :

           1) whatever NI$DEVICE translates to (if anything)
           2) XEA0:
           3) XQA0:

        Therefore, on a machine with a different interface device, simply
assign the logical name NI$DEVICE as that device name before doing the
MONITOR.

      II) Further information about the $QIOW ethernet interface is
contained in chapter 6 of the I/O user's guide Part II.

--------------------------------------------------------------------------------
Here's the patch, in case you missed it. For version of VMS before 4.6, simply
omit the last replace/long command from the patch. This patch is turning on
code which doesn't seem to have been maintained by DEC for fair while. It works
for me, but your mileage may vary.
--------------------------------------------------------------------------------
$! modified for version 4.6 of VMS by Simon Hackett 29/3/88
$! (and works fine for 4.7)
$!
$! Copy the image SYS$SYSTEM:MONITOR.EXE into your working directory,
$! execute this file as a command file (@ it), define the logical name
$! MONITOR to specify the name of your copy of MONITOR, and
$! type MONITOR ETHERNET
$!
$! note: requires PHY_IO privilege and a large byte limit quota
$!
$ Patch Monitor.exe
REPLACE 4158+33e
211
exit
11
exit
replace 4158+391
211
exit
11
exit
replace 4158+48a
235
exit
35
exit
replace 4158+583
211
exit
11
exit
replace 4158+629
211
exit
11
exit
replace/long 170f6      ! additional for V4.6
00000000
exit
00000660                ! specify nonzero protocol to use
exit
update
exit
$ exit
------------------------<end of file>-------------------------------------------

{-------------------------------------------------------------------------}
{  Simon Hackett, Systems Group, University of Adelaide, South Australia  }
{  ACSNET,CSNET,BITNET: simon@sirius.ua.oz                                }
{  ARPA:                simon%sirius.ua.oz@seismo.css.gov                 }
{  USENET:              ...!<backbone>!munnari!sirius.ua.oz!simon         }
{-------------------------------------------------------------------------}
