Skip to contentSkip to conversation

What is the good of find_appropriate_src?

DISCUSSION zhi wang 1 participant 1 message Mar 30, 2004 netfilter

lore
Share & tools
lore

zhi wang

author
#0 lore raw

find_appropriate_src is a function in ip_nat_core.c. What is this function for? Although confused, I figured the following facts about this function(only udp is consided):

1. The packet hit a SNAT target.
2. There is already a NATed connection. It has the same srcip/proto/src-proto-part, and the connection's srcip/proto/src-proto-part is in ip_nat_multi_range.
3. The very same srcip/proto/src-proto-part are kept intacted.

In short, "If this srcip/proto/src-proto-part is currently mapped, and that same mapping gives a unique tuple within the given range, use that"

I don't know under what condition the No.1 and No.2 conditions will be fulfilled. I also notice, that when this function is called, only nat table is locked, but conntrak table is not locked. I suspet that there could be a race condition here in SMP machines with some odd configuration. And if that race condition occurs, get_unique_tuple will be called over and over again until the racing conntrack entry times out.

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html