Hi,
Robert Dahlem wrote:
[...]The problem is to combine these two scenarios: make both netfilter and IPSEC active at the same time.
# SYN packet HostA kernel: Debug INPUT:IN=eth1 OUT= MAC=00:0a:5e:4d:0f:12:00:0a:5e:4d:10:42:08:00 SRC=10.133.127.197 DST=10.133.126.6 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=5559 DF PROTO=TCP SPT=1023 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=0
This packet causes the problem because the encapsulated TCP (transport mode) or IP packet (tunnel mode) is not inspected and due the connection tracking does not know of.
Robert, you may want to look into the mailing list archive of the developer list (https://lists.netfilter.org/pipermail/netfilter-devel/) and/or the current patch-o-matic. January last year there was a discussion on the developer list with the topic "NAT before IPsec with 2.6" which caused Harald Welte to produce a patch which may be of help to you. I have no idea of the current state of this.
Michael