LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-07-2010, 08:51 AM   #1
greplinux
Member
 
Registered: Jun 2007
Posts: 118

Rep: Reputation: 17
Using netlink sockets to get MAC address


Hi All,

I am trying to retrieve an interface's MAC address using netlink address. I got to a point, where I am able to parse the reply for 'RTM_GETLINK' till 'case IFLA_ADDRESS'. After that, I have no idea to print the MAC address.

Can any one give me inputs regarding this?

Thanks in advance,
 
Old 07-08-2010, 07:47 AM   #2
greplinux
Member
 
Registered: Jun 2007
Posts: 118

Original Poster
Rep: Reputation: 17
This post looks like THE DUMBEST question I ever asked in this forum. I could have spent 5 more minutes with my program, I could have got the answer myself. Anyhow sorry guys.

In-order to get the MAC, once you hit the 'IFLA_ADDRESS' case, you can use 'RTA_DATA' to store the result in a unsigned char array and then print that as you like. :-)

Netlink sockets rocks :-)

Thanks,
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Netlink Sockets yaplej Programming 2 05-09-2010 01:20 PM
Generic Netlink sockets krishna123 Linux - Networking 0 03-04-2009 02:30 AM
A question about netlink sockets alfrag Linux - Newbie 1 12-26-2008 09:48 AM
Netlink Sockets Problem gio123 Programming 3 01-23-2005 07:17 PM
Adding Routes using Netlink Sockets mpls_linux Linux - Networking 0 05-22-2004 10:14 PM


All times are GMT -5. The time now is 11:27 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration