]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
wintun: add LUID accessor
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 10 May 2019 19:30:23 +0000 (21:30 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 10 May 2019 19:30:23 +0000 (21:30 +0200)
tun/tun_windows.go

index 8218fc3645e3500deffe9b0f8cb5731aa451acea..03e04a2dfca9ee8d6318628b54aaac515bd5db63 100644 (file)
@@ -373,3 +373,10 @@ func (tun *NativeTun) Write(buff []byte, offset int) (int, error) {
 func (tun *NativeTun) GUID() windows.GUID {
        return tun.wt.CfgInstanceID
 }
+
+//
+// GUID returns Windows adapter instance ID.
+//
+func (tun *NativeTun) LUID() uint64 {
+       return ((uint64(tun.wt.LUIDIndex) & ((1 << 24) - 1)) << 24) | ((uint64(tun.wt.IfType) & ((1 << 16) - 1)) << 48)
+}