LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-12-2014, 04:23 AM   #1
chakka.lokesh
Member
 
Registered: Mar 2008
Distribution: Ubuntu
Posts: 270

Rep: Reputation: 33
read function call failing with EFAULT (Bad address)


I want to receive any packet with any destination/source ethernet address.

I set the card in promiscous mode using the following code:

Code:
ifr.ifr_flags |= ( IFF_PROMISC );
ioctl( sockets, SIOCSIFFLAGS, &ifr )
ioctl has returned success.

still I am seeing read function is returning EFAULT error.

Is it okay if I ignore that error and do call the read function again with same parameters ?

can some one please help me in fixing the issue ?
 
Old 09-12-2014, 05:20 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by chakka.lokesh View Post
still I am seeing read function is returning EFAULT error.
This is unlikely to be related to the ioctl() call.

From the read(2) man page:
Quote:
ssize_t read(int fd, void *buf, size_t count);
[.....]
EFAULT - buf is outside your accessible address space
In your case, buf might be a NULL pointer, or too small for what you are reading, or pointing to an unallocated address.
 
1 members found this post helpful.
  


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] read function call returning more amount of data than wiritten using write function chakka.lokesh Programming 1 09-11-2014 03:14 AM
Syscall stat64() returning EFAULT (bad address)... alclub Programming 0 08-29-2011 08:33 AM
i am using write() function to send string to my driver . it returns EFAULT. dpattnaik Linux - Newbie 0 06-22-2009 02:39 AM
problem of function call address in executable file valpa Programming 12 09-05-2008 08:36 AM
Bad address error when using the system call rename Macska Linux - Newbie 1 11-18-2007 01:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:17 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