optional linklocal ipv6 support (firefox/ie11 only)

This commit is contained in:
ed 2022-12-05 20:45:21 +00:00
parent 9a28afcb48
commit 6cd6dadd06
4 changed files with 8 additions and 3 deletions

View file

@ -651,6 +651,7 @@ def run_argparse(
ap2 = ap.add_argument_group('network options')
ap2.add_argument("-i", metavar="IP", type=u, default="::", help="ip to bind (comma-sep.), default: all IPv4 and IPv6")
ap2.add_argument("-p", metavar="PORT", type=u, default="3923", help="ports to bind (comma/range)")
ap2.add_argument("--ll", action="store_true", help="enable link-local IPv6 (supported by ie11 and firefox (not chrome)) -- breaks some mdns clients")
ap2.add_argument("--rproxy", metavar="DEPTH", type=int, default=1, help="which ip to keep; [\033[32m0\033[0m]=tcp, [\033[32m1\033[0m]=origin (first x-fwd), [\033[32m2\033[0m]=cloudflare, [\033[32m3\033[0m]=nginx, [\033[32m-1\033[0m]=closest proxy")
ap2.add_argument("--s-wr-sz", metavar="B", type=int, default=256*1024, help="socket write size in bytes")
ap2.add_argument("--s-wr-slp", metavar="SEC", type=float, default=0, help="debug: socket write delay in seconds")

View file

@ -320,7 +320,9 @@ class MDNS(MCast):
def eat(self, buf: bytes, addr: tuple[str, int], sck: socket.socket) -> None:
cip = addr[0]
v6 = ":" in cip
if cip.startswith("169.254") or v6 and not cip.startswith("fe80"):
if cip.startswith("169.254") or (
v6 and not cip.startswith("fe80") and not self.args.ll
):
return
cache = self.rx6 if v6 else self.rx4

View file

@ -183,7 +183,9 @@ class MCast(object):
srv.ips[oth_ip.split("/")[0]] = ipaddress.ip_network(oth_ip, False)
# gvfs breaks if a linklocal ip appears in a dns reply
srv.ips = {k: v for k, v in srv.ips.items() if not k.startswith("fe80")}
if not self.args.ll:
srv.ips = {k: v for k, v in srv.ips.items() if not k.startswith("fe80")}
if not srv.ips:
self.log("no routable IPs on {}; skipping [{}]".format(netdev, ip), 3)
continue

View file

@ -128,7 +128,7 @@ class TcpSrv(object):
title_vars = [x[1:] for x in self.args.wintitle.split(" ") if x.startswith("$")]
t = "available @ {}://{}:{}/ (\033[33m{}\033[0m)"
for ip, desc in sorted(eps.items(), key=lambda x: x[1]):
if ip.startswith("fe80"):
if ip.startswith("fe80") and not self.args.ll:
continue
for port in sorted(self.args.p):