funlockfile(output.to.stream);
}
+void firewall_print_error_on_operation_return_code(const fl_print_t output, const f_string_static_t tool, const f_string_statics_t arguments, const int return_code) {
+
+ if (output.verbosity == f_console_verbosity_quiet_e) return;
+
+ flockfile(output.to.stream);
+
+ fl_print_format("%r%[%QFailed to perform requested %r operation '%]", output.to.stream, f_string_eol_s, output.context, output.prefix, tool, output.context);
+ fl_print_format("%[%r", output.to.stream, output.notable, tool);
+
+ for (f_array_length_t i = 0; i < arguments.used; ++i) {
+ fl_print_format(" %Q", output.to.stream, arguments.array[i]);
+ } // for
+
+ fl_print_format("%]%[' returned with code of%] ", output.to.stream, output.notable, output.context, output.context);
+ fl_print_format("%[%i%]", output.to.stream, output.notable, return_code, output.notable);
+ fl_print_format("%[.%]%r", output.to.stream, output.context, output.context, f_string_eol_s);
+
+ funlockfile(output.to.stream);
+}
+
void firewall_print_error_on_unhandled(const fl_print_t output, const char *function, const f_status_t status) {
if (output.verbosity == f_console_verbosity_quiet_e) return;
extern void firewall_print_error_on_operation(const fl_print_t output, const f_string_static_t tool, const f_string_statics_t arguments) F_attribute_visibility_internal_d;
/**
+ * Print an error about the given operation failed.
+ *
+ * @param output
+ * The output to print to.
+ * @param tool
+ * The iptables tool that failed.
+ * @param arguments
+ * The arguments passed to the tool.
+ * @param return_code
+ * The return code that represents the failure.
+ */
+extern void firewall_print_error_on_operation_return_code(const fl_print_t output, const f_string_static_t tool, const f_string_statics_t arguments, const int return_code) F_attribute_visibility_internal_d;
+
+/**
* Print an unhandled error for the given function.
*
* @param output
for (f_array_length_t at = 0; at < basic_objects.used; ++at) {
arguments.array[arguments.used].used = 0;
+ return_code = 0;
status = f_string_dynamic_partial_append(local_buffer, basic_objects.array[at], &arguments.array[arguments.used]);
if (F_status_is_error(status)) break;
break;
}
+ else if (return_code) {
+ firewall_print_error_on_operation_return_code(data->main->error, current_tool, arguments, return_code);
+ }
} // for
// Remove ip_list_action from arguments string.
if (F_status_set_fine(status) == F_failure || F_status_set_fine(status) == F_parameter) break;
}
else {
+ return_code = 0;
+
firewall_print_debug_tool(data->main->warning, current_tool, arguments);
status = fll_execute_program(current_tool, arguments, 0, 0, (void *) &return_code);
break;
}
+ else if (return_code) {
+ firewall_print_error_on_operation_return_code(data->main->error, current_tool, arguments, return_code);
+ }
}
}
} // for
firewall_print_debug_tool(data->main->warning, firewall_tool_iptables_s, arguments);
tool = firewall_program_iptables_e;
+ return_code = 0;
+
status = fll_execute_program(firewall_tool_iptables_s, arguments, 0, 0, (void *) &return_code);
if (status == F_child) {
break;
}
+ if (return_code) {
+ firewall_print_error_on_operation_return_code(data->main->error, firewall_tool_iptables_s, arguments, return_code);
+ }
+
+ return_code = 0;
+
firewall_print_debug_tool(data->main->warning, firewall_tool_ip6tables_s, arguments);
tool = firewall_program_ip6tables_e;
break;
}
+ else if (return_code) {
+ firewall_print_error_on_operation_return_code(data->main->error, firewall_tool_ip6tables_s, arguments, return_code);
+ }
}
++data->chains.used;
return status;
}
+ else if (return_code) {
+ firewall_print_error_on_operation_return_code(data->main->error, tools[i], arguments, return_code);
+ }
} // for
int return_code = 0;
break;
}
+ else if (return_code) {
+ firewall_print_error_on_operation_return_code(data->main->error, tools[i], arguments, return_code);
+ }
} // for
return status;
break;
}
+ else if (return_code) {
+ firewall_print_error_on_operation_return_code(data->main->error, tools[j], arguments, return_code);
+ }
} // for
} // for