in6_pton(9)
๐ in6_pton(9) ๐
okay so bestie, welcome to the in6_pton(9) page from the Kernel API Manual โ yes it's a section 9 kernel thing, and yes it is lowkey iconic. This is the one that takes your cute little IPv6 address as a string and turns it into the raw binary glow-up. โจ
๐ธ NAME ๐ธ
in6_pton โ convert an IPv6 address from literal to binary representation
Like, string in, bytes out. That's the whole vibe. ๐ฆ
โจ SYNOPSIS โจ
int in6_pton (const char *src , int srclen , u8 *dst , int delim , const char **end );
that's the whole signature, no cap โ copy it exactly, don't be out here renaming things ๐
๐ ARGUMENTS ๐
srcโ the start of the IPv6 address string. the beginning of the whole situation fr fr ๐srclenโ the length of the string, and-1meansstrlen(src). so like, if you're too lazy to count, just pass-1and let it do the math for you ๐งฎdstโ the binary (u8[16]array) representation of the IPv6 address. this is where the parsed bytes get dropped off โ a 16-elementu8array, exactly that size, no thoughts head empty ๐delimโ the delimiter of the IPv6 address insrc, and-1means no delimiter. so if your address is chillin' inside a bigger string, this tells it where to stop ๐endโ A pointer to the end of the parsed string will be placed here. so afterwards,*endpoints at where parsing wrapped up ๐ซถ
๐ DESCRIPTION ๐
Return one on success, return zero when any error occurs and end will point to the end of the parsed string. ๐
that's it, that's the contract โ 1 = slay, 0 = something went wrong ๐ญ. and either way, end gets set to the end of the parsed string, so you always know where you landed. main character behaviour honestly.
๐ฅ SEE ALSO ๐ฅ
- Kernel file
./net/core/utils.cโ that's where this lives, go read it bestie ๐ in4_pton(9)inet_pton_with_scope(9)inet_proto_csum_replace16(9)
all of these are your friends, go say hi ๐ซถ
and that's the page!! brought to you by ./net/core, version dated October 2026, page in6_pton(9) โ mwah, go parse some addresses, ily bye ๐๐งโโ๏ธ
๐ฆ 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