summaryrefslogtreecommitdiffstats
path: root/src/basic/parse-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/parse-util.c')
-rw-r--r--src/basic/parse-util.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c
index dc868c9b8e..0430e33e40 100644
--- a/src/basic/parse-util.c
+++ b/src/basic/parse-util.c
@@ -123,8 +123,7 @@ int parse_ifindex(const char *s) {
}
int parse_mtu(int family, const char *s, uint32_t *ret) {
- uint64_t u;
- size_t m;
+ uint64_t u, m;
int r;
r = parse_size(s, 1024, &u);
@@ -134,10 +133,16 @@ int parse_mtu(int family, const char *s, uint32_t *ret) {
if (u > UINT32_MAX)
return -ERANGE;
- if (family == AF_INET6)
+ switch (family) {
+ case AF_INET:
+ m = IPV4_MIN_MTU; /* This is 68 */
+ break;
+ case AF_INET6:
m = IPV6_MIN_MTU; /* This is 1280 */
- else
- m = IPV4_MIN_MTU; /* For all other protocols, including 'unspecified' we assume the IPv4 minimal MTU */
+ break;
+ default:
+ m = 0;
+ }
if (u < m)
return -ERANGE;