in4_pton(9)
π in4_pton(9) π
okay so bestie, welcome to the Kernel API Manual β yes that's the manual name, we're fancy here π
β and today's main character is in4_pton, which is literally the glow-up from IPv4 literal to binary. no cap.
β¨ NAME β¨
in4_pton β convert an IPv4 address from literal to binary representation π¦
πΈ SYNOPSIS πΈ
int in4_pton (const char *src , int srclen , u8 *dst , int delim , const
char **end );
like, five arguments, all iconic, all doing their job π
π ARGUMENTS π
srcβ the start of the IPv4 address string. this is where the vibe begins, fr fr.srclenβ the length of the string. and plot twist:-1meansstrlen(src)β she'll figure it out herself, self-sufficient queen β¨dstβ the binary (u8[4] array) representation of the IPv4 address. yes, exactlyu8[4], not "whatever", she counts πdelimβ the delimiter of the IPv4 address insrc, and-1means no delimiter. boundaries, we love to see them π«Άendβ A pointer to the end of the parsed string will be placed here. she leaves a little note for you, cute π
π¦ DESCRIPTION π¦
Return one on success π β that's the win, that's the slay.
Return zero when any error occurs π (yeah, zero is the bad ending) and end will point to the end of the parsed string.
that's it, that's the whole personality. simple, effective, no toxic complexity.
bestie heads up: zero is the error return here, so do not get it twisted β one means success, zero means something went wrong π
π§ SEE ALSO π§
- Kernel file
./net/core/utils.cβ the literal address of the function, go read the source iykyk π in6_pton(9)β her IPv6 cousin, equally iconic πinet_pton_with_scope(9)β the scoped one π₯inet_proto_csum_replace16(9)β checksum energy, very main character β
and that's the whole page, bestie π β brought to you by the crew at ./net/core, stamped October 2026, and honestly? ate. periodt. ππΈπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms