why we need find_appopriate_src? rether than just check in_range?
1.find_appropriate_src(const struct ip_conntrack_tuple *tuple,
const struct ip_nat_multi_range *mr)
{
unsigned int h = hash_by_src(&tuple->src, tuple->dst.protonum); struct ip_nat_hash *i;
MUST_BE_READ_LOCKED(&ip_nat_lock);
i = LIST_FIND(&bysource[h], src_cmp, struct ip_nat_hash *, tuple, mr); if (i)
return &i->conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src;
else
return NULL;
}
static inline int
src_cmp(const struct ip_nat_hash *i,
const struct ip_conntrack_tuple *tuple,
const struct ip_nat_multi_range *mr)
{
return (i->conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum
== tuple->dst.protonum
&& i->conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip == tuple->src.ip
&& i->conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.all == tuple->src.u.all
# ??? Is code marked by RED colour is somewhat a kind of pre-designed idea for certain SECURITY mechanism, that is not clear so far ??? ... Murphy Hsu-ting Lin ( Taiwan )
&& in_range(tuple,
&i->conntrack->tuplehash[IP_CT_DIR_ORIGINAL]
.tuple.src,
mr));
}