I understood that relay mode is used only if the ISP gives just a /64 without prefix delegation. Is this condition enough to decide if the relay mode should be enabled? (otherwise use the server mode).
I didn't find information about the hybrid mode regarding how it picks relay vs server. Looking at the source code for odhcpd (https://github.com/openwrt/odhcpd/blob/master/src/config.c) I understand that an interface in hybrid mode is set to
relay - if the master interface is in relay mode.
server - if the master interface is NOT relay mode or there is no master
Is this the correct and complete behaviour for the hybrid mode?
Is the master set to relay mode if and only if there is no received prefix?
My final goal is to detect when to choose server or relay if the ISP is changed (from a script that runs on a router).
Hopefully you have got things working by now. Sorry about the slow reply. If you are getting PD (Prefix Delegation) from your ISP, then you always want to use "Server Mode".