Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 946409 | Differences between
and this patch

Collapse All | Expand All

(-)kismet-2023-07-R1-orig/datasourcetracker.cc (-1 / +1 lines)
Lines 594-600 void datasource_tracker::trigger_deferre Link Here
594
                remotecap_v4 = std::make_shared<datasource_tracker_remote_server>(v4_ep);
594
                remotecap_v4 = std::make_shared<datasource_tracker_remote_server>(v4_ep);
595
            } else {
595
            } else {
596
                auto v4_ep = 
596
                auto v4_ep = 
597
                    tcp::endpoint(boost::asio::ip::address_v4::from_string(config_defaults->get_remote_cap_listen()),
597
                    tcp::endpoint(boost::asio::ip::make_address_v4(config_defaults->get_remote_cap_listen()),
598
                            config_defaults->get_remote_cap_port());
598
                            config_defaults->get_remote_cap_port());
599
                remotecap_v4 = std::make_shared<datasource_tracker_remote_server>(v4_ep);
599
                remotecap_v4 = std::make_shared<datasource_tracker_remote_server>(v4_ep);
600
            }
600
            }
(-)kismet-2023-07-R1-orig/gpsgpsd_v3.cc (-10 / +10 lines)
Lines 136-148 void kis_gps_gpsd_v3::close_impl() { Link Here
136
}
136
}
137
137
138
void kis_gps_gpsd_v3::start_connect(const boost::system::error_code& error, 
138
void kis_gps_gpsd_v3::start_connect(const boost::system::error_code& error, 
139
        tcp::resolver::iterator endpoints) {
139
        tcp::resolver::results_type endpoints) {
140
140
141
    if (error) {
141
    if (error) {
142
        _MSG_ERROR("(GPS) Could not resolve gpsd address {}:{} - {}", host, port, error.message());
142
        _MSG_ERROR("(GPS) Could not resolve gpsd address {}:{} - {}", host, port, error.message());
143
        stopped = true;
143
        stopped = true;
144
        set_int_device_connected(false);
144
        set_int_device_connected(false);
145
    } else if (endpoints == tcp::resolver::iterator()) {
145
    } else if (endpoints.empty()) {
146
        _MSG_ERROR("(GPS) Could not connect to gpsd {}:{}", host, port);
146
        _MSG_ERROR("(GPS) Could not connect to gpsd {}:{}", host, port);
147
        stopped = true;
147
        stopped = true;
148
        set_int_device_connected(false);
148
        set_int_device_connected(false);
Lines 150-179 void kis_gps_gpsd_v3::start_connect(cons Link Here
150
        boost::asio::async_connect(socket, endpoints,
150
        boost::asio::async_connect(socket, endpoints,
151
                boost::asio::bind_executor(strand_, 
151
                boost::asio::bind_executor(strand_, 
152
                    [self = shared_from_this()](const boost::system::error_code& ec, 
152
                    [self = shared_from_this()](const boost::system::error_code& ec, 
153
                        tcp::resolver::iterator endpoint) {
153
                        tcp::resolver::results_type::endpoint_type endpoint) {
154
                        self->handle_connect(ec, endpoint);
154
                        self->handle_connect(ec, endpoint);
155
                    }));
155
                    }));
156
    }
156
    }
157
}
157
}
158
158
159
void kis_gps_gpsd_v3::handle_connect(const boost::system::error_code& error, 
159
void kis_gps_gpsd_v3::handle_connect(const boost::system::error_code& error, 
160
        tcp::resolver::iterator endpoint) {
160
        tcp::resolver::results_type::endpoint_type endpoint) {
161
161
162
    if (stopped) {
162
    if (stopped) {
163
        return;
163
        return;
164
    }
164
    }
165
165
166
    if (error) {
166
    if (error) {
167
        if (endpoint == tcp::resolver::iterator())
167
        if (endpoint == tcp::resolver::results_type::endpoint_type())
168
            _MSG_ERROR("(GPS) Could not connect to gpsd {}:{} - {}", host, port, error.message());
168
            _MSG_ERROR("(GPS) Could not connect to gpsd {}:{} - {}", host, port, error.message());
169
        else
169
        else
170
            _MSG_ERROR("(GPS) Could not connect to gpsd {} - {}", endpoint->endpoint(), error.message());
170
            _MSG_ERROR("(GPS) Could not connect to gpsd {} - {}", endpoint.address().to_string(), endpoint.port(), error.message());
171
171
172
        handle_error();
172
        handle_error();
173
        return;
173
        return;
174
    }
174
    }
175
175
176
    _MSG_INFO("(GPS) Connected to gpsd server {}", endpoint->endpoint());
176
    _MSG_INFO("(GPS) Connected to gpsd server {}", endpoint.address().to_string(), endpoint.port());
177
177
178
    stopped = false;
178
    stopped = false;
179
    set_int_device_connected(true);
179
    set_int_device_connected(true);
Lines 728-737 bool kis_gps_gpsd_v3::open_gps(std::stri Link Here
728
728
729
    lk.unlock();
729
    lk.unlock();
730
730
731
    resolver.async_resolve(tcp::resolver::query(host.c_str(), port.c_str()),
731
    resolver.async_resolve(host, port,
732
            boost::asio::bind_executor(strand_, 
732
            boost::asio::bind_executor(strand_, 
733
            [self = shared_from_this()](const boost::system::error_code& error, tcp::resolver::iterator endp) {
733
            [self = shared_from_this()](const boost::system::error_code& error, tcp::resolver::results_type results) {
734
                self->start_connect(error, endp);
734
                self->start_connect(error, results);
735
            }));
735
            }));
736
736
737
    return 1;
737
    return 1;
(-)kismet-2023-07-R1-orig/gpsgpsd_v3.h (-2 / +2 lines)
Lines 47-55 protected: Link Here
47
    void handle_open_gps();
47
    void handle_open_gps();
48
48
49
    void start_connect(const boost::system::error_code& error, 
49
    void start_connect(const boost::system::error_code& error, 
50
            tcp::resolver::iterator endpoint_iter);
50
            tcp::resolver::results_type endpoints);
51
    void handle_connect(const boost::system::error_code& error, 
51
    void handle_connect(const boost::system::error_code& error, 
52
            tcp::resolver::iterator endpoint);
52
            tcp::resolver::results_type::endpoint_type endpoint);
53
53
54
    void start_read();
54
    void start_read();
55
    void handle_read(const boost::system::error_code& error, std::size_t sz);
55
    void handle_read(const boost::system::error_code& error, std::size_t sz);
(-)kismet-2023-07-R1-orig/gpstcp_v2.cc (-9 / +9 lines)
Lines 117-152 void kis_gps_tcp_v2::start_read_impl() { Link Here
117
}
117
}
118
118
119
void kis_gps_tcp_v2::start_connect(std::shared_ptr<kis_gps_tcp_v2> ref,
119
void kis_gps_tcp_v2::start_connect(std::shared_ptr<kis_gps_tcp_v2> ref,
120
        const boost::system::error_code& error, tcp::resolver::iterator endpoints) {
120
        const boost::system::error_code& error, tcp::resolver::results_type endpoints) {
121
    if (error) {
121
    if (error) {
122
        _MSG_ERROR("(GPS) Could not resolve TCP GPS server address {}:{} - {}", host, port, error.message());
122
        _MSG_ERROR("(GPS) Could not resolve TCP GPS server address {}:{} - {}", host, port, error.message());
123
        stopped = true;
123
        stopped = true;
124
        set_int_device_connected(false);
124
        set_int_device_connected(false);
125
    } else {
125
    } else {
126
        boost::asio::async_connect(socket, endpoints,
126
        boost::asio::async_connect(socket, endpoints,
127
                [this, ref](const boost::system::error_code& ec, tcp::resolver::iterator endpoint) {
127
                [this, ref](const boost::system::error_code& ec, tcp::resolver::results_type::endpoint_type endpoint) {
128
                    handle_connect(ref, ec, endpoint);
128
                    handle_connect(ref, ec, endpoint);
129
                });
129
                });
130
    }
130
    }
131
}
131
}
132
132
133
void kis_gps_tcp_v2::handle_connect(std::shared_ptr<kis_gps_tcp_v2> ref,
133
void kis_gps_tcp_v2::handle_connect(std::shared_ptr<kis_gps_tcp_v2> ref,
134
        const boost::system::error_code& error, tcp::resolver::iterator endpoint) {
134
        const boost::system::error_code& error, tcp::resolver::results_type::endpoint_type endpoint) {
135
    if (stopped) {
135
    if (stopped) {
136
        return;
136
        return;
137
    }
137
    }
138
138
139
    if (error) {
139
    if (error) {
140
        if (endpoint == tcp::resolver::iterator())
140
        if (endpoint == tcp::resolver::results_type::endpoint_type())
141
            _MSG_ERROR("(GPS) Could not connect to TCP GPS {}:{} - {}", host, port, error.message());
141
            _MSG_ERROR("(GPS) Could not connect to TCP GPS {}:{} - {}", host, port, error.message());
142
        else
142
        else
143
            _MSG_ERROR("(GPS) Could not connect to TCP GPS server {} - {}", endpoint->endpoint(), 
143
            _MSG_ERROR("(GPS) Could not connect to TCP GPS server {} - {}", endpoint.address().to_string(), endpoint.port(),
144
                    error.message());
144
                    error.message());
145
        close_impl();
145
        close_impl();
146
        return;
146
        return;
147
    }
147
    }
148
148
149
    _MSG_INFO("(GPS) Connected to TCP GPS server {}", endpoint->endpoint());
149
    _MSG_INFO("(GPS) Connected to TCP GPS server {}", endpoint.address().to_string(), endpoint.port());
150
150
151
    stopped = false;
151
    stopped = false;
152
    set_int_device_connected(true);
152
    set_int_device_connected(true);
Lines 198-207 bool kis_gps_tcp_v2::open_gps(std::strin Link Here
198
198
199
    _MSG_INFO("(GPS) Connecting to TCP GPS on {}:{}", host, port);
199
    _MSG_INFO("(GPS) Connecting to TCP GPS on {}:{}", host, port);
200
200
201
    resolver.async_resolve(tcp::resolver::query(host.c_str(), port.c_str()),
201
    resolver.async_resolve(host, port,
202
            [this](const boost::system::error_code& error, tcp::resolver::iterator endp) {
202
            [this](const boost::system::error_code& error, tcp::resolver::results_type results) {
203
                start_connect(std::static_pointer_cast<kis_gps_tcp_v2>(shared_from_this()), 
203
                start_connect(std::static_pointer_cast<kis_gps_tcp_v2>(shared_from_this()), 
204
                        error, endp);
204
                        error, results);
205
            });
205
            });
206
206
207
    return 1;
207
    return 1;
(-)kismet-2023-07-R1-orig/gpstcp_v2.h (-2 / +2 lines)
Lines 48-56 public: Link Here
48
48
49
protected:
49
protected:
50
    void start_connect(std::shared_ptr<kis_gps_tcp_v2> ref, 
50
    void start_connect(std::shared_ptr<kis_gps_tcp_v2> ref, 
51
            const boost::system::error_code& error, tcp::resolver::iterator endpoint_iter);
51
            const boost::system::error_code& error, tcp::resolver::results_type endpoints);
52
    void handle_connect(std::shared_ptr<kis_gps_tcp_v2> ref,
52
    void handle_connect(std::shared_ptr<kis_gps_tcp_v2> ref,
53
            const boost::system::error_code& error, tcp::resolver::iterator endpoint);
53
            const boost::system::error_code& error, tcp::resolver::results_type::endpoint_type endpoint);
54
54
55
    void write_gpsd(std::shared_ptr<kis_gps_tcp_v2> ref, const std::string& data);
55
    void write_gpsd(std::shared_ptr<kis_gps_tcp_v2> ref, const std::string& data);
56
56
(-)kismet-2023-07-R1-orig/kis_external.cc (-1 / +1 lines)
Lines 294-300 void kis_external_ws::write_impl() { Link Here
294
            if (ec == 0)
294
            if (ec == 0)
295
                errc = boost::asio::error::make_error_code(boost::asio::stream_errc::eof);
295
                errc = boost::asio::error::make_error_code(boost::asio::stream_errc::eof);
296
296
297
            self->strand().post([self, errc]() { 
297
            boost::asio::post(self->strand(), [self, errc]() {
298
                self->out_bufs_.pop_front();
298
                self->out_bufs_.pop_front();
299
299
300
                if (errc) {
300
                if (errc) {
(-)kismet-2023-07-R1-orig/kis_external.h (-8 / +8 lines)
Lines 112-118 public: Link Here
112
112
113
    virtual bool connected() { return false; }
113
    virtual bool connected() { return false; }
114
114
115
    virtual boost::asio::io_service::strand &strand() { return strand_; }
115
    virtual boost::asio::io_context::strand &strand() { return strand_; }
116
116
117
    virtual void close() { 
117
    virtual void close() { 
118
        stopped_ = true;
118
        stopped_ = true;
Lines 129-135 public: Link Here
129
    std::atomic<bool> stopped_;
129
    std::atomic<bool> stopped_;
130
130
131
    std::shared_ptr<kis_external_interface> interface_;
131
    std::shared_ptr<kis_external_interface> interface_;
132
    boost::asio::io_service::strand strand_;
132
    boost::asio::io_context::strand strand_;
133
133
134
    boost::asio::streambuf in_buf_;
134
    boost::asio::streambuf in_buf_;
135
    std::list<std::shared_ptr<std::string>> out_bufs_;
135
    std::list<std::shared_ptr<std::string>> out_bufs_;
Lines 203-209 public: Link Here
203
        ws_strand_{ws->strand()},
203
        ws_strand_{ws->strand()},
204
        write_cb_{write_cb} { }
204
        write_cb_{write_cb} { }
205
205
206
    virtual boost::asio::io_service::strand &strand() override {
206
    virtual boost::asio::io_context::strand &strand() override {
207
        return ws_strand_;
207
        return ws_strand_;
208
    }
208
    }
209
209
Lines 219-225 public: Link Here
219
219
220
220
221
    std::shared_ptr<kis_net_web_websocket_endpoint> ws_;
221
    std::shared_ptr<kis_net_web_websocket_endpoint> ws_;
222
    boost::asio::io_service::strand ws_strand_;
222
    boost::asio::io_context::strand ws_strand_;
223
    cb_func_t write_cb_;
223
    cb_func_t write_cb_;
224
};
224
};
225
225
Lines 424-431 public: Link Here
424
                return result_handle_packet_needbuf;
424
                return result_handle_packet_needbuf;
425
            }
425
            }
426
426
427
            frame = boost::asio::buffer_cast<const kismet_external_frame_t *>(buffer.data());
427
            frame = static_cast<const kismet_external_frame_t *>(buffer.data().data());
428
            frame_v2 = boost::asio::buffer_cast<const kismet_external_frame_v2_t *>(buffer.data());
428
            frame_v2 = static_cast<const kismet_external_frame_v2_t *>(buffer.data().data());
429
429
430
            // Check the frame signature
430
            // Check the frame signature
431
            if (kis_ntoh32(frame->signature) != KIS_EXTERNAL_PROTO_SIG) {
431
            if (kis_ntoh32(frame->signature) != KIS_EXTERNAL_PROTO_SIG) {
Lines 542-549 public: Link Here
542
            return result_handle_packet_needbuf;
542
            return result_handle_packet_needbuf;
543
        }
543
        }
544
544
545
        frame = boost::asio::buffer_cast<const kismet_external_frame_t *>(data);
545
        frame = static_cast<const kismet_external_frame_t *>(data.data());
546
        frame_v2 = boost::asio::buffer_cast<const kismet_external_frame_v2_t *>(data);
546
        frame_v2 = static_cast<const kismet_external_frame_v2_t *>(data.data());
547
547
548
        // Check the frame signature
548
        // Check the frame signature
549
        if (kis_ntoh32(frame->signature) != KIS_EXTERNAL_PROTO_SIG) {
549
        if (kis_ntoh32(frame->signature) != KIS_EXTERNAL_PROTO_SIG) {
(-)kismet-2023-07-R1-orig/kismet_server.cc (-1 / +1 lines)
Lines 601-607 int main(int argc, char *argv[], char *e Link Here
601
                "unique server UUID");
601
                "unique server UUID");
602
602
603
    // Allocate the IO service
603
    // Allocate the IO service
604
    boost::asio::io_service::work work(Globalreg::globalreg->io);
604
    boost::asio::executor_work_guard<boost::asio::io_context::executor_type> work_guard = boost::asio::make_work_guard(Globalreg::globalreg->io);
605
605
606
    // Make the timetracker
606
    // Make the timetracker
607
    auto timetracker = time_tracker::create_timetracker();
607
    auto timetracker = time_tracker::create_timetracker();
(-)kismet-2023-07-R1-orig/kis_net_beast_httpd.cc (-1 / +1 lines)
Lines 391-397 void kis_net_beast_httpd::trigger_deferr Link Here
391
                        [](std::shared_ptr<kis_net_web_websocket_endpoint> ws,
391
                        [](std::shared_ptr<kis_net_web_websocket_endpoint> ws,
392
                            boost::beast::flat_buffer& buf, bool text) {
392
                            boost::beast::flat_buffer& buf, bool text) {
393
                            // Simple echo protocol
393
                            // Simple echo protocol
394
                            ws->write(boost::asio::buffer_cast<const char *>(buf.data()),
394
                            ws->write(static_cast<const char *>(buf.data().data()),
395
                                    buf.size());
395
                                    buf.size());
396
                        });
396
                        });
397
397
(-)kismet-2023-07-R1-orig/kis_net_beast_httpd.h (-2 / +2 lines)
Lines 558-564 public: Link Here
558
		ws_.text(true);
558
		ws_.text(true);
559
	}
559
	}
560
560
561
	boost::asio::io_service::strand &strand() { return strand_; };
561
	boost::asio::io_context::strand &strand() { return strand_; };
562
562
563
protected:
563
protected:
564
    virtual void close_impl();
564
    virtual void close_impl();
Lines 572-578 protected: Link Here
572
    boost::beast::websocket::stream<boost::beast::tcp_stream> ws_;
572
    boost::beast::websocket::stream<boost::beast::tcp_stream> ws_;
573
573
574
    boost::beast::flat_buffer buffer_;
574
    boost::beast::flat_buffer buffer_;
575
	boost::asio::io_service::strand strand_;
575
	boost::asio::io_context::strand strand_;
576
576
577
	std::queue<std::string, std::deque<std::string>> ws_write_queue_;
577
	std::queue<std::string, std::deque<std::string>> ws_write_queue_;
578
578

Return to bug 946409