Skip to contentSkip to conversation

ipv6: use the right ifindex when replying to icmpv6 from localhost

PATCH Superseded Fernando Fernandez Mancera 3 participants 9 messages Jan 7 – Jan 20

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 ipv6: use the right ifindex when replying to icmpv6 from localhost

When replying to a ICMPv6 echo request that comes from localhost address the right output ifindex is 1 (lo) and not rt6i_idev dev index. Use the skb device ifindex instead. This fixes pinging to a local address from localhost source address.

$ ping6 -I ::1 2001:1:1::2 -c 3
PING 2001:1:1::2 (2001:1:1::2) from ::1 : 56 data bytes
64 bytes from 2001:1:1::2: icmp_seq=1 ttl=64 time=0.037 ms
64 bytes from 2001:1:1::2: icmp_seq=2 ttl=64 time=0.069 ms
64 bytes from 2001:1:1::2: icmp_seq=3 ttl=64 time=0.122 ms

2001:1:1::2 ping statistics
3 packets transmitted, 3 received, 0% packet loss, time 2032ms rtt min/avg/max/mdev = 0.037/0.076/0.122/0.035 ms

Fixes 1b70d792cf67 ("ipv6: Use rt6i_idev index for echo replies to a local address")

---
v2: no changes

---
 net/ipv6/icmp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv6/icmp.c +3 -1
index 5d2f90babaa5..5de254043133 100644
@@ -965,7 +965,9 @@ static enum skb_drop_reason icmpv6_echo_reply(struct sk_buff *skb)
 	fl6.daddr = ipv6_hdr(skb)->saddr;
 	if (saddr)
 		fl6.saddr = *saddr;
-	fl6.flowi6_oif = icmp6_iif(skb);
+	fl6.flowi6_oif = ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LOOPBACK ?
+			 skb->dev->ifindex :
+			 icmp6_iif(skb);
 	fl6.fl6_icmp_type = type;
 	fl6.flowi6_mark = mark;
 	fl6.flowi6_uid = sock_net_uid(net, NULL);
Signature · 1 line
2.52.0
#1 lore raw

PATCH v2 2/2 selftests: ipv6_icmp: add tests for ICMPv6 handling

Test ICMPv6 to link local address and local address, also VRF based tests. In addition, this test set could be extended to cover more situations in the future.

ICMPv6 to local addresses

    TEST: Ping to link local address                                    [OK]
    TEST: Ping to link local address from ::1                           [OK]
    TEST: Ping to local address                                         [OK]
    TEST: Ping to local address from ::1                                [OK]

ICMPv6 to VRF based local address

    TEST: Ping to link local address on VRF context                     [OK]
    TEST: Ping to link local address from ::1 on VRF context            [OK]
    TEST: Ping to local address on VRF context                          [OK]
    TEST: Ping to local address from ::1 on VRF context                 [OK]
Tests passed:   8
Tests failed:   0

---
v2: shellcheck fixes, added VRF based tests and simplified linklocal address parsing

---
 tools/testing/selftests/net/Makefile     |   1 +
 tools/testing/selftests/net/ipv6_icmp.sh | 244 +++++++++++++++++++++++
 2 files changed, 245 insertions(+)
 create mode 100755 tools/testing/selftests/net/ipv6_icmp.sh
tools/testing/selftests/net/Makefile +1 -0
index b66ba04f19d9..4d29b47bb084 100644
@@ -47,6 +47,7 @@ TEST_PROGS := \
 	ip_local_port_range.sh \
 	ipv6_flowlabel.sh \
 	ipv6_force_forwarding.sh \
+	ipv6_icmp.sh \
 	ipv6_route_update_soft_lockup.sh \
 	l2_tos_ttl_inherit.sh \
 	l2tp.sh \
tools/testing/selftests/net/ipv6_icmp.sh new file +244 -0

244 lines not on this page · raw message

Signature · 1 line
2.52.0
maintainer
#2 lore raw

Re: [PATCH 2/2 net-next v2] selftests: ipv6_icmp: add tests for ICMPv6 handling

Quoted 13 lines · Fernando Fernandez Mancera
tools/testing/selftests/net/ipv6_icmp.sh new file +13 -0
+icmpv6_to_vrf_based_local_address()
+{
+	local rc
+	local lldummy
+
+	echo
+	echo "ICMPv6 to VRF based local address"
+
+	setup
+
+	lldummy=$(get_linklocal dummy0)
+
+	if [ -z "$lldummy" ]; then

tools/testing/selftests/net/ipv6_icmp.sh line 158

Quoted 10 lines
tools/testing/selftests/net/ipv6_icmp.sh new file +10 -0
+		echo "Failed to get link local address for dummy0"
+		return 1
+	fi
+
+	run_cmd "$NS_EXEC sysctl -w net.ipv6.conf.all.keep_addr_on_down=1"
+
+	# create VRF and setup
+	run_cmd "$IP link add vrf0 type vrf table 10"
+	run_cmd "$IP link set vrf0 up"
+	run_cmd "$IP link set dummy0 master vrf0"

run_cmd "$IP -6 addr add ::1 dev vrf0 nodad"

makes the VRF device the loopback.

tools/testing/selftests/net/ipv6_icmp.sh line 162

Quoted 4 lines
tools/testing/selftests/net/ipv6_icmp.sh new file +4 -0
+
+	# route to reach 2001:db8::1/128 on VRF device and back to ::1
+	run_cmd "$IP -6 route add 2001:db8:1::1/64 dev vrf0"
+	run_cmd "$IP -6 route add ::1/128 dev vrf0 table 10"

and then this route add should not be needed. This is how fcnal-test.sh works.

tools/testing/selftests/net/ipv6_icmp.sh line 169

Quoted 7 lines
tools/testing/selftests/net/ipv6_icmp.sh new file +7 -0
+
+	# ping6 to link local address
+	run_cmd "$NS_EXEC ${ping6} -c 3 $lldummy%dummy0"
+	log_test $? 0 "Ping to link local address on VRF context"
+
+	# ping6 to link local address from localhost (::1)
+	run_cmd "$NS_EXEC ${ping6} -c 3 -I ::1 $lldummy%dummy0"

-I vrf0 should be needed for all VRF tests. I suspect your current passing tests are because you have a single setup step and then run non-VRF test followed by VRF test. Really you need to do the setup, run_test, cleanup for each test.

Quoted 11 lines
tools/testing/selftests/net/ipv6_icmp.sh new file +11 -0
+	log_test $? 0 "Ping to link local address from ::1 on VRF context"
+
+	# ping6 to local address
+	run_cmd "$NS_EXEC ${ping6} -c 3 2001:db8:1::1"
+	log_test $? 0 "Ping to local address on VRF context"
+
+	# ping6 to local address from localhost (::1)
+	run_cmd "$NS_EXEC ${ping6} -c 3 -I ::1 2001:db8:1::1"
+	log_test $? 0 "Ping to local address from ::1 on VRF context"
+}
+
#3 lore raw

Re: [PATCH 2/2 net-next v2] selftests: ipv6_icmp: add tests for ICMPv6 handling

Quoted 29 lines · David Ahern
Quoted 13 lines · Fernando Fernandez Mancera
tools/testing/selftests/net/ipv6_icmp.sh new file +13 -0
+icmpv6_to_vrf_based_local_address()
+{
+	local rc
+	local lldummy
+
+	echo
+	echo "ICMPv6 to VRF based local address"
+
+	setup
+
+	lldummy=$(get_linklocal dummy0)
+
+	if [ -z "$lldummy" ]; then

tools/testing/selftests/net/ipv6_icmp.sh line 158

Quoted 10 lines
tools/testing/selftests/net/ipv6_icmp.sh new file +10 -0
+		echo "Failed to get link local address for dummy0"
+		return 1
+	fi
+
+	run_cmd "$NS_EXEC sysctl -w net.ipv6.conf.all.keep_addr_on_down=1"
+
+	# create VRF and setup
+	run_cmd "$IP link add vrf0 type vrf table 10"
+	run_cmd "$IP link set vrf0 up"
+	run_cmd "$IP link set dummy0 master vrf0"

run_cmd "$IP -6 addr add ::1 dev vrf0 nodad"

makes the VRF device the loopback.

Quoted 8 lines

tools/testing/selftests/net/ipv6_icmp.sh line 162

Quoted 4 lines
tools/testing/selftests/net/ipv6_icmp.sh new file +4 -0
+
+	# route to reach 2001:db8::1/128 on VRF device and back to ::1
+	run_cmd "$IP -6 route add 2001:db8:1::1/64 dev vrf0"
+	run_cmd "$IP -6 route add ::1/128 dev vrf0 table 10"

and then this route add should not be needed. This is how fcnal-test.sh works.

Oh neat! Thanks.

Quoted 4 lines
Quoted 4 lines
tools/testing/selftests/net/ipv6_icmp.sh new file +4 -0
+
+	# ping6 to link local address
+	run_cmd "$NS_EXEC ${ping6} -c 3 $lldummy%dummy0"
+	log_test $? 0 "Ping to link local address on VRF context"
Quoted 9 lines

tools/testing/selftests/net/ipv6_icmp.sh line 124

Quoted 3 lines
tools/testing/selftests/net/ipv6_icmp.sh new file +3 -0
+
+	# ping6 to link local address from localhost (::1)
+	run_cmd "$NS_EXEC ${ping6} -c 3 -I ::1 $lldummy%dummy0"

-I vrf0 should be needed for all VRF tests. I suspect your current passing tests are because you have a single setup step and then run non-VRF test followed by VRF test. Really you need to do the setup, run_test, cleanup for each test.

You are right here about the cleanup, although the tests are passing even if the cleanup is properly done or if -t icmpv6_to_vrf_based_local_address. I don't see why they should not pass.

I am changing them to use -I vrf0 because it makes more sense.

Thanks for the feedback!
Fernando.

Quoted 12 lines
Quoted 11 lines
tools/testing/selftests/net/ipv6_icmp.sh new file +11 -0
+	log_test $? 0 "Ping to link local address from ::1 on VRF context"
+
+	# ping6 to local address
+	run_cmd "$NS_EXEC ${ping6} -c 3 2001:db8:1::1"
+	log_test $? 0 "Ping to local address on VRF context"
+
+	# ping6 to local address from localhost (::1)
+	run_cmd "$NS_EXEC ${ping6} -c 3 -I ::1 2001:db8:1::1"
+	log_test $? 0 "Ping to local address from ::1 on VRF context"
+}
+
maintainer
#4 lore raw

Re: [PATCH 2/2 net-next v2] selftests: ipv6_icmp: add tests for ICMPv6 handling

Quoted 55 lines · Fernando Fernandez Mancera
Quoted 29 lines · David Ahern
Quoted 13 lines · Fernando Fernandez Mancera
tools/testing/selftests/net/ipv6_icmp.sh new file +13 -0
+icmpv6_to_vrf_based_local_address()
+{
+    local rc
+    local lldummy
+
+    echo
+    echo "ICMPv6 to VRF based local address"
+
+    setup
+
+    lldummy=$(get_linklocal dummy0)
+
+    if [ -z "$lldummy" ]; then

tools/testing/selftests/net/ipv6_icmp.sh line 158

Quoted 10 lines
tools/testing/selftests/net/ipv6_icmp.sh new file +10 -0
+        echo "Failed to get link local address for dummy0"
+        return 1
+    fi
+
+    run_cmd "$NS_EXEC sysctl -w net.ipv6.conf.all.keep_addr_on_down=1"
+
+    # create VRF and setup
+    run_cmd "$IP link add vrf0 type vrf table 10"
+    run_cmd "$IP link set vrf0 up"
+    run_cmd "$IP link set dummy0 master vrf0"

run_cmd "$IP -6 addr add ::1 dev vrf0 nodad"

makes the VRF device the loopback.

Quoted 8 lines
Quoted 4 lines

+
+    # route to reach 2001:db8::1/128 on VRF device and back to ::1 +    run_cmd "$IP -6 route add 2001:db8:1::1/64 dev vrf0" +    run_cmd "$IP -6 route add ::1/128 dev vrf0 table 10"

and then this route add should not be needed. This is how fcnal-test.sh works.

Oh neat! Thanks.

Quoted 4 lines
Quoted 4 lines

+
+    # ping6 to link local address
+    run_cmd "$NS_EXEC ${ping6} -c 3 $lldummy%dummy0" +    log_test $? 0 "Ping to link local address on VRF context"

Quoted 9 lines
Quoted 3 lines

+
+    # ping6 to link local address from localhost (::1) +    run_cmd "$NS_EXEC ${ping6} -c 3 -I ::1 $lldummy%dummy0"

-I vrf0 should be needed for all VRF tests. I suspect your current passing tests are because you have a single setup step and then run non-VRF test followed by VRF test. Really you need to do the setup, run_test, cleanup for each test.

Quoted 3 lines

You are right here about the cleanup, although the tests are passing even if the cleanup is properly done or if -t icmpv6_to_vrf_based_local_address. I don't see why they should not pass.

Without ::1 on the vrf device there is no valid address. ie., ::1 is in the default vrf and dummy0 is in the VRF so it should not be allowed. Something is off.

Quoted 2 lines

I am changing them to use -I vrf0 because it makes more sense.

I should have asked yesterday: how do these tests differ from what is done in fcnal-test.sh - ipv4_ping and ipv6_ping? Those tests cover loopback, linklocal address and global address combined with vrf and no vrf.

#5 lore raw

Re: [PATCH 2/2 net-next v2] selftests: ipv6_icmp: add tests for ICMPv6 handling

Quoted 56 lines · David Ahern
Quoted 55 lines · Fernando Fernandez Mancera
Quoted 29 lines · David Ahern
Quoted 13 lines · Fernando Fernandez Mancera
tools/testing/selftests/net/ipv6_icmp.sh new file +13 -0
+icmpv6_to_vrf_based_local_address()
+{
+    local rc
+    local lldummy
+
+    echo
+    echo "ICMPv6 to VRF based local address"
+
+    setup
+
+    lldummy=$(get_linklocal dummy0)
+
+    if [ -z "$lldummy" ]; then

tools/testing/selftests/net/ipv6_icmp.sh line 158

Quoted 10 lines
tools/testing/selftests/net/ipv6_icmp.sh new file +10 -0
+        echo "Failed to get link local address for dummy0"
+        return 1
+    fi
+
+    run_cmd "$NS_EXEC sysctl -w net.ipv6.conf.all.keep_addr_on_down=1"
+
+    # create VRF and setup
+    run_cmd "$IP link add vrf0 type vrf table 10"
+    run_cmd "$IP link set vrf0 up"
+    run_cmd "$IP link set dummy0 master vrf0"

run_cmd "$IP -6 addr add ::1 dev vrf0 nodad"

makes the VRF device the loopback.

Quoted 8 lines
Quoted 4 lines

+
+    # route to reach 2001:db8::1/128 on VRF device and back to ::1 +    run_cmd "$IP -6 route add 2001:db8:1::1/64 dev vrf0" +    run_cmd "$IP -6 route add ::1/128 dev vrf0 table 10"

and then this route add should not be needed. This is how fcnal-test.sh works.

Oh neat! Thanks.

Quoted 13 lines

tools/testing/selftests/net/ipv6_icmp.sh line 169

Quoted 7 lines
tools/testing/selftests/net/ipv6_icmp.sh new file +7 -0
+
+    # ping6 to link local address
+    run_cmd "$NS_EXEC ${ping6} -c 3 $lldummy%dummy0"
+    log_test $? 0 "Ping to link local address on VRF context"
+
+    # ping6 to link local address from localhost (::1)
+    run_cmd "$NS_EXEC ${ping6} -c 3 -I ::1 $lldummy%dummy0"

-I vrf0 should be needed for all VRF tests. I suspect your current passing tests are because you have a single setup step and then run non-VRF test followed by VRF test. Really you need to do the setup, run_test, cleanup for each test.

Quoted 7 lines
Quoted 3 lines

You are right here about the cleanup, although the tests are passing even if the cleanup is properly done or if -t icmpv6_to_vrf_based_local_address. I don't see why they should not pass.

Without ::1 on the vrf device there is no valid address. ie., ::1 is in the default vrf and dummy0 is in the VRF so it should not be allowed. Something is off.

Yes, what is off is the setup but see comment below, please disregard the test file I created.

Quoted 8 lines
Quoted 2 lines

I am changing them to use -I vrf0 because it makes more sense.

I should have asked yesterday: how do these tests differ from what is done in fcnal-test.sh - ipv4_ping and ipv6_ping? Those tests cover loopback, linklocal address and global address combined with vrf and no vrf.

Sorry for my late reply. About fcnal-test.sh - ipv6_ping, I didn't know this existed, sorry. The main difference is that they do not use -I ::1. Indeed, if -I ::1 case is added for pinging a configured local address it fails. Both, vrf and no vrf.

I am preparing a v3 adding a scenario to that test instead of creating new ones.

Thank you very much David for all this feedback,
Fernando.

#6 lore raw

Re: [PATCH 2/2 net-next v2] selftests: ipv6_icmp: add tests for ICMPv6 handling

Quoted 71 lines · Fernando Fernandez Mancera
Quoted 57 lines · David Ahern
Quoted 56 lines · Fernando Fernandez Mancera
Quoted 30 lines · David Ahern
Quoted 18 lines · Fernando Fernandez Mancera
tools/testing/selftests/net/ipv6_icmp.sh new file +18 -0
+icmpv6_to_vrf_based_local_address()
+{
+    local rc
+    local lldummy
+
+    echo
+    echo "ICMPv6 to VRF based local address"
+
+    setup
+
+    lldummy=$(get_linklocal dummy0)
+
+    if [ -z "$lldummy" ]; then
+        echo "Failed to get link local address for dummy0"
+        return 1
+    fi
+
+    run_cmd "$NS_EXEC sysctl -w 
Quoted 6 lines

net.ipv6.conf.all.keep_addr_on_down=1"
+
+    # create VRF and setup
+    run_cmd "$IP link add vrf0 type vrf table 10" +    run_cmd "$IP link set vrf0 up"
+    run_cmd "$IP link set dummy0 master vrf0"

run_cmd "$IP -6 addr add ::1 dev vrf0 nodad"

makes the VRF device the loopback.

Quoted 8 lines
Quoted 4 lines

+
+    # route to reach 2001:db8::1/128 on VRF device and back to ::1 +    run_cmd "$IP -6 route add 2001:db8:1::1/64 dev vrf0" +    run_cmd "$IP -6 route add ::1/128 dev vrf0 table 10"

and then this route add should not be needed. This is how fcnal-test.sh works.

Oh neat! Thanks.

Quoted 13 lines

tools/testing/selftests/net/ipv6_icmp.sh line 169

Quoted 7 lines
tools/testing/selftests/net/ipv6_icmp.sh new file +7 -0
+
+    # ping6 to link local address
+    run_cmd "$NS_EXEC ${ping6} -c 3 $lldummy%dummy0"
+    log_test $? 0 "Ping to link local address on VRF context"
+
+    # ping6 to link local address from localhost (::1)
+    run_cmd "$NS_EXEC ${ping6} -c 3 -I ::1 $lldummy%dummy0"

-I vrf0 should be needed for all VRF tests. I suspect your current passing tests are because you have a single setup step and then run non-VRF test followed by VRF test. Really you need to do the setup, run_test, cleanup for each test.

Quoted 7 lines
Quoted 3 lines

You are right here about the cleanup, although the tests are passing even if the cleanup is properly done or if -t icmpv6_to_vrf_based_local_address. I don't see why they should not pass.

Without ::1 on the vrf device there is no valid address. ie., ::1 is in the default vrf and dummy0 is in the VRF so it should not be allowed. Something is off.

Yes, what is off is the setup but see comment below, please disregard the test file I created.

Quoted 3 lines
Quoted 2 lines

I am changing them to use -I vrf0 because it makes more sense.

Quoted 8 lines
Quoted 5 lines

I should have asked yesterday: how do these tests differ from what is done in fcnal-test.sh - ipv4_ping and ipv6_ping? Those tests cover loopback, linklocal address and global address combined with vrf and no vrf.

Sorry for my late reply. About fcnal-test.sh - ipv6_ping, I didn't know this existed, sorry. The main difference is that they do not use -I ::1. Indeed, if -I ::1 case is added for pinging a configured local address it fails. Both, vrf and no vrf.

Correction: only on no-vrf scenario, as vrf scenario uses -I $VRF it is fine.

Quoted 5 lines

I am preparing a v3 adding a scenario to that test instead of creating new ones.

Thank you very much David for all this feedback,
Fernando.

#7 lore raw
In reply to Fernando Fernandez Mancera

Hi Fernando,

Quoted 28 lines · Fernando Fernandez Mancera

When replying to a ICMPv6 echo request that comes from localhost address the right output ifindex is 1 (lo) and not rt6i_idev dev index. Use the skb device ifindex instead. This fixes pinging to a local address from localhost source address.

$ ping6 -I ::1 2001:1:1::2 -c 3
PING 2001:1:1::2 (2001:1:1::2) from ::1 : 56 data bytes
64 bytes from 2001:1:1::2: icmp_seq=1 ttl=64 time=0.037 ms
64 bytes from 2001:1:1::2: icmp_seq=2 ttl=64 time=0.069 ms
64 bytes from 2001:1:1::2: icmp_seq=3 ttl=64 time=0.122 ms

2001:1:1::2 ping statistics
3 packets transmitted, 3 received, 0% packet loss, time 2032ms rtt min/avg/max/mdev = 0.037/0.076/0.122/0.035 ms

Fixes 1b70d792cf67 ("ipv6: Use rt6i_idev index for echo replies to a local address")

---
v2: no changes

---
  net/ipv6/icmp.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv6/icmp.c +0 -0
index 5d2f90babaa5..5de254043133 100644

net/ipv6/icmp.c static enum skb_drop_reason icmpv6_echo_reply(struct sk_buff *skb) · line 973

Quoted 10 lines
net/ipv6/icmp.c +3 -1
@@ -965,7 +965,9 @@ static enum skb_drop_reason icmpv6_echo_reply(struct sk_buff *skb)
  	fl6.daddr = ipv6_hdr(skb)->saddr;
  	if (saddr)
  		fl6.saddr = *saddr;
-	fl6.flowi6_oif = icmp6_iif(skb);
+	fl6.flowi6_oif = ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LOOPBACK ?
+			 skb->dev->ifindex :
+			 icmp6_iif(skb);
  	fl6.fl6_icmp_type = type;
  	fl6.flowi6_mark = mark;
  	fl6.flowi6_uid = sock_net_uid(net, NULL);

Using ipv6_addr_loopback(&fl6.daddr) might be more efficient as it does a direct comparison of the address.

-Brian

#8 lore raw
Quoted 36 lines · Brian Haley

Hi Fernando,

Quoted 33 lines · Fernando Fernandez Mancera

When replying to a ICMPv6 echo request that comes from localhost address the right output ifindex is 1 (lo) and not rt6i_idev dev index. Use the skb device ifindex instead. This fixes pinging to a local address from localhost source address.

$ ping6 -I ::1 2001:1:1::2 -c 3
PING 2001:1:1::2 (2001:1:1::2) from ::1 : 56 data bytes
64 bytes from 2001:1:1::2: icmp_seq=1 ttl=64 time=0.037 ms
64 bytes from 2001:1:1::2: icmp_seq=2 ttl=64 time=0.069 ms
64 bytes from 2001:1:1::2: icmp_seq=3 ttl=64 time=0.122 ms

2001:1:1::2 ping statistics
3 packets transmitted, 3 received, 0% packet loss, time 2032ms rtt min/avg/max/mdev = 0.037/0.076/0.122/0.035 ms

Fixes 1b70d792cf67 ("ipv6: Use rt6i_idev index for echo replies to a local address")

---
v2: no changes
---
  net/ipv6/icmp.c | 4 +++-

  1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv6/icmp.c +0 -1
index 5d2f90babaa5..5de254043133 100644
@@ -965,7 +965,9 @@ static enum skb_drop_reason 
 icmpv6_echo_reply(struct sk_buff *skb)
       fl6.daddr = ipv6_hdr(skb)->saddr;
       if (saddr)
           fl6.saddr = *saddr;
-    fl6.flowi6_oif = icmp6_iif(skb);
Quoted 9 lines
Quoted 6 lines
net/ipv6/icmp.c +3 -0
+    fl6.flowi6_oif = ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LOOPBACK ?
+             skb->dev->ifindex :
+             icmp6_iif(skb);
       fl6.fl6_icmp_type = type;
       fl6.flowi6_mark = mark;

      fl6.flowi6_uid = sock_net_uid(net, NULL);

Using ipv6_addr_loopback(&fl6.daddr) might be more efficient as it does a direct comparison of the address.

Yes, I think you are right.

Thanks!
Fernando.

Quoted 2 lines

-Brian