View | Details | Raw Unified | Return to bug 155765
Collapse All | Expand All

(-)b/lib/Makefile (-1 / +5 lines)
Lines 77-83 SUBDIR= ${SUBDIR_ORDERED} \ Link Here
77
	${_librpcsec_gss} \
77
	${_librpcsec_gss} \
78
	libipsec \
78
	libipsec \
79
	${_libipx} \
79
	${_libipx} \
80
	libjail \
80
	${_libjail} \
81
	libkiconv \
81
	libkiconv \
82
	liblzma \
82
	liblzma \
83
	libmagic \
83
	libmagic \
Lines 165-170 _libiconv_modules= libiconv_modules Link Here
165
_libipx=	libipx
165
_libipx=	libipx
166
.endif
166
.endif
167
167
168
.if ${MK_JAIL} != "no"
169
_libjail=	libjail
170
.endif
171
168
.if ${MK_LIBTHR} != "no"
172
.if ${MK_LIBTHR} != "no"
169
_libthr=	libthr
173
_libthr=	libthr
170
.endif
174
.endif
(-)b/sbin/ifconfig/Makefile (-2 / +8 lines)
Lines 28-35 SRCS+= ifgre.c # GRE keys etc Link Here
28
SRCS+=	ifgif.c			# GIF reversed header workaround
28
SRCS+=	ifgif.c			# GIF reversed header workaround
29
29
30
SRCS+=	ifieee80211.c regdomain.c # SIOC[GS]IEEE80211 support
30
SRCS+=	ifieee80211.c regdomain.c # SIOC[GS]IEEE80211 support
31
DPADD+=	${LIBBSDXML} ${LIBJAIL} ${LIBSBUF}
31
DPADD+=	${LIBBSDXML} ${LIBSBUF}
32
LDADD+=	-lbsdxml -ljail -lsbuf
32
LDADD+=	-lbsdxml -lsbuf
33
34
.if ${MK_JAIL} != "no"
35
SRCS+= vnet.c
36
DPADD+=	${LIBJAIL}
37
LDADD+=	-ljail
38
.endif
33
39
34
SRCS+=	ifcarp.c		# SIOC[GS]VH support
40
SRCS+=	ifcarp.c		# SIOC[GS]VH support
35
SRCS+=	ifgroup.c		# ...
41
SRCS+=	ifgroup.c		# ...
(-)b/sbin/ifconfig/ifconfig.c (-31 lines)
Lines 66-72 static const char rcsid[] = Link Here
66
#include <err.h>
66
#include <err.h>
67
#include <errno.h>
67
#include <errno.h>
68
#include <fcntl.h>
68
#include <fcntl.h>
69
#include <jail.h>
70
#include <stdio.h>
69
#include <stdio.h>
71
#include <stdlib.h>
70
#include <stdlib.h>
72
#include <string.h>
71
#include <string.h>
Lines 664-697 deletetunnel(const char *vname, int param, int s, const struct afswtch *afp) Link Here
664
}
663
}
665
664
666
static void
665
static void
667
setifvnet(const char *jname, int dummy __unused, int s,
668
    const struct afswtch *afp)
669
{
670
	struct ifreq my_ifr;
671
672
	memcpy(&my_ifr, &ifr, sizeof(my_ifr));
673
	my_ifr.ifr_jid = jail_getid(jname);
674
	if (my_ifr.ifr_jid < 0)
675
		errx(1, "%s", jail_errmsg);
676
	if (ioctl(s, SIOCSIFVNET, &my_ifr) < 0)
677
		err(1, "SIOCSIFVNET");
678
}
679
680
static void
681
setifrvnet(const char *jname, int dummy __unused, int s,
682
    const struct afswtch *afp)
683
{
684
	struct ifreq my_ifr;
685
686
	memcpy(&my_ifr, &ifr, sizeof(my_ifr));
687
	my_ifr.ifr_jid = jail_getid(jname);
688
	if (my_ifr.ifr_jid < 0)
689
		errx(1, "%s", jail_errmsg);
690
	if (ioctl(s, SIOCSIFRVNET, &my_ifr) < 0)
691
		err(1, "SIOCSIFRVNET(%d, %s)", my_ifr.ifr_jid, my_ifr.ifr_name);
692
}
693
694
static void
695
setifnetmask(const char *addr, int dummy __unused, int s,
666
setifnetmask(const char *addr, int dummy __unused, int s,
696
    const struct afswtch *afp)
667
    const struct afswtch *afp)
697
{
668
{
Lines 1133-1140 static struct cmd basic_cmds[] = { Link Here
1133
	DEF_CMD_ARG2("tunnel",			settunnel),
1104
	DEF_CMD_ARG2("tunnel",			settunnel),
1134
	DEF_CMD("-tunnel", 0,			deletetunnel),
1105
	DEF_CMD("-tunnel", 0,			deletetunnel),
1135
	DEF_CMD("deletetunnel", 0,		deletetunnel),
1106
	DEF_CMD("deletetunnel", 0,		deletetunnel),
1136
	DEF_CMD_ARG("vnet",			setifvnet),
1137
	DEF_CMD_ARG("-vnet",			setifrvnet),
1138
	DEF_CMD("link0",	IFF_LINK0,	setifflags),
1107
	DEF_CMD("link0",	IFF_LINK0,	setifflags),
1139
	DEF_CMD("-link0",	-IFF_LINK0,	setifflags),
1108
	DEF_CMD("-link0",	-IFF_LINK0,	setifflags),
1140
	DEF_CMD("link1",	IFF_LINK1,	setifflags),
1109
	DEF_CMD("link1",	IFF_LINK1,	setifflags),
(-)b/sbin/ifconfig/vnet.c (-1 / +91 lines)
Added Link Here
0
- 
1
/*
2
 * Copyright (c) 1983, 1993
3
 *	The Regents of the University of California.  All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 * 4. Neither the name of the University nor the names of its contributors
14
 *    may be used to endorse or promote products derived from this software
15
 *    without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
 * SUCH DAMAGE.
28
 */
29
30
#ifndef lint
31
static const char rcsid[] =
32
  "$FreeBSD$";
33
#endif /* not lint */
34
35
#include <sys/param.h>
36
#include <sys/socket.h>
37
#include <sys/ioctl.h>
38
39
#include <net/if.h>
40
#include <net/if_var.h>
41
42
#include <err.h>
43
#include <string.h>
44
#include <jail.h>
45
46
#include "ifconfig.h"
47
48
static void
49
setifvnet(const char *jname, int dummy __unused, int s,
50
    const struct afswtch *afp)
51
{
52
	struct ifreq my_ifr;
53
54
	memcpy(&my_ifr, &ifr, sizeof(my_ifr));
55
	my_ifr.ifr_jid = jail_getid(jname);
56
	if (my_ifr.ifr_jid < 0)
57
		errx(1, "%s", jail_errmsg);
58
	if (ioctl(s, SIOCSIFVNET, &my_ifr) < 0)
59
		err(1, "SIOCSIFVNET");
60
}
61
62
static void
63
setifrvnet(const char *jname, int dummy __unused, int s,
64
    const struct afswtch *afp)
65
{
66
	struct ifreq my_ifr;
67
68
	memcpy(&my_ifr, &ifr, sizeof(my_ifr));
69
	my_ifr.ifr_jid = jail_getid(jname);
70
	if (my_ifr.ifr_jid < 0)
71
		errx(1, "%s", jail_errmsg);
72
	if (ioctl(s, SIOCSIFRVNET, &my_ifr) < 0)
73
		err(1, "SIOCSIFRVNET(%d, %s)", my_ifr.ifr_jid, my_ifr.ifr_name);
74
}
75
76
static struct cmd vnet_cmds[] =
77
{
78
	DEF_CMD_ARG("vnet",	setifvnet),
79
	DEF_CMD_ARG("-vnet",	setifrvnet),
80
};
81
82
static __constructor void
83
vnet_ctor(void)
84
{
85
#define	N(a)	(sizeof(a) / sizeof(a[0]))
86
	size_t i;
87
88
	for (i = 0; i < N(vnet_cmds);  i++)
89
		cmd_register(&vnet_cmds[i]);
90
#undef N
91
}

Return to bug 155765