i did a bit test using \n as message boundary. client is netcat and server is echo streamserver. firstly i used 10.2.4 hf4 but having an issue about multiple messages per packet (e.g. 1\n2\n3\n). anyway, one message per packet (e.g. 1\n) seems okay.
i suspected it might be bug 383853. there is engineering hotfix available on 11.1.0 hf4, so i applied it and it seems a bit better. tcp::notify eom is command from the engineering hotfix. it is used to release parsed message. tcp::notify request/response is used in the past.
Bug 383853 - Need a synchronous event to signal end of message from TCP rule event
not sure if this is what you are looking for. anyway, this is my testing. hope it helps.
root@ve11enghf(Active)(/Common)(tmos) show sys version| grep -i -A 3 product
Product BIG-IP
Version 11.1.0
Build 2185.38
Edition Engineering Hotfix HF4
root@ve11enghf(Active)(/Common)(tmos) list ltm virtual bar
ltm virtual bar {
destination 172.28.19.252:7
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
mblb { }
tcp { }
}
rules {
myrule
}
snat automap
vlans-disabled
}
root@ve11enghf(Active)(/Common)(tmos) list ltm pool foo
ltm pool foo {
members {
200.200.200.101:7 {
address 200.200.200.101
}
200.200.200.111:7 {
address 200.200.200.111
}
}
}
root@ve11enghf(Active)(/Common)(tmos) list ltm rule myrule
ltm rule myrule {
when CLIENT_ACCEPTED {
log local0. "--"
log local0. "[IP::client_addr]:[TCP::client_port] > [IP::local_addr]:[TCP::local_port]"
TCP::collect
}
when CLIENT_DATA {
set idx 1
log local0. "--"
log local0. "received [TCP::payload]"
while {$idx <= [TCP::payload length]} {
if {[TCP::payload $idx] ends_with "\n"} {
log local0. "sent [TCP::payload $idx]"
TCP::release $idx
TCP::notify request
TCP::notify eom
set idx 1
} else {
incr idx
}
}
TCP::collect
}
when SERVER_CONNECTED {
log local0. "--"
TCP::collect
}
when SERVER_DATA {
set recvidx 1
log local0. "--"
log local0. "[IP::remote_addr]:[TCP::remote_port] > [IP::local_addr]:[TCP::local_port]"
log local0. "received [TCP::payload]"
while {$recvidx <= [TCP::payload length]} {
if {[TCP::payload $recvidx] ends_with "\n"} {
log local0. "sent [TCP::payload $recvidx]"
TCP::release $recvidx
TCP::notify response
TCP::notify eom
set recvidx 1
} else {
incr recvidx
}
}
TCP::collect
}
}
A. single message per packet
clieint
[root@centos251 ~] nc 172.28.19.252 7
1 <--- (type in)
1 <--- (echo response)
2
2
3
3
log
[root@ve11enghf:Active] config tail -f /var/log/ltm
Feb 11 09:41:17 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:41:17 tmm info tmm[8822]: Rule /Common/myrule : 172.28.19.251:49509 > 172.28.19.252:7
Feb 11 09:41:19 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:41:19 tmm info tmm[8822]: Rule /Common/myrule : received 1
Feb 11 09:41:19 tmm info tmm[8822]: Rule /Common/myrule : sent 1
Feb 11 09:41:19 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:41:19 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:41:19 tmm info tmm[8822]: Rule /Common/myrule : 200.200.200.111:7 > 200.200.200.10:49509
Feb 11 09:41:19 tmm info tmm[8822]: Rule /Common/myrule : received 1
Feb 11 09:41:19 tmm info tmm[8822]: Rule /Common/myrule : sent 1
Feb 11 09:41:20 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:41:20 tmm info tmm[8822]: Rule /Common/myrule : received 2
Feb 11 09:41:20 tmm info tmm[8822]: Rule /Common/myrule : sent 2
Feb 11 09:41:20 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:41:20 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:41:20 tmm info tmm[8822]: Rule /Common/myrule : 200.200.200.101:7 > 200.200.200.10:49509
Feb 11 09:41:20 tmm info tmm[8822]: Rule /Common/myrule : received 2
Feb 11 09:41:20 tmm info tmm[8822]: Rule /Common/myrule : sent 2
Feb 11 09:41:21 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:41:21 tmm info tmm[8822]: Rule /Common/myrule : received 3
Feb 11 09:41:21 tmm info tmm[8822]: Rule /Common/myrule : sent 3
Feb 11 09:41:21 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:41:21 tmm info tmm[8822]: Rule /Common/myrule : 200.200.200.111:7 > 200.200.200.10:49509
Feb 11 09:41:21 tmm info tmm[8822]: Rule /Common/myrule : received 3
Feb 11 09:41:21 tmm info tmm[8822]: Rule /Common/myrule : sent 3
B. multiple messages per packet
client
[root@centos251 ~] cat data.txt
1
2
3
4
5
6
7
8
9
10
[root@centos251 ~] nc 172.28.19.252 7 < data.txt
2
4
6
8
10
1
3
5
7
9
log
[root@ve11enghf:Active] config tail -f /var/log/ltm
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : 172.28.19.251:49513 > 172.28.19.252:7
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : received 1 2 3 4 5 6 7 8 9 10
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 1
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 2
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 3
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 4
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 5
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 6
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 7
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 8
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 9
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 10
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : 200.200.200.111:7 > 200.200.200.10:49513
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : received 2 4 6 8 10
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 2
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 4
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 6
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 8
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 10
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : --
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : 200.200.200.101:7 > 200.200.200.10:49513
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : received 1 3 5 7 9
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 1
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 3
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 5
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 7
Feb 11 09:44:01 tmm info tmm[8822]: Rule /Common/myrule : sent 9