[Fwd: ioctl in kernel]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




--- Begin Message ---  

Ravi K wrote:

Hi,
  If you have the pointer to net_device (say *dev),
you can call dev->do_ioctl().

-Ravi.

--- Nickolay Dokovsky <dokovsky@cs.utwente.nl> wrote:
> Hello,
> May you provide an example how to invoke ioctl on
> device from kernel
> module.
> For instance I have an dev pointer to struct
> net_device and I want to
> make SIOCSIFADDR on it from kernel module.
> Thank you
 

It Dosen't work because dev->do_ioctl is used only for device specific ioctls. When you try to invoke it with normal IOCTL it returns "not supported"

I saw that devinet_ioctl could be invoked wrapped in getting and setting segments call
like :
mm_segment_t. fs = get_fs();
set_fs(get_ds());
devinet_ioctl(SIOCSIFADDR,&ir);
  {
    it hangs here .... ????
   }
set_fs(fs);
whitout fs functions devinet_ioctl returns "Bad_address" error generated by copy_from_user()
call that is in devinet_ioctl......

All this is invoked from a kernel module which registrates network event listener and than invokes notifier_call when an NETDEVICE_GOINGDOWN is receieved.
The idea is when you have two NICs and one is going down than the other to obtain
MAC and IP addresses of the first.

Thanks
N. Dokovsky
 
 
 

begin:vcard 
n:Dokovsky;Nickolay
tel;work:+31534893283
x-mozilla-html:FALSE
url:http://www.ctit.utwente.nl
org:University of Twente;CTIT
adr:;;PO BOX 217;Enschede;;7500 AE;Netherlands
version:2.1
email;internet:dokvosky@cs.utwente.nl
title:Software Developer
fn:Nickolay Dokovsky
end:vcard
--- End Message ---
begin:vcard 
n:Dokovsky;Nickolay
tel;work:+31534893283
x-mozilla-html:FALSE
url:http://www.ctit.utwente.nl
org:University of Twente;CTIT
adr:;;PO BOX 217;Enschede;;7500 AE;Netherlands
version:2.1
email;internet:dokvosky@cs.utwente.nl
title:Software Developer
fn:Nickolay Dokovsky
end:vcard

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux