Commit 0a5ebb8000c5362be368df9d197943deb06b6916

Authored by David S. Miller
1 parent 1c3319fb69

ipv4: Pass explicit daddr arg to ip_send_reply().

This eliminates an access to rt->rt_src.

Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 3 changed files with 7 additions and 8 deletions Side-by-side Diff

... ... @@ -174,8 +174,8 @@
174 174 return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0;
175 175 }
176 176  
177   -void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg,
178   - unsigned int len);
  177 +void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
  178 + struct ip_reply_arg *arg, unsigned int len);
179 179  
180 180 struct ipv4_config {
181 181 int log_martians;
net/ipv4/ip_output.c
... ... @@ -1459,20 +1459,19 @@
1459 1459 * Should run single threaded per socket because it uses the sock
1460 1460 * structure to pass arguments.
1461 1461 */
1462   -void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg,
1463   - unsigned int len)
  1462 +void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
  1463 + struct ip_reply_arg *arg, unsigned int len)
1464 1464 {
1465 1465 struct inet_sock *inet = inet_sk(sk);
1466 1466 struct ip_options_data replyopts;
1467 1467 struct ipcm_cookie ipc;
1468 1468 struct flowi4 fl4;
1469   - __be32 daddr;
1470 1469 struct rtable *rt = skb_rtable(skb);
1471 1470  
1472 1471 if (ip_options_echo(&replyopts.opt.opt, skb))
1473 1472 return;
1474 1473  
1475   - daddr = ipc.addr = rt->rt_src;
  1474 + ipc.addr = daddr;
1476 1475 ipc.opt = NULL;
1477 1476 ipc.tx_flags = 0;
1478 1477  
... ... @@ -651,7 +651,7 @@
651 651 arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0;
652 652  
653 653 net = dev_net(skb_dst(skb)->dev);
654   - ip_send_reply(net->ipv4.tcp_sock, skb,
  654 + ip_send_reply(net->ipv4.tcp_sock, skb, ip_hdr(skb)->saddr,
655 655 &arg, arg.iov[0].iov_len);
656 656  
657 657 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
... ... @@ -726,7 +726,7 @@
726 726 if (oif)
727 727 arg.bound_dev_if = oif;
728 728  
729   - ip_send_reply(net->ipv4.tcp_sock, skb,
  729 + ip_send_reply(net->ipv4.tcp_sock, skb, ip_hdr(skb)->saddr,
730 730 &arg, arg.iov[0].iov_len);
731 731  
732 732 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);