support MAX_EXTERNAL_PORTS