ip_packet: Apply transport protocol ports when encoding IP packet