[Cake] de-natting & host fairness

Kevin Darbyshire-Bryant kevin at darbyshire-bryant.me.uk
Tue Sep 27 23:33:29 EDT 2016

On 28/09/16 04:06, Jonathan Morton wrote:
>> On 28 Sep, 2016, at 05:56, Kevin Darbyshire-Bryant
>> <kevin at darbyshire-bryant.me.uk> wrote:
>> Does this need to be another variable/parameter or could it be the
>> next bit along in the flow type?
> I’ve already pushed it to the ‘cobalt’ branch, so you can see how
> I’ve done it and start testing.  I’ve verified that it compiles, no
> more than that so far.
> For configuration, there is a separate flag parameter passed.
> Internally, I’ve used another bit of the existing flow_mode field
> (but not the next one along).  The latter is also how the
> configuration is read back out again to tc.
> Overall, the patch ended up much smaller than the original.  Switch
> statements in C are actually quite verbose.

Looks good and as you say much smaller without the switch stuff and 
IPv6.  As a further bikeshed.....

Is it worth doing:

if (reverse) {
    all the src/dst swaps
    if ports do port src/dst swaps
} else {
    all the dst/src swaps
    if ports do port dst/src swaps

Code gets duplicated...or possibly not depending on the compiler, but 
those ternaries are if/else in disguise...and we do a few of them, so if 
we did one at the cost of some duplicate code......

> - Jonathan Morton

More information about the Cake mailing list