mirror of
https://passt.top/passt
synced 2025-08-12 10:13:14 +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
2
tcp.c
2
tcp.c
|
@ -1139,7 +1139,7 @@ int tcp_prepare_flags(const struct ctx *c, struct tcp_tap_conn *conn,
|
|||
if (flags & SYN) {
|
||||
int mss;
|
||||
|
||||
if (c->mtu == -1) {
|
||||
if (!c->mtu) {
|
||||
mss = tinfo.tcpi_snd_mss;
|
||||
} else {
|
||||
mss = c->mtu - sizeof(struct tcphdr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue