Bug fix to avoid incorrect update of external gateway.

Change-Id: I363a8ec5e727d4017b99793aa42c55b3f588e321