Re: how does ifconfig communicates with network device driver strace output given

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

 



On Thu, Nov 11, 2010 at 11:28 PM, Tapas Mishra <mightydreams@xxxxxxxxx> wrote:
> Hi,
> I read the 17th Chapter of LDD3 and explored what is a network device driver.
> I wanted to understand in real context the working of network device
> driver on my laptop.
> The book described about snull (dummy ) device.
>
> So here is the problem
> when I do an ifconfig the open,close, and other methods which the
> driver has defined come into action.
> I did strace ifconfig to understand what system calls were issued when
> I do an ifconfig from userspace
> here is the output of strace
> http://pastebin.com/FMggtA9s
> what I see is most of the calls are
> open,access,fstat,mmap,mprotect,close,ioctl,write,

Have you ever looked at strace output before?  Most of it is
extraneous to you at the start.  In your output, you can probably
safely ignore everything before line 103.

> what I am not clear is
> what mechanism is existing which says that when ifconfig is issued
> then the response will come from
> a particular set of driver

That's what the major / minor device numbers are for.  I assume you
are familiar with those?  It's very dynamic now and controlled by udev
rules, so it can get complex to follow the setup logic.

> (I understand that we register the driver
> by register_netdev

> but how does the
> system calls or requests from ifconfig transferred to the particular
> device or how does
> ifconfig communicates with kernel and I see the resultant commands
> issued via strace as you see in above pastebin output.

When you see "/dev/..." opened, then a connection to the kernel is
opened.  Read / write / ioctl etc. all directly send data to the
kernel.

You do know the standard file descriptors: stdin, stdout, stderr right?

You see stdout (1) being sent the ifconfig output in the code, so just
look immediately before that to try and see what ifconfig did to
figure what it did to allow it to generate the output.

Greg

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[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