Skip to content

Instantly share code, notes, and snippets.

@kido5217
kido5217 / prevent-host-driver-in-pci-pass.md
Created October 1, 2022 22:14 — forked from kiler129/prevent-host-driver-in-pci-pass.md
Definitely prevent stubborn devices from being bound by the host driver in PCI passthrough scenario

Scenario

You're running a KVM-based virtualization. You want to do PCI/PCIe passthrough of some device. You don't want it to attach to the host OS at all.

Your device looks like that:

00:1f.2 SATA controller [0106]: Intel Corporation 6 Series/C200 Series Chipset Family SATA AHCI Controller [8086:1c02] (rev 05)
	Subsystem: Hewlett-Packard Company 6 Series/C200 Series Chipset Family 6 port Desktop SATA AHCI Controller [103c:330d]
	Kernel driver in use: ahci
	Kernel modules: ahci
@kido5217
kido5217 / gen_cisco_config.py
Created July 10, 2021 21:41
Generate cisco-like interfaces configuration file for ciscoconfparse and networkparse testing,
import random
import sys
def gen_ip_addr() -> str:
ip_addr = (
str(random.randrange(1, 255))
+ "."
+ str(random.randrange(1, 255))
+ "."