LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 09-25-2008, 03:12 AM   #1
lironl
LQ Newbie
 
Registered: Aug 2008
Posts: 6

Rep: Reputation: 0
Question find MAC address


how can i find MAC address using ioctl function
on solaris machine using c/c++
 
Old 09-25-2008, 06:15 AM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi.

You can poke around the Solaris 'ifconfig' source (which can display MAC addresses) here:
http://src.opensolaris.org/source/xr...sbin/ifconfig/

Maybe you will find what you seek.

Dave
 
Old 11-02-2008, 02:11 AM   #3
lironl
LQ Newbie
 
Registered: Aug 2008
Posts: 6

Original Poster
Rep: Reputation: 0
Question mac address solaris

how can i use ioctl function with SIOCGIFHWADDR command?
(when i try to compaile i am getting this error : SIOCGIFHWADDR' undeclared)
 
Old 11-02-2008, 04:33 AM   #4
lironl
LQ Newbie
 
Registered: Aug 2008
Posts: 6

Original Poster
Rep: Reputation: 0
Question libdlpi

I am using solaris machine version 10.5
and there is not exist libdlpi.h file, that is why i can not use dlpi_get_physaddr() , what can i do instesd?

thanks
 
Old 11-02-2008, 12:40 PM   #5
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
I've merged two similar threads. Please keep any related discussions in one thread.
 
Old 11-03-2008, 02:43 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You can get the libdlpi sources from here

Regards
 
Old 11-03-2008, 03:49 AM   #7
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Quote:
Originally Posted by lironl View Post
how can i use ioctl function with SIOCGIFHWADDR command?
(when i try to compaile i am getting this error : SIOCGIFHWADDR' undeclared)
You can't. This constant is neither defined nor supported (yet?) under Solaris. Use a different way like getting the mac address from the arp table or using dlpi.

Here is sample code using the dlpi library, although slightly buggy:
http://cplus.kompf.de/artikel/macaddr.html

Here is what I did to have it working:
1: remove "#include <signal.h>" directive.
2: add my ethernet devices:
static char *dlpi_dev[] = {"/dev/eri", "/dev/hme", "/dev/ie", "/dev/le", "/dev/pcwl", "/dev/skge", "/dev/iwi"};
3: fix a bug in line 182
for (dev = dlpi_dev; **dev != '\0'; ++dev) {
4: run it as root.
 
Old 11-03-2008, 04:01 AM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Two similar threads merged, again. Please keep any related discussions in one thread.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find an IP address from the MAC address of a remote machine ? jitz Linux - General 3 01-03-2006 07:55 AM
How to find IP address of a machine if I know their MAC Address dysenteryduke Linux - Networking 13 09-12-2005 10:21 AM
How to find MAC address of a specified IP address ? longtongfish Programming 1 07-12-2005 03:26 PM
how would you find the mac address bhupee Linux - Newbie 5 07-05-2004 06:07 PM
how to find IP if I have MAC address bojo Linux - Networking 3 11-29-2003 10:10 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 12:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration