Skip to contentSkip to conversation

ping: always initialize ->sin6_scope_id and ->sin6_flowinfo

PATCH Applied Cong Wang 3 participants 3 messages Jun 3, 2013 – Jun 4, 2013

Subsystems (2)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH v2 1/1 ping: always initialize ->sin6_scope_id and ->sin6_flowinfo

From: Cong Wang <[email protected]>

If we don't need scope id, we should initialize it to zero. Same for ->sin6_flowinfo.

Cc Lorenzo Colitti <[email protected]>
Cc David S. Miller <[email protected]>
---
 net/ipv4/ping.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
net/ipv4/ping.c +3 -3
index 71f6ad0..0f419a2 100644
@@ -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);
Acked-by on v2 1/1
#1 lore raw
Quoted 22 lines · Cong Wang

From: Cong Wang <[email protected]>

If we don't need scope id, we should initialize it to zero. Same for ->sin6_flowinfo.

Cc Lorenzo Colitti <[email protected]>
Cc David S. Miller <[email protected]>
---
 net/ipv4/ping.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
net/ipv4/ping.c +1 -0
index 71f6ad0..0f419a2 100644
@@ -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)

net/ipv4/ping.c int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, · line 903

Quoted 10 lines
net/ipv4/ping.c +2 -3
                        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);
maintainer Applied
#2 lore raw

From: Lorenzo Colitti <[email protected]>
Date: Mon, 3 Jun 2013 18:25:39 +0900

Quoted 9 lines · Cong Wang
Quoted 8 lines

From: Cong Wang <[email protected]>

If we don't need scope id, we should initialize it to zero. Same for ->sin6_flowinfo.

Cc Lorenzo Colitti <[email protected]>
Cc David S. Miller <[email protected]>

...

Quoted 1 line

Applied, thanks.