This fixes some obvious problems.
The firewall rules are not currently working and I am going to guess that it might be related to the buffering logic.
return;
}
- f_number_unsigned_t at = 0;
f_number_unsigned_t index = 0;
if (main->program.parameters.array[firewall_parameter_operation_start_e].result & f_console_result_found_e) {
- main->setting.flag &= ~firewall_main_flag_operation_lock_e;
- main->setting.flag &= ~firewall_main_flag_operation_restart_e;
- main->setting.flag &= ~firewall_main_flag_operation_show_e;
- main->setting.flag &= ~firewall_main_flag_operation_stop_e;
-
+ main->setting.flag &= ~firewall_main_flag_operation_e;
main->setting.flag |= firewall_main_flag_operation_start_e;
- at = main->program.parameters.array[firewall_parameter_operation_start_e].values.array[0];
+ index = main->program.parameters.array[firewall_parameter_operation_start_e].location;
}
if (main->program.parameters.array[firewall_parameter_operation_stop_e].result & f_console_result_found_e) {
- if (!(main->setting.flag & firewall_main_flag_operation_e) || (main->program.parameters.array[at].values.array[0] > main->program.parameters.array[firewall_parameter_operation_stop_e].values.array[0])) {
- main->setting.flag &= ~firewall_main_flag_operation_lock_e;
- main->setting.flag &= ~firewall_main_flag_operation_restart_e;
- main->setting.flag &= ~firewall_main_flag_operation_show_e;
- main->setting.flag &= ~firewall_main_flag_operation_start_e;
-
+ if (!(main->setting.flag & firewall_main_flag_operation_e) || main->program.parameters.array[firewall_parameter_operation_stop_e].location > index) {
+ main->setting.flag &= ~firewall_main_flag_operation_e;
main->setting.flag |= firewall_main_flag_operation_stop_e;
- at = main->program.parameters.array[firewall_parameter_operation_stop_e].values.array[0];
+ index = main->program.parameters.array[firewall_parameter_operation_stop_e].location;
}
}
if (main->program.parameters.array[firewall_parameter_operation_restart_e].result & f_console_result_found_e) {
- if (!(main->setting.flag & firewall_main_flag_operation_e) || (main->program.parameters.array[at].values.array[0] > main->program.parameters.array[firewall_parameter_operation_restart_e].values.array[0])) {
- main->setting.flag &= ~firewall_main_flag_operation_lock_e;
- main->setting.flag &= ~firewall_main_flag_operation_show_e;
- main->setting.flag &= ~firewall_main_flag_operation_start_e;
- main->setting.flag &= ~firewall_main_flag_operation_stop_e;
-
+ if (!(main->setting.flag & firewall_main_flag_operation_e) || main->program.parameters.array[firewall_parameter_operation_restart_e].location > index) {
+ main->setting.flag &= ~firewall_main_flag_operation_e;
main->setting.flag |= firewall_main_flag_operation_restart_e;
- at = main->program.parameters.array[firewall_parameter_operation_restart_e].values.array[0];
+ index = main->program.parameters.array[firewall_parameter_operation_restart_e].location;
}
}
if (main->program.parameters.array[firewall_parameter_operation_lock_e].result & f_console_result_found_e) {
- if (!(main->setting.flag & firewall_main_flag_operation_e) || (main->program.parameters.array[at].values.array[0] > main->program.parameters.array[firewall_parameter_operation_lock_e].values.array[0])) {
- main->setting.flag &= ~firewall_main_flag_operation_restart_e;
- main->setting.flag &= ~firewall_main_flag_operation_show_e;
- main->setting.flag &= ~firewall_main_flag_operation_start_e;
- main->setting.flag &= ~firewall_main_flag_operation_stop_e;
-
+ if (!(main->setting.flag & firewall_main_flag_operation_e) || main->program.parameters.array[firewall_parameter_operation_lock_e].location > index) {
+ main->setting.flag &= ~firewall_main_flag_operation_e;
main->setting.flag |= firewall_main_flag_operation_lock_e;
- at = main->program.parameters.array[firewall_parameter_operation_lock_e].values.array[0];
+ index = main->program.parameters.array[firewall_parameter_operation_lock_e].location;
}
}
if (main->program.parameters.array[firewall_parameter_operation_show_e].result & f_console_result_found_e) {
- if (!(main->setting.flag & firewall_main_flag_operation_e) || (main->program.parameters.array[at].values.array[0] > main->program.parameters.array[firewall_parameter_operation_show_e].values.array[0])) {
- main->setting.flag &= ~firewall_main_flag_operation_lock_e;
- main->setting.flag &= ~firewall_main_flag_operation_restart_e;
- main->setting.flag &= ~firewall_main_flag_operation_start_e;
- main->setting.flag &= ~firewall_main_flag_operation_stop_e;
-
+ if (!(main->setting.flag & firewall_main_flag_operation_e) || main->program.parameters.array[firewall_parameter_operation_show_e].location > index) {
+ main->setting.flag &= ~firewall_main_flag_operation_e;
main->setting.flag |= firewall_main_flag_operation_show_e;
}
}
if (main->program.parameters.remaining.used) {
main->setting.flag &= ~firewall_main_flag_operation_show_filter_nat_mangle_e;
- for (at = 0; at < main->program.parameters.remaining.used; ++at) {
+ for (f_number_unsigned_t i = 0; i < main->program.parameters.remaining.used; ++i) {
if (firewall_signal_check(main)) return;
- index = main->program.parameters.remaining.array[at];
+ index = main->program.parameters.remaining.array[i];
if (f_compare_dynamic(firewall_show_nat_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
main->setting.flag |= firewall_main_flag_operation_show_nat_e;
main->setting.flag |= firewall_main_flag_operation_show_filter_nat_mangle_e;
}
}
- else {
- // @todo
-
- // Example:
- /*
- for (f_number_unsigned_t number = 0; index < main->program.parameters.remaining.used; ++index) {
-
- if (control_signal_check(main)) return;
-
- number = main->program.parameters.remaining.array[index];
-
- // Statically allocate the inner strings.
- main->setting.actions.array[main->setting.actions.used].string = main->program.parameters.arguments.array[number].string;
- main->setting.actions.array[main->setting.actions.used].used = main->program.parameters.arguments.array[number].used;
- main->setting.actions.array[main->setting.actions.used++].size = 0;
- } // for
- */
- }
}
#endif // _di_firewall_setting_load_
* - operation_show: Perform the show operation.
* - operation_show_nat: For the show operation, show nat.
* - operation_show_mangle: For the show operation, show mangle.
- * - operation_show_filter: For the show operation, show ports.
- * - operation_show_filter_nat_mangle: A helper flag representing the show nat, show mangle, and short port flags set.
+ * - operation_show_filter: For the show operation, show filter.
+ * - operation_show_filter_nat_mangle: A helper flag representing the show nat, show mangle, and short filter flags set.
* - operation_start: Perform the start operation.
* - operation_start_restart: A helper flag representing both the start and restart operation flag set.
* - operation_stop: Perform the stop operation.
firewall_main_flag_none_e = 0x0,
firewall_main_flag_copyright_e = 0x1,
firewall_main_flag_help_e = 0x2,
- firewall_main_flag_operation_e = 0x4,
- firewall_main_flag_operation_lock_e = 0x8,
- firewall_main_flag_operation_restart_e = 0x10,
- firewall_main_flag_operation_show_e = 0x20,
- firewall_main_flag_operation_show_nat_e = 0x40,
- firewall_main_flag_operation_show_mangle_e = 0x80,
- firewall_main_flag_operation_show_filter_e = 0x100,
- firewall_main_flag_operation_show_filter_nat_mangle_e = 0x1c0,
- firewall_main_flag_operation_start_e = 0x200,
- firewall_main_flag_operation_start_restart_e = 0x210,
- firewall_main_flag_operation_stop_e = 0x400,
- firewall_main_flag_operation_stop_restart_e = 0x410,
- firewall_main_flag_operation_stop_restart_lock_e = 0x418,
- firewall_main_flag_pipe_e = 0x800,
- firewall_main_flag_print_first_e = 0x1000,
- firewall_main_flag_print_last_e = 0x2000,
- firewall_main_flag_version_e = 0x4000,
- firewall_main_flag_version_copyright_help_e = 0x4003,
+ firewall_main_flag_operation_e = 0x31c,
+ firewall_main_flag_operation_lock_e = 0x4,
+ firewall_main_flag_operation_restart_e = 0x8,
+ firewall_main_flag_operation_show_e = 0x10,
+ firewall_main_flag_operation_show_nat_e = 0x20,
+ firewall_main_flag_operation_show_mangle_e = 0x40,
+ firewall_main_flag_operation_show_filter_e = 0x80,
+ firewall_main_flag_operation_show_filter_nat_mangle_e = 0xe0,
+ firewall_main_flag_operation_start_e = 0x100,
+ firewall_main_flag_operation_start_restart_e = 0x108,
+ firewall_main_flag_operation_stop_e = 0x200,
+ firewall_main_flag_operation_stop_restart_e = 0x208,
+ firewall_main_flag_operation_stop_restart_lock_e = 0x20c,
+ firewall_main_flag_pipe_e = 0x400,
+ firewall_main_flag_print_first_e = 0x800,
+ firewall_main_flag_print_last_e = 0x1000,
+ firewall_main_flag_version_e = 0x2000,
+ firewall_main_flag_version_copyright_help_e = 0x2003,
}; // enum
#endif // _di_firewall_main_flag_e_
parameters.array = show_arrays[i];
parameters.used = show_lengths[i];
+ return_code = 0;
firewall_print_message_show_header(&main->program.output, show_lefts[i], show_headers[i], show_rights[i]);
fl_print_format("%[%Q%] ", print->to, print->set->standout, left, print->set->standout);
}
- fll_print_format("%[%Q%]", print->to, print->set->standout, print->set->standout, print->set->title, print->set->title, print->set->standout, print->set->standout, f_string_eol_s);
+ fll_print_format("%[%Q%]", print->to, print->set->title, header, print->set->title, f_string_eol_s);
if (left.used) {
fl_print_format(" %[%Q%]", print->to, print->set->standout, right, print->set->standout);
else {
fl_print_format(" %[the object '%]", print->to, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_range_single_s.string, print->to, print->notable, buffer, range, print->notable);
- fl_print_format("%[' has no content.%]%r", print->to, print->context, print->context, f_string_eol_s);
+ fl_print_format("%[' is invalid.%]%r", print->to, print->context, print->context, f_string_eol_s);
}
f_file_stream_unlock(print->to);