Backport r40979-40981 improvements for low-mem

Early testing indicates we can now do IPv6 while running
wireless AP on a 16MB system.
Backport r40983, reduce memory usage a bit more