diff options
author | David S. Miller <davem@davemloft.net> | 2015-06-24 11:58:51 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-06-24 11:58:51 +0200 |
commit | 3a07bd6fead4f00f67b1bf5f551e686661c4f52c (patch) | |
tree | f8b8f257d928a9ae1aeb3fdbe748f03f1012f02e /net/ipv4/ip_sockglue.c | |
parent | net: inet_diag: export IPV6_V6ONLY sockopt (diff) | |
parent | stmmac: troubleshoot unexpected bits in des0 & des1 (diff) | |
download | linux-3a07bd6fead4f00f67b1bf5f551e686661c4f52c.tar.xz linux-3a07bd6fead4f00f67b1bf5f551e686661c4f52c.zip |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
drivers/net/ethernet/mellanox/mlx4/main.c
net/packet/af_packet.c
Both conflicts were cases of simple overlapping changes.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_sockglue.c')
-rw-r--r-- | net/ipv4/ip_sockglue.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 04ae2992a5cd..c3c359ad66e3 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -432,6 +432,15 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf 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 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, struct msghdr *msg, int len, int *addr_len) 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); |