Skip to content

Commit cd0ce9f

Browse files
authored
fix(snort): limit CPU thread and queue count to a maximum of 16 (#1431)
1 parent 7046c0c commit cd0ce9f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/ns-api/files/ns.snort

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ def __setup(enabled, set_home_net=False, include_vpn=False, ns_policy='balanced'
128128

129129
# always set the number of threads to the number of CPUs
130130
# if the hardware changes, a new setup is required
131-
uci.set('snort', 'nfq', 'queue_count', str(os.cpu_count()))
132-
uci.set('snort', 'nfq', 'thread_count', str(os.cpu_count()))
131+
# limit to 16 cores if more than 16 CPUs are available
132+
cpu_count = min(os.cpu_count(), 16)
133+
uci.set('snort', 'nfq', 'queue_count', str(cpu_count))
134+
uci.set('snort', 'nfq', 'thread_count', str(cpu_count))
133135

134136
if set_home_net:
135137
uci.set('snort', 'snort', 'home_net', get_snort_homenet(uci, include_vpn))

0 commit comments

Comments
 (0)