Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase maximum -s value to 65507 #344

Merged
merged 1 commit into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ci/test-03-forbidden.pl
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ END
$cmd7->stdout_is_eq("");
$cmd7->stderr_is_eq("fping: specify only one of c, l\n");

# fping -b 65509
my $cmd8 = Test::Command->new(cmd => "fping -b 65509 127.0.0.1");
# fping -b 65508
my $cmd8 = Test::Command->new(cmd => "fping -b 65508 127.0.0.1");
$cmd8->exit_is_num(1);
$cmd8->stdout_is_eq("");
$cmd8->stderr_is_eq("fping: data size 65509 not valid, must be lower than 65488\n");
$cmd8->stderr_is_eq("fping: data size 65508 not valid, must not be larger than 65507\n");

# fping -B 0.9
my $cmd9 = Test::Command->new(cmd => "fping -B 0.9 127.0.0.1");
Expand Down
6 changes: 3 additions & 3 deletions src/fping.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ extern int h_errno;

/*** Ping packet defines ***/

#define MAX_IP_PACKET 65536 /* (theoretical) max IP packet size */
#define SIZE_IP_HDR 40
#define MAX_IP_PACKET 65535 /* (theoretical) max IPv4 packet size */
auerswal marked this conversation as resolved.
Show resolved Hide resolved
#define SIZE_IP_HDR 20 /* min IPv4 header size */
auerswal marked this conversation as resolved.
Show resolved Hide resolved
#define SIZE_ICMP_HDR 8 /* from ip_icmp.h */
#define MAX_PING_DATA (MAX_IP_PACKET - SIZE_IP_HDR - SIZE_ICMP_HDR)

Expand Down Expand Up @@ -952,7 +952,7 @@ int main(int argc, char **argv)
#endif

if (ping_data_size > MAX_PING_DATA) {
fprintf(stderr, "%s: data size %u not valid, must be lower than %u\n",
fprintf(stderr, "%s: data size %u not valid, must not be larger than %u\n",
prog, ping_data_size, (unsigned int)MAX_PING_DATA);
exit(1);
}
Expand Down
Loading