Dnsmasq segfault

Have suddenly started to get these in the logs:

[   28.671047] dnsmasq[5399]: segfault at 6 ip 004ae37c sp bfb5a2e0 error 4 in dnsmasq[49d000+2a000]
[   28.697843] Code: f4 5b 5e 5f 5d c3 55 89 e5 57 56 53 83 ec 3c e8 a8 e1 ff ff 81 c1 e2 59 02 00 89 4d e4 89 45 d4 89 55 e0 8b 42 68 85 c0 74 07 <8b> 00 e9 10 02 00 00 8b 45 d4 8b 18 85 db 74 1d 8b 33 8b 16 8b 45
[   35.424874] dnsmasq[5836]: segfault at 6 ip 004bc37c sp bf83ade0 error 4 in dnsmasq[4ab000+2a000]
[   35.451719] Code: f4 5b 5e 5f 5d c3 55 89 e5 57 56 53 83 ec 3c e8 a8 e1 ff ff 81 c1 e2 59 02 00 89 4d e4 89 45 d4 89 55 e0 8b 42 68 85 c0 74 07 <8b> 00 e9 10 02 00 00 8b 45 d4 8b 18 85 db 74 1d 8b 33 8b 16 8b 45

Home router, with separate AP. Running 22.03.5 on a x86 box, Zotac CI327, N3450 processor. Also running Adblock, and was running DNS over HTTPS but have it disabled now, but it may have left some settings it should have cleaned up.

Had these two right at the end of a bootup, before that over a 10 day uptime, it happened 5 times. May be associated with loss of net connectivity, there was a complaint of that. If so it seems to recover from the event by itself. Been running 22.03.5 since it came out, haven't noticed this problem till now.

Ideas?

What is the output of uci export dhcp; logread -e dnsmasq ?

Here you go...
There was much more, of dhcp restarting during normal (?) operation, and lease refreshing. I just included a cycle or two here. The first few cycles seem shorter than the normal dhcp cycle looks like.
Included is one of the segfault events, two happened inside the normal reboot time, on this reboot. This one doesn't have the "Code: " line that the other events had.

root@OpenWrt:~# uci export dhcp; logread -e dnsmasq
package dhcp

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option localservice '1'
        option ednspacket_max '1232'
        option quietdhcp '1'
        option dnsforwardmax '250'
        option cachesize '5000'
        option confdir '/tmp/dnsmasq.d'
        list server '/mask.icloud.com/'
        list server '/mask-h2.icloud.com/'
        list server '/use-application-dns.net/'
        list server '127.0.0.1#5053'
        list server '127.0.0.1#5054'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

Fri Jun  9 20:57:09 2023 user.notice dnsmasq: DNS rebinding protection is active, will discard upstream RFC1918 responses!
Fri Jun  9 20:57:09 2023 user.notice dnsmasq: Allowing 127.0.0.0/8 responses
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: started, version 2.86 cachesize 5000
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: DNS service limited to local subnets
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: compile time options: IPv6 GNU-getopt no-DBus UBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth no-cryptohash no-DNSSEC no-ID loop-detect inotify dumpfile
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: UBus support enabled: connected to system bus
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: using nameserver 127.0.0.1#5053
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: using nameserver 127.0.0.1#5054
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: using only locally-known addresses for test
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: using only locally-known addresses for onion
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: using only locally-known addresses for localhost
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: using only locally-known addresses for local
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: using only locally-known addresses for invalid
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: using only locally-known addresses for bind
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: using only locally-known addresses for use-application-dns.net
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: using only locally-known addresses for mask-h2.icloud.com
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: using 2 more local addresses
Fri Jun  9 20:57:09 2023 daemon.warn dnsmasq[1]: no servers found in /tmp/resolv.conf.d/resolv.conf.auto, will retry
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: read /etc/hosts - 4 addresses
Fri Jun  9 20:57:09 2023 daemon.info dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 0 addresses
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: exiting on receipt of SIGTERM
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: started, version 2.86 cachesize 5000
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: DNS service limited to local subnets
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: compile time options: IPv6 GNU-getopt no-DBus UBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth no-cryptohash no-DNSSEC no-ID loop-detect inotify dumpfile
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: UBus support enabled: connected to system bus
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq-dhcp[1]: DHCP, IP range 192.168.1.100 -- 192.168.1.249, lease time 12h
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: using nameserver 127.0.0.1#5053
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: using nameserver 127.0.0.1#5054
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: using only locally-known addresses for test
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: using only locally-known addresses for onion
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: using only locally-known addresses for localhost
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: using only locally-known addresses for local
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: using only locally-known addresses for invalid
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: using only locally-known addresses for bind
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: using only locally-known addresses for use-application-dns.net
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: using only locally-known addresses for mask-h2.icloud.com
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: using 2 more local addresses
Fri Jun  9 20:57:14 2023 daemon.warn dnsmasq[1]: no servers found in /tmp/resolv.conf.d/resolv.conf.auto, will retry
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: read /etc/hosts - 4 addresses
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 2 addresses
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq-dhcp[1]: read /etc/ethers - 0 addresses
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: read /etc/hosts - 4 addresses
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 2 addresses
Fri Jun  9 20:57:14 2023 daemon.info dnsmasq-dhcp[1]: read /etc/ethers - 0 addresses
Fri Jun  9 20:57:15 2023 daemon.info dnsmasq[1]: exiting on receipt of SIGTERM
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: started, version 2.86 cachesize 5000
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: DNS service limited to local subnets
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: compile time options: IPv6 GNU-getopt no-DBus UBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth no-cryptohash no-DNSSEC no-ID loop-detect inotify dumpfile
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: UBus support enabled: connected to system bus
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq-dhcp[1]: DHCP, IP range 192.168.1.100 -- 192.168.1.249, lease time 12h
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 127.0.0.1#5053
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 127.0.0.1#5054
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for test
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for onion
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for localhost
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for local
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for invalid
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for bind
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for dns.msftncsi.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for time.nist.gov
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for mask.icloud.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for mask-h2.icloud.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for proctor.in
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for proctordata.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for proctorcollect.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for proctorauth.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for click.appcast.io
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for invenio.sgn.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for cookie-jam.sgn.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for tongue.jamcity.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for example.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for use-application-dns.net
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using 3 more local addresses
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: reading /tmp/resolv.conf.d/resolv.conf.auto
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 127.0.0.1#5053
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 127.0.0.1#5054
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 1.1.1.1#53
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 1.0.0.1#53
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 2606:4700:4700::1111#53
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 2606:4700:4700::1001#53
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 2001:578:3f::30#53
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 2001:578:3f:1::30#53
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for test
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for onion
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for localhost
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for local
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for invalid
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for bind
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for dns.msftncsi.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for time.nist.gov
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for mask.icloud.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for mask-h2.icloud.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for proctor.in
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for proctordata.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for proctorcollect.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for proctorauth.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for click.appcast.io
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for invenio.sgn.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for cookie-jam.sgn.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for tongue.jamcity.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using standard nameservers for example.com
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using only locally-known addresses for use-application-dns.net
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using 3 more local addresses
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: read /etc/hosts - 4 addresses
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 2 addresses
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: read /tmp/hosts/odhcpd - 0 addresses
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq-dhcp[1]: read /etc/ethers - 0 addresses
Fri Jun  9 20:57:18 2023 kern.info kernel: [   28.671047] dnsmasq[5399]: segfault at 6 ip 004ae37c sp bfb5a2e0 error 4 in dnsmasq[49d000+2a000]
Fri Jun  9 20:57:23 2023 daemon.info dnsmasq[1]: started, version 2.86 cachesize 5000
Fri Jun  9 20:57:23 2023 daemon.info dnsmasq[1]: DNS service limited to local subnets
Fri Jun  9 20:57:23 2023 daemon.info dnsmasq[1]: compile time options: IPv6 GNU-getopt no-DBus UBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth no-cryptohash no-DNSSEC no-ID loop-detect inotify dumpfile
Fri Jun  9 20:57:23 2023 daemon.info dnsmasq[1]: UBus support enabled: connected to system bus
Fri Jun  9 20:57:23 2023 daemon.info dnsmasq-dhcp[1]: DHCP, IP range 192.168.1.100 -- 192.168.1.249, lease time 12h

I have a few non stock settings, like increasing max connections and upping the cache size. The router has 8GB of ram.

I have seen other odd behavior in the past, but not sure if that's related to this problem. Please let me know if any settings look funny...

And, duh... I realize the "code: xxxx..." response being missing was due to the search limit for dnsmasq. :roll_eyes: And, I realized the difference in length in the later cycles was due to dnsmasq coming up first, then after Adblock comes up and dnsmasq resets, there's a lot of added log info.

I can't see anything very wrong. So I would suggest to try a few days with stock dnsmasq, without changes, without ADB nor DoH for a start, then add components gradually.

Been busy, and now will be offline for a week or more, but will get back to it.

Did disable the dns over https, and the Adblock, seemed to have less instances. But did have someone in the house reboot everything a few days ago on a possible connection issue... no logs for me, or longer uptime.

And, had a major outage with the cable provider, which with no outside DHCP server or DNS connections, the router actually ended up getting a IP and was trying to resolve DNS thru the back end, lan side of the cable modem! Very weird! Not exactly the former issue, but it segfaulted a time or two, and gave large numbers of "exceeded 250 request limit" errors as everything connected kept trying to resolve DNS on 192.168.100.xx.

Maybe theres a clue in there, mostly another thead subject on how to prevent/ignore getting an IP lease fron the cable modem back end.

If the wan protocol is DHCP, then there is not much you can do, apart from blocking the dhcp from the modem on the wan port.

The past few OpenWRT versions, I was seeing a "WAN" IP address (actually from the modem) get requested and approved, for a 20 sec lease time (???) during a reboot, then the real outside world IP, one from Cox Cable, later in the bootlog for a more normal 24 hour lease time.

The other number for 20 sec is in the modem admin group. Sounds like something changed either on a modem firware update, or on OWT to make this more prone to happen, or beats OWT's server coming up.

So you think I could block the modems IP's other than the ones Id want, like the web access page, spectrum analyzer, etc?

Was wondering if these few numbers at the beginning were leftover DOH stuff that it did not remove vs something normal

type or paste code here
using nameserver 127.0.0.1#5054
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 1.1.1.1#53
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 1.0.0.1#53
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 2606:4700:4700::1111#53
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 2606:4700:4700::1001#53
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 2001:578:xx:xx#53
Fri Jun  9 20:57:18 2023 daemon.info dnsmasq[1]: using nameserver 2001:578:xx:xx#53

and why might i seem to also be using a pair of (?) Cox IPv6 DNS rserver when I havent added it?

During a reboot and before OpenWrt is fully up all ports are bridged in certain boards, therefore if any lan host starts the DHCP process, the DHCP is answered from the modem. This is not uncommon and you cannot do much. One solution is to minimize the possibility of a lan host asking for DHCP during the reboot is to have a switch in the middle. When OpenWrt reboots lan hosts will not disconnect and will not send DHCP discoveries from scratch.

You still have them.

Yeah, should start a thread and get stangri involved. I poorly understand what needs to be done with DOH, there have been some curl errors reported, and theres a newer version if I want to risk that (think the -rc1 version has it, do I risk THAT on the home router/test lab?)

Tho I havent seen complaints of his DOH not removing and resetting things when you pause and reenable it, like its supposed to.

It seems there are more dns servers available, but if you are not using the DoH better remove it.