From 395af051bda6c9fce6529fce15e8e13f156dd43a Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 1 Dec 2024 15:38:24 +0000 Subject: [PATCH] mdns: option to ignore invalid packets on the lan --- copyparty/__main__.py | 1 + copyparty/mdns.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 789491c2..6cf0ddfe 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -1124,6 +1124,7 @@ def add_zc_mdns(ap): ap2.add_argument("--zm6", action="store_true", help="IPv6 only") ap2.add_argument("--zmv", action="store_true", help="verbose mdns") ap2.add_argument("--zmvv", action="store_true", help="verboser mdns") + ap2.add_argument("--zm-no-pe", action="store_true", help="mute parser errors (invalid incoming MDNS packets)") ap2.add_argument("--zms", metavar="dhf", type=u, default="", help="list of services to announce -- d=webdav h=http f=ftp s=smb -- lowercase=plaintext uppercase=TLS -- default: all enabled services except http/https (\033[32mDdfs\033[0m if \033[33m--ftp\033[0m and \033[33m--smb\033[0m is set, \033[32mDd\033[0m otherwise)") ap2.add_argument("--zm-ld", metavar="PATH", type=u, default="", help="link a specific folder for webdav shares") ap2.add_argument("--zm-lh", metavar="PATH", type=u, default="", help="link a specific folder for http shares") diff --git a/copyparty/mdns.py b/copyparty/mdns.py index 849c8417..6329556c 100644 --- a/copyparty/mdns.py +++ b/copyparty/mdns.py @@ -336,6 +336,9 @@ class MDNS(MCast): self.log("stopped", 2) return + if self.args.zm_no_pe: + continue + t = "{} {} \033[33m|{}| {}\n{}".format( self.srv[sck].name, addr, len(buf), repr(buf)[2:-1], min_ex() )