Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Feb 2020 17:24:00 +0000
From:      "hrs (Hiroki Sato)" <phabric-noreply@FreeBSD.org>
To:        Phabricator <phabric-noreply@FreeBSD.org>
Cc:        freebsd-net@freebsd.org
Subject:   [Differential] D23788: DRAFT: ng_ksocket: IPv6 address parsing and unparsing
Message-ID:  <bae7d3f756a93eff3f1a706e0bab4fc9@localhost.localdomain>
In-Reply-To: <differential-rev-PHID-DREV-isgti776xdsdvju2ufh3-req@reviews.freebsd.org>
References:  <differential-rev-PHID-DREV-isgti776xdsdvju2ufh3-req@reviews.freebsd.org>

index | next in thread | previous in thread | raw e-mail

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

help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bae7d3f756a93eff3f1a706e0bab4fc9>