cdp: fix regression in CDP packet building

The associativity of the ternary operator was not as expected. Put a
bunch of parentheses to fix that.