diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-04-12 17:53:12 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-04-12 17:53:12 +0200 |
commit | bfe13ccc58ccb96f243a58309800410db1ccb52c (patch) | |
tree | 9b11760d9a0a5bfbdfeda140c0f795e80844a556 /src/testdir/check.vim | |
parent | c5f1ef53c24cc0c9f7b2131609e916f913634feb (diff) | |
download | vim-git-bfe13ccc58ccb96f243a58309800410db1ccb52c.tar.gz |
patch 8.2.0557: no IPv6 support for channelsv8.2.0557
Problem: No IPv6 support for channels.
Solution: Add IPv6 support. (Ozaki Kiichi, closes #5893)
Diffstat (limited to 'src/testdir/check.vim')
-rw-r--r-- | src/testdir/check.vim | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/testdir/check.vim b/src/testdir/check.vim index 34bf5b319..efb273b00 100644 --- a/src/testdir/check.vim +++ b/src/testdir/check.vim @@ -142,4 +142,37 @@ func CheckEnglish() endif endfunc +" Command to check that loopback device has IPv6 address +command CheckIPv6 call CheckIPv6() +func CheckIPv6() + if !has('ipv6') + throw 'Skipped: cannot use IPv6 networking' + endif + if !exists('s:ipv6_loopback') + let s:ipv6_loopback = s:CheckIPv6Loopback() + endif + if !s:ipv6_loopback + throw 'Skipped: no IPv6 address for loopback device' + endif +endfunc + +func s:CheckIPv6Loopback() + if has('win32') + return system('netsh interface ipv6 show interface') =~? '\<Loopback\>' + elseif filereadable('/proc/net/if_inet6') + return (match(readfile('/proc/net/if_inet6'), '\slo$') >= 0) + elseif executable('ifconfig') + for dev in ['lo0', 'lo', 'loop'] + " NOTE: On SunOS, need specify address family 'inet6' to get IPv6 info. + if system('ifconfig ' .. dev .. ' inet6 2>/dev/null') =~? '\<inet6\>' + \ || system('ifconfig ' .. dev .. ' 2>/dev/null') =~? '\<inet6\>' + return v:true + endif + endfor + else + " TODO: How to check it in other platforms? + endif + return v:false +endfunc + " vim: shiftwidth=2 sts=2 expandtab |