LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-12-2010, 02:53 PM   #1
bostan
LQ Newbie
 
Registered: Feb 2010
Posts: 14

Rep: Reputation: 0
How to find the device name for ioctl(sd, SIOCGIFINDEX, &ifr) call


Hi I am trying to add the device by using followig code strip and it says that eth1 is not defind in the code.

strncpy(ifr.ifr_name,eth1,IFNAMSIZ);
if (ioctl(sd, SIOCGIFINDEX, &ifr) == -1) {
return 0;
}

How do I write down the DEVICE name in the ifr.ifr_name structure ?
-Thanks
 
Old 02-14-2010, 08:38 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Moved: This thread is more suitable in Programming and has been moved accordingly to help your question get the exposure it deserves.
 
Old 01-11-2011, 06:37 AM   #3
jackhab
LQ Newbie
 
Registered: Jan 2011
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by bostan View Post
Hi I am trying to add the device by using followig code strip and it says that eth1 is not defind in the code.

strncpy(ifr.ifr_name,eth1,IFNAMSIZ);
if (ioctl(sd, SIOCGIFINDEX, &ifr) == -1) {
return 0;
}

How do I write down the DEVICE name in the ifr.ifr_name structure ?
-Thanks
You forgot to put double-quotes around "eth1".
 
  


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
ioctl call for obtaining the RSSI saioha Linux - Wireless Networking 11 03-27-2012 11:47 AM
ioctl call returns error. HarryBoy Programming 6 09-10-2008 10:08 AM
How to pass IOCTL arguments from usespace ioctl call devkpict Linux - Kernel 1 12-07-2007 06:45 PM
dm driver ioctl call tantrix Programming 0 05-16-2005 06:50 PM
Ioctl() call fails Custer Linux - Wireless Networking 0 02-16-2004 12:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:56 PM.

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