rsyslog/tests/impcap_bug_ether.sh
frikilax 62dd906245 IMPCAP::Fixes: segfault, memory and build corrections (resolves #4332)
- fix bug in ethernet packets parsing
  - fix removes build error with gcc10: 'multiple definition of...'
- resolve memory leak during interface init failure (device not freed after post-create error)
- add test 'impcap_bug_ether' to prove ethernet parser fix is working
2020-07-06 10:49:47 +02:00

26 lines
773 B
Bash
Executable File

#!/bin/bash
# added 2020-06-30 by frikilax
# This file is part of the rsyslog project, released under ASL 2.0
. ${srcdir:=.}/diag.sh init
source ${srcdir:-.}/impcap.sh
generate_conf
add_conf '
module(load="../contrib/impcap/.libs/impcap")
template(name="impcap" type="string" string="%$!impcap%\n")
input(type="impcap" file="'${srcdir}/bug_ether.pcap'")
action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="impcap")
'
startup
shutdown_when_empty
wait_shutdown
# Check for the intended parsing of the packet in wrong_ethtype.cap
content_check '{ "ID": 1, "timestamp": "2020-06-30T17:07:25.980151+00:00", "net_bytes_total": 14, "ETH_src": "0:0:0:0:0:0", "ETH_dst": "ff:ff:ff:ff:ff:ff", "ETH_type": 36865, "ETH_typestr": "UNKNOWN", "net_bytes_data": 0 }'
exit_test