• Blitzping: A very high-speed, configurable, and portable packet-craftin

    From Fereydoun Memarzanjany@21:1/5 to All on Fri Aug 23 11:04:46 2024
    XPost: comp.lang.c, alt.comp.networking.routers, alt.2600.hackers
    XPost: comp.os.linux.misc, comp.unix.misc

    https://github.com/Thraetaona/Blitzping

    Hello!

    I've been working on Blitzping for the past few weeks. Blitzping is an open-source (GPLv3.0+) packet-crafting and sending utility designed to
    be much faster, more portable, and more configurable than existing tools
    like nping and hping3.

    Developed with embedded devices in mind, Blitzping operates with
    bare-minimum dependencies, requiring only POSIX.1-2001 Berkeley sockets (without any non-standard BSD-, GNU-, SysV, or XSI-specific extensions);
    this makes it highly portable to low-power MIPS- and ARM-based routers.
    The codebase uses C11 syntax (e.g., anonymous structs and comma lists)
    but without any hard dependency on actual C11 headers; it can compile
    under C99 just fine. Additionally, seeing how standard-nonconformance
    resulted in hping3's source code failing to compile under new compilers
    without requiring manual patches, Blitzping's source code gets compiled
    under "-Wall -Wextra -Werror -pedantic-errors" by default.

    Other than giving the user more control over editing all parts
    (including the reserved bits, unlike hping3/nping) of their packets,
    Blitzping also introduces several unique performance optimizations: pre-generating and buffering packets, multithreading, using asynchronous sockets, and using vectored I/O to minimize system calls. These
    optimizations enable Blitzping to significantly outperform its
    counterparts, achieving up to millions of (40-byte) packets per second
    even on underpowered ARM-based systems.

    Shown below are comparisons between Blitzping, hping3, and nping across
    two CPUs running OpenWrt GNU/Linux v23.05.03 (more details in the linked repository https://github.com/Thraetaona/Blitzping):

    # Quad-Core "Rockchip RK3328" CPU @ 1.3 GHz. (ARMv8-A) #
    +--------------------+--------------+--------------+---------------+
    | ARM (4 x 1.3 GHz) | nping | hping3 | Blitzping |
    +--------------------+ -------------+--------------+---------------+
    | Num. Instances | 4 (1 thread) | 4 (1 thread) | 1 (4 threads) |
    | Pkts. per Second | ~65,000 | ~80,000 | ~3,150,000 |
    | Bandwidth (MiB/s) | ~2.50 | ~3.00 | ~120 |
    +--------------------+--------------+--------------+---------------+

    # Single-Core "Qualcomm Atheros QCA9533" SoC @ 650 MHz. (MIPS32r2) #
    +--------------------+--------------+--------------+---------------+
    | MIPS (1 x 650 MHz) | nping | hping3 | Blitzping |
    +--------------------+--------------+--------------+---------------+
    | Num. Instances | 1 (1 thread) | 1 (1 thread) | 1 (1 thread) |
    | Pkts. per Second | ~5,000 | ~10,000 | ~420,000 |
    | Bandwidth (MiB/s) | ~0.20 | ~0.40 | ~16 |
    +--------------------+--------------+--------------+---------------+

    In terms of protocol support, as of the time of writing, the IPv4
    interface is complete and the TCP frontend is almost finished, too.
    Afterward, I will be adding IPv6, UDP, and ICMP support.

    (There's also an entry in the FSF directory for Blitzping: https://directory.fsf.org/wiki/Blitzping)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)