Portál AbcLinuxu, 5. května 2025 23:18
tcp 6 40258 ESTABLISHED src=201.231.167.28 dst=192.168.46.59 sport=44186 dport=4252 packets=2 bytes=80 [UNREPLIED] src=192.168.46.59 dst=201.231.167.28 sport=4252 dport=44187 packets=0 bytes=0 mark=0 use=1 tcp 6 40253 ESTABLISHED src=24.206.184.124 dst=192.168.46.59 sport=44165 dport=4241 packets=2 bytes=80 [UNREPLIED] src=192.168.46.59 dst=24.206.184.124 sport=4241 dport=44166 packets=0 bytes=0 mark=0 use=1 tcp 6 39735 ESTABLISHED src=84.54.166.74 dst=192.168.46.64 sport=42749 dport=1889 packets=2 bytes=80 [UNREPLIED] src=192.168.46.64 dst=84.54.166.74 sport=1889 dport=42750 packets=0 bytes=0 mark=0 use=1 tcp 6 39223 ESTABLISHED src=87.121.169.51 dst=192.168.46.64 sport=5 dport=1777 packets=2 bytes=80 [UNREPLIED] src=192.168.46.64 dst=87.121.169.51 sport=1777 dport=6 packets=0 bytes=0 mark=0 use=1 tcp 6 39082 ESTABLISHED src=87.120.145.133 dst=192.168.46.64 sport=41759 dport=1729 packets=2 bytes=80 [UNREPLIED] src=192.168.46.64 dst=87.120.145.133 sport=1729 dport=41760 packets=0 bytes=0 mark=0 use=1 tcp 6 38298 ESTABLISHED src=87.120.145.133 dst=192.168.46.64 sport=311 dport=1587 packets=2 bytes=80 [UNREPLIED] src=192.168.46.64 dst=87.120.145.133 sport=1587 dport=312 packets=0 bytes=0 mark=0 use=1 tcp 6 38100 ESTABLISHED src=85.196.168.249 dst=192.168.46.64 sport=39774 dport=1533 packets=2 bytes=80 [UNREPLIED] src=192.168.46.64 dst=85.196.168.249 sport=1533 dport=39775 packets=0 bytes=0 mark=0 use=1
... packets=2 bytes=80 [UNREPLIED] src=... packets=0 bytes=0
.
> Now I see log entries like: > > ip_ct_tcp: invalid packet ignored IN= OUT= SRC=a.b.c.d DST=x.y.z.q LEN=48 > TOS=0x00 PREC=0x00 TTL=118 ID=57462 DF PROTO=TCP SPT=2745 DPT=110 > SEQ=1241333208 ACK=0 WINDOW=65535 RES=0x00 SYN URGP=0 OPT (020405B401010402) > (most of them have SYN flag) > > Interesting thing is that these log entries do not match those logged by > iptables -t filter -A INPUT -m state --state INVALID -j LOG > > Can someone tell why these two logs do not match, and what happens with > packets logged by (ip_ct_tcp) ip_conntrack_log_invalid? TCP conntrack tries very hard to keep track of the connections. The packets which are logged as 'invalid packet ignored' looks to conntrack as invalid, because it holds a connections and the packet does not fit into the stream. But at the same time it might be that conntrack holds a dead connection and the packet is a real, new, connection-initiating packet (SYN flag is on). So conntrack ignores the seemingly invalid packet, flags it as 'ESTABLISHED' (not 'INVALID') and lets it through. The reply packet will tell conntrack what should it do: delete the old dead connection or keep it as real. ip_conntrack_log_invalid logs the "magic", which can help to identify possible problems in TCP connection tracking: ignored packets or packets dropped by conntrack itself. All else is flagges as NEW, ESTABLISHED, RELATED or INVALID.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.