refactored process_ip_packet