@@ -141,7 +141,7 @@ GCC_PRAGMA (GCC diagnostic ignored "-Wmissing-braces")
141
141
142
142
/**
143
143
* \def FW_FUNC_ENOSYS
144
- * The error-code (120) to use if `g_cfg.FIREWALL.enable == FALSE `.
144
+ * The error-code (120) to use if `g_cfg.FIREWALL.enable == false `.
145
145
*/
146
146
#define FW_FUNC_ENOSYS ERROR_CALL_NOT_IMPLEMENTED
147
147
@@ -180,7 +180,7 @@ static int fw_api = FW_API_DEFAULT;
180
180
static bool fw_force_init = false;
181
181
182
182
/**
183
- * TRUE if we've been called from `firewall_main()`.
183
+ * `true` if we've been called from `firewall_main()`.
184
184
*/
185
185
static bool from_firewall_main = false;
186
186
@@ -1239,7 +1239,7 @@ DEF_FUNC (ULONG, FWClosePolicyStore, (HANDLE *policy_store));
1239
1239
* Add the function-pointer value `p_XXfunc` to the `fw_funcs[]` array.
1240
1240
*/
1241
1241
#undef ADD_VALUE
1242
- #define ADD_VALUE(dll, func) { TRUE , NULL, dll, #func, (void**)&p_##func }
1242
+ #define ADD_VALUE(dll, func) { true , NULL, dll, #func, (void**)&p_##func }
1243
1243
1244
1244
static struct LoadTable fw_funcs[] = {
1245
1245
ADD_VALUE ("FirewallAPI.dll", FWOpenPolicyStore),
@@ -2028,7 +2028,7 @@ static bool fw_monitor_init (_FWPM_NET_EVENT_SUBSCRIPTION0 *subscription)
2028
2028
FWP_VALUE value;
2029
2029
DWORD rc;
2030
2030
2031
- /* If 'fw_init()' wasn't called or succeeded, return FALSE .
2031
+ /* If 'fw_init()' wasn't called or succeeded, return false .
2032
2032
*/
2033
2033
if (fw_policy_handle == INVALID_HANDLE_VALUE)
2034
2034
{
@@ -2095,7 +2095,7 @@ static bool fw_monitor_init (_FWPM_NET_EVENT_SUBSCRIPTION0 *subscription)
2095
2095
}
2096
2096
2097
2097
/**
2098
- * Try all available `FwpmNetEventSubscribeX()` functions and return TRUE if one succeedes.
2098
+ * Try all available `FwpmNetEventSubscribeX()` functions and return `true` if one succeedes.
2099
2099
* Start with the one above or equal the given API-level in `fw_api`.
2100
2100
*/
2101
2101
static bool fw_monitor_subscribe (_FWPM_NET_EVENT_SUBSCRIPTION0 *subscription)
@@ -2631,7 +2631,7 @@ static int rule_compare_name (const void **_a, const void **_b)
2631
2631
* ```
2632
2632
* HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Defaults\FirewallPolicy\FirewallRules
2633
2633
* ```
2634
- * and if `g_cfg.FIREWALL.show_all == TRUE `:
2634
+ * and if `g_cfg.FIREWALL.show_all == true `:
2635
2635
* ```
2636
2636
* HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules"
2637
2637
* ```
@@ -4266,9 +4266,9 @@ static void print_eff_name_id (const _FWPM_NET_EVENT_HEADER3 *header)
4266
4266
* Lookup the account and domain for a SID to get
4267
4267
* a more sensible account and domain-name.
4268
4268
*
4269
- * \retval TRUE The account and domain for the SID was found.
4270
- * Also returns TRUE if there is no mapping of the SID.
4271
- * \retval FALSE The account and domain for the SID was not found.
4269
+ * \retval true The account and domain for the SID was found.
4270
+ * Also returns `true` if there is no mapping of the SID.
4271
+ * \retval false The account and domain for the SID was not found.
4272
4272
*/
4273
4273
static bool lookup_account_SID (const SID *sid, const char *sid_str, char *account, char *domain)
4274
4274
{
@@ -4414,6 +4414,16 @@ static void print_reauth_reason (const _FWPM_NET_EVENT_HEADER3 *header,
4414
4414
else fw_buf_addf ("%lu\n", DWORD_CAST(allow_event->reauthReason));
4415
4415
}
4416
4416
4417
+ /*
4418
+ * Map a 'FWP_IP_VERSION_V4' / 'FWP_IP_VERSION_V6'
4419
+ * to "4", "6" or "?".
4420
+ */
4421
+ static const char *ip_ver_str (int fw_ip_ver)
4422
+ {
4423
+ return (fw_ip_ver == FWP_IP_VERSION_V4 ? "4" :
4424
+ fw_ip_ver == FWP_IP_VERSION_V6 ? "6" : "?");
4425
+ }
4426
+
4417
4427
static void CALLBACK
4418
4428
fw_event_callback (const UINT event_type,
4419
4429
const _FWPM_NET_EVENT_HEADER3 *header,
@@ -4449,7 +4459,7 @@ static void CALLBACK
4449
4459
(header->ipVersion == FWP_IP_VERSION_V6 && !g_cfg.FIREWALL.show_ipv6))
4450
4460
{
4451
4461
fw_num_ignored++;
4452
- TRACE (2, "Ignoring IPv%d event.\n", header->ipVersion);
4462
+ TRACE (2, "Ignoring IPv%s event.\n", ip_ver_str( header->ipVersion) );
4453
4463
return;
4454
4464
}
4455
4465
}
@@ -4459,7 +4469,7 @@ static void CALLBACK
4459
4469
* of `exclude_list_get (address_str, EXCL_ADDRESS)` before deciding to print anything.
4460
4470
* The same goes for `exclude_list_get (appId, EXCL_PROGRAM)`.
4461
4471
*
4462
- * If all `X_printed` are `FALSE `, `fw_buf_reset()` is called and nothing gets printed to `C_puts()`.
4472
+ * If all `X_printed` are `false `, `fw_buf_reset()` is called and nothing gets printed to `C_puts()`.
4463
4473
*/
4464
4474
event_name = list_lookup_name (event_type, events, DIM(events));
4465
4475
@@ -4796,7 +4806,8 @@ int firewall_main (int argc, char **argv)
4796
4806
4797
4807
set_program_name (argv[0]);
4798
4808
4799
- g_cfg.FIREWALL.show_ipv6 = false; /* override the config-file */
4809
+ g_cfg.FIREWALL.show_ipv6 = false; /* override the config-file */
4810
+ g_cfg.FIREWALL.show_all = false; /* ditto */
4800
4811
4801
4812
while ((ch = getopt(argc, argv, "46a:Afh?cel:prRstv")) != EOF)
4802
4813
switch (ch)
@@ -4862,8 +4873,8 @@ int firewall_main (int argc, char **argv)
4862
4873
4863
4874
program = set_net_program (argc-optind, argv+optind);
4864
4875
4865
- g_cfg.FIREWALL.enable = true; /* should be redundant */
4866
- g_cfg.trace_report = true; /* enable statistics in 'fw_report()' */
4876
+ g_cfg.FIREWALL.enable = true; /* should be redundant */
4877
+ g_cfg.trace_report = true; /* enable statistics in 'fw_report()' */
4867
4878
4868
4879
if (dump_events || dump_rules || dump_callouts || log_file ||
4869
4880
g_data.stdout_redirected || g_cfg.trace_use_ods)
0 commit comments