Skip to content

Commit

Permalink
Update to use getaddrinfo and set to allow only from a certain node.
Browse files Browse the repository at this point in the history
  • Loading branch information
coldav committed Apr 18, 2024
1 parent 4c8f584 commit bc9312e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions hal/hal_remote/source/hal_socket_transmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ hal_socket_transmitter::~hal_socket_transmitter() {
hal_socket_transmitter::error_code hal_socket_transmitter::start_server(
bool print_port) {
if (!setup_connection_done) {
<<<<<<< HEAD
const hal_socket_transmitter::error_code res = setup_connection(true);
=======
hal_socket_transmitter::error_code res = setup_connection(true);
>>>>>>> Update to use getaddrinfo and set to allow only from a certain node.
if (res != hal_socket_transmitter::success) {
last_error = res;
return res;
Expand Down Expand Up @@ -138,14 +142,22 @@ hal_socket_transmitter::error_code hal_socket_transmitter::setup_connection(
hints.ai_flags = AI_NUMERICSERV;
hints.ai_protocol = IPPROTO_TCP;

<<<<<<< HEAD
const std::string port_str = std::to_string(port_requested);
=======
std::string port_str = std::to_string(port_requested);
>>>>>>> Update to use getaddrinfo and set to allow only from a certain node.
s = getaddrinfo(node.c_str(), port_str.c_str(), &hints, &result);
// Use getaddrinfo on the node and port. This may return one or
// more entries we can bind to in priority order. We take the first
// one that matches.
if (s != 0) {
if (debug_enabled()) {
<<<<<<< HEAD
(void)fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(s));
=======
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(s));
>>>>>>> Update to use getaddrinfo and set to allow only from a certain node.
}
return hal_socket_transmitter::getaddrinfo_failed;
} else {
Expand Down

0 comments on commit bc9312e

Please sign in to comment.