Page MenuHomeFreeBSD

D40377.id122708.diff
No OneTemporary

D40377.id122708.diff

diff --git a/sbin/route/route.8 b/sbin/route/route.8
--- a/sbin/route/route.8
+++ b/sbin/route/route.8
@@ -28,7 +28,7 @@
.\" @(#)route.8 8.3 (Berkeley) 3/19/94
.\" $FreeBSD$
.\"
-.Dd March 14, 2023
+.Dd June 1, 2023
.Dt ROUTE 8
.Os
.Sh NAME
@@ -36,6 +36,7 @@
.Nd manually manipulate the routing tables
.Sh SYNOPSIS
.Nm
+.Op Fl j Ar jail
.Op Fl dnqtv
.Ar command
.Oo
@@ -91,6 +92,8 @@
and
.Cm flush
commands.
+.It Fl j Ar jail
+Run inside a jail.
.El
.Pp
The
diff --git a/sbin/route/route.c b/sbin/route/route.c
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -48,6 +48,9 @@
#include <sys/file.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#ifdef JAIL
+#include <sys/jail.h>
+#endif
#include <sys/sysctl.h>
#include <sys/types.h>
#include <sys/queue.h>
@@ -172,7 +175,7 @@
{
if (cp != NULL)
warnx("bad keyword: %s", cp);
- errx(EX_USAGE, "usage: route [-46dnqtv] command [[modifiers] args]");
+ errx(EX_USAGE, "usage: route [-j jail] [-46dnqtv] command [[modifiers] args]");
/* NOTREACHED */
}
@@ -180,6 +183,9 @@
main(int argc, char **argv)
{
int ch;
+#ifdef JAIL
+ int jid;
+#endif
size_t len;
if (argc < 2)
@@ -218,6 +224,18 @@
case 'd':
debugonly = 1;
break;
+ case 'j':
+#ifdef JAIL
+ if (optarg == NULL)
+ usage(NULL);
+ jid = jail_getid(optarg);
+ if (jid == -1)
+ errx(1, "Jail not found");
+ if (jail_attach(jid) != 0)
+ errx(1, "Cannot attach to jail");
+#else
+ errx(1, "Jail support is not compiled in");
+#endif
case '?':
default:
usage(NULL);

File Metadata

Mime Type
text/plain
Expires
Tue, Feb 11, 10:23 AM (6 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16593342
Default Alt Text
D40377.id122708.diff (1 KB)

Event Timeline