gateway detection