[comp.unix.ultrix] DLI/Ethernet interface questions

jh@allez.uh.edu (Jeff Hayward) (07/20/89)

Some questions for anyone familiar with the DLI Ethernet interface
provided with DECnet-Ultrix.

How can I obtain the Ethernet address of a given interface?  
Is it possible to enable promiscuous-mode reception, and if so, how?
Is there a better (software) interface available for Ultrix?

Any suggestions welcome.

Jeff Hayward			713/749-3396
The University of Houston	jh@allez.uh.edu

michaud@decvax.dec.com (Jeff Michaud) (07/21/89)

In article <810@uhnix2.uh.edu>, jh@allez.uh.edu (Jeff Hayward) writes:
> Some questions for anyone familiar with the DLI Ethernet interface
> provided with DECnet-Ultrix.

	Just so no one thinks they have to buy DECnet-ULTRIX (though it would be nice
	if they bought it anyways :-) to use DLI, you don't.  DLI is part of the
	base (ULTRIX) system.  The confusion may be because DLI is documented in
	our (DECnet-ULTRIX) doc set :-).

> How can I obtain the Ethernet address of a given interface?

	Open a socket to to the AF_UNIX or DLI domain and issue ioctl(SIOCRPHYSADDR).
	I'll post a sample program as a seperate followup.

> Is it possible to enable promiscuous-mode reception, and if so, how?

	Nope, not that I know of.

> Is there a better (software) interface available for Ultrix?

	If you do have DECnet-ULTRIX V3.0 you may want to install the DNUBASE030 (or DNPBASE030
	for RISC, ala DS3100 version) and then take a look in /usr/examples/dli.
-- 
/--------------------------------------------------------------\
|Jeff Michaud    michaud@decwrl.dec.com  michaud@decvax.dec.com|
|DECnet-ULTRIX   #include <standard/disclaimer.h>              |
\--------------------------------------------------------------/

michaud@decvax.dec.com (Jeff Michaud) (07/21/89)

In article <810@uhnix2.uh.edu>, jh@allez.uh.edu (Jeff Hayward) writes:
> How can I obtain the Ethernet address of a given interface?  

As promised, here is the sample program:

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <sys/ioctl.h>

main(argc, argv)
    int argc;
    char *argv[];
{
    struct ifdevea address;
    int sock;

    if( argc <= 1 ) {
        fprintf(stderr, "Usage: %s device\n", argv[0]);
        exit();
    }

    bzero(&address, sizeof(address));
    strcpy(address.ifr_name, argv[1]);

    sock = socket(AF_UNIX, SOCK_DGRAM, 0);
    if( sock < 0 ) {
        perror("socket(AF_UNIX, SOCK_DGRAM, 0)");
        exit();
    }

    if( ioctl(sock, SIOCRPHYSADDR, &address) < 0 ) {
        perror("ioctl(SIOCRPHYSADDR)");
        exit();
    }

    close(sock);

    printf("Current Physical Address: %02x-%02x-%02x-%02x-%02x-%02x\n",
        address.current_pa[0], address.current_pa[1], address.current_pa[2],
        address.current_pa[3], address.current_pa[4], address.current_pa[5]);

    printf("Default Hardware Address: %02x-%02x-%02x-%02x-%02x-%02x\n",
        address.default_pa[0], address.default_pa[1], address.default_pa[2],
        address.default_pa[3], address.default_pa[4], address.default_pa[5]);
}
-- 
/--------------------------------------------------------------\
|Jeff Michaud    michaud@decwrl.dec.com  michaud@decvax.dec.com|
|DECnet-ULTRIX   #include <standard/disclaimer.h>              |
\--------------------------------------------------------------/