binarysec / node-tuntap Goto Github PK
View Code? Open in Web Editor NEWNetwork Tuntap binding for nodejs
Network Tuntap binding for nodejs
i use:
tt.write(packet);
to send ip packet and than use tcp dump to capture the packet:
tcpdump -i tun8
it seems tcp dump can't recognize the packet.
here is my tun device setup:
tt = tuntap({
type: 'tun',
name: 'tun8',
mtu: 1500,
addr: '192.168.100.1',
dest: '192.168.100.2',
mask: '255.255.255.0',
ethtype_comp: 'none',
persist: true,
up: true,
running: true,
});
than i look into the code, and modify the code in
src/tuntap-itf/tuntap-itf-linux.inc.cc
while open the tun device, and add the flag as follows:
109 if(opts.mode == tuntap_itf_opts_t::MODE_TUN)
110 ifr.ifr_flags |= IFF_TUN;
111 else if(opts.mode == tuntap_itf_opts_t::MODE_TAP)
112 ifr.ifr_flags |= IFF_TAP;
113
114 //add by chengen
115 ifr.ifr_flags |= IFF_NO_PI;
116
117 MK_IOCTL(*fd, TUNSETIFF, &ifr)
line 115. and then it works. tcpdump can recognize the packet. is this a bug or i missed something on configuration?
Hi,
do you think to extends this project to node v4?
The build process fail on node v4 but is working on v0.12.
Bests
Walter
Would be nice to have Mac OSX support. Currently fails right off the bat with a #include <linux/if.h>
.
Hi,
trying to use this module, but apparently I suck at nodejs and I can't create working tun tunnel.
Could you please add some more code snippets with the example usage?
Thx.
When a ipv4 packet is sent (I reply successfully to ARP), node has a crash:
*** Error in `node': double free or corruption (!prev): 0x000055a74504ab30 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7908b)[0x7f436149208b]
/lib/x86_64-linux-gnu/libc.so.6(+0x826fa)[0x7f436149b6fa]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f436149f12c]
node(_ZN2v88internal18ArrayBufferTracker18FreeDeadInNewSpaceEPNS0_4HeapE+0x13c)[0x55a74266d50c]
node(_ZN2v88internal4Heap8ScavengeEv+0x189b)[0x55a74268e43b]
node(_ZN2v88internal4Heap24PerformGarbageCollectionENS0_16GarbageCollectorENS_15GCCallbackFlagsE+0x119)[0x55a74268ecf9]
node(_ZN2v88internal4Heap14CollectGarbageENS0_16GarbageCollectorENS0_23GarbageCollectionReasonEPKcNS_15GCCallbackFlagsE+0x153)[0x55a74268f7c3]
node(_ZN2v88internal7Factory15NewFillerObjectEibNS0_15AllocationSpaceE+0x7f)[0x55a74263a9cf]
node(_ZN2v88internal26Runtime_AllocateInNewSpaceEiPPNS0_6ObjectEPNS0_7IsolateE+0x78)[0x55a742941bc8]
[0x37977ff843a7]
Hi,
What is necessary to support ipv6?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.