lkml.org 
[lkml]   [1998]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Confusing ifreq behavior: guru needed
On Mon, 12 Oct 1998, B. James Phillippe wrote:

> Hello,
>
> I'll be concise: I am writing some user-space code that needs to
> obtain the IPv4 protocol address and hardware address from an interface
> (arbitrary). I am using the ioctl() method with SIOCGIFHWADDR and
> SIOCGIFADDR, operating on struct ifreq (contains struct sockaddr). The
> hardware address part works like I expect. But the IP address doesn't;
> it's stored in sa_data, offset two bytes. I don't understand why. Here is
> a code pseudo-fragment:

The result of SIOCGIFADDR is a struct sockaddr, or for an INET socket a
struct sockaddr_in, which has an (unused) port number at the front.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:45    [W:0.042 / U:0.844 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site