diff mbox

[v3,3/3] ping: use gateway address for routing

Message ID 1462248067-15346-3-git-send-email-nikunj@linux.vnet.ibm.com
State Superseded
Headers show

Commit Message

Nikunj A Dadhania May 3, 2016, 4:01 a.m. UTC
ping was failing for machine across the subnet with statically assinged
IP address. The parsed gateway address was ignored in the stack because
the router variable was not set.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
---
 clients/net-snk/app/netapps/ping.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Thomas Huth May 3, 2016, 7:53 a.m. UTC | #1
On 03.05.2016 06:01, Nikunj A Dadhania wrote:
> ping was failing for machine across the subnet with statically assinged
> IP address. The parsed gateway address was ignored in the stack because
> the router variable was not set.
> 
> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
> ---
>  clients/net-snk/app/netapps/ping.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/clients/net-snk/app/netapps/ping.c b/clients/net-snk/app/netapps/ping.c
> index bd8f2d3..369951a 100644
> --- a/clients/net-snk/app/netapps/ping.c
> +++ b/clients/net-snk/app/netapps/ping.c
> @@ -166,6 +166,8 @@ ping(int argc, char *argv[])
>  
>  	} else {
>  		memcpy(&fn_ip.own_ip, &ping_args.client_ip.integer, 4);
> +		if (ping_args.gateway_ip.integer)
> +			set_ipv4_router(ping_args.gateway_ip.integer);
>  		if (!ping_args.netmask) {
>  			/* Netmask is not provided, assume default according to
>  			 * the network class

Reviewed-by: Thomas Huth <thuth@redhat.com>

By the way, have you checked whether the code in netboot.c works right
already when specifying a router manually? I can see another call to
set_ipv4_router() dhcp.c, but there does not seem to be something
similar for the manual netload process?

 Thomas
Nikunj A Dadhania May 3, 2016, 8:08 a.m. UTC | #2
Thomas Huth <thuth@redhat.com> writes:

> On 03.05.2016 06:01, Nikunj A Dadhania wrote:
>> ping was failing for machine across the subnet with statically assinged
>> IP address. The parsed gateway address was ignored in the stack because
>> the router variable was not set.
>> 
>> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>> ---
>>  clients/net-snk/app/netapps/ping.c | 2 ++
>>  1 file changed, 2 insertions(+)
>> 
>> diff --git a/clients/net-snk/app/netapps/ping.c b/clients/net-snk/app/netapps/ping.c
>> index bd8f2d3..369951a 100644
>> --- a/clients/net-snk/app/netapps/ping.c
>> +++ b/clients/net-snk/app/netapps/ping.c
>> @@ -166,6 +166,8 @@ ping(int argc, char *argv[])
>>  
>>  	} else {
>>  		memcpy(&fn_ip.own_ip, &ping_args.client_ip.integer, 4);
>> +		if (ping_args.gateway_ip.integer)
>> +			set_ipv4_router(ping_args.gateway_ip.integer);
>>  		if (!ping_args.netmask) {
>>  			/* Netmask is not provided, assume default according to
>>  			 * the network class
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
>
> By the way, have you checked whether the code in netboot.c works right
> already when specifying a router manually? I can see another call to
> set_ipv4_router() dhcp.c, but there does not seem to be something
> similar for the manual netload process?

Yes, thats not there as well. But netboot.c is a maze wrt argument
parsing. There is a lot of scope of consolidating that piece of code. I
will send separate patches(wip) addressing those.

Regards,
Nikunj
diff mbox

Patch

diff --git a/clients/net-snk/app/netapps/ping.c b/clients/net-snk/app/netapps/ping.c
index bd8f2d3..369951a 100644
--- a/clients/net-snk/app/netapps/ping.c
+++ b/clients/net-snk/app/netapps/ping.c
@@ -166,6 +166,8 @@  ping(int argc, char *argv[])
 
 	} else {
 		memcpy(&fn_ip.own_ip, &ping_args.client_ip.integer, 4);
+		if (ping_args.gateway_ip.integer)
+			set_ipv4_router(ping_args.gateway_ip.integer);
 		if (!ping_args.netmask) {
 			/* Netmask is not provided, assume default according to
 			 * the network class