How does an anti-aircraft missile differentiate between passenger and war plane?

Iran has said that it has unintentionally brought down Ukrainian International Airlines airplane. As per the reports, the Ukrainian plane had flown close to a sensitive military site.