So I think I have determined that this cannot work. The problem is that the IMQ device which is used for ingress traffic control can only be entered in the PREROUTING and POSTROUTING tables. Packets destined for internal router processes get marked and selected to go into IMQ0 but since this selection is done in the INPUT table they don't actually go into the IMQ device and instead just go straight to the process.
Traffic which originates in the router and goes out the WAN interface (egress) is handled by QoS as expected. Traffic going through the router also works. It is only the incoming WAN traffic going to the router itself that this post applies to.
So I have read and studied this in some detail and I do not see any easy way to resolve this issue. We cannot use the PREROUTING table because the mangle chain is transversed before NAT is done. We cannot use the POSTROUTING table because the traffic in question never hits this table.
If anyone has any bright ideas now would be a good time.
