Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Real ethernet address?
@ 1994-02-01 21:26 Jim Reiss
  1994-02-02  1:53 ` Dan Wing
  1994-02-02 15:15 ` Matt Thomas
  0 siblings, 2 replies; 5+ messages in thread
From: Jim Reiss @ 1994-02-01 21:26 UTC (permalink / raw)


Hi all...we have some software which uses a SIOCPHYSADDR ioctl to read the
physical ethernet address of an Alpha OSF/1 system.  It appears that the
latest DECnet for OSF/1 1.3A has started mucking with the physical address,
and so now we're getting a DECnet address back (aa00....).  Is there any
way to get the actual hardware ethernet address so we can work around this
new "feature"?  Suggestions much appreciated.  Thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Real ethernet address?
  1994-02-01 21:26 Real ethernet address? Jim Reiss
@ 1994-02-02  1:53 ` Dan Wing
  1994-02-02 16:35   ` Jim Reiss
  1994-02-02 15:15 ` Matt Thomas
  1 sibling, 1 reply; 5+ messages in thread
From: Dan Wing @ 1994-02-02  1:53 UTC (permalink / raw)


In article <CKKE8A.LEy@accelr8.com>, jim@accelr8.com (Jim Reiss) writes:
>Hi all...we have some software which uses a SIOCPHYSADDR ioctl to read the
>physical ethernet address of an Alpha OSF/1 system.  It appears that the
>latest DECnet for OSF/1 1.3A has started mucking with the physical address,
>and so now we're getting a DECnet address back (aa00....).  Is there any
>way to get the actual hardware ethernet address so we can work around this
>new "feature"?  Suggestions much appreciated.  Thanks.

DECnet Phase IV has always, to my knowledge, changed the "physical" ethernet 
address of a device to AA-00-04-00-xx-yy; the "xx-yy" portion is computed 
by:

  yyxx = (DECnet area) * (DECnet node)

For example, if your DECnet address is 5.15, your physical ethernet address
would be (5*1025+15=5135= hex 140f) AA-00-04-00-0f-14 (hope I got all that
right). 

The hardware ethernet address, which is the address burned into the chip, 
is unchanged.

-Dan Wing, Systems Administrator, University Hospital, Denver
 dwing@uh01.colorado.edu or wing@eisner.decus.org


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Real ethernet address?
  1994-02-01 21:26 Real ethernet address? Jim Reiss
  1994-02-02  1:53 ` Dan Wing
@ 1994-02-02 15:15 ` Matt Thomas
  1 sibling, 0 replies; 5+ messages in thread
From: Matt Thomas @ 1994-02-02 15:15 UTC (permalink / raw)



In article <CKKE8A.LEy@accelr8.com>, jim@accelr8.com (Jim Reiss) writes:
|>Hi all...we have some software which uses a SIOCPHYSADDR ioctl to read the
|>physical ethernet address of an Alpha OSF/1 system.  It appears that the
|>latest DECnet for OSF/1 1.3A has started mucking with the physical address,
|>and so now we're getting a DECnet address back (aa00....).  Is there any
|>way to get the actual hardware ethernet address so we can work around this
|>new "feature"?  Suggestions much appreciated.  Thanks.

This is due to a bug in if_te driver (fixed in V2.0).  There currently is
no workaround.  Contact the CSC to get the problem resolved (you can have
them contact me for more informtion).

-- 
Matt Thomas                            Internet:   thomas@lkg.dec.com
U*X Networking                         UUCP:       ...!decwrl!thomas
Digital Equipment Corporation          Disclaimer: This message reflects my own
Littleton, MA                                      warped views, etc.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Real ethernet address?
  1994-02-02  1:53 ` Dan Wing
@ 1994-02-02 16:35   ` Jim Reiss
  1994-02-02 18:00     ` Rob Riepel
  0 siblings, 1 reply; 5+ messages in thread
From: Jim Reiss @ 1994-02-02 16:35 UTC (permalink / raw)


In article <1994Feb1.195338.910@buckie.hsc.colorado.edu>,
Dan Wing <dwing@uh01.Colorado.EDU> wrote:
>In article <CKKE8A.LEy@accelr8.com>, jim@accelr8.com (Jim Reiss) writes:
>>Hi all...we have some software which uses a SIOCPHYSADDR ioctl to read the
>>physical ethernet address of an Alpha OSF/1 system.  It appears that the
>>latest DECnet for OSF/1 1.3A has started mucking with the physical address,
>
>DECnet Phase IV has always, to my knowledge, changed the "physical" ethernet 
>address of a device to AA-00-04-00-xx-yy
This is definitely new behavior.  For years, this code has returned the real
ethernet address on Ultrix (and more recently OSF/1) systems which had DECnet
up and running.
--
 Jim Reiss (jim@accelr8.com)    Accelr8 Technology, Denver, Colorado, USA


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Real ethernet address?
  1994-02-02 16:35   ` Jim Reiss
@ 1994-02-02 18:00     ` Rob Riepel
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Riepel @ 1994-02-02 18:00 UTC (permalink / raw)



Here's something I picked up long ago.  I don't have an Alpha (yet), and
even if I did, I probably wouldn't be running DECnet on it, so I have no
idea if it works in this brave new world.  If it does, please let us all
know....

/*
 *      getadr.c -- program to acquire ethernet controller addresses
 *              (c) Digital Equipment Corporation, 1989
 *              Author: Jim Lieb, Digital Equipment Corp. suntan::lieb
 *              This program is distributed free as a demonstration
 *              of network access methods.  No warrantee is expressed or
 *              implied.
 *
 *      Application: Use the getadr function to get the hardware address
 *              for the system in applications where the license key is
 *              verified by checking something unique like a system serial
 *              number (not always present on DEC cpus).
 *
 *      NOTE:   There is a difference between the hardware address and the
 *              physical address of Digital manufactured Ethernet controller.
 *              The hardware address is a unique number, typically of the
 *              form:  08-00-2B-xx-xx-xx, as assigned by IEEE authority.  The
 *              xx-xx-xx number is fixed in ROM and is unique for each
 *              controller.  This address is guaranteed fixed and unique.
 *              The physical address is programmable and is MODIFIED by the
 *              DECnet routing layer to encode the 16 bit Phase IV DECnet
 *              address in the least significant 2 octets (byte swapped)
 *              of the source address of packets. This address, typically
 *              of the form aa-00-04-00-yy-yy where yy-yy is the DECnet
 *              address, becomes the address used by the controller for
 *              packet receive and transmit.
 *
 *              March 3, 1990 - Jim Lieb, changed to use internal tables
 *                              and clean up struct usage.  Please note!
 *              May 21, 1990 - John Dustin OSG, use status bits rather than
 *                              string compares to get right interface.
 *                              also test for interface turned on and use
 *                              best guess of none on...
 */

#include <strings.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <errno.h>                      /* error numbers */
#include <stdio.h>

static char getadrSID[] = "@(#)getadr.c 1.5 6/22/90 demo";
extern int errno;

int getadr();

/* main -- Shell to demonstrate the call to the getadr function.  This
 *      also prints the address contents to stdout.
 */

main(argc, argv, envp)
int argc;
char **argv, **envp;
{
        struct ifdevea ifr;
        char *interface;

        if(argc < 2)
                interface = NULL;
        else
                interface = argv[1];
        if(getadr(interface, &ifr) < 0) {
                fprintf(stderr, "couldn't get network interface\n");
                exit(1);
        }
        printf("ifr_name = '%s'\n", ifr.ifr_name);
        printf(
           "Ethernet hardware address = (%02x-%02x-%02x-%02x-%02x-%02x)\n",
                ifr.default_pa[0], ifr.default_pa[1], ifr.default_pa[2],
                ifr.default_pa[3], ifr.default_pa[4], ifr.default_pa[5]);
        printf(
            "Ethernet physical address = (%02x-%02x-%02x-%02x-%02x-%02x)\n",
                ifr.current_pa[0], ifr.current_pa[1], ifr.current_pa[2],
                ifr.current_pa[3], ifr.current_pa[4], ifr.current_pa[5]);
    }

/*      getadr -- get primary ethernet interface address
 *              read list of net devices via ioctl to ifreqs.  Pass over
 *              loopback device and any serial line interfaces.  Use first
 *              ether device found.  This could cause a problem if there are
 *              multiple ether controllers on the system as it will find the
 *              first device configured.  No panic since most have only one
 *              device.  This function does not require setuid(2) priviledges.
 */

#define IFREQCNT 64     /* need enough room for total number of possible
                         * interfaces, including aliases for LAT and DECnet
                         */
int getadr(name, ifrp)
char *name;
struct ifdevea *ifrp;
{
        int s;
        struct ifreq *ifr;
        struct ifreq ifreqs[IFREQCNT];
        struct ifreq tmp_ifr;
        struct ifconf ifc;
        char *maybe = NULL;     /* a device that might be it */

        bzero(ifrp, sizeof(struct ifdevea));
        if((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
                perror("socket");
                return( -1);
        }
        if(name != NULL)
                strcpy(ifrp->ifr_name, name);
        else {
                ifc.ifc_req = ifreqs;
                ifc.ifc_len = sizeof(ifreqs);
                if (ioctl(s, SIOCGIFCONF, &ifc) < 0) {
                        perror("ioctl: SIOCGIFCONF");
			close(s);
                        return(-1);
                }
                for(ifr = ifreqs; ifr < &ifreqs[IFREQCNT]; ifr++) {
                        if(strlen(ifr->ifr_name) == 0) {
                                if (maybe == NULL) {
                                        fprintf(stderr, "No network devices configured\n");
					close(s);
                                        return(-1);
                                } else
                                        break;  /* check out maybe */
                        } else {
                                (void) strcpy(tmp_ifr.ifr_name, ifr->ifr_name);
                                if (ioctl(s, SIOCGIFFLAGS, &tmp_ifr) < 0) {
                                        perror("ioctl: SIOCGIFFLAGS");
					close(s);
                                        return(-1);
                                }
                                if ((tmp_ifr.ifr_flags & (IFF_POINTOPOINT))
                                         == (IFF_POINTOPOINT)) {
                                        continue; /* skip point to point */
                                }
                                if ((tmp_ifr.ifr_flags
                                    & (IFF_DYNPROTO|IFF_BROADCAST))
                                          != (IFF_DYNPROTO|IFF_BROADCAST)) {
                                        continue;       /* skip CI, etc. */
                                }
                                if ((tmp_ifr.ifr_flags & (IFF_UP|IFF_RUNNING))
                                         != (IFF_UP|IFF_RUNNING)) {
                                        /* save this name, it might be the
                                         * right one but just isn't up now
                                         */
                                        if (maybe == NULL)
                                                maybe = ifr->ifr_name;
                                        continue;   /* not up and running */
                                }
                                (void)strcpy(ifrp->ifr_name, tmp_ifr.ifr_name);
                                maybe = NULL; /* found real one, clear maybe */
                                break;
                        }
                }
        }
        if (maybe != NULL) {
                (void) strcpy(ifrp->ifr_name, maybe);
        }
        if (ioctl(s, SIOCRPHYSADDR, ifrp) < 0) {
                perror("ioctl: SIOCRPHYSADDR");
		close(s);
                return(-1);
        }
	close(s);
        return 0;
}

--
  Rob Riepel                             |     168 Pine Hall
  Systems Programmer                     |     Stanford, CA 94305-4122
  Networking & Communications Systems    |     (415) 725-7577
  Stanford University                    |     riepel@Snowflake.Stanford.EDU
  --------------------------------------------------------------------------
  GE/CS -d+ -p+(---) c++@ !l u++/- e--/* m+ s+ n+ h/--- f+ g+ w+ t+ r+@ y?/+


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1994-02-02 18:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-02-01 21:26 Real ethernet address? Jim Reiss
1994-02-02  1:53 ` Dan Wing
1994-02-02 16:35   ` Jim Reiss
1994-02-02 18:00     ` Rob Riepel
1994-02-02 15:15 ` Matt Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox