Merge pull request #3156 from steverao/2.2.x-0217-fix_IPv6_problem

fix: remove useless suffix of IPv6 address.
pull/3160/head
RuanSheng 2 years ago committed by GitHub
commit 31d9c81fe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -96,7 +96,10 @@ public class InetIPv6Utils {
}
private String normalizeIPv6(String ip) {
return "[" + ip + "]";
// Remove the suffix of network card in IPv6 address, such as
// 2408:400a:8c:5400:6578:5c42:77b1:bc5d%eth0
int idx = ip.indexOf("%");
return idx != -1 ? "[" + ip.substring(0, idx) + "]" : "[" + ip + "]";
}
private boolean isPreferredAddress(InetAddress address) {

Loading…
Cancel
Save