]> Kevux Git Server - kevux-tools/commitdiff
Progress: Begin addressing existing todo comments and other tasks.
authorKevin Day <Kevin@kevux.org>
Thu, 22 Jan 2026 03:50:06 +0000 (21:50 -0600)
committerKevin Day <Kevin@kevux.org>
Thu, 22 Jan 2026 03:50:06 +0000 (21:50 -0600)
Remove `gpgme` from `modes_default` in `data/build/tacocat/settings.tacocat`.

The `// @todo port here.` seems to not be needed.

There is random selecting of `host.h_addr_list` does not seem to be used.
Remove this dead code.

Remove redundant allocation increase.

Call `f_network_from_host_short()` rather than directly calling `htons()`.

Add port number in network address printing messages.

data/build/tacocat/settings.tacocat
sources/c/program/kevux/tools/tacocat/main/common.c
sources/c/program/kevux/tools/tacocat/main/print/message.c

index 702f9d617ad7410ac95a1ec9e780b6abf0c775e1..799ef88b92903b4a1d4b7b13cefdae244681a7b1 100644 (file)
@@ -31,7 +31,7 @@ version_file micro
 version_target minor
 
 modes android clang coverage debug fanalyzer flex_arrays gcc gpgme individual individual_thread level monolithic pinephone test thread threadless
-modes_default debug gcc gpgme monolithic thread
+modes_default debug gcc monolithic thread
 
 build_compiler gcc
 build_compiler-clang clang
index 3f762f4489ea809c934710c084ffbb6dca9117a4..b38d4f94870d7991b03fa476d87359f9fc204468 100644 (file)
@@ -449,8 +449,6 @@ extern "C" {
                 main->setting.state.status = f_network_from_ip_string(address, &family);
 
                 macro_kt_tacocat_handle_load_send_receive_error_continue_2();
-
-                // @todo port here.
               }
               else {
                 main->setting.state.status = f_network_from_ip_name(address, &host);
@@ -475,24 +473,6 @@ extern "C" {
 
                 macro_kt_tacocat_handle_load_send_receive_error_continue_2();
 
-                // Randomly select one of the addresses when there are more than one.
-                if (host.h_addr_list[1]) {
-                  k = 2;
-
-                  while (host.h_addr_list[k++]);
-
-                  // Real randomness or security is not needed here, so fiddle with predictable but somewhat dynamic numbers.
-                  srand(main->program.pid + j + host.h_addr_list[0][0]);
-                  k = rand() % (k - 1);
-                }
-                else {
-                  k = 0;
-                }
-
-                main->setting.state.status = f_memory_array_increase_by(INET6_ADDRSTRLEN + 1, sizeof(f_char_t), (void **) &sets[i]->array[j].network.string, &sets[i]->array[j].network.used, &sets[i]->array[j].network.size);
-
-                macro_kt_tacocat_handle_load_send_receive_error_continue_2();
-
                 main->setting.state.status = f_network_to_ip_string(family, &sets[i]->array[j].network);
 
                 if (main->setting.state.status == F_data_not || !host.h_addr_list || !host.h_addr_list[0]) {
@@ -518,14 +498,20 @@ extern "C" {
               if (host.h_addrtype == f_socket_address_family_inet4_e) {
                 sets[i]->array[j].socket.domain = f_socket_protocol_family_inet4_e;
                 sets[i]->array[j].socket.address.inet4.sin_family = f_socket_address_family_inet4_e;
-                sets[i]->array[j].socket.address.inet4.sin_port = htons((in_port_t) sets[i]->array[j].port);
                 sets[i]->array[j].socket.address.inet4.sin_addr.s_addr = family.address.v4.s_addr;
+
+                main->setting.state.status = f_network_from_host_short(sets[i]->array[j].port, &sets[i]->array[j].socket.address.inet4.sin_port);
+
+                macro_kt_tacocat_handle_load_send_receive_error_continue_2();
               }
               else if (host.h_addrtype == f_socket_address_family_inet6_e) {
                 sets[i]->array[j].socket.domain = f_socket_protocol_family_inet6_e;
                 sets[i]->array[j].socket.address.inet4.sin_family = f_socket_address_family_inet6_e;
-                sets[i]->array[j].socket.address.inet6.sin6_port = htons((in_port_t) sets[i]->array[j].port);
                 sets[i]->array[j].socket.address.inet6.sin6_addr = family.address.v6;
+
+                main->setting.state.status = f_network_from_host_short(sets[i]->array[j].port, &sets[i]->array[j].socket.address.inet6.sin6_port);
+
+                macro_kt_tacocat_handle_load_send_receive_error_continue_2();
               }
             }
             else {
index 92959199ec913a8f5d386f6cce387daf638fae7f..febe2ab01ecd5d0d12dc91754b0155f833e6a6d0 100644 (file)
@@ -109,6 +109,8 @@ extern "C" {
 
     fl_print_format("%rPacket from ", print->to, f_string_eol_s);
     fl_print_format(f_string_format_Q_single_s.string, print->to, print->set->notable, set.network, print->set->notable);
+    fl_print_format(" port ", print->to);
+    fl_print_format(f_string_format_ul_single_s.string, print->to, print->set->notable, set.port, print->set->notable);
     fl_print_format(" is complete.%r", print->to, f_string_eol_s);
 
     f_file_stream_unlock(print->to);
@@ -127,6 +129,8 @@ extern "C" {
 
     fl_print_format("%rPacket from ", print->to, f_string_eol_s);
     fl_print_format(f_string_format_Q_single_s.string, print->to, print->set->notable, set.network, print->set->notable);
+    fl_print_format(" port ", print->to);
+    fl_print_format(f_string_format_ul_single_s.string, print->to, print->set->notable, set.port, print->set->notable);
     fl_print_format(" is %[%ul%] Bytes.%r", print->to, print->set->notable, set.packet.size, print->set->notable, f_string_eol_s);
 
     f_file_stream_unlock(print->to);
@@ -145,6 +149,8 @@ extern "C" {
 
     fl_print_format("%rReceived packet from ", print->to, f_string_eol_s);
     fl_print_format(f_string_format_Q_single_s.string, print->to, print->set->notable, set.network, print->set->notable);
+    fl_print_format(" port ", print->to);
+    fl_print_format(f_string_format_ul_single_s.string, print->to, print->set->notable, set.port, print->set->notable);
 
     if (print->verbosity > f_console_verbosity_normal_e) {
       fl_print_format(" (appending to file '", print->to);