Patch "ip: report the original address of ICMP messages" has been added to the 4.1-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
ip: report the original address of ICMP messages
to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ip-report-the-original-address-of-icmp-messages.patch
and it can be found in the queue-4.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Fri Jul 3 20:00:25 PDT 2015
From: Julian Anastasov <[email protected]>
Date: Tue, 23 Jun 2015 08:34:39 +0300
Subject: ip: report the original address of ICMP messages
From: Julian Anastasov <[email protected]>
[ Upstream commit 34b99df4e6256ddafb663c6de0711dceceddfe0e ]
ICMP messages can trigger ICMP and local errors. In this case serr->port is 0 and starting from Linux 4.0 we do not return the original target address to the error queue readers. Add function to define which errors provide addr_offset. With this fix my ping command is not silent anymore.
--- net/ipv4/ip_sockglue.c | 11 ++++++++++- net/ipv6/datagram.c | 12 +++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-)
net/ipv4/ip_sockglue.c +10 -1
@@ -432,6 +432,15 @@ void ip_local_error(struct sock *sk, intkfree_skb (skb); } +/* For some errors we have valid addr_offset even with zero payload and +* zero port. Also, addr_offset should be supported if port is set. +*/ +static inline bool ipv4_datagram_support_addr (struct sock_exterr_skb *serr) +{ +return serr->ee.ee_origin ==SO_EE_ORIGIN_ICMP || + serr->ee.ee_origin ==SO_EE_ORIGIN_LOCAL || serr->port; +} +/* IPv4 supports cmsg on all imcp errors and some timestamps * * Timestamp code paths do not initialize the fields expected by cmsg:
@@ -498,7 +507,7 @@ int ip_recv_error(struct sock *sk, struc serr =SKB_EXT_ERR (skb); -if (sin && serr->port) { +if (sin &&ipv4_datagram_support_addr (serr)) { sin->sin_family =AF_INET ; sin->sin_addr.s_addr = *(__be32 *)(skb_network_header (skb) + serr->addr_offset);
net/ipv6/datagram.c +11 -1
@@ -325,6 +325,16 @@ void ipv6_local_rxpmtu(struct sock *sk,kfree_skb (skb); } +/* For some errors we have valid addr_offset even with zero payload and +* zero port. Also, addr_offset should be supported if port is set. +*/ +static inline bool ipv6_datagram_support_addr (struct sock_exterr_skb *serr) +{ +return serr->ee.ee_origin ==SO_EE_ORIGIN_ICMP6 || + serr->ee.ee_origin ==SO_EE_ORIGIN_ICMP || + serr->ee.ee_origin ==SO_EE_ORIGIN_LOCAL || serr->port; +} +/* IPv6 supports cmsg on all origins aside from SO_EE_ORIGIN_LOCAL. * * At one point, excluding local errors was a quick test to identify icmp/icmp6
@@ -389,7 +399,7 @@ int ipv6_recv_error(struct sock *sk, str serr =SKB_EXT_ERR (skb); -if (sin && serr->port) { +if (sin &&ipv6_datagram_support_addr (serr)) {const unsigned char *nh =skb_network_header (skb); sin->sin6_family =AF_INET6 ; sin->sin6_flowinfo =0 ;
Patches currently in stable-queue which might be from [email protected] are
queue-4.1/neigh-do-not-modify-unlinked-entries.patch queue-4.1/ip-report-the-original-address-of-icmp-messages.patch