1
0
Fork 0
mirror of https://passt.top/passt synced 2025-06-19 13:35:34 +02:00

conf, dhcp, ndp: Fix message about default MTU, make NDP consistent

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-09-07 11:19:57 +02:00
parent 8e9333616a
commit ec2b58ea4d
3 changed files with 16 additions and 4 deletions

15
conf.c
View file

@ -617,7 +617,9 @@ static void usage(const char *name)
info(" /tmp/passt_ISO8601-TIMESTAMP_INSTANCE-NUMBER.pcap");
info( " -m, --mtu MTU Assign MTU via DHCP/NDP");
info( " default: no MTU assigned via DHCP/NDP options");
info( " a zero value disables assignment");
info( " default: 65520: maximum 802.3 MTU minus 802.3 header");
info( " length, rounded to 32 bits (IPv4 words)");
info( " -a, --address ADDR Assign IPv4 or IPv6 address ADDR");
info( " can be specified zero to two times (for IPv4 and IPv6)");
info( " default: use addresses from interface with default route");
@ -954,6 +956,12 @@ void conf(struct ctx *c, int argc, char **argv)
errno = 0;
c->mtu = strtol(optarg, NULL, 0);
if (!c->mtu) {
c->mtu = -1;
break;
}
if (c->mtu < ETH_MIN_MTU || c->mtu > (int)ETH_MAX_MTU ||
errno) {
err("Invalid MTU: %s", optarg);
@ -1132,6 +1140,11 @@ void conf(struct ctx *c, int argc, char **argv)
}
}
if (!c->mtu) {
c->mtu = (ETH_MAX_MTU - ETH_HLEN) /
sizeof(uint32_t) * sizeof(uint32_t);
}
get_routes(c);
get_addrs(c);