Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Network card hardware sddress "C" function

Posted on 1997-06-01
7
Medium Priority
?
242 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
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
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 420 total points
ID: 1582119
just awk it out from 'prtconf' or arp -a
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This program is used to assist in finding and resolving common problems with wireless connections.
This article explains the fundamentals of industrial networking which ultimately is the backbone network which is providing communications for process devices like robots and other not so interesting stuff.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

927 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