Solved

Network card hardware sddress "C" function

Posted on 1997-06-01
7
231 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Outlook keeps opened file locked 2 56
Not able to route between subnets 8 104
VIRL IP adress 3 58
inserting an ACL line Cisco IOS XR Software, Version 5.3.3 2 22
Some time ago I was asked to set up a web portal PC to put at our entrance. When customers arrive, they could see a webpage 'promoting' our company. So I tried to set up a windows 7 PC as a kiosk PC.......... I will spare you all the annoyances I…
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
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…

863 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

21 Experts available now in Live!

Get 1:1 Help Now