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;
|
struct termios ts;
|
||||||
size_t sz;
|
size_t sz;
|
||||||
u_char *datap, packet[IP_MAXPACKET];
|
u_char *datap, packet[IP_MAXPACKET];
|
||||||
char *ep, *source, *target;
|
char *ep, *source, *target, *payload;
|
||||||
struct hostent *hp;
|
struct hostent *hp;
|
||||||
#ifdef IPSEC_POLICY_IPSEC
|
#ifdef IPSEC_POLICY_IPSEC
|
||||||
char *policy_in, *policy_out;
|
char *policy_in, *policy_out;
|
||||||
@ -249,7 +249,6 @@ main(argc, argv)
|
|||||||
alarmtimeout = df = preload = tos = 0;
|
alarmtimeout = df = preload = tos = 0;
|
||||||
|
|
||||||
outpack = outpackhdr + sizeof(struct ip);
|
outpack = outpackhdr + sizeof(struct ip);
|
||||||
datap = &outpack[MINICMPLEN + PHDR_LEN];
|
|
||||||
while ((ch = getopt(argc, argv,
|
while ((ch = getopt(argc, argv,
|
||||||
"ADI:LQRS:T:c:adfi:l:m:Mnop:qrs:t:vz:"
|
"ADI:LQRS:T:c:adfi:l:m:Mnop:qrs:t:vz:"
|
||||||
#ifdef IPSEC
|
#ifdef IPSEC
|
||||||
@ -341,7 +340,7 @@ main(argc, argv)
|
|||||||
break;
|
break;
|
||||||
case 'p': /* fill buffer with user pattern */
|
case 'p': /* fill buffer with user pattern */
|
||||||
options |= F_PINGFILLED;
|
options |= F_PINGFILLED;
|
||||||
fill((char *)datap, optarg);
|
payload = optarg;
|
||||||
break;
|
break;
|
||||||
case 'Q':
|
case 'Q':
|
||||||
options |= F_QUIET2;
|
options |= F_QUIET2;
|
||||||
@ -427,6 +426,10 @@ main(argc, argv)
|
|||||||
if (datalen > maxpayload)
|
if (datalen > maxpayload)
|
||||||
errx(EX_USAGE, "packet size too large: %lu > %u", datalen,
|
errx(EX_USAGE, "packet size too large: %lu > %u", datalen,
|
||||||
maxpayload);
|
maxpayload);
|
||||||
|
datap = &outpack[MINICMPLEN + PHDR_LEN];
|
||||||
|
if (options & F_PINGFILLED) {
|
||||||
|
fill((char *)datap, payload);
|
||||||
|
}
|
||||||
if (source) {
|
if (source) {
|
||||||
bzero((char *)&sin, sizeof(sin));
|
bzero((char *)&sin, sizeof(sin));
|
||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
|
Loading…
Reference in New Issue
Block a user