ipvs: fix ipv6 route unreach panic
Subsystems (3)
PATCH 1/1 ipvs: fix ipv6 route unreach panic
Previously there was a trivial panic
unshare -n /bin/bash <<EOF
ip addr add dev lo face::1/128
ipvsadm -A -t [face::1]:15213
ipvsadm -a -t [face::1]:15213 -r b00c::1
echo boom | nc face::1 15213
EOF
This patch allows us to replicate the net logic above and simply capture the skb_dst(skb)->dev and use that for the purpose of the invocation.
--- net/netfilter/ipvs/ip_vs_xmit.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/netfilter/ipvs/ip_vs_xmit.c +7 -0
@@ -505,6 +505,13 @@ err_put:return -1 ; err_unreach: +/* The ip6_link_failure function requires the dev field to be set +* in order to get the net (further for the sake of fwmark +* reflection). +*/ +if (!skb->dev) + skb->dev =skb_dst (skb)->dev; +dst_link_failure (skb);return -1 ; }
Signature · 1 line
Alex Gartrell <[email protected]>
Hello,
Quoted 9 lines · Alex Gartrell
Previously there was a trivial panic
unshare -n
/bin/bash<<EOF
ip addr add dev lo face::1/128
ipvsadm -A -t [face::1]:15213
ipvsadm -a -t [face::1]:15213 -r b00c::1
echo boom | nc face::1 15213
EOF
Quoted 4 lines
This patch allows us to replicate the net logic above and simply capture the skb_dst(skb)->dev and use that for the purpose of the invocation.
Signed-off-by Alex Gartrell <[email protected]>
Looks good to me, thanks! Simon, patch looks suitable
for ipvs (net) tree.
Quoted 24 lines
--- net/netfilter/ipvs/ip_vs_xmit.c | 7 +++++++ 1 file changed, 7 insertions(+)net/netfilter/ipvs/ip_vs_xmit.c +7
-0@@ -505,6 +505,13 @@ err_put:return -1 ; err_unreach: +/* The ip6_link_failure function requires the dev field to be set +* in order to get the net (further for the sake of fwmark +* reflection). +*/ +if (!skb->dev) + skb->dev =skb_dst (skb)->dev; +dst_link_failure (skb);return -1 ; }Signature · 1 line
Alex Gartrell <[email protected]>
Regards
--
Julian Anastasov <[email protected]>
Simon Horman
maintainerQuoted 17 lines · Julian Anastasov
Hello,
Quoted 12 lines · Alex Gartrell
Previously there was a trivial panic
unshare -n
/bin/bash<<EOF
ip addr add dev lo face::1/128
ipvsadm -A -t [face::1]:15213
ipvsadm -a -t [face::1]:15213 -r b00c::1
echo boom | nc face::1 15213
EOFThis patch allows us to replicate the net logic above and simply capture the skb_dst(skb)->dev and use that for the purpose of the invocation.
Quoted 6 lines
Quoted 1 line
Signed-off-by Alex Gartrell <[email protected]>Looks good to me, thanks! Simon, patch looks suitable
for ipvs (net) tree.Acked-by Julian Anastasov <[email protected]>
Thanks, I have applied this to to the ipvs tree.
Simon Horman
maintainer[Cc Hannes]
Quoted 25 lines · Alex Gartrell
Previously there was a trivial panic
unshare -n
/bin/bash<<EOF
ip addr add dev lo face::1/128
ipvsadm -A -t [face::1]:15213
ipvsadm -a -t [face::1]:15213 -r b00c::1
echo boom | nc face::1 15213
EOFThis patch allows us to replicate the net logic above and simply capture the skb_dst(skb)->dev and use that for the purpose of the invocation.
Signed-off-by Alex Gartrell <[email protected]>--- net/netfilter/ipvs/ip_vs_xmit.c | 7 +++++++ 1 file changed, 7 insertions(+)net/netfilter/ipvs/ip_vs_xmit.c +0
-0@@ -505,6 +505,13 @@ err_put:return -1 ; err_unreach:
net/netfilter/ipvs/ip_vs_xmit.c err_put: · line 517
Quoted 10 lines
net/netfilter/ipvs/ip_vs_xmit.c +7
-0+/* The ip6_link_failure function requires the dev field to be set +* in order to get the net (further for the sake of fwmark +* reflection). +*/ +if (!skb->dev) + skb->dev =skb_dst (skb)->dev; +dst_link_failure (skb);return -1 ; }
My reading of this is that the above:
As it seems to me that it is that patch that causes ip6_link_failure to require the dev field to be set.
Does that seem sane?
Quoted 46 lines · Simon Horman
[Cc Hannes]
Quoted 30 lines · Alex Gartrell
Previously there was a trivial panic
unshare -n
/bin/bash<<EOF
ip addr add dev lo face::1/128 ipvsadm -A -t [face::1]:15213 ipvsadm -a -t [face::1]:15213 -r b00c::1 echo boom | nc face::1 15213
EOFThis patch allows us to replicate the net logic above and simply capture
the skb_dst(skb)->dev and use that for the purpose of the invocation.Signed-off-by Alex Gartrell <[email protected]>--- net/netfilter/ipvs/ip_vs_xmit.c | 7 +++++++ 1 file changed, 7 insertions(+)net/netfilter/ipvs/ip_vs_xmit.c +1
-0@@ -505,6 +505,13 @@ err_put:return -1 ; err_unreach: +/* The ip6_link_failure function requires the dev field to be set
net/netfilter/ipvs/ip_vs_xmit.c err_put: · line 517
Quoted 9 lines
net/netfilter/ipvs/ip_vs_xmit.c +6
-0+* in order to get the net (further for the sake of fwmark +* reflection). +*/ +if (!skb->dev) + skb->dev =skb_dst (skb)->dev; +dst_link_failure (skb);return -1 ; }My reading of this is that the above:
Quoted 8 lines
Fixes 1eb4f7582868 ("ipv6: in case of link failure remove routedirectly instead of letting it expire")
As it seems to me that it is that patch that causes
ip6_link_failureto
require the dev field to be set.Does that seem sane?
From what dst_link_failure -> ip6_link_failure expects the patch does make sense.
But the Fixes tag is wrong, because the panic should be triggered during dereferencing dev_net(skb->dev) in icmp6_send. This part was not touched by my patch.
Bye,
Hannes
Simon Horman
maintainerQuoted 54 lines · Hannes Frederic Sowa
Quoted 53 lines · Simon Horman
[Cc Hannes]
Quoted 30 lines · Alex Gartrell
Previously there was a trivial panic
unshare -n
/bin/bash<<EOF
ip addr add dev lo face::1/128 ipvsadm -A -t [face::1]:15213 ipvsadm -a -t [face::1]:15213 -r b00c::1 echo boom | nc face::1 15213
EOFThis patch allows us to replicate the net logic above and simply capture
the skb_dst(skb)->dev and use that for the purpose of the invocation.Signed-off-by Alex Gartrell <[email protected]>--- net/netfilter/ipvs/ip_vs_xmit.c | 7 +++++++ 1 file changed, 7 insertions(+)net/netfilter/ipvs/ip_vs_xmit.c +1
-0@@ -505,6 +505,13 @@ err_put:return -1 ; err_unreach: +/* The ip6_link_failure function requires the dev field to be set
net/netfilter/ipvs/ip_vs_xmit.c err_put: · line 517
Quoted 9 lines
net/netfilter/ipvs/ip_vs_xmit.c +6
-0+* in order to get the net (further for the sake of fwmark +* reflection). +*/ +if (!skb->dev) + skb->dev =skb_dst (skb)->dev; +dst_link_failure (skb);return -1 ; }My reading of this is that the above:
Fixes 1eb4f7582868 ("ipv6: in case of link failure remove routedirectly instead of letting it expire")
As it seems to me that it is that patch that causes
ip6_link_failureto
require the dev field to be set.
Quoted 8 lines
Quoted 3 lines
Does that seem sane?
From what
dst_link_failure->ip6_link_failureexpects the patch doesmake sense.
But the Fixes tag is wrong, because the panic should be triggered during dereferencing
dev_net(skb->dev)inicmp6_send. This part was not touched by my patch.
Thanks, of course you are correct.
I now wonder if this bug may not have been present ever since IPv6 support was added to IPv6 in v2.6.28 and thus this patch fixes b3cdd2a73867 ("IPVS: Add and bind IPv6 xmit functions") which originally added the call to dst_link_failure for IPv6.