mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
Do some more sanity checks in route(8): require netmask to have
the same address family as destination. Found by: jmg MFC after: 2 weeks
This commit is contained in:
parent
796aef8d17
commit
88d2c8fc87
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=260472
@ -958,11 +958,18 @@ newroute(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/* Do some sanity checks on resulting request */
|
||||
if (so[RTAX_DST].ss_len == 0) {
|
||||
warnx("destination parameter required");
|
||||
usage(NULL);
|
||||
}
|
||||
|
||||
if (so[RTAX_NETMASK].ss_len != 0 &&
|
||||
so[RTAX_DST].ss_family != so[RTAX_NETMASK].ss_family) {
|
||||
warnx("destination and netmask family need to be the same");
|
||||
usage(NULL);
|
||||
}
|
||||
|
||||
if (nrflags & F_FORCEHOST) {
|
||||
nrflags |= F_ISHOST;
|
||||
#ifdef INET6
|
||||
|
Loading…
Reference in New Issue
Block a user