]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
oncp_control_queue → tcp_control_queue
authorDaniel Lenski <dlenski@gmail.com>
Mon, 11 May 2020 22:34:34 +0000 (15:34 -0700)
committerDavid Woodhouse <dwmw2@infradead.org>
Sun, 28 Mar 2021 09:30:25 +0000 (10:30 +0100)
This is a queue for outgoing packets which must be sent over the
TCP-based transport; that is, they cannot be sent over the
UDP-based transport.

This queue was initially used by oNCP protocol for ESP enable/disable
packets, and it is now also used by Pulse. It will likely be used for
control packets by some PPP-based protocols as well.

Renaming it to TCP control queue to emphasize its cross-protocol
nature (cf. https://gitlab.com/openconnect/openconnect/-/merge_requests/151).

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
esp.c
library.c
mainloop.c
oncp.c
openconnect-internal.h
pulse.c

diff --git a/esp.c b/esp.c
index b25a468a169633d6cc88f63b80344fd8cced35f3..03f383431de091b7bc10c355a7c8c81dce6e45ca 100644 (file)
--- a/esp.c
+++ b/esp.c
@@ -320,7 +320,7 @@ int esp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                                        store_be32(&this->pulse.vendor, 0xa4c);
                                        store_be32(&this->pulse.type, 4);
                                        store_be32(&this->pulse.len, this->len + 16);
-                                       queue_packet(&vpninfo->oncp_control_queue, this);
+                                       queue_packet(&vpninfo->tcp_control_queue, this);
                                        work_done = 1;
                                        continue;
                                }
index e6d27184f35a6b02762a8f3faeab02f1d6107e12..fe21dcde35858440bb3ee17410bb401189b1d358 100644 (file)
--- a/library.c
+++ b/library.c
@@ -71,7 +71,7 @@ struct openconnect_info *openconnect_vpninfo_new(const char *useragent,
 #endif
        init_pkt_queue(&vpninfo->incoming_queue);
        init_pkt_queue(&vpninfo->outgoing_queue);
-       init_pkt_queue(&vpninfo->oncp_control_queue);
+       init_pkt_queue(&vpninfo->tcp_control_queue);
        vpninfo->dtls_tos_current = 0;
        vpninfo->dtls_pass_tos = 0;
        vpninfo->ssl_fd = vpninfo->dtls_fd = -1;
index 2c1ce94ebaefebed9e0559dfa01ea88d3a4492e9..b8f401f8a67b9187bc23aa4b50676f222d5dc550 100644 (file)
@@ -80,7 +80,7 @@ int tun_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                        work_done = 1;
 
                        if (queue_packet(&vpninfo->outgoing_queue, out_pkt) +
-                           vpninfo->oncp_control_queue.count >= vpninfo->max_qlen) {
+                           vpninfo->tcp_control_queue.count >= vpninfo->max_qlen) {
                                out_pkt = NULL;
                                unmonitor_read_fd(vpninfo, tun);
                                break;
@@ -88,7 +88,7 @@ int tun_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                        out_pkt = NULL;
                }
                vpninfo->tun_pkt = out_pkt;
-       } else if (vpninfo->outgoing_queue.count + vpninfo->oncp_control_queue.count < vpninfo->max_qlen) {
+       } else if (vpninfo->outgoing_queue.count + vpninfo->tcp_control_queue.count < vpninfo->max_qlen) {
                monitor_read_fd(vpninfo, tun);
        }
 
diff --git a/oncp.c b/oncp.c
index 188fd68c916f2fb0bd36a0f2dca60ebf10150810..7e8feac3dd76b18f00d5b94d8e9098930647bc1c 100644 (file)
--- a/oncp.c
+++ b/oncp.c
@@ -443,7 +443,7 @@ static int queue_esp_control(struct openconnect_info *vpninfo, int enable)
 
        memcpy(new, &esp_enable_pkt, sizeof(*new) + 13);
        new->data[12] = enable;
-       queue_packet(&vpninfo->oncp_control_queue, new);
+       queue_packet(&vpninfo->tcp_control_queue, new);
        return 0;
 }
 
@@ -815,7 +815,7 @@ static int oncp_receive_espkeys(struct openconnect_info *vpninfo, int len)
                store_le16(vpninfo->cstp_pkt->oncp.rec,
                           (p - vpninfo->cstp_pkt->oncp.kmp));
 
-               queue_packet(&vpninfo->oncp_control_queue, vpninfo->cstp_pkt);
+               queue_packet(&vpninfo->tcp_control_queue, vpninfo->cstp_pkt);
                vpninfo->cstp_pkt = NULL;
 
                print_esp_keys(vpninfo, _("new incoming"), esp);
@@ -1224,7 +1224,7 @@ int oncp_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                goto handle_outgoing;
        }
 
-       vpninfo->current_ssl_pkt = dequeue_packet(&vpninfo->oncp_control_queue);
+       vpninfo->current_ssl_pkt = dequeue_packet(&vpninfo->tcp_control_queue);
        if (vpninfo->current_ssl_pkt)
                goto handle_outgoing;
 
index 2f5e9e63e7957642d6555d13b9e2c4d71907df39..04776bdb783b28f1b87f8061edfa5fcd1dc1324e 100644 (file)
@@ -557,7 +557,6 @@ struct openconnect_info {
        struct pkt *deflate_pkt;                /* For compressing outbound packets into */
        struct pkt *pending_deflated_pkt;       /* The original packet associated with above */
        struct pkt *current_ssl_pkt;            /* Partially sent SSL packet */
-       struct pkt_q oncp_control_queue;                /* Control packets to be sent on oNCP next */
        int oncp_rec_size;                      /* For packetising incoming oNCP stream */
        /* Packet buffers for receiving into */
        struct pkt *cstp_pkt;
@@ -658,6 +657,7 @@ struct openconnect_info {
 
        struct pkt_q incoming_queue;
        struct pkt_q outgoing_queue;
+       struct pkt_q tcp_control_queue;         /* Control packets to be sent via TCP */
        int max_qlen;
        struct oc_stats stats;
        openconnect_stats_vfn stats_handler;
diff --git a/pulse.c b/pulse.c
index fbe62c766baa8f526a1ef1d5225eb82666afaba0..c07b21b5e7962fca6690e5e3a5fef16b598012a9 100644 (file)
--- a/pulse.c
+++ b/pulse.c
@@ -2701,7 +2701,7 @@ int pulse_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                        }
                        vpninfo->cstp_pkt = NULL;
                        pkt->len = load_be32(&pkt->pulse.len) - 16;
-                       queue_packet(&vpninfo->oncp_control_queue, pkt);
+                       queue_packet(&vpninfo->tcp_control_queue, pkt);
 
                        print_esp_keys(vpninfo, _("new incoming"), &vpninfo->esp_in[vpninfo->current_esp_in]);
                        print_esp_keys(vpninfo, _("new outgoing"), &vpninfo->esp_out);
@@ -2878,7 +2878,7 @@ int pulse_mainloop(struct openconnect_info *vpninfo, int *timeout, int readable)
                work_done = 1;
        }
 
-       vpninfo->current_ssl_pkt = dequeue_packet(&vpninfo->oncp_control_queue);
+       vpninfo->current_ssl_pkt = dequeue_packet(&vpninfo->tcp_control_queue);
        if (vpninfo->current_ssl_pkt) {
                /* Anything on the control queue will have the rest of its
                   header filled in already. */