Skip to content

Commit

Permalink
ping: always initialize ->sin6_scope_id and ->sin6_flowinfo
Browse files Browse the repository at this point in the history
If we don't need scope id, we should initialize it to zero.
Same for ->sin6_flowinfo.

Cc: Lorenzo Colitti <lorenzo@google.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Acked-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Cong Wang authored and David S. Miller committed Jun 4, 2013
1 parent 430f03c commit c26d6b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/ipv4/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,12 +892,12 @@ int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
sin6->sin6_port = 0;
sin6->sin6_addr = ip6->saddr;

sin6->sin6_flowinfo = 0;
if (np->sndflow)
sin6->sin6_flowinfo = ip6_flowinfo(ip6);

if (__ipv6_addr_needs_scope_id(
ipv6_addr_type(&sin6->sin6_addr)))
sin6->sin6_scope_id = IP6CB(skb)->iif;
sin6->sin6_scope_id = ipv6_iface_scope_id(&sin6->sin6_addr,
IP6CB(skb)->iif);

if (inet6_sk(sk)->rxopt.all)
pingv6_ops.ip6_datagram_recv_ctl(sk, msg, skb);
Expand Down

0 comments on commit c26d6b4

Please sign in to comment.