Don't overflow our fd_set. This is not a full sync with KAME because there
are a whole lot of other changes which may not be suitable for us. Obtained from: KAME
This commit is contained in:
parent
c9f7579521
commit
5088aa38a3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=66811
@ -112,10 +112,7 @@ static const char rcsid[] =
|
|||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <net/route.h>
|
#include <net/route.h>
|
||||||
|
|
||||||
#include <netinet/in_systm.h>
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netinet/ip.h>
|
|
||||||
#include <netinet/ip_var.h>
|
|
||||||
#include <netinet/ip6.h>
|
#include <netinet/ip6.h>
|
||||||
#include <netinet/icmp6.h>
|
#include <netinet/icmp6.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
@ -268,7 +265,8 @@ main(argc, argv)
|
|||||||
struct sockaddr_in6 from;
|
struct sockaddr_in6 from;
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
fd_set fdset;
|
fd_set *fdmaskp;
|
||||||
|
int fdmasks;
|
||||||
register int cc, i;
|
register int cc, i;
|
||||||
int ch, fromlen, hold, packlen, preload, optval, ret_ga;
|
int ch, fromlen, hold, packlen, preload, optval, ret_ga;
|
||||||
u_char *datap, *packet;
|
u_char *datap, *packet;
|
||||||
@ -870,9 +868,10 @@ main(argc, argv)
|
|||||||
(void)setitimer(ITIMER_REAL, &itimer, NULL);
|
(void)setitimer(ITIMER_REAL, &itimer, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
FD_ZERO(&fdset);
|
fdmasks = howmany(s+1, NFDBITS);
|
||||||
timeout.tv_sec = 0;
|
if ((fdmaskp = malloc(fdmasks)) == NULL)
|
||||||
timeout.tv_usec = 10000;
|
err(1, "malloc");
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
struct msghdr m;
|
struct msghdr m;
|
||||||
struct cmsghdr *cm;
|
struct cmsghdr *cm;
|
||||||
@ -881,8 +880,11 @@ main(argc, argv)
|
|||||||
|
|
||||||
if (options & F_FLOOD) {
|
if (options & F_FLOOD) {
|
||||||
pinger();
|
pinger();
|
||||||
FD_SET(s, &fdset);
|
timeout.tv_sec = 0;
|
||||||
if (select(s + 1, &fdset, NULL, NULL, &timeout) < 1)
|
timeout.tv_usec = 10000;
|
||||||
|
memset(fdmaskp, 0, fdmasks);
|
||||||
|
FD_SET(s, fdmaskp);
|
||||||
|
if (select(s + 1, fdmaskp, NULL, NULL, &timeout) < 1)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fromlen = sizeof(from);
|
fromlen = sizeof(from);
|
||||||
|
Loading…
Reference in New Issue
Block a user