From dcef7bcdf3feddcc5eb012d55223bc796993bc2a Mon Sep 17 00:00:00 2001 From: zhenwei pi Date: Wed, 23 Jun 2021 16:24:11 +0800 Subject: [PATCH] tcprtt: fix compatibility for python3 Suggested by Yonghong, tcprtt report error on python3: TypeError: can't concat str to bytes Both python2 and python3, inet_ntop returns a string type, there is no need to encode any more. Test for python2 and python3, both work fine. Signed-off-by: zhenwei pi --- tools/tcprtt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tcprtt.py b/tools/tcprtt.py index abbdc34079f1..046e892f6763 100755 --- a/tools/tcprtt.py +++ b/tools/tcprtt.py @@ -215,7 +215,7 @@ def print_section(addr): addrstr = "*******" if (addr): - addrstr = inet_ntop(AF_INET, struct.pack("I", addr)).encode() + addrstr = inet_ntop(AF_INET, struct.pack("I", addr)) avglat = "" if args.extension: