summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/op_mode/show_nat_translations.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/op_mode/show_nat_translations.py b/src/op_mode/show_nat_translations.py
index e888f3509..3af33b78e 100755
--- a/src/op_mode/show_nat_translations.py
+++ b/src/op_mode/show_nat_translations.py
@@ -117,8 +117,12 @@ def process(data, stats, protocol, pipe, verbose, flowtype=''):
if 'layer4' in meta:
l4 = meta['layer4']
- sport[direction] = l4[SPORT]
- dport[direction] = l4[DPORT]
+ sp = l4.get(SPORT, '')
+ dp = l4.get(DPORT, '')
+ if sp:
+ sport[direction] = sp
+ if dp:
+ dport[direction] = dp
proto[direction] = l4.get('@protoname','')
if stats and 'counters' in meta: