Skip to content

Commit 365d1f9

Browse files
committed
base: minor logging updates, fixed port-argument in cli
1 parent b7a8bc8 commit 365d1f9

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/firewall_test/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def main():
8181
src=args.src_ip,
8282
dst=args.dst_ip,
8383
proto_l4=args.proto,
84+
dport=args.port,
8485
)
8586

8687
else:

src/firewall_test/simulator/firewall.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def process(self, chain: Chain, packet: PACKET_KINDS) -> (bool, (Rule, None)):
6262
log_info(
6363
label='Firewall',
6464
v1=f'> Chain {chain.name} | Rule {rule.seq}',
65-
v2=f' | {rule.dump()}'
65+
v2=f' | {rule.log()}'
6666
)
6767
continue
6868

@@ -331,8 +331,8 @@ def _process_chain(self, chain: Chain, packet: PACKET_KINDS) -> (bool, (Rule, No
331331
log_info(
332332
'Firewall',
333333
f'Processing Chain: '
334-
f'Table {chain.run_table.name} {chain.run_table.family.N} | '
335-
f'Chain {chain.name} {chain.family.N} {chain.type}'
334+
f'Table "{chain.run_table.name}" {chain.run_table.family.N} | '
335+
f'Chain "{chain.name}" {chain.family.N} {chain.type} ({len(chain.rules)} rules)'
336336
)
337337
return self._run_chains.process(chain=chain, packet=packet)
338338

src/firewall_test/utils/logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def rule_repr(uid: (int, str), matches: any, cmt: str = None) -> str:
123123
if cmt is None:
124124
cmt = ''
125125

126-
elif not cmt.startswith(' '):
126+
elif not cmt.startswith(' ') and cmt.strip() != '':
127127
cmt = f' "{cmt}"'
128128

129129
if not isinstance(matches, str):

0 commit comments

Comments
 (0)