summaryrefslogtreecommitdiff
path: root/Userland/Utilities/ping.cpp
AgeCommit message (Collapse)Author
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-22ping: Utilize TRY + Core::System wrappersBrian Gianforcaro
2022-02-17ping: Fix broken count argument errorbrapru
By storing count as an Optional<size_t>, we can leverage count's empty state to proceed with pinging indefinitely, and ensure a proper value is passed when count does have a value. This returns pings expected behavior to send infinite packets when a count is not specified, stop after sending a specified count, and disallow any count < 1. Closes #12524
2022-02-14ping: Count argument must be greater than zerobrapru
Previously, when passing 0 as a count number to the ping utility it would ping the specified host indefinitely. This is obviously not the intended behavior, so forcing the count to be in the range of 1 <= value <= UINT32_MAX resolves the issue.
2022-02-14ping: Fix off by one error in count argumentbrapru
Previously, the count and total_pings comparison was evaluated after a ping was sent for that iteration. This would cause one extra ping to be sent greater than the specific count passed.
2022-01-27ping: Port to LibMainbrapru
2022-01-24Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOrSam Atkins
Apologies for the enormous commit, but I don't see a way to split this up nicely. In the vast majority of cases it's a simple change. A few extra places can use TRY instead of manual error checking though. :^)
2022-01-22ping: Handle optional field in the IPv4 headerdayarthvader
2021-10-08Utilities: Fix -Wunreachable-code warnings from clangNico Weber
2021-09-06Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safeAli Mohammad Pur
2021-08-03Ping: Add -s argument to specify the payload size of the pingThomas Wagenveld
Change the static buffers to ByteBuffers to deal with the dynamic size of the incoming and outgoing packets. Use sizeof(struct ip) rather than the magic number '20' for the IPv4 header size. Report the size of the reply packet to the console.
2021-07-25Utilities: Add count option for pingbrapru
2021-06-01Userland: Replace most printf-style APIs with AK::Format APIs :^)Linus Groh
2021-05-17Utilities: Correct non-standard assert macros includesJean-Baptiste Boric
2021-05-14LibC: Do not include errno.h inside unistd.hJean-Baptiste Boric
POSIX does not mandate this, therefore let's not do it.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-31LibC+ping: Move internet_checksum to serenity headerIdan Horowitz
This will be useful for traceroute and any other packet related application, so this will reduce code duplication.
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-09Userland: Use INET_ADDRSTRLEN for inet_ntop() buffersLinus Groh
There's no point in using different, seemingly randomly sized buffers as the required size for storing an IPv4 address representation is well known (16 bytes).
2021-02-08ping: Replace two magic numbers with ICMP_* macrosLinus Groh
2021-01-22Kernel+Userland: Remove "dns" pledge promise aliasAndreas Kling
This was just an alias for "unix" that I added early on back when there was some belief that we might be compatible with OpenBSD. We're clearly never going to be compatible with their pledges so just drop the alias.
2021-01-12Userland: Move command-line utilities to Userland/Utilities/Andreas Kling