Fix gateway resolution logic for routes

We've previously been using the destination network to determine whether
or not we need to resolve the gateway address. This causes issues when
attempting to propagate routes since patch ecea28c, as routes are no
longer propagated when gateway resolution is incomplete.

This patch fixes the issue and reduces calls to resolveGateway() by
ensuring that the gateway address is used for this check.

Signed-off-by: Joe Stringer <joestringernz@gmail.com>