mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 10:19:26 +00:00
Call fill() after maxpayload has been initialized.
Reviewed by: maxim
This commit is contained in:
parent
288a05f9ee
commit
d074d39fef
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=110054
@ -213,7 +213,7 @@ main(argc, argv)
|
||||
struct termios ts;
|
||||
size_t sz;
|
||||
u_char *datap, packet[IP_MAXPACKET];
|
||||
char *ep, *source, *target;
|
||||
char *ep, *source, *target, *payload;
|
||||
struct hostent *hp;
|
||||
#ifdef IPSEC_POLICY_IPSEC
|
||||
char *policy_in, *policy_out;
|
||||
@ -249,7 +249,6 @@ main(argc, argv)
|
||||
alarmtimeout = df = preload = tos = 0;
|
||||
|
||||
outpack = outpackhdr + sizeof(struct ip);
|
||||
datap = &outpack[MINICMPLEN + PHDR_LEN];
|
||||
while ((ch = getopt(argc, argv,
|
||||
"ADI:LQRS:T:c:adfi:l:m:Mnop:qrs:t:vz:"
|
||||
#ifdef IPSEC
|
||||
@ -341,7 +340,7 @@ main(argc, argv)
|
||||
break;
|
||||
case 'p': /* fill buffer with user pattern */
|
||||
options |= F_PINGFILLED;
|
||||
fill((char *)datap, optarg);
|
||||
payload = optarg;
|
||||
break;
|
||||
case 'Q':
|
||||
options |= F_QUIET2;
|
||||
@ -427,6 +426,10 @@ main(argc, argv)
|
||||
if (datalen > maxpayload)
|
||||
errx(EX_USAGE, "packet size too large: %lu > %u", datalen,
|
||||
maxpayload);
|
||||
datap = &outpack[MINICMPLEN + PHDR_LEN];
|
||||
if (options & F_PINGFILLED) {
|
||||
fill((char *)datap, payload);
|
||||
}
|
||||
if (source) {
|
||||
bzero((char *)&sin, sizeof(sin));
|
||||
sin.sin_family = AF_INET;
|
||||
|
Loading…
Reference in New Issue
Block a user