Forum Discussion
hellhammer_3588
Nimbostratus
May 07, 2010Help: how to only discard the first packet?
Hi
I'm trying to use the dynamic IP to do SNAT.
I setup a virtual server as 0.0.0.0:7070 with pool member "sourcetest".
When the client request, client should first send an IP to BIGIP in the format "IP=x.x.x.x&". If BIGIP captures IP x.x.x.x, it will use this IP to do SNAT. If BIGIP captures only "null", it will use 192.168.0.1 to do SNAT.
The problem I met is, when I use "discard" to discard the packet contains IP info, it fails. "discard" will not drop the packet but the connection. It causes the client cannot access to the server.
If I removed "discard" from iRule, BIGIP will also forward the "IP=x.x.x.x&" to the server. This packet is meaningless to server and sometimes will cause the connection dropped.
when CLIENT_ACCEPTED {
set source 0
log local0. "7070 connected"
TCP::collect 19
}
when CLIENT_DATA {
if { $source == 0 } {
if { [findstr [TCP::payload] "IP=" 3 "&"] equals "null" } {
set source 1
log local0. "No client ip found."
} else {
set source [findstr [TCP::payload] "IP=" 3 "&"]
log local0. "Found client ip=$source"
}
discard
}
if { $source == 1 } {
snat 192.168.0.1
log local0. "snat 192"
} else {
snat $source
log local0. "snat with source"
}
pool sourcetest
TCP::release
}
In DevCentral, I found the description of "discard":
Causes the current packet or connection (depending on the context of the event) to be discarded.
My question is, how can I let "discard" only discard the first packet?
No RepliesBe the first to reply
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects