From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.github.com (out-25.smtp.github.com [192.30.252.208]) by mail.toke.dk (Postfix) with ESMTPS id 65E268C5B87 for ; Wed, 29 Sep 2021 23:51:41 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key) header.d=github.com header.i=@github.com header.b=AMmF3WPl Received: from github-lowworker-98efffe.ac4-iad.github.net (github-lowworker-98efffe.ac4-iad.github.net [10.52.122.80]) by smtp.github.com (Postfix) with ESMTP id 635AE840E4A for ; Wed, 29 Sep 2021 14:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1632952300; bh=Z3hnfpckTf7Kre06qe0jB51tcGalWENx2WwrjT9ntSU=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:List-ID: List-Archive:List-Post:List-Unsubscribe:From; b=AMmF3WPlirKFS4lqCQdQnHOPQvIsVmWV9EQEJ0otfSOQIk1CLCNTSBnNf0qUGAqFr Q+SKDH7QgZk9b8qei3SlpJbI2ltLwOhdpHt0SC9ztkVB550kgLAS7tzc5FiOOMtz2P TyfUiYgttoQ6tHv0xa6WnicEu1ymAL4NMYpjSgLs= Date: Wed, 29 Sep 2021 14:51:40 -0700 From: =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= To: tohojo/flent Message-ID: In-Reply-To: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_6154dfec520cc_3526c7602403ec"; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: list X-GitHub-Sender: tohojo X-GitHub-Recipient: flent-users X-GitHub-Reason: subscribed X-Auto-Response-Suppress: All X-GitHub-Recipient-Address: flent-users@flent.org Message-ID-Hash: OHDQWINTBXSLHOXKFSAXTHJOW66K5TXR X-Message-ID-Hash: OHDQWINTBXSLHOXKFSAXTHJOW66K5TXR X-MailFrom: noreply@github.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Subscribed X-Mailman-Version: 3.3.4 Reply-To: tohojo/flent Subject: [Flent-users] Re: [tohojo/flent] runners: Bracket IPv6 addresses before passing to irtt (#239) List-Id: Flent discussion list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: ----==_mimepart_6154dfec520cc_3526c7602403ec Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit @tohojo requested changes on this pull request. > @@ -1682,7 +1683,13 @@ def check(self): if self.ip_version is not None: args.append("-{}".format(self.ip_version)) - args.append(self.host) + try: + ipaddress.IPv6Address(self.host) + host = "[{}]".format(self.host) + except ValueError: + host = self.host Using the ipaddress module for parsing is fine, but let's move this into the normalise_host() utility function. Simply adding a second argument 'bracket_v6' which defaults to 'False' to that should do the trick :) -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/tohojo/flent/pull/239#pullrequestreview-767221497 ----==_mimepart_6154dfec520cc_3526c7602403ec Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

@tohojo requested changes on this pull request.


In flent/runners.py:

> @@ -1682,7 +1683,13 @@ def check(self):
             if self.ip_version is not None:
                 args.append("-{}".format(self.ip_version))
 
-            args.append(self.host)
+            try:
+                ipaddress.IPv6Address(self.host)
+                host = "[{}]".format(self.host)
+            except ValueError:
+                host = self.host

Using the ipaddress module for parsing is fine, but let's move this into the normalise_host() utility function. Simply adding a second argument 'bracket_v6' which defaults to 'False' to that should do the trick :)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

----==_mimepart_6154dfec520cc_3526c7602403ec--