[libvirt] [libvirt-sandbox][PATCH] Avoid segfault if broadcast address is NULL

Alex Jia ajia at redhat.com
Fri Mar 15 02:58:38 UTC 2013


On 03/14/2013 07:16 PM, Daniel P. Berrange wrote:
> On Thu, Mar 14, 2013 at 07:00:43PM +0800, Alex Jia wrote:
>> It seems the broadcast address parameter is not optional now, if users haven't
>> specified the broadcast address to the network interface then a segfault will
>> be raised.
>>
>> This patch is just a temporary solution to avoid segfault, and with the patch,
>> users will get a expected error "Unable to parse networks: Unable to parse
>> broadcast address (null)", of course, a better patch should automatically
>> generate a broadcast address according to actual ip address. But AFAIK,
>> the IPv6 hasn't defined broadcast address, so it needs to do address protocol
>> judgement firstly, I will try to implement it later.
> I think that if you don't explicitly set a broadcast address, then the
> kernel will set one on the device based on its address/netmask. So I
> think you can just allow a NULL bcast value everywhere in virt-sandbox
> code.
>
> Daniel

Daniel, got it and thanks for your nice comments, but I think a 
segmentation fault (core dumped)
isn't very friendly for users after all, or should we apply a patch to 
allow NULL in g_inet_address_new_from_string()?

Regards,
Alex




More information about the libvir-list mailing list