hassio-addons / addon-adguard-home

AdGuard Home - Home Assistant Community Add-ons
https://addons.community
MIT License
378 stars 47 forks source link

Link-local addresses not bound #394

Closed jherby2k closed 1 year ago

jherby2k commented 1 year ago

Problem/Motivation

Not binding to link-local addresses

Expected behavior

Should be able to do a DNS query against home assistant's link-local IPv6 address (fe80::/10).

Actual behavior

DNS query fails.

Steps to reproduce

nslookup <ha's link-local IPv6 address> google.com

Proposed changes

I'm not sure why this code is present in https://github.com/hassio-addons/addon-adguard-home/blob/main/adguard/rootfs/etc/s6-overlay/s6-rc.d/init-adguard/run. Why can't we do DNS queries to the local link-local address?

      # fe80::/10 according to RFC 4193 -> Local link. Skip it
      if (( (fd == 254) && ( (a2 & 192) == 128) )); then
        continue
      fi
    else
      # IPv4
      part="${host%%.*}"

      # 169.254.0.0/16 according to RFC 3927 -> Local link. Skip it
      if (( part == 169 )); then
        continue
      fi
    fi

Rationale

My HA has both a prefix-delegated global IPv6 address and a link-local address. Unfortunately, sometimes my ISP changes our prefix without warning, causing my SLAAC and DHCPv6-assigned addresses to change. HA of course is statically configured as per the Adguard guide. This means our DNS server becomes unreachable, breaking all sorts of stuff. If Adguard was running on the link-local address as well, we'd still be able to do lookups from the router and/or local network.

osh123 commented 1 year ago

I've tried to manually cause AdGuard to listen to the link-local address (stopped supervisor service and changed the run script according to your suggestion). It failed with [fatal] couldn't start forwarding DNS server: couldn't listen to UDP socket, cause: listen udp bind: invalid argument, leading me to this ticket. and in AdGuard itself: https://github.com/AdguardTeam/AdGuardHome/issues/2926

It seems like this is not possible at the moment because of a bug in AdGuard.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

punkidow commented 1 year ago

Still facing this issue. Trying to bind to the link-local IPv6 address fails and calls it an invalid argument.