kohler / click

The Click modular router: fast modular packet processing and analysis
Other
740 stars 321 forks source link

checkpaint.cc doesn't behave as documents say #373

Closed AlanYiNew closed 6 years ago

AlanYiNew commented 6 years ago

According to the document packet is always pushed to port 0 when redirect , the copy will be pushed through port1 as well. Right now packet is pushed through either port based on color. Am I wrong?

bcronje commented 6 years ago

The documentation states correctly:

Checks that incoming packets have paint annotation equal to COLOR. If their paints are not equal to COLOR, then they are dropped or emitted on output 1, depending on how many outputs were used. CheckPaint uses the packet's PAINT annotation by default, but the ANNO argument can specify any one-byte annotation.

In other words, if the color matches it will emit on port 0, if it doesn't match it will emit on port 1 if it exists otherwise it will be dropped.

ahenning commented 6 years ago

If you want a copy you can use Tee after the checkpaint to clone the packet. Then there are two and you can forward the original packet and process the cloned packet with different elements.