diff mbox series

[net-next] pktgen: do not abuse IN6_ADDR_HSIZE

Message ID 1509809234.2849.73.camel@edumazet-glaptop3.roam.corp.google.com
State Accepted, archived
Delegated to: David Miller
Headers show
Series [net-next] pktgen: do not abuse IN6_ADDR_HSIZE | expand

Commit Message

Eric Dumazet Nov. 4, 2017, 3:27 p.m. UTC
From: Eric Dumazet <edumazet@google.com>

pktgen accidentally used IN6_ADDR_HSIZE, instead of using the size of an
IPv6 address.

Since IN6_ADDR_HSIZE recently was increased from 16 to 256, this old
bug is hitting us.

Fixes: 3f27fb23219e ("ipv6: addrconf: add per netns perturbation in inet6_addr_hash()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 net/core/pktgen.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Nov. 5, 2017, 12:17 a.m. UTC | #1
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 04 Nov 2017 08:27:14 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> pktgen accidentally used IN6_ADDR_HSIZE, instead of using the size of an
> IPv6 address.
> 
> Since IN6_ADDR_HSIZE recently was increased from 16 to 256, this old
> bug is hitting us.
> 
> Fixes: 3f27fb23219e ("ipv6: addrconf: add per netns perturbation in inet6_addr_hash()")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.
diff mbox series

Patch

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 6e1e10ff433a5f4097d1d4b33848ab13d4e005c6..e3fa53a07d34b3e5f6b438e08b440f520b3cd6d4 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2165,7 +2165,7 @@  static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
 						+ pkt_dev->pkt_overhead;
 		}
 
-		for (i = 0; i < IN6_ADDR_HSIZE; i++)
+		for (i = 0; i < sizeof(struct in6_addr); i++)
 			if (pkt_dev->cur_in6_saddr.s6_addr[i]) {
 				set = 1;
 				break;