[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220510172739.30823-1-tariqt@nvidia.com>
Date: Tue, 10 May 2022 20:27:39 +0300
From: Tariq Toukan <tariqt@...dia.com>
To: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
David Ahern <dsahern@...nel.org>
CC: <netdev@...r.kernel.org>, Aya Levin <ayal@...dia.com>,
Gal Pressman <gal@...dia.com>,
Saeed Mahameed <saeedm@...dia.com>,
Tariq Toukan <tariqt@...dia.com>
Subject: [PATCH net] net: ping6: Fix ping -6 with interface name
From: Aya Levin <ayal@...dia.com>
When passing interface parameter to ping -6:
$ ping -6 ::11:141:84:9 -I eth2
Results in:
PING ::11:141:84:10(::11:141:84:10) from ::11:141:84:9 eth2: 56 data bytes
ping: sendmsg: Invalid argument
ping: sendmsg: Invalid argument
Initialize the fl6's outgoing interface (OIF) before triggering
ip6_datagram_send_ctl.
Fixes: 13651224c00b ("net: ping6: support setting basic SOL_IPV6 options via cmsg")
Signed-off-by: Aya Levin <ayal@...dia.com>
Reviewed-by: Gal Pressman <gal@...dia.com>
Reviewed-by: Saeed Mahameed <saeedm@...dia.com>
Signed-off-by: Tariq Toukan <tariqt@...dia.com>
---
net/ipv6/ping.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
index ff033d16549e..83f014559c0d 100644
--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -106,6 +106,8 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
opt.tot_len = sizeof(opt);
ipc6.opt = &opt;
+ memset(&fl6, 0, sizeof(fl6));
+ fl6.flowi6_oif = oif;
err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, &ipc6);
if (err < 0)
--
2.21.0
Powered by blists - more mailing lists