Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Mar 2012 09:57:25 +0300
From:      Sergey Kandaurov <pluknet@gmail.com>
To:        hiren panchasara <hiren.panchasara@gmail.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Difference between "struct addr" and "struct addrs"
Message-ID:  <CAE-mSOKrY7-p2mt_0tp2OqcTzjBuzj9g4Kjnx6ZHTQb=XxRduA@mail.gmail.com>
In-Reply-To: <CALCpEUFED9-ZNwLCVFKfx1_Vyh9tNVXauhwSdPqmtCQa8DcJ2w@mail.gmail.com>
References:  <CALCpEUFED9-ZNwLCVFKfx1_Vyh9tNVXauhwSdPqmtCQa8DcJ2w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 6 March 2012 06:05, hiren panchasara <hiren.panchasara@gmail.com> wrote:
> What is the difference between following 2 structs?
>
> /src/sys/net/if_var.h: struct ifaddr (from the comments seems like it
> contains a particular address (of probably many) information for an
> interface.)
>
> /src/include/ifaddrs.h: struct ifaddrs
>

struct ifaddr is the in-kernel representation of the interface address.
In kernel each network interface consists of a linked list of interface
addresses, described by ifaddr structures.
See man ifnet(9): http://man.freebsd.org/ifnet

struct ifaddrs is used in the userland BSD API getifaddrs(3). This interface
is used to get interface addresses in userland programs. See how it is
used in e.g. ifconfig(8) sources: /usr/src/sbin/ifconfig/ifconfig.c
See man getifaddrs(3): http://man.freebsd.org/getifaddrs

-- 
wbr,
pluknet



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-mSOKrY7-p2mt_0tp2OqcTzjBuzj9g4Kjnx6ZHTQb=XxRduA>