This has been a pain in my ass for some time now so I came up with a workaround that doesn't care which OS you are using.
So my thinking was since the client is not logged in to the Hotspot yet then It would not matter if I cut off the internet of it. So the idea is to put my new clients in a list that will not be allowed to masquerade except for the redirected domain of the Hotspot after the login splash screen. Then on Hotspot login the address list should get a counter of a few minutes and during that time the Captive Portal stays open presenting the redirected website. When the timer goes to 00:00:00 the captive portal closes and the client continues normally.
Step 1. In the [/ip firewall address-list] I added an address-list with the domain of the redirected website
add address=www.redirected-website.com list=Redirection
Step 2. In the [/ip firewall nat] I added a rule to masquerade calls from the IPs in the address-list created from the dhcp-server with direction to the address-list of the redirection domain and another rule for masquerading the Hotspot domain except those in the address-list created from the dhcp-server.
add action=masquerade chain=srcnat dst-address-list=Redirection src-address-list=LoggedIn
add action=masquerade chain=srcnat src-address=10.0.0.0/24 src-address-list=!LoggedIn
Step 3. In the [/ip hotspot user profile] I added an on-login and an on-logout script to the client's profile
on-login="/ip firewall address-list set timeout=00:01:00 [find comment="$"mac-address""];"
on-logout="/ip firewall address-list add list=LoggedIn address=$address comment="$"mac-address"";"
Step 4. In the [/ip dhcp-server] used for the hotspot I added a lease-script
lease-script="
:local Active 0;
foreach i in=[/ip hotspot active find] do={
:local j [/ip hotspot active get $i address]
if ($leaseActIP=$j) do={ :set Active 1 }
}
foreach h in=[/ip hotspot cookie find] do={
:local k [/ip hotspot cookie get $h mac-address]
if ($leaseActMAC=$k) do={ :set Active 1 }
}
if ($leaseBound = "1" and $Active = 0) do={
/ip firewall address-list add list=LoggedIn address=$leaseActIP comment=$leaseActMAC;
}
if ($leaseBound = "0") do={
/ip firewall address-list remove [find where address=$leaseActIP];
}
"
# 5. DHCP Lease time value should be graeter than Hotspot Session Timeout and/or KeepAlive Timeout in User Profile
Please let me know if this could be made better.