|
20 | 20 |
|
21 | 21 | namespace nstun { |
22 | 22 |
|
23 | | -void udp_destroy_flow(Context* ctx, UdpFlow* flow) { |
| 23 | +static void udp_destroy_flow(Context* ctx, UdpFlow* flow) { |
24 | 24 | if (flow->host_fd != -1 && !flow->host_fd_is_listener) { |
25 | 25 | epoll_ctl(ctx->epoll_fd, EPOLL_CTL_DEL, flow->host_fd, nullptr); |
26 | 26 | ctx->flows_by_fd.erase(flow->host_fd); |
@@ -50,7 +50,7 @@ static void udp_send_packet4(Context* ctx, uint32_t saddr, uint32_t daddr, uint1 |
50 | 50 | udp_hdr* r_udp = reinterpret_cast<udp_hdr*>(header_buf + sizeof(ip4_hdr)); |
51 | 51 |
|
52 | 52 | /* IPv4 */ |
53 | | - r_ip->ihl_version = (4 << 4) | (sizeof(ip4_hdr) / 4); |
| 53 | + ip4_set_ihl_version(r_ip, 4, sizeof(ip4_hdr) / 4); |
54 | 54 | r_ip->tos = 0; |
55 | 55 | r_ip->tot_len = htons(sizeof(ip4_hdr) + sizeof(udp_hdr) + len); |
56 | 56 | r_ip->id = 0; |
@@ -138,7 +138,7 @@ static void udp_push_to_guest(Context* ctx, UdpFlow* flow, const uint8_t* data, |
138 | 138 | } |
139 | 139 | } |
140 | 140 |
|
141 | | -void handle_host_udp_control(Context* ctx, UdpFlow* flow, uint32_t events) { |
| 141 | +static void handle_host_udp_control(Context* ctx, UdpFlow* flow, uint32_t events) { |
142 | 142 | int fd = flow->tcp_fd; |
143 | 143 | flow->last_active = time(NULL); |
144 | 144 |
|
@@ -501,7 +501,7 @@ void handle_udp4(Context* ctx, const ip4_hdr* ip, std::span<const uint8_t> paylo |
501 | 501 | } |
502 | 502 | } |
503 | 503 |
|
504 | | -void handle_host_udp(Context* ctx, UdpFlow* flow) { |
| 504 | +static void handle_host_udp(Context* ctx, UdpFlow* flow) { |
505 | 505 | int fd = flow->host_fd; |
506 | 506 | flow->last_active = time(NULL); |
507 | 507 |
|
|
0 commit comments