Solved

Network card hardware sddress "C" function

Posted on 1997-06-01
7
235 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Data center, now-a-days, is referred as the home of all the advanced technologies. In-fact, most of the businesses are now establishing their entire organizational structure around the IT capabilities.
For many of us, the  holiday season kindles the natural urge to give back to our friends, family members and communities. While it's easy for friends to notice the impact of such deeds, understanding the contributions of businesses and enterprises i…
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…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

777 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