diff options
author | Devaev Maxim <[email protected]> | 2020-09-30 07:49:58 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-09-30 07:49:58 +0300 |
commit | 1b62570466804a2fe0a21bbdccd7a289c8974496 (patch) | |
tree | 2c9b820746ef24fc2552e909e17a3822466c9ad4 /kvmd/apps/otg | |
parent | 630593492abe6f7d6edf15ee05e62e7d0489e36d (diff) |
optional host_mac and kvm_mac
Diffstat (limited to 'kvmd/apps/otg')
-rw-r--r-- | kvmd/apps/otg/__init__.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kvmd/apps/otg/__init__.py b/kvmd/apps/otg/__init__.py index 85db4b9d..6b98dc81 100644 --- a/kvmd/apps/otg/__init__.py +++ b/kvmd/apps/otg/__init__.py @@ -112,12 +112,14 @@ def _create_serial(gadget_path: str, config_path: str) -> None: def _create_ethernet(gadget_path: str, config_path: str, host_mac: str, kvm_mac: str) -> None: - if host_mac == kvm_mac: + if host_mac and kvm_mac and host_mac == kvm_mac: raise RuntimeError("Ethernet host_mac should not be equal to kvm_mac") func_path = join(gadget_path, "functions/ecm.usb0") _mkdir(func_path) - _write(join(func_path, "host_addr"), host_mac) - _write(join(func_path, "dev_addr"), kvm_mac) + if host_mac: + _write(join(func_path, "host_addr"), host_mac) + if kvm_mac: + _write(join(func_path, "dev_addr"), kvm_mac) _symlink(func_path, join(config_path, "ecm.usb0")) |