libtins as a tcp/udp stack

259 views
Skip to first unread message

dcow

unread,
Jan 5, 2016, 4:03:12 PM1/5/16
to libtins
I'm looking at writing a tcp/udp proxy. Does anyone have experience using libtins simply for packet parsing and creation without the whole sniffing bit? Would I be better served with an IP stack like `lwip`, or does libtins sufficiently act as an IP stack? Ideally If I did go this route, I'd want to build libtins without libpcap, which doesn't look to be currently supported.

Einar Jón

unread,
Feb 19, 2016, 3:28:57 AM2/19/16
to libtins
If you don't use the classes that call pcap functions (Sniffer/PacketWriter/PacketSender/OfflinePacketFilter), the project builds and runs fine if you just have the pcap.h and pcap/bpf.h headers available.

We've been using libtins simply for packet parsing and creation in a big scale project (thousands of deployed devices).

We read the packets from a linux tap interface and parse the raw data as Tins::EthernetII packets.
Then we do some manipulation (including transmission to another device), serialize the EthernetII frame and write the binary data to the tap interface.
Libtins is great for that (running on Android and embedded Linux devices.)
The android part does not need to support libcap, but we had to add an ifaddrs.c implementation and do some minor changes (I think they're all in master now).
We do some routing too (including ARP/NDP request creation), but I've never really looked into the packet sniffing and sending parts.

The product can be seen here.
http://theneworderman.com/
Reply all
Reply to author
Forward
0 new messages