Solved

Network card hardware sddress "C" function

Posted on 1997-06-01
7
229 Views
Last Modified: 2013-12-23
Where I can find a "C" function that will return the
hardware address of the network card on Solaris 2.5.1
that run on X86?
0
Comment
Question by:kaplan060197
  • 4
  • 2
7 Comments
 

Author Comment

by:kaplan060197
ID: 1582113
Adjusted points to 100
0
 
LVL 3

Expert Comment

by:dhm
ID: 1582114
There's no single function that can do this (afaik); in Solaris these days you have to send STREAMS messages to get the info.  I'm sure you've noticed that, if you run ifconfig(1M) as root, it prints out the ethernet hardware address.  Running truss(1) to trace the system calls ifconfig(1M) runs gives the output below; what it means is that you'll have to open the driver pseudo-device and do STREAMS I/O to get the hardware address.  The STREAMS message you'll need to send is DL_PHYS_ADDR_REQ; see the DLPI(7P) man page and the page for your particular network card.

Here's the relevant portion of my truss output.  "/dev/smc" is the name of the pseudo-device (I have an SMC ethernet card in my machine).

open("/dev/smc", O_RDWR)                        = 4
brk(0x080CBD78)                                 = 0
putmsg(4, 0x08047A10, 0x00000000, 0)            = 0
sigaction(SIGALRM, 0x080478B8, 0x080479B0)      = 0
sigprocmask(SIG_UNBLOCK, 0x080479E0, 0x080479D0) = 0
alarm(60)                                       = 0
getmsg(4, 0x08047A10, 0x00000000, 0x08047A0C)   = 0
alarm(0)                                        = 60
sigaction(SIGALRM, 0x080478B8, 0x080479B0)      = 0
sigprocmask(SIG_UNBLOCK, 0x080479E0, 0x080479D0) = 0
putmsg(4, 0x08047A90, 0x00000000, 0)            = 0
sigaction(SIGALRM, 0x08047938, 0x08047A30)      = 0
sigprocmask(SIG_UNBLOCK, 0x08047A60, 0x08047A50) = 0
alarm(60)                                       = 0
getmsg(4, 0x08047A90, 0x00000000, 0x08047A8C)   = 0
alarm(0)                                        = 60
sigaction(SIGALRM, 0x08047938, 0x08047A30)      = 0
sigprocmask(SIG_UNBLOCK, 0x08047A60, 0x08047A50) = 0
close(4)                                        = 0
write(1, "\t e t h e r   0 : 0 : c".., 24)      = 24

(Most of that is signal-handling stuff so that alarms can be set around functions that might hang.  The essentials are:

open("/dev/smc", O_RDWR)                        = 4
putmsg(4, 0x08047A10, 0x00000000, 0)            = 0
getmsg(4, 0x08047A10, 0x00000000, 0x08047A0C)   = 0
putmsg(4, 0x08047A90, 0x00000000, 0)            = 0
getmsg(4, 0x08047A90, 0x00000000, 0x08047A8C)   = 0
close(4)                                        = 0
write(1, "\t e t h e r   0 : 0 : c".., 24)      = 24

The last "write" statement prints out the hardware address detected by the getmsg/putmsg sequence.)
0
 

Author Comment

by:kaplan060197
ID: 1582115
I ask to FIND exsisting user function already written and
TESTED, not adivces how to write one by try and error.
0
Free camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

 
LVL 3

Expert Comment

by:dhm
ID: 1582116
You're welcome.
0
 

Author Comment

by:kaplan060197
ID: 1582117
Adjusted points to 150
0
 

Author Comment

by:kaplan060197
ID: 1582118
Adjusted points to 210
0
 
LVL 2

Accepted Solution

by:
red031197 earned 210 total points
ID: 1582119
just awk it out from 'prtconf' or arp -a
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Redesigning network for lab and gaming, cisco switch, pfsense router 9 75
RIP Routing 5 47
OSPF Design NSSA 5 33
Security Alert 2 43
This is an article about my experiences with remote access to my clients (so that I may serve them) and eventually to my home office system via Radmin Remote Control. I have been using remote access for over 10 years and have been improving my metho…
Let’s list some of the technologies that enable smooth teleworking. 
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now