routes: fix metric rendering (LP: #2023681)#367
Conversation
Routes metric are rendered as signed integer instead of unsigned integer. This means all metric > 2147483647 is rendered as negative and is breaking the generated configuration.
|
Thanks so much for you contribution, @bengentil! Your fix looks good. Do you think you can write a couple of unit test for it though? You could add one for networkd and another for Network Manager in Thanks again! |
daniloegea
left a comment
There was a problem hiding this comment.
Approved. Check my other comment, please. Maybe we could add a couple of unit tests as well.
|
Hi @daniloegea, I've pushed a couple of tests. The tests are testing against 4294967294, which is not strictly the max value as the max value is used internally to set the metric as undefined (NETPLAN_METRIC_UNSPEC == G_MAXUINT == 4294967295) For more details see: This means technically 4294967295 can't be set as metric with netplan but this is another issue, here the goal is to avoid signed values as metrics. |
slyon
left a comment
There was a problem hiding this comment.
Thank you very much for your contribution. LGTM!
I'll leave merging to Danilo, when he feels his comments are resolved.
|
Thank you for your bug fix! :) |
Routes metric are rendered as signed integer instead of unsigned integer. This means all metric > 2147483647 is rendered as negative and is breaking the generated configuration.
Description
https://bugs.launchpad.net/netplan/+bug/2023681
Checklist
make checksuccessfully.make check-coverage).