On Mon, Jun 11, 2007 at 11:34:26PM +0100, Mikolaj Kucharski wrote:
> Hi,
> 
> I've extracted two functions from Pidgin and its SIPE plugin. Both
> functions are returning an IP address of an interface (if I understand
> correctly).
> 
> I'm attaching C source and output from OpenBSD and Linux. On Linux this
> function detects an IP address correctly, but on OpenBSD not.
> 
> Here is part (among others) which I don't understand. Declaration of
> struc:
> 
>       struct ifreq *ifr;
> 
> and with printf I can see that:
> 
>       sizeof(*ifr) == sizeof(struct ifreq) /* 32 bytes */
> 
> and with my function print_buf I see that on Linux each interface starts
> every 32 bytes in a buffer[1024], but on OpenBSD this isn't the case.
> 

We don't do that, all ifreq follow each other without padding.
The size of the objects depends on the size of the passed data in such a
evil way that I will not try to explain it here. You don't want to use
that interface anyway.

> Could someone which knows the subject in question contact with me off
> the list, how to fix this issue and shed some light so I could
> understand that. Thanks in advance.
> 
> 
> My other question is, you think that Pidgin should use getifaddrs() to
> detect an IP address (please see attached source to avoid confusions)?
> 

YES. getifaddrs is the right way to receive all interface addresses.
This is easier to handle.

-- 
:wq Claudio

Reply via email to