Using packet histories to troubleshoot networks