From a412f472d9c3169438bddf7863bcad0332e239bb Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 16 Dec 2017 12:39:31 +0000 Subject: [PATCH] Drop tunctl We don't use this at all Signed-off-by: Michael Tremer --- config/rootfiles/common/tunctl | 1 - lfs/tunctl | 54 ---------------- make.sh | 1 - src/tunctl/tunctl.c | 113 --------------------------------- 4 files changed, 169 deletions(-) delete mode 100644 config/rootfiles/common/tunctl delete mode 100644 lfs/tunctl delete mode 100755 src/tunctl/tunctl.c diff --git a/config/rootfiles/common/tunctl b/config/rootfiles/common/tunctl deleted file mode 100644 index f05749ca9c..0000000000 --- a/config/rootfiles/common/tunctl +++ /dev/null @@ -1 +0,0 @@ -usr/bin/tunctl diff --git a/lfs/tunctl b/lfs/tunctl deleted file mode 100644 index 54d0928bc8..0000000000 --- a/lfs/tunctl +++ /dev/null @@ -1,54 +0,0 @@ -############################################################################### -# # -# IPFire.org - A linux based firewall # -# Copyright (C) 2007 Michael Tremer & Christian Schmidt # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -############################################################################### - -############################################################################### -# Definitions -############################################################################### - -include Config - -VER = ipfire - -THISAPP = tunctl -TARGET = $(DIR_INFO)/$(THISAPP) - -############################################################################### -# Top-level Rules -############################################################################### - -install : $(TARGET) - -check : - -download : - -md5 : - -############################################################################### -# Installation Details -############################################################################### - -$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) - @$(PREBUILD) - @rm -rf $(DIR_SRC)/tunctl - cd $(DIR_SRC) && gcc $(CFLAGS) -latm $(DIR_SRC)/src/tunctl/tunctl.c -o tunctl - cd $(DIR_SRC) && install -v -m 755 tunctl /usr/bin/tunctl - @rm -rf $(DIR_SRC)/tunctl - @$(POSTBUILD) diff --git a/make.sh b/make.sh index 10a31fd9f7..dadc87f0ce 100755 --- a/make.sh +++ b/make.sh @@ -1365,7 +1365,6 @@ buildipfire() { lfsmake2 qemu lfsmake2 sane lfsmake2 netpbm - lfsmake2 tunctl lfsmake2 netsnmpd lfsmake2 nagios_nrpe lfsmake2 nagios-plugins diff --git a/src/tunctl/tunctl.c b/src/tunctl/tunctl.c deleted file mode 100755 index 6e439060a0..0000000000 --- a/src/tunctl/tunctl.c +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright 2002 Jeff Dike - * Licensed under the GPL - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -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); -} -- 2.39.2