mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04: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
1 changed files with 7 additions and 0 deletions
|
|
@ -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 a new issue