summaryrefslogtreecommitdiff
path: root/kvmd/apps/otgnet/netctl.py
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-10-16 23:40:14 +0300
committerDevaev Maxim <[email protected]>2020-10-16 23:40:14 +0300
commitbfe437e4059014d329804704dc2df940b09f8a97 (patch)
treee1dbb9de6f4001a87240487c63e8f84b99ba5c25 /kvmd/apps/otgnet/netctl.py
parentdd279e3a13a62de9a1372e7a29d1a2a7aed9643e (diff)
allow icmp
Diffstat (limited to 'kvmd/apps/otgnet/netctl.py')
-rw-r--r--kvmd/apps/otgnet/netctl.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/kvmd/apps/otgnet/netctl.py b/kvmd/apps/otgnet/netctl.py
index 874e904a..1e7f2289 100644
--- a/kvmd/apps/otgnet/netctl.py
+++ b/kvmd/apps/otgnet/netctl.py
@@ -58,6 +58,18 @@ class IptablesDropAllCtl(BaseCtl):
return [*self.__base_cmd, ("-A" if direct else "-D"), "INPUT", "-i", self.__iface, "-j", "DROP"]
+class IptablesAllowIcmpCtl(BaseCtl):
+ def __init__(self, base_cmd: List[str], iface: str) -> None:
+ self.__base_cmd = base_cmd
+ self.__iface = iface
+
+ def get_command(self, direct: bool) -> List[str]:
+ return [
+ *self.__base_cmd,
+ ("-A" if direct else "-D"), "INPUT", "-i", self.__iface, "-p", "icmp", "-j", "ACCEPT",
+ ]
+
+
class IptablesAllowPortCtl(BaseCtl):
def __init__(self, base_cmd: List[str], iface: str, port: int, tcp: bool) -> None:
self.__base_cmd = base_cmd