19 Feb
2025
19 Feb
'25
7:56 a.m.
On Wed, 19 Feb 2025 14:14:28 +1100
David Gibson
On the command line -m 0 means "don't assign an MTU" (letting the guest use its default. However, internally we use (c->mtu == -1) to represent that state. We use (c->mtu == 0) to represent "the user didn't specify on the command line, so use the default" - but this is only used during conf(), never afterwards.
This is unnecessarily confusing. We can instead just initialise c->mtu to its default (65520) before parsing options and use 0 on both the command line and internally to represent the "don't assign" special case. This ensures that c->mtu is always 0..65535, so we can store it in a uint16_t which is more natural.
Signed-off-by: David Gibson
Applied. -- Stefano