Login by mac on 2.9.51

We have a hotspot client that has dhcp+login-by-mac. The problem is that eventually they get hotspot asking for username and password.

The cause seems to be that IP changes too quick and it happens a “no more sessions allowed for this user” event.
After the old IP has been removed, the new IP doesn’t log in automatically when it should.

Jan 26 13:45:07 dhcp,info,debug dhcp1 assigned 192.168.3.152 to 00:18:F8:AB:CD:EF
Jan 26 13:45:09 hotspot,info,debug 00:18:F8:AB:CD:EF (192.168.3.152): trying to log in by mac
Jan 26 13:45:09 hotspot,account,info,debug 00:18:F8:AB:CD:EF (192.168.3.152): logged in
Jan 26 13:45:51 dhcp,info,debug dhcp1 deassigned 192.168.3.152 from 00:18:F8:AB:CD:EF
Jan 26 13:45:55 dhcp,info,debug dhcp1 assigned 192.168.3.152 to 00:18:F8:AB:CD:EF
...
Jan 27 13:02:15 dhcp,info,debug dhcp1 deassigned 192.168.3.152 from 00:18:F8:AB:CD:EF
Jan 27 13:02:22 dhcp,info,debug dhcp1 assigned 192.168.3.141 to 00:18:F8:AB:CD:EF
Jan 27 13:02:24 hotspot,info,debug 00:18:F8:AB:CD:EF (192.168.3.141): trying to log in by mac
Jan 27 13:02:24 hotspot,info,debug 00:18:F8:AB:CD:EF (192.168.3.141): login failed: no more sessions are allowed for user
Jan 27 13:07:32 hotspot,info,debug 00:18:F8:AB:CD:EF (192.168.3.152): logged out: host removed: overrided by static entry

(This is a digest of the original log with some macs and ip replaced)

My answer was to make the mac-to-ip assignment static. This is not a static ip, it just makes the dhcp assignment permanent to that mac address. Connect the box to the ap and get an ip, then:
/ip dhcp-server lease
print
make-static X