[Differential] D23788: DRAFT: ng_ksocket: IPv6 address parsing and unparsing
hrs (Hiroki Sato)
phabric-noreply at FreeBSD.org
Sun Feb 23 17:24:01 UTC 2020
hrs requested changes to this revision.
hrs added inline comments.
This revision now requires changes to proceed.
INLINE COMMENTS
> ng_ksocket.c:319
> +
> + for (i = 0; i < 8; i++) {
> + u_long val;
inet_pton in libkern should be used to parse an IPv6 address. Also, you should consider to support a link-local address with an interface identifier such as [fe80::1%em0]:80.
> ng_ksocket.c:410
> +
> + slen += snprintf(cbuf, cbuflen, "inet6/[%u:%u:%u:%u:%u:%u:%u:%u]",
> + ((const u_int *)&sin6->sin6_addr.__u6_addr.__u6_addr16)[0],
Please use inet_ntop(). And sin6->sin6_scope_id must not be ignored. The in-kernel representation of an link-local address has embedded scope zone id inside the address itself, so you might want to double-check the scope and value of sin6_addr.s6_addr16[1] in both cases of ntop and pton.
REPOSITORY
rS FreeBSD src repository
CHANGES SINCE LAST ACTION
https://reviews.freebsd.org/D23788/new/
REVISION DETAIL
https://reviews.freebsd.org/D23788
EMAIL PREFERENCES
https://reviews.freebsd.org/settings/panel/emailpreferences/
To: neel_neelc.org, hrs
Cc: hrs, imp, lutz_donnerhacke.de, melifaro, #contributor_reviews_base, freebsd-net-list, mmacy, kpraveen.lkml_gmail.com, marcnarc_gmail.com, simonvella_gmail.com, novice_techie.com, tommi.pernila_iki.fi
More information about the freebsd-net
mailing list