Add veth (#4312), thanks Raphael
git-svn-id: svn://svn.openwrt.org/openwrt/packages@13576 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
22bbd87042
commit
d01b379857
48
net/veth/Makefile
Normal file
48
net/veth/Makefile
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2008 OpenWrt.org
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
# $Id: $
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=veth
|
||||||
|
PKG_VERSION:=1.0
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
|
PKG_SOURCE_URL:=http://www.geocities.com/nestorjpg/veth/
|
||||||
|
PKG_MD5SUM:=11536388d9c76552a4b736638a458361
|
||||||
|
|
||||||
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define Package/veth
|
||||||
|
SECTION:=net
|
||||||
|
CATEGORY:=Network
|
||||||
|
DEPENDS:=+kmod-tun
|
||||||
|
TITLE:=Virtual Ethernet Device for Linux
|
||||||
|
URL:=http://www.geocities.com/nestorjpg/veth/
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/veth/description
|
||||||
|
VETH is a daemon that virtualizes a ethernet card in Linux.
|
||||||
|
The virtualization is done via Universal TUN/TAP Driver.
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
$(MAKE) -C $(PKG_BUILD_DIR)/veth \
|
||||||
|
CC="$(TARGET_CC)" \
|
||||||
|
CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
|
||||||
|
LDFLAGS="$(TARGET_LDFLAGS)"
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/veth/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/veth/vethd $(1)/usr/sbin/
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,veth))
|
14
net/veth/patches/100-veth-makefile-cflags.patch
Normal file
14
net/veth/patches/100-veth-makefile-cflags.patch
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Index: veth-1.0/veth/Makefile
|
||||||
|
===================================================================
|
||||||
|
--- veth-1.0.orig/veth/Makefile 2008-10-29 16:11:33.000000000 +0100
|
||||||
|
+++ veth-1.0/veth/Makefile 2008-10-31 18:01:33.000000000 +0100
|
||||||
|
@@ -4,8 +4,7 @@
|
||||||
|
rm -f vethd
|
||||||
|
|
||||||
|
vethd: vethd.c
|
||||||
|
- $(CC) -O6 -Wall -pedantic -o vethd vethd.c
|
||||||
|
- strip vethd
|
||||||
|
+ $(CC) $(CFLAGS) -o vethd vethd.c
|
||||||
|
|
||||||
|
install: all
|
||||||
|
install -s -m 750 ./vethd $(INSTALL_DIR)
|
32
net/veth/patches/200-drop-multicast.patch
Normal file
32
net/veth/patches/200-drop-multicast.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
diff -pNur veth-1.0/veth/vethd.c veth-1.0/veth/vethd.c
|
||||||
|
--- veth-1.0/veth/vethd.c 2008-11-14 10:59:50.000000000 +0100
|
||||||
|
+++ veth-1.0/veth/vethd.c 2008-11-24 11:24:45.000000000 +0100
|
||||||
|
@@ -29,6 +29,7 @@
|
||||||
|
#include <linux/if_ether.h>
|
||||||
|
#include <linux/if_packet.h>
|
||||||
|
#include <linux/if_tun.h>
|
||||||
|
+#include <net/ethernet.h>
|
||||||
|
|
||||||
|
#define max(a,b) ((a)>(b) ? (a):(b))
|
||||||
|
|
||||||
|
@@ -223,6 +224,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
|
int vfd, nfd, leidos, opc, foreground = 0;
|
||||||
|
fd_set fds;
|
||||||
|
+ struct ether_header const* const ether_hdr = (struct ether_header const *)buffer;
|
||||||
|
|
||||||
|
set_locale();
|
||||||
|
show_copyright();
|
||||||
|
@@ -356,7 +358,11 @@ int main(int argc, char **argv)
|
||||||
|
perror("Error reading from ethernet interface");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
- write(vfd, buffer, leidos);
|
||||||
|
+ /* drop multicast and ppp session */
|
||||||
|
+ if (!(ether_hdr->ether_dhost[0] == 0x01)
|
||||||
|
+ && (ether_hdr->ether_type != htons(ETH_P_PPP_SES))) {
|
||||||
|
+ write(vfd, buffer, leidos);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
FD_ZERO(&fds);
|
||||||
|
FD_SET(nfd, &fds);
|
Loading…
x
Reference in New Issue
Block a user