Re: getifaddrs

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

 



Il giorno Tue, Sep 02, 2003 at 08:00:31PM +0200, pare che Daniele Bellucci abbia scritto:
> On Tue, Sep 02, 2003 at 07:45:35PM +0200, mato wrote:
> |
> |Hi,
> |
> |
> |you can try this command:
> |    grep  -r \\\"getifaddrs\\\" /usr/src/linux
> |Sorry, this command is ok. (no get -r ....) but grep -r ....  
> 
> 
> When you search for "something" in a source kernel tree 
> its find to use the following:
> 
> find /usr/src/linux-`uname -r`/ -name \*.[ch] -exec grep -nH "something" {} \;

getifaddrs(3) is a library function, implemented through ioctl calls [1]. 

The ioctl calls are handled by the code of net/core/dev.c See, for
example, http://lxr.linux.no/source/net/core/dev.c?v=2.4.21#L2232

Have a look here for a man page describing getifaddrs:
http://sources.redhat.com/ecos/docs-latest/ref/net-common-tcpip-manpages-getifaddrs.html


HTH,
Marco


[1] An strace of a simple program that calls getifaddrs and exits
shows:
[some uninteresting stuff here]
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
ioctl(3, 0x8912, 0xbffff820)            = 0
ioctl(3, 0x8913, 0x804a008)             = 0
ioctl(3, 0x891b, 0x804a008)             = 0
ioctl(3, 0x8919, 0x804a008)             = 0
ioctl(3, 0x8913, 0x804a028)             = 0
ioctl(3, 0x891b, 0x804a028)             = 0
ioctl(3, 0x8919, 0x804a028)             = 0
[more uninteresting stuff here]

and /usr/include/bits/ioctls.h includes the following #defines:
#define SIOCGIFCONF     0x8912          /* get iface list               */
#define SIOCGIFFLAGS    0x8913          /* get flags                    */
#define SIOCGIFNETMASK  0x891b          /* get network PA mask */
#define SIOCGIFBRDADDR  0x8919          /* get broadcast PA address     */


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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