Mac Address

How do I find “Ehthernet Physical Address”.

Thanks

The easiest way might be to run your driver with the -v option.
This will display the MAC address on the screen.

Previously, lalit wrote in comp.os.qnx:

How do I find “Ehthernet Physical Address”.

Thanks
begin:vcard
n:Agarwal;Lalit
tel;fax:(402) 472 9291
tel;home:(402) 477 0471
tel;work:(402) 472 4375
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:> lalit@engrs.unl.edu
fn:Lalit Agarwal
end:vcard


Mitchell Schoenbrun --------- maschoen@pobox.com

If you have the Net driver running, just type “netinfo -l”. It will be
called Physical Node Id, in the list of information presented.

lalit wrote:

How do I find “Ehthernet Physical Address”.

Thanks

and as addition to replies: you’r running tcpip then try “netstat -i”

Ian M. Zagorskih
Software Developer
Novosoft CyBearNet Department
Custom software development and web design since 1992

Phone: +7 (3832) 39-72-60
Fax: +7 (3832) 39-63-58
E-mail: ianzag@novosoft.ru
For more visit http://www.novosoft.ru/

“lalit” <lalit@engrs.unl.edu> wrote in message
news:39C7DA94.17D88595@engrs.unl.edu

How do I find “Ehthernet Physical Address”.

Thanks

How I can it into programm.
Is there way without netmap?

Eugene A. Kislov <evkislov@asutp.yorp.yaroslavl.ru> wrote:

How I can it into programm.
Is there way without netmap?

Try this:

#include <stdio.h>
#include <malloc.h>
#include <sys/kernel.h>
#include <sys/net_nq.h>
#include <sys/net41msg.h>
#include <sys/net_drvr.h>
#include <errno.h>


void main()

{
int ctr;
int pid;
struct _net_rnodemap rnodemap;
char data[1024];
struct _net_rnodemap_reply *rnodemap_reply;
int nids[20];

if ((pid=qnx_vc_name_attach(0, 64, “qnx/net”))==-1) {
printf (“Could not attach to Net (%d)\n”, errno);
exit(0);
}

memset(&rnodemap, 0, sizeof(rnodemap));
rnodemap.type=_NET_RNODEMAP;
rnodemap.log_nid=getnid();

rnodemap_reply=(struct _net_rnodemap_reply *) data;

if ((Send(pid, &rnodemap, rnodemap_reply, sizeof(rnodemap),
1000))==-1) {
printf (“Send error\n” );
exit(0);
}

printf (“MAC: “); // If you have multiple cards you will need a loop here
for (ctr=0; ctr<6; ctr++)
printf (”%02X”, rnodemap_reply->card[0].phys_addr[ctr]);

printf ("\n");

}

-David

David Gibbs <dagibbs@qnx.com> wrote:

Eugene A. Kislov <> evkislov@asutp.yorp.yaroslavl.ru> > wrote:

How I can it into programm.
Is there way without netmap?

Oh ya, the following assumes this question (and thread) was referring
to QNX 4.xx

-David

Try this:

#include <stdio.h
#include <malloc.h
#include <sys/kernel.h
#include <sys/net_nq.h
#include <sys/net41msg.h
#include <sys/net_drvr.h
#include <errno.h



void main()

{
int ctr;
int pid;
struct _net_rnodemap rnodemap;
char data[1024];
struct _net_rnodemap_reply *rnodemap_reply;
int nids[20];

if ((pid=qnx_vc_name_attach(0, 64, “qnx/net”))==-1) {
printf (“Could not attach to Net (%d)\n”, errno);
exit(0);
}

memset(&rnodemap, 0, sizeof(rnodemap));
rnodemap.type=_NET_RNODEMAP;
rnodemap.log_nid=getnid();

rnodemap_reply=(struct _net_rnodemap_reply *) data;

if ((Send(pid, &rnodemap, rnodemap_reply, sizeof(rnodemap),
1000))==-1) {
printf (“Send error\n” );
exit(0);
}

printf (“MAC: “); // If you have multiple cards you will need a loop here
for (ctr=0; ctr<6; ctr++)
printf (”%02X”, rnodemap_reply->card[0].phys_addr[ctr]);

printf ("\n");

}

-David

This method isn’t safe. If for some reason a wrong MAC address
was specified in the netmap file you will not get the right MAC
address.


“David Gibbs” <dagibbs@qnx.com> wrote in message
news:8qth6k$57$1@nntp.qnx.com

Eugene A. Kislov <> evkislov@asutp.yorp.yaroslavl.ru> > wrote:

How I can it into programm.
Is there way without netmap?

Try this:

#include <stdio.h
#include <malloc.h
#include <sys/kernel.h
#include <sys/net_nq.h
#include <sys/net41msg.h
#include <sys/net_drvr.h
#include <errno.h


void main()

{
int ctr;
int pid;
struct _net_rnodemap rnodemap;
char data[1024];
struct _net_rnodemap_reply *rnodemap_reply;
int nids[20];

if ((pid=qnx_vc_name_attach(0, 64, “qnx/net”))==-1) {
printf (“Could not attach to Net (%d)\n”, errno);
exit(0);
}

memset(&rnodemap, 0, sizeof(rnodemap));
rnodemap.type=_NET_RNODEMAP;
rnodemap.log_nid=getnid();

rnodemap_reply=(struct _net_rnodemap_reply *) data;

if ((Send(pid, &rnodemap, rnodemap_reply, sizeof(rnodemap),
1000))==-1) {
printf (“Send error\n” );
exit(0);
}

printf (“MAC: “); // If you have multiple cards you will need a loop
here
for (ctr=0; ctr<6; ctr++)
printf (”%02X”, rnodemap_reply->card[0].phys_addr[ctr]);

printf ("\n");

}

-David

Mario Charest <mcz@videotron.ca> wrote:

This method isn’t safe. If for some reason a wrong MAC address
was specified in the netmap file you will not get the right MAC
address.

Quite true. It does assume you have a properly configured system.
But the person seemed to be looking for an alternative to doing
a popen(netmap) and parsing the output. This does give the same
information the netmap command would have given.

Given that caveat, it is useful code.

-David

“David Gibbs” <> dagibbs@qnx.com> > wrote in message
news:8qth6k$57$> 1@nntp.qnx.com> …
Eugene A. Kislov <> evkislov@asutp.yorp.yaroslavl.ru> > wrote:

How I can it into programm.
Is there way without netmap?

Try this:

#include <stdio.h
#include <malloc.h
#include <sys/kernel.h
#include <sys/net_nq.h
#include <sys/net41msg.h
#include <sys/net_drvr.h
#include <errno.h


void main()

{
int ctr;
int pid;
struct _net_rnodemap rnodemap;
char data[1024];
struct _net_rnodemap_reply *rnodemap_reply;
int nids[20];

if ((pid=qnx_vc_name_attach(0, 64, “qnx/net”))==-1) {
printf (“Could not attach to Net (%d)\n”, errno);
exit(0);
}

memset(&rnodemap, 0, sizeof(rnodemap));
rnodemap.type=_NET_RNODEMAP;
rnodemap.log_nid=getnid();

rnodemap_reply=(struct _net_rnodemap_reply *) data;

if ((Send(pid, &rnodemap, rnodemap_reply, sizeof(rnodemap),
1000))==-1) {
printf (“Send error\n” );
exit(0);
}

printf (“MAC: “); // If you have multiple cards you will need a loop
here
for (ctr=0; ctr<6; ctr++)
printf (”%02X”, rnodemap_reply->card[0].phys_addr[ctr]);

printf ("\n");

}

-David

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:8r0evh$lg3$2@nntp.qnx.com

Mario Charest <> mcz@videotron.ca> > wrote:

This method isn’t safe. If for some reason a wrong MAC address
was specified in the netmap file you will not get the right MAC
address.

Quite true. It does assume you have a properly configured system.
But the person seemed to be looking for an alternative to doing
a popen(netmap) and parsing the output. This does give the same
information the netmap command would have given.

Given that caveat, it is useful code.

Indeed, I never mean to say it was useless. I was just pointing
out one must understand what this realy does. It doesn’t
get the MAC address of a card, it get the MAC address in
the netmap database, quite different, trust me :wink:


-David

“David Gibbs” <> dagibbs@qnx.com> > wrote in message
news:8qth6k$57$> 1@nntp.qnx.com> …
Eugene A. Kislov <> evkislov@asutp.yorp.yaroslavl.ru> > wrote:

How I can it into programm.
Is there way without netmap?

Try this:

#include <stdio.h
#include <malloc.h
#include <sys/kernel.h
#include <sys/net_nq.h
#include <sys/net41msg.h
#include <sys/net_drvr.h
#include <errno.h


void main()

{
int ctr;
int pid;
struct _net_rnodemap rnodemap;
char data[1024];
struct _net_rnodemap_reply *rnodemap_reply;
int nids[20];

if ((pid=qnx_vc_name_attach(0, 64, “qnx/net”))==-1) {
printf (“Could not attach to Net (%d)\n”, errno);
exit(0);
}

memset(&rnodemap, 0, sizeof(rnodemap));
rnodemap.type=_NET_RNODEMAP;
rnodemap.log_nid=getnid();

rnodemap_reply=(struct _net_rnodemap_reply *) data;

if ((Send(pid, &rnodemap, rnodemap_reply, sizeof(rnodemap),
1000))==-1) {
printf (“Send error\n” );
exit(0);
}

printf (“MAC: “); // If you have multiple cards you will need a
loop
here
for (ctr=0; ctr<6; ctr++)
printf (”%02X”, rnodemap_reply->card[0].phys_addr[ctr]);

printf ("\n");

}

-David

Mario Charest <mcz@videotron.ca> wrote:

It doesn’t
get the MAC address of a card, it get the MAC address in
the netmap database, quite different, trust me > :wink:

I did tech support for several years. I don’t have to trust
you on the difference – I KNOW the difference. :slight_smile: (Or,
would that be :frowning: in the cases where it mattered?)

-David

That post wasn’t mean for you David,
I was meant for the other listener.

I know you know, and you should know that I know
you know.

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:8r2cmp$se6$2@nntp.qnx.com

Mario Charest <> mcz@videotron.ca> > wrote:

It doesn’t
get the MAC address of a card, it get the MAC address in
the netmap database, quite different, trust me > :wink:

I did tech support for several years. I don’t have to trust
you on the difference – I KNOW the difference. > :slight_smile: > (Or,
would that be > :frowning: > in the cases where it mattered?)

-David