Closed Qcloud1223 closed 2 years ago
Hi @Qcloud1223 !
I think the confusion comes from _rep.hashkey() which actually returns the full key, that is the flow.
get() calls find(), which will use bucket() to find the right bucket. bucket() find the hask of the key is obtained through hashcode(key). In the bucket, the "hashkey" are compared but that is a full compare, not hash compare.
I think the confusion comes from _rep.hashkey() which actually returns the full key, that is the flow.
Exactly. One needs to check hashkey()
inside IPRewriterEntry
to find it returns _flowid
, which is of class IPFlowID
containing the four tuple.
Thanks as always @tbarbette ! I really appreciate it :)
Hello all,
I spent some time surveying how NAT/NAPT functionalities are implemented under cilck, but failed to find anything about handling hash collision during this process.
In
IPRewriter::push
fromelements/tcpudp/iprewriter.cc
, ifmap->get(flowid)
returns a non-emptyIPRewriterEntry
, it will be applied to the TCP flowtcpmf
without a check. Then I dug a little bit deeper into theget
method ofHashContainer
, and found it just simply hashs the incoming key and returns the object if found (ininclude/click/hashcontainer.hh
). Then won't a new flow whose hash collides with an existing entry be written into the existing entry?Thanks in advance for your time.