As being discussed the udp and dns functionality has been long broken, mostly because of infinite loop caused by iptables setting. Here are some workaround:
disable dns service from dnsmasq by adding "port=0" to /etc/dnsmasq.conf, to free the local 53/udp port.
add a dokodemo-door inbound "dns-in" that listens 53/udp and forwards to 8.8.8.8:53/udp, or whatever ip you like.
add an outbound "dns-out", set protocol to dns.
setup and enable internal DNS of v2ray.
route "dns-in" to "dns-out". Now v2ray acts as a dns server on localhost:53/udp.
you might also need to set "domainStrategy" to "UseIP" for your freedom outbound.
this does the trick: in LAN, set dns to the IP of your device, 192.168.1.1 for example, it makes sense as it is now indeed a dns server. Then add your subnet, 192.168.1.0/24 for example, to the extra direct list in v2ray setting, so that to avoid infinite loop.
Now everything works fine.
As being discussed the udp and dns functionality has been long broken, mostly because of infinite loop caused by iptables setting. Here are some workaround: