Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jan 2014 10:40:37 +0000 (UTC)
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r260472 - head/sbin/route
Message-ID:  <201401091040.s09AeboK082120@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: melifaro
Date: Thu Jan  9 10:40:36 2014
New Revision: 260472
URL: http://svnweb.freebsd.org/changeset/base/260472

Log:
  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

Modified:
  head/sbin/route/route.c

Modified: head/sbin/route/route.c
==============================================================================
--- head/sbin/route/route.c	Thu Jan  9 09:19:59 2014	(r260471)
+++ head/sbin/route/route.c	Thu Jan  9 10:40:36 2014	(r260472)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401091040.s09AeboK082120>