aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2019-09-05 18:05:15 +0200
committerToni Uhlig <matzeton@googlemail.com>2019-09-05 18:05:15 +0200
commit2fe275b7484a9d8b2dcdfbfbe11c4392f877596d (patch)
tree3894bfc70d2310646a74ffa371b81bbb577a71bb
parent70197e23c9b3905987596d70b5fd72d5ec9e7652 (diff)
removed unused function prototype, improved termination msgs
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r--src/ptunnel.c19
-rw-r--r--src/ptunnel.h4
2 files changed, 10 insertions, 13 deletions
diff --git a/src/ptunnel.c b/src/ptunnel.c
index 9af8db7..1d95cd5 100644
--- a/src/ptunnel.c
+++ b/src/ptunnel.c
@@ -890,14 +890,15 @@ uint16_t calc_icmp_checksum(uint16_t *data, int bytes) {
* the tunnel is being closed down.
*/
void send_termination_msg(proxy_desc_t *cur, int icmp_sock) {
+ size_t i;
+ const size_t max_termination_msgs = 3;
+
/* Send packet twice, hoping at least one of them makes it through.. */
- queue_packet(icmp_sock, cur->pkt_type, 0, 0, cur->id_no, cur->icmp_id, &cur->my_seq,
- cur->send_ring, &cur->send_idx, &cur->send_wait_ack, 0, 0,
- kProto_close | cur->type_flag, &cur->dest_addr, cur->next_remote_seq,
- &cur->send_first_ack, &cur->ping_seq, cur->window_size);
- queue_packet(icmp_sock, cur->pkt_type, 0, 0, cur->id_no, cur->icmp_id, &cur->my_seq,
- cur->send_ring, &cur->send_idx, &cur->send_wait_ack, 0, 0,
- kProto_close | cur->type_flag, &cur->dest_addr, cur->next_remote_seq,
- &cur->send_first_ack, &cur->ping_seq, cur->window_size);
- cur->xfer.icmp_out += 2;
+ for (i = 0; i < max_termination_msgs; ++i) {
+ queue_packet(icmp_sock, cur->pkt_type, 0, 0, cur->id_no, cur->icmp_id, &cur->my_seq,
+ cur->send_ring, &cur->send_idx, &cur->send_wait_ack, 0, 0,
+ kProto_close | cur->type_flag, &cur->dest_addr, cur->next_remote_seq,
+ &cur->send_first_ack, &cur->ping_seq, cur->window_size);
+ }
+ cur->xfer.icmp_out += max_termination_msgs;
}
diff --git a/src/ptunnel.h b/src/ptunnel.h
index 5a63acc..2fce25d 100644
--- a/src/ptunnel.h
+++ b/src/ptunnel.h
@@ -152,10 +152,6 @@ void pt_forwarder(void);
void print_statistics(xfer_stats_t *xfer, int is_continuous);
-void init_ip_packet(ip_packet_t *packet, uint16_t id, uint16_t frag_offset,
- uint16_t pkt_len, uint8_t ttl, uint32_t src_ip, uint32_t dst_ip,
- bool is_last_frag, bool dont_frag);
-
uint16_t calc_icmp_checksum(uint16_t *data, int bytes);
void send_termination_msg(proxy_desc_t *cur, int icmp_sock);