this spec is confusing

This commit is contained in:
ed 2022-11-17 09:08:58 +00:00
parent 0cedaf4fa9
commit 5abe0c955c
4 changed files with 13 additions and 8 deletions

View file

@ -663,7 +663,7 @@ def run_argparse(
ap2 = ap.add_argument_group("Zeroconf options")
ap2.add_argument("--zm", action="store_true", help="announce the enabled protocols over mDNS (multicast DNS-SD) -- compatible with KDE, gnome, macOS, ...")
ap2.add_argument("--zm4", action="store_true", help="IPv4 only -- try this if some clients don't work")
ap2.add_argument("--zm4", action="store_true", help="IPv4 only -- try this if some clients can't connect")
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")
@ -674,6 +674,7 @@ def run_argparse(
ap2.add_argument("--zm-ls", metavar="PATH", type=str, default="", help="link a specific folder for smb shares")
ap2.add_argument("--zm-mnic", action="store_true", help="merge NICs which share subnets; assume that same subnet means same network")
ap2.add_argument("--zm-msub", action="store_true", help="merge subnets on each NIC -- always enabled for ipv6 -- reduces network load, but gnome-gvfs clients may stop working")
ap2.add_argument("--zm-noneg", action="store_true", help="disable NSEC replies -- try this if some clients don't see copyparty")
ap2.add_argument("--mc-hop", metavar="SEC", type=int, default=0, help="rejoin multicast groups every SEC seconds (workaround for some switches/routers which cause mDNS to suddenly stop working after some time); try [\033[32m300\033[0m] or [\033[32m180\033[0m]")
ap2 = ap.add_argument_group('FTP options')

View file

@ -175,12 +175,6 @@ class MDNS(MCast):
sreply.add_answer(r120)
bye.add_answer(r0)
if not have4 or not have6:
ns = NSEC(self.hn, ["AAAA" if have4 else "A"])
r = RR(self.hn, QTYPE.NSEC, DC.F_IN, 120, ns)
areply.add_ar(r)
sreply.add_ar(r)
for sclass, props in self.svcs.items():
sname = props["name"]
sport = props["port"]
@ -216,6 +210,14 @@ class MDNS(MCast):
r = RR(sfqdn, QTYPE.TXT, DC.F_IN, 4500, TXT(txts))
sreply.add_answer(r)
if not (have4 and have6) and not self.args.zm_noneg:
have = "AAAA" if have6 else "A"
ns = NSEC(self.hn, [have, "PTR", "SRV", "TXT"])
r = RR(self.hn, QTYPE.NSEC, DC.F_IN, 120, ns)
areply.add_ar(r)
if len(sreply.pack()) < 1400:
sreply.add_ar(r)
srv.bp_probe = probe.pack()
srv.bp_ip = areply.pack()
srv.bp_svc = sreply.pack()

View file

@ -41,6 +41,8 @@ class MC_Sck(object):
self.net = net
self.ips = {ip: net}
self.v6 = ":" in ip
self.have4 = ":" not in ip
self.have6 = ":" in ip
class MCast(object):

View file

@ -105,7 +105,7 @@ class DNSRecord(object):
self, header=None, questions=None, rr=None, q=None, a=None, auth=None, ar=None
) -> None:
self.header = header or DNSHeader()
self.questions = questions or []
self.questions: list[DNSQuestion] = questions or []
self.rr = rr or []
self.auth = auth or []
self.ar = ar or []