/* enable broadcast pings */
setsockopt_broadcast(pingsock);
- /* set recv buf for broadcast pings */
- sockopt = 48 * 1024; /* explain why 48k? */
+ /* set recv buf (needed if we can get lots of responses: flood ping,
+ * broadcast ping etc) */
+ sockopt = (datalen * 2) + 7 * 1024; /* giving it a bit of extra room */
setsockopt(pingsock, SOL_SOCKET, SO_RCVBUF, &sockopt, sizeof(sockopt));
signal(SIGINT, print_stats_and_exit);
/* enable broadcast pings */
setsockopt_broadcast(pingsock);
- /* set recv buf for broadcast pings */
- sockopt = 48 * 1024; /* explain why 48k? */
+ /* set recv buf (needed if we can get lots of responses: flood ping,
+ * broadcast ping etc) */
+ sockopt = (datalen * 2) + 7 * 1024; /* giving it a bit of extra room */
setsockopt(pingsock, SOL_SOCKET, SO_RCVBUF, &sockopt, sizeof(sockopt));
sockopt = offsetof(struct icmp6_hdr, icmp6_cksum);