Re: [PATCH] portability: handle ifreq differences in virnetdev

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

 



On 04/29/2013 11:48 AM, Eric Blake wrote:
> On 04/27/2013 09:50 AM, Roman Bogorodskiy wrote:
>> FreeBSD (and maybe other BSDs) have different member
>> names in struct ifreq when compared to Linux, such as:
>>
>>  - uses ifr_data instead of ifr_newname for setting
>>    interface names
>>  - uses ifr_index instead of ifr_ifindex for interface
>>    index
>>
>> Also, add a check for SIOCGIFHWADDR for virNetDevValidateConfig().
>>
>> Use AF_LOCAL if AF_PACKET is not available.
>> ---
> 
> Overall, looks sane; I'll probably apply the touchups mentioned and push
> later today after testing on my own FreeBSD VM.

With this patch, I'm getting a compile failure on FreeBSD 8.2:

util/virnetdev.c:667: error: 'struct ifreq' has no member named
'ifr_ifindex'

Looking further, I see <net/if.h> has:

struct ifreq {
...
 union {
  ...
  short ifru_index;
 } ifr_ifru;
#define ifr_index ifr_ifru.ifru_index
};

so it should have picked the ifreq.ifr_index path; next looking at
config.log, I see:

configure:67334: checking for struct ifreq.ifr_index
configure:67334: gcc -std=gnu99 -c -g  -D_THREAD_SAFE -D_THREAD_SAFE
conftest.c >&5
In file included from conftest.c:540:
/usr/include/net/if.h:305: error: field 'ifru_addr' has incomplete type

aha - BSD's <net/if.h> is not self-contained.

I'm now testing a minor tweak to configure.ac to include further pre-req
headers; I'll post the modified version of your patch that finally gets
things working for me.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]