hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/ipv6/ping.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * INET An implementation of the TCP/IP protocol suite for the LINUX
34 * operating system. INET is implemented using the BSD Socket
....@@ -5,17 +6,11 @@
56 *
67 * "Ping" sockets
78 *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License
10
- * as published by the Free Software Foundation; either version
11
- * 2 of the License, or (at your option) any later version.
12
- *
139 * Based on ipv4/ping.c code.
1410 *
1511 * Authors: Lorenzo Colitti (IPv6 support)
1612 * Vasiliy Kulikov / Openwall (IPv4 implementation, for Linux 2.6),
1713 * Pavel Kankovsky (IPv4 implementation, for Linux 2.4.32)
18
- *
1914 */
2015
2116 #include <net/addrconf.h>
....@@ -101,7 +96,8 @@
10196 addr_type = ipv6_addr_type(daddr);
10297 if ((__ipv6_addr_needs_scope_id(addr_type) && !oif) ||
10398 (addr_type & IPV6_ADDR_MAPPED) ||
104
- (oif && sk->sk_bound_dev_if && oif != sk->sk_bound_dev_if))
99
+ (oif && sk->sk_bound_dev_if && oif != sk->sk_bound_dev_if &&
100
+ l3mdev_master_ifindex_by_index(sock_net(sk), oif) != sk->sk_bound_dev_if))
105101 return -EINVAL;
106102
107103 /* TODO: use ip6_datagram_send_ctl to get options from cmsg */
....@@ -116,9 +112,10 @@
116112 fl6.flowi6_uid = sk->sk_uid;
117113 fl6.fl6_icmp_type = user_icmph.icmp6_type;
118114 fl6.fl6_icmp_code = user_icmph.icmp6_code;
119
- security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
115
+ security_sk_classify_flow(sk, flowi6_to_flowi_common(&fl6));
120116
121117 ipcm6_init_sk(&ipc6, np);
118
+ ipc6.sockc.mark = sk->sk_mark;
122119 fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel);
123120
124121 dst = ip6_sk_dst_lookup_flow(sk, &fl6, daddr, false);