// LinuxToTUNFlags converts Linux TUN flags to a tun.Flags.
LinuxToTUNFlags converts Linux TUN flags to a tun.Flags.
// LinuxToTUNFlags converts Linux TUN flags to a tun . Flags .
func LinuxToTUNFlags(flags uint16) (tun.Flags, error) {
	if flags&^uint16(linux.IFF_TUN|linux.IFF_TAP|linux.IFF_NO_PI|linux.IFF_ONE_QUEUE) != 0 {
		return tun.Flags{}, syserror.EINVAL
	}
	return tun.Flags{
		TUN:          flags&linux.IFF_TUN != 0,
		TAP:          flags&linux.IFF_TAP != 0,
		NoPacketInfo: flags&linux.IFF_NO_PI != 0,
	}, nil
}
func LinuxToTUNFlags ( flags uint16 ) ( tun . Flags , error ) { if flags &^ uint16 ( linux . IFF_TUN | linux . IFF_TAP | linux . IFF_NO_PI | linux . IFF_ONE_QUEUE ) != 0 { return tun . Flags { } , syserror . EINVAL } return tun . Flags { TUN : flags & linux . IFF_TUN != 0 , TAP : flags & linux . IFF_TAP != 0 , NoPacketInfo : flags & linux . IFF_NO_PI != 0 , } , nil }
LinuxToTUNFlags converts Linux TUN flags to a tun.Flags.
LinuxToTUNFlags converts Linux TUN flags to a tun . Flags .
// Linux adds IFF_NOFILTER (the same value as IFF_NO_PI unfortunately) // when there is no sk_filter. See __tun_chr_ioctl() in // net/drivers/tun.c.