mirror of
https://passt.top/passt
synced 2025-07-30 12:58:00 +02:00
conf: Use 0 instead of -1 as "unassigned" mtu value
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 <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
3dc7da68a2
commit
1cc5d4c9fe
6 changed files with 8 additions and 14 deletions
3
passt.h
3
passt.h
|
@ -274,6 +274,8 @@ struct ctx {
|
|||
int fd_repair;
|
||||
unsigned char our_tap_mac[ETH_ALEN];
|
||||
unsigned char guest_mac[ETH_ALEN];
|
||||
uint16_t mtu;
|
||||
|
||||
uint64_t hash_secret[2];
|
||||
|
||||
int ifi4;
|
||||
|
@ -298,7 +300,6 @@ struct ctx {
|
|||
int no_icmp;
|
||||
struct icmp_ctx icmp;
|
||||
|
||||
int mtu;
|
||||
int no_dns;
|
||||
int no_dns_search;
|
||||
int no_dhcp_dns;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue