summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schweizer <genstef@gentoo.org>2007-07-07 12:27:43 +0000
committerStefan Schweizer <genstef@gentoo.org>2007-07-07 12:27:43 +0000
commitda769baa88662f0190b6a831a66be2cb2f059981 (patch)
treedf776da95f4eb397da7c9c8f5a2102b9346d7717 /net-misc
parentUpdate man page on "-l" option, fixes bug #168555. Fix some typos, #170691. (diff)
downloadgentoo-2-da769baa88662f0190b6a831a66be2cb2f059981.tar.gz
gentoo-2-da769baa88662f0190b6a831a66be2cb2f059981.tar.bz2
gentoo-2-da769baa88662f0190b6a831a66be2cb2f059981.zip
patch to enable unixterm to receive commands from standard input thanks to Adrian Lambeck <adrian@basicsedv.de> in bug 184429
(Portage version: 2.1.3_rc6)
Diffstat (limited to 'net-misc')
-rw-r--r--net-misc/vde/ChangeLog9
-rw-r--r--net-misc/vde/files/Unixterm_20070403.patch208
-rw-r--r--net-misc/vde/files/digest-vde-2.1.6-r13
-rw-r--r--net-misc/vde/vde-2.1.6-r1.ebuild42
4 files changed, 261 insertions, 1 deletions
diff --git a/net-misc/vde/ChangeLog b/net-misc/vde/ChangeLog
index 2e4891a487ed..d9dddaff4e93 100644
--- a/net-misc/vde/ChangeLog
+++ b/net-misc/vde/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for net-misc/vde
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/vde/ChangeLog,v 1.11 2007/06/09 15:38:23 genstef Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/vde/ChangeLog,v 1.12 2007/07/07 12:27:43 genstef Exp $
+
+*vde-2.1.6-r1 (07 Jul 2007)
+
+ 07 Jul 2007; Stefan Schweizer <genstef@gentoo.org>
+ +files/Unixterm_20070403.patch, +vde-2.1.6-r1.ebuild:
+ patch to enable unixterm to receive commands from standard input thanks to
+ Adrian Lambeck <adrian@basicsedv.de> in bug 184429
09 Jun 2007; Stefan Schweizer <genstef@gentoo.org> files/vde.init:
Fix failing script thanks to Giuliano Gagliardi <gentoo@gogi.tv> in bug 181193
diff --git a/net-misc/vde/files/Unixterm_20070403.patch b/net-misc/vde/files/Unixterm_20070403.patch
new file mode 100644
index 000000000000..0d5a2a6cb8ee
--- /dev/null
+++ b/net-misc/vde/files/Unixterm_20070403.patch
@@ -0,0 +1,208 @@
+diff -Naur vde2-2.1.6/unixterm/unixterm.c vde2-2.1.6-unixterm/unixterm/unixterm.c
+--- vde2-2.1.6/unixterm/unixterm.c 2006-07-07 16:54:39.000000000 +0200
++++ vde2-2.1.6/unixterm/unixterm.c 2007-04-03 12:49:14.000000000 +0200
+@@ -4,6 +4,8 @@
+ * Minimal terminal emulator on a UNIX stream socket
+ */
+
++/* render: addedd support for stdin commands */
++
+ #include <stdio.h>
+ #include <fcntl.h>
+ #include <stdlib.h>
+@@ -11,10 +13,12 @@
+ #include <sys/poll.h>
+ #include <sys/socket.h>
+ #include <sys/un.h>
+-
++#include <getopt.h>
+ #include <vde.h>
+
+ #define BUFSIZE 1024
++#define LINESIZE 1025
++#define THRESHOLD 4
+ char buf[BUFSIZE];
+
+ int main(int argc,char *argv[])
+@@ -23,25 +27,168 @@
+ int fd;
+ int rv;
+ static struct pollfd pfd[]={
+- {STDIN_FILENO,POLLIN | POLLHUP,0},
+- {STDIN_FILENO,POLLIN | POLLHUP,0}};
++ {STDIN_FILENO,POLLIN | POLLHUP, 0},
++ {STDIN_FILENO,POLLIN | POLLHUP, 0}};
+ static int fileout[]={STDOUT_FILENO,STDOUT_FILENO};
++ int optret;
++ char *sockpath, *sockname;
++ char sentinel = 0;
++ unsigned char injecting = 0;
++ unsigned char optcount = 0;
++ unsigned char failures = 0;
++ unsigned char loggedout = 0;
++ unsigned char ok_to_write = 0;
++
++ /* options management loop */
++ while (1) {
++ static struct option options[] = {
++ {"inject", 0, 0, 0}, /* get command list from stdin */
++ {"socket", 1, 0, 0}, /* management socket */
++ {0, 0, 0, 0} /* default case */
++ };
++ int option_index = 0;
++
++ if ((optret = getopt_long (argc, argv, "is:", options, &option_index)) == -1)
++ break;
++
++ optcount++;
++
++ switch (optret) {
++ case 0:
++ switch (option_index) {
++ case 0:
++ injecting = 1;
++ break;
++ case 1:
++ if ((sockpath = strdup(optarg)) == NULL)
++ fprintf(stderr, "strdup error\n");
++ sockname = (char *)basename(sockpath);
++ break;
++ default:
++ fprintf(stderr, "unknown long option\n");
++ break;
++ }
++
++ break;
++
++ case 'i':
++ injecting = 1;
++ break;
++
++ case 's':
++ if ((sockpath = strdup(optarg)) == NULL)
++ fprintf(stderr, "strdup error\n");
++ sockname = (char *)basename(sockpath);
++ break;
++
++ case '?':
++ fprintf(stderr, "unknown short option\n");
++ break;
++
++ default:
++ fprintf(stderr, "default case!\n");
++ break;
++ }
++ }
++
+ sun.sun_family=PF_UNIX;
+- snprintf(sun.sun_path,sizeof(sun.sun_path),"%s",argv[1]);
++ snprintf(sun.sun_path,sizeof(sun.sun_path),"%s", optcount ? sockpath : argv[1]);
++
+ fd=socket(PF_UNIX,SOCK_STREAM,0);
+- rv=connect(fd,(struct sockaddr *)(&sun),sizeof(sun));
++
++ if (connect(fd, (struct sockaddr *)(&sun), sizeof(sun)) < 0) {
++ perror("connect");
++ exit(-1);
++ }
++
+ pfd[1].fd=fileout[0]=fd;
++
+ while(1) {
+- int m,i,n=poll(pfd,2,-1);
+- for(i=0;n>0;i++) {
+- if(pfd[i].revents & POLLHUP)
+- exit(0);
++ int ccount,m,i,n = poll(pfd,2,-1);
++ for(i = 0; n > 0; i++) {
+ if(pfd[i].revents & POLLIN) {
+- n--;
+- if((m=read(pfd[i].fd,buf,BUFSIZE)) == 0)
++ --n;
++ if (injecting) {
++ switch (i) {
++ case 0:
++ if (!feof(stdin)) {
++ ccount = 0;
++
++ if (sentinel > 0) {
++ buf[ccount] = sentinel;
++ ccount++;
++ }
++
++ while ((buf[ccount] = fgetc(stdin)) != '\n' && !feof(stdin))
++ ccount++;
++ /* avoid write of empty lines */
++ if ((ccount > 0) && (buf[0] != '\n')) {
++ write(fileout[i],buf,ccount);
++ }
++ sentinel = fgetc(stdin);
++ }
++ /* end of stdin: logout from management console */
++ if (feof(stdin) && !loggedout) {
++ write(fileout[i],"logout\n",strlen("logout\n"));
++ loggedout = 1;
++ }
++
++ break;
++ case 1: {
++ int cursor = 0;
++ int base = 0;
++ char line[LINESIZE];
++ unsigned char start = 1;
++
++ if ((m = read(pfd[i].fd,buf,BUFSIZE)) == 0)
++ exit(0);
++
++ while (cursor < m) {
++ while ((buf[cursor] != '\n') && (cursor <= m))
++ cursor++;
++
++ memcpy(line, &buf[base], cursor - base + 1);
++
++ if (!ok_to_write && (start = (strstr(line, "0000 DATA") == NULL))) {
++ base += (cursor - base) + 1;
++ cursor += 1;
++ } else {
++ if (ok_to_write && (strstr(line, ".\n") != NULL)) {
++ ok_to_write = 0;
++ }
++
++ if (ok_to_write) {
++ write(fileout[i],sockname, strlen(sockname));
++ write(fileout[i],": ", 2);
++ write(fileout[i],line,cursor - base + 1);
++ }
++ else {
++ if (!start) {
++ ok_to_write = 1;
++ start = 1;
++ }
++ }
++ base += (cursor - base) + 1;
++ cursor += 1;
++ }
++ }
++
++ break;
++ }
++ }
++ } else {
++ if((m=read(pfd[i].fd,buf,BUFSIZE)) == 0)
++ exit(0);
++
++ write(fileout[i],buf,m);
++ }
++ }
++
++ if(pfd[i].revents & POLLHUP) {
++ --n;
++ if (sentinel > 0)
+ exit(0);
+- write(fileout[i],buf,m);
+ }
+- }
+- }
++ } /* for */
++ } /* infinite while */
+ }
diff --git a/net-misc/vde/files/digest-vde-2.1.6-r1 b/net-misc/vde/files/digest-vde-2.1.6-r1
new file mode 100644
index 000000000000..21b986fdd60b
--- /dev/null
+++ b/net-misc/vde/files/digest-vde-2.1.6-r1
@@ -0,0 +1,3 @@
+MD5 68a9a5c4c8cf713bd4d97acc1eb341a6 vde2-2.1.6.tar.bz2 390222
+RMD160 083be75c89c5915ce7fa8a2b300a09af49e793cd vde2-2.1.6.tar.bz2 390222
+SHA256 4a4664346e357e95f3113af6d72878d57e0ef5d493d476ec49870376a2ee00e7 vde2-2.1.6.tar.bz2 390222
diff --git a/net-misc/vde/vde-2.1.6-r1.ebuild b/net-misc/vde/vde-2.1.6-r1.ebuild
new file mode 100644
index 000000000000..ba364632a0d7
--- /dev/null
+++ b/net-misc/vde/vde-2.1.6-r1.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/vde/vde-2.1.6-r1.ebuild,v 1.1 2007/07/07 12:27:43 genstef Exp $
+
+inherit eutils
+
+MY_P="${PN}2-${PV}"
+S="${WORKDIR}/${MY_P}"
+
+DESCRIPTION="vde2 is a virtual distributed ethernet emulator for emulators like qemu, bochs, and uml."
+SRC_URI="mirror://sourceforge/vde/${MY_P}.tar.bz2"
+HOMEPAGE="http://vde.sourceforge.net/"
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+DEPEND=""
+
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}/Unixterm_20070403.patch"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+ newinitd "${FILESDIR}"/vde.init vde
+ newconfd "${FILESDIR}"/vde.conf vde
+
+ dodoc INSTALL README
+}
+
+pkg_postinst() {
+ # default group already used in kqemu
+ enewgroup qemu
+ einfo "To start vde automatically add it to the default runlevel:"
+ einfo "# rc-update add vde default"
+ einfo "You need to setup tap0 in /etc/conf.d/net"
+ einfo "To use it as an user be sure to set a group in /etc/conf.d/vde"
+ einfo "Users of the group can then run: $ vdeq qemu -sock /var/run/vde.ctl ..other opts"
+}