Has anyone thought about making a simple UPS for a router? I'm thinking about two power diodes to allow either the battery (a rechargeable 9v will probably work nicely, using a resistor and diode to trickle charge it) or power supply to power the router, along with some circuits to detect main power loss and a transistor switch to turn off the battery back up after the router shuts down. (Make some connections to the GPIOs for that, and make the transistor only disconnect the battery so it can start from main power.) Program it to shut down only if the power is lost for a certain time to avoid nuisance shutdowns due to brief power failures, or even add a circuit to monitor the battery so it shuts down only when the charge runs low. (Also add a circuit to force the transistor switch off when the reset button is pressed to allow easy hard rebooting of a crashed router.)
GPIO is a limited resource, but I see some techniques that can be used to reuse some GPIOs. For instance, the power LED line can also switch on the transistor switch. Then only one more GPIO will be needed to monitor power status, and that can possibly be multiplexed with some function that does not interfere.