diff options
| author | tongzongzhen <[email protected]> | 2024-04-30 10:53:02 +0800 |
|---|---|---|
| committer | tongzongzhen <[email protected]> | 2024-04-30 10:53:02 +0800 |
| commit | fadf6b0309f0cd56ae1f8ad6a034043c8bdc00fc (patch) | |
| tree | dee438a85f189d5e6ca89c9b2bde564fb5dc2083 | |
| parent | 427e7e702c3eb91bcaa5bb90c710986dd30678e9 (diff) | |
Port byte order conversion
| -rw-r--r-- | src/trace_output.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/trace_output.c b/src/trace_output.c index 33cd174..98e57cd 100644 --- a/src/trace_output.c +++ b/src/trace_output.c @@ -699,14 +699,14 @@ int marsio_pkt_inner_ip_port_get(const marsio_buff_t * mbuf, struct pkt_inner_ip if (l4_layer_type_id == LAYER_TYPE_ID_TCP) { struct tcphdr * tcp_hdr = (struct tcphdr *)tcp_ptr; - info->src_port = tcp_hdr->th_sport; - info->dst_port = tcp_hdr->th_dport; + info->src_port = ntohs(tcp_hdr->th_sport); + info->dst_port = ntohs(tcp_hdr->th_dport); } else if (l4_layer_type_id == LAYER_TYPE_ID_UDP) { struct udphdr * udp_hdr = (struct udphdr *)udp_ptr; - info->src_port = udp_hdr->uh_sport; - info->dst_port = udp_hdr->uh_dport; + info->src_port = ntohs(udp_hdr->uh_sport); + info->dst_port = ntohs(udp_hdr->uh_dport); } return 0; |
