[SLOF] [PATCH v2 2/3] ping: add netmask in the ping argument

Thomas Huth thuth at redhat.com
Tue May 3 06:04:08 AEST 2016


On 02.05.2016 12:21, Nikunj A Dadhania wrote:
> Nikunj A Dadhania <nikunj at linux.vnet.ibm.com> writes:
>> diff --git a/clients/net-snk/app/netapps/ping.c b/clients/net-snk/app/netapps/ping.c
>> index 4facf06..3e4d440 100644
>> --- a/clients/net-snk/app/netapps/ping.c
>> +++ b/clients/net-snk/app/netapps/ping.c
...
>> @@ -163,6 +166,9 @@ ping(int argc, char *argv[])
>>
>>  	} else {
>>  		memcpy(&fn_ip.own_ip, &ping_args.client_ip.integer, 4);
>> +		if (ping_args.netmask)
>> +			set_ipv4_netmask(ping_args.netmask);
> 
> Missed the following:
> 
> +               else
> +                       set_ipv4_netmask(0xFFFFFF00UL);
> 
> is this a safe assumption when user has not provided any netmask
> variable?

I think in this case you should set the netmask according to whether
it's a class A, class B or class C network:

 Class A: 255.0.0.0
 Class B: 255.255.0.0
 Class C: 255.255.255.0

  Thomas



More information about the SLOF mailing list