Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37870821
en ru br
Репозитории ALT
S:1.5-alt1.qa2
5.1: 20060323-alt4
4.1: 20060323-alt3
4.0: 20060323-alt3
www.altlinux.org/Changes

Группа :: Сети/Прочее
Пакет: tunctl

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

pax_global_header00006660000000000000000000000064110744237340014517gustar00rootroot0000000000000052 comment=692831338c72a5be9edc0bff2f2de06744ef3cdd
tunctl-20060323/000075500000000000000000000000001107442373400132675ustar00rootroot00000000000000tunctl-20060323/.gear-rules000064400000000000000000000000751107442373400153400ustar00rootroot00000000000000tar: . name=@name@-@version@-@release@ base=@name@-@version@
tunctl-20060323/.rpmwrap000064400000000000000000000001351107442373400147570ustar00rootroot00000000000000%_topdir %_macropath/...
%_sourcedir %_topdir/sources
%_specdir %_macropath
tunctl-20060323/Makefile000064400000000000000000000004051107442373400147260ustar00rootroot00000000000000OBJS = tunctl.o
BIN = tunctl
CFLAGS = -g -Wall

BIN_DIR ?= /usr/bin

all : $(BIN)

$(BIN) : $(OBJS)
$(CC) $(CFLAGS) -o $(BIN) $(OBJS)

clean :
rm -f $(BIN) $(OBJS) *~

install : $(BIN)
install -d $(DESTDIR)$(BIN_DIR)
install -s $(BIN) $(DESTDIR)$(BIN_DIR)
tunctl-20060323/tun.rules000064400000000000000000000000471107442373400151520ustar00rootroot00000000000000KERNEL=="tun", GROUP="tun" MODE="0660"
tunctl-20060323/tunctl.8000064400000000000000000000037601107442373400146770ustar00rootroot00000000000000.\" This manpage has been automatically generated by docbook2man
.\" from a DocBook document. This tool can be found at:
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <steve@ggi-project.org>.
.TH "TUNCTL" "8" "03 June 2007" "" ""

.SH NAME
tunctl \- create and manage persistent TUN/TAP interfaces
.SH SYNOPSIS

\fBtunctl\fR [ \fB-f \fItun-clone-device\fB\fR ] [ \fB-u \fIowner\fB\fR ] [ \fB-t \fIdevice-name\fB\fR ]


\fBtunctl\fR [ \fB-f \fItun-clone-device\fB\fR ] \fB-d \fIdevice-name\fB\fR

.SH "DESCRIPTION"
.PP
This manual page documents briefly the
\fBtunctl\fR command.
.PP
This manual page was written for the Debian GNU/Linux distribution
because the original program does not have a manual page.
Instead, it has documentation in HTML format; see below.
.PP
\fBtunctl\fR allows the host sysadmin to
preconfigure a TUN/TAP device for use by a particular user. That
user may open and use the device, but may not change any aspects
of the host side of the interface.
.SH "USAGE"
.PP
To create an interface for use by a particular user, invoke
tunctl without the -d option:
.PP

.nf
# \fBtunctl -u someuser\fR

Set 'tap0' persistent and owned by uid 500

.fi
.PP
Then, configure the interface as normal:
.PP

.nf
# \fBifconfig tap0 192.168.0.254 up\fR

# \fBroute add -host 192.168.0.253 dev tap0\fR

# \fBbash -c 'echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp'\fR

# \fBarp -Ds 192.168.0.253 eth0 pub\fR

.fi
.PP
To delete the interface, use the -d option:
.PP

.nf
# \fBtunctl -d tap0\fR

Set 'tap0' nonpersistent

.fi
.SH "SEE ALSO"
.PP
The UserModeLinux-HOWTO <URL:http://user-mode-linux.sourceforge.net/UserModeLinux-HOWTO.html>
.SH "AUTHOR"
.PP
tunctl was written by Jeff Dike
<jdike@karaya.com>
.PP
This manual page was written by Matt Zimmerman <mdz@debian.org> for
the Debian GNU/Linux system, based on examples from Jeff Dike.
tunctl-20060323/tunctl.c000064400000000000000000000046521107442373400147530ustar00rootroot00000000000000/* Copyright 2002 Jeff Dike
* Licensed under the GPL
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <pwd.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <linux/if_tun.h>

static void Usage(char *name)
{
fprintf(stderr, "Create: %s [-b] [-u owner] [-t device-name] "
"[-f tun-clone-device]\n", name);
fprintf(stderr, "Delete: %s -d device-name [-f tun-clone-device]\n\n",
name);
fprintf(stderr, "The default tun clone device is /dev/net/tun - some systems"
" use\n/dev/misc/net/tun instead\n\n");
fprintf(stderr, "-b will result in brief output (just the device name)\n");
exit(1);
}

int main(int argc, char **argv)
{
struct ifreq ifr;
struct passwd *pw;
long owner = geteuid();
int tap_fd, opt, delete = 0, brief = 0;
char *tun = "", *file = "/dev/net/tun", *name = argv[0], *end;

while((opt = getopt(argc, argv, "bd:f:t:u:")) > 0){
switch(opt) {
case 'b':
brief = 1;
break;
case 'd':
delete = 1;
tun = optarg;
break;
case 'f':
file = optarg;
break;
case 'u':
pw = getpwnam(optarg);
if(pw != NULL){
owner = pw->pw_uid;
break;
}
owner = strtol(optarg, &end, 0);
if(*end != '\0'){
fprintf(stderr, "'%s' is neither a username nor a numeric uid.\n",
optarg);
Usage(name);
}
break;
case 't':
tun = optarg;
break;
case 'h':
default:
Usage(name);
}
}

argv += optind;
argc -= optind;

if(argc > 0)
Usage(name);

if((tap_fd = open(file, O_RDWR)) < 0){
fprintf(stderr, "Failed to open '%s' : ", file);
perror("");
exit(1);
}

memset(&ifr, 0, sizeof(ifr));

ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
strncpy(ifr.ifr_name, tun, sizeof(ifr.ifr_name) - 1);
if(ioctl(tap_fd, TUNSETIFF, (void *) &ifr) < 0){
perror("TUNSETIFF");
exit(1);
}

if(delete){
if(ioctl(tap_fd, TUNSETPERSIST, 0) < 0){
perror("TUNSETPERSIST");
exit(1);
}
printf("Set '%s' nonpersistent\n", ifr.ifr_name);
}
else {
if(ioctl(tap_fd, TUNSETPERSIST, 1) < 0){
perror("TUNSETPERSIST");
exit(1);
}
if(ioctl(tap_fd, TUNSETOWNER, owner) < 0){
perror("TUNSETPERSIST");
exit(1);
}
if(brief)
printf("%s\n", ifr.ifr_name);
else printf("Set '%s' persistent and owned by uid %ld\n", ifr.ifr_name,
owner);
}
return(0);
}
tunctl-20060323/tunctl.spec000064400000000000000000000053431107442373400154610ustar00rootroot00000000000000Name: tunctl
Version: 20060323
Release: alt4

Summary: Tool to create and manage persistent TUN/TAP interfaces
License: GPL
Group: Networking/Other
Url: http://user-mode-linux.sourceforge.net/

Source: %name-%version-%release.tar

Requires(pre): shadow-utils

%description
tunctl allows the host sysadmin to preconfigure a TUN/TAP device for
use by a particular user. That user may open and use the device, but
may not change any aspects of the host side of the interface.

%prep
%setup

%build
make CFLAGS="%optflags"

%install
install -pm0644 -D tun.rules %buildroot%_sysconfdir/udev/rules.d/90-tun.rules
install -pm0755 -D %name %buildroot%_sbindir/%name
install -pm0644 -D %name.8 %buildroot%_man8dir/%name.8

%pre
/usr/sbin/groupadd -r -f tun &>/dev/null

%files
%_sysconfdir/udev/rules.d/90-tun.rules
%_sbindir/%name
%_man8dir/%name.8*

%changelog
* Sun Oct 12 2008 Sergey Bolshakov <sbolshakov@altlinux.ru> 20060323-alt4
- dropped unneeded source tree parts and rebuilt

* Sun Jun 03 2007 Fr. Br. George <george@altlinux.ru> 20060323-alt3
- Fixed #11003 (mithraen@)

* Sun Apr 29 2007 Denis Smirnov <mithraen@altlinux.ru> 20060323-alt2
- Not remove group when uninstall
- Force groupadd when install (not crash at upgrade)

* Wed Apr 18 2007 Denis Smirnov <mithraen@altlinux.ru> 20060323-alt1
- Add requires(pre) to shadow-utils (need for %%pre section)

* Tue Jan 09 2007 Fr. Br. George <george@altlinux.ru> 20060323-alt0
- Initial build from MDV+Debian

* Sat Jan 06 2007 Olivier Blin <oblin@mandriva.com> 20060323-3mdv2007.0
+ Revision: 104685
- make /dev/net/tun owned by the tun group (#21113)
- make the tunctl package add a tun system group (part of #21113)
- move tunctl in a subpackage since it is often used without UML (description from Debian manpage)

* Wed Aug 09 2006 Olivier Thauvin <nanardon@mandriva.org> 20060323-2mdv2007.0
+ Revision: 54861
- patch0: fix build
- Import uml-utilities


* Tue Apr 4 2006 Tibor Pittich <Tibor.Pittich@mandriva.org> 20060323-1mdk
- 20060323
- remove suid bit on uml_net

* Thu Mar 16 2006 Tibor Pittich <Tibor.Pittich@mandriva.org> 20060216-1mdk
- new version

* Mon Apr 04 2005 Nicolas LИcureuil <neoclust@mandrake.org> 20040406-3mdk
- %%mkrel
- Fix summary

* Mon Apr 04 2005 Nicolas LИcureuil <neoclust@mandrake.org> 20040406-2mdk
- Rebuild for Readline

* Tue Apr 13 2004 Stew Benedict <sbenedict@mandrakesoft.com> 20040406-1mdk
- 20040406

* Thu Jan 8 2004 Olivier Thauvin <thauvin@aerov.jussieu.fr> 20030903-3mdk
- DIRM fix

* Sat Nov 08 2003 Michael Scherer <scherer.michael@free.fr> 20030903-2mdk
- BuildRequires ( libncurses-devel )

* Tue Oct 07 2003 Olivier Thauvin <thauvin@aerov.jussieu.fr> 20030903-1mdk
- 20030903

* Tue Aug 13 2002 Olivier Thauvin <thauvin@aerov.jussieu.fr> 20020729-0.1mdk
- 1st pre release

 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin