Commit 1510a838 authored by Jondy Zhao's avatar Jondy Zhao

Fix no guid of network connection in the Windows 7

parent 007fb44a
...@@ -308,8 +308,13 @@ function format_interface_name() ...@@ -308,8 +308,13 @@ function format_interface_name()
if ! [[ "${guid:0:1}" == "{" ]] ; then if ! [[ "${guid:0:1}" == "{" ]] ; then
echo $1 echo $1
else else
ipv6 if | grep -B1 "${guid}" | \ which ipv6 > /dev/null 2>&1
sed -e "2d" -e "s/^Interface[0-9: ]\+\(Ethernet: \)\?//g" if (( $? )) ; then
getmac /fo list /v | grep -B3 "^Transport Name:.*$guid" | grep "^Connection Name:" | sed -e "s/^Connection Name: *//g"
else
ipv6 if | grep -B1 "${guid}" | \
sed -e "2d" -e "s/^Interface[0-9: ]\+\(Ethernet: \)\?//g"
fi
fi fi
} }
......
...@@ -73,9 +73,8 @@ function reset_connection() ...@@ -73,9 +73,8 @@ function reset_connection()
function connection2guid() function connection2guid()
{ {
ifname=${1-re6stnet-lo} ifname=${1-re6stnet-lo}
netsh interface ipv6 show interface $ifname | \ getmac /fo list /v | grep -A3 "^Connection Name: *$ifname\$" \
grep "^GUID\s*:" | \ | grep "^Transport Name:" | sed -e "s/^.*Tcpip_//g"
sed -e "s/^GUID\s*:\s*//"
} }
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment