aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/icmp.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-05-18 18:42:43 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-18 18:42:43 -0400
commita48eff128865aa20520fa6e0e0c5fbd2ac50d712 (patch)
treec60e376c3fca23bb215c977e42661187076dccbf /net/ipv4/icmp.c
parented2361e66eec60645f8e4715fe39a42235ef43ae (diff)
ipv4: Pass explicit destination address to rt_bind_peer().
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/icmp.c')
-rw-r--r--net/ipv4/icmp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 3f47585aad68..5395e45dcce6 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -234,7 +234,7 @@ static inline void icmp_xmit_unlock(struct sock *sk)
234 */ 234 */
235 235
236static inline bool icmpv4_xrlim_allow(struct net *net, struct rtable *rt, 236static inline bool icmpv4_xrlim_allow(struct net *net, struct rtable *rt,
237 int type, int code) 237 struct flowi4 *fl4, int type, int code)
238{ 238{
239 struct dst_entry *dst = &rt->dst; 239 struct dst_entry *dst = &rt->dst;
240 bool rc = true; 240 bool rc = true;
@@ -253,7 +253,7 @@ static inline bool icmpv4_xrlim_allow(struct net *net, struct rtable *rt,
253 /* Limit if icmp type is enabled in ratemask. */ 253 /* Limit if icmp type is enabled in ratemask. */
254 if ((1 << type) & net->ipv4.sysctl_icmp_ratemask) { 254 if ((1 << type) & net->ipv4.sysctl_icmp_ratemask) {
255 if (!rt->peer) 255 if (!rt->peer)
256 rt_bind_peer(rt, 1); 256 rt_bind_peer(rt, fl4->daddr, 1);
257 rc = inet_peer_xrlim_allow(rt->peer, 257 rc = inet_peer_xrlim_allow(rt->peer,
258 net->ipv4.sysctl_icmp_ratelimit); 258 net->ipv4.sysctl_icmp_ratelimit);
259 } 259 }
@@ -363,7 +363,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
363 rt = ip_route_output_key(net, &fl4); 363 rt = ip_route_output_key(net, &fl4);
364 if (IS_ERR(rt)) 364 if (IS_ERR(rt))
365 goto out_unlock; 365 goto out_unlock;
366 if (icmpv4_xrlim_allow(net, rt, icmp_param->data.icmph.type, 366 if (icmpv4_xrlim_allow(net, rt, &fl4, icmp_param->data.icmph.type,
367 icmp_param->data.icmph.code)) 367 icmp_param->data.icmph.code))
368 icmp_push_reply(icmp_param, &fl4, &ipc, &rt); 368 icmp_push_reply(icmp_param, &fl4, &ipc, &rt);
369 ip_rt_put(rt); 369 ip_rt_put(rt);
@@ -603,7 +603,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
603 if (IS_ERR(rt)) 603 if (IS_ERR(rt))
604 goto out_unlock; 604 goto out_unlock;
605 605
606 if (!icmpv4_xrlim_allow(net, rt, type, code)) 606 if (!icmpv4_xrlim_allow(net, rt, &fl4, type, code))
607 goto ende; 607 goto ende;
608 608
609 /* RFC says return as much as we can without exceeding 576 bytes. */ 609 /* RFC says return as much as we can without exceeding 576 bytes. */