Commit Diff


commit - 1ecf319919277305fea3d35396c316fc23e7f3db
commit + 19bcd64795f4a5b5c86abafd112cfaa87cb614bb
blob - e589a9248c616b92452683464991fe98de5758ca
blob + a558cf19abc8bd22c365719553f577e6a42ebe5b
--- route.c
+++ route.c
@@ -220,6 +220,14 @@ route(int argc, char **argv)
 		printf("%% unknown destination address family %d\n", dest.family);
 		return(1);
 	}
+
+	/*
+	 * Adding blackhole or reject routes requires a gateway even if the
+	 * "iface" parameter was specified. A gateway argument is required when
+	 * adding routes so simply setting the GATEWAY flag here is sufficient.
+	 */
+	if (cmd == RTM_ADD && (flags & (RTF_BLACKHOLE|RTF_REJECT)))
+		flags |= RTF_GATEWAY;
 
 	flags |= RTF_UP;