libmn: make mn_port_t more type-safe