Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I test a custom TCP implementation on Linux?

For learning purposes I'm implementing TCP (for now just RFC 793) but I have no idea how to test it. Most TUN/TAP stuff on the internet are out of date (e.g. Linux API calls no longer work) and just doesn't explain enough. In addition, I feel like a creating a device and forwarding packages etc. are not the best way for learning purposes. For example, I'd rather only override socket(), listen(), connect(), accept(), send(), recv() etc. in a program rather than forwarding all ethernet traffic to a device/program that does the bookeeping for the whole system rather than for a single program.

I'm wondering if this is possible. If not, I'd like to know the simplest way to test a TCP implementation on Linux.

Because I'm following RFC 793, it'd be great if I could have an IP (Internet Protocol as mentioned in the RFC) API in my application. Is this possible or do I have to mess with TUN/TAP stuff?

Thanks..

like image 441
sinan Avatar asked Aug 28 '17 07:08

sinan


People also ask

How check TCP connection in Linux?

Check TCP Connection Status in Linux To display listeners and connections on Linux we can use the netstat or ss command. While older Linux boxes only support netstat, newer Linux distributions use netstat and ss in parallel.

How does Linux implement TCP?

The TCP layer builds packets when data is available in the send buffer or ACK packets in response to data packets received. Each packet is pushed down to the IP layer for transmission. The IP layer enqueues each packet in an output queue (qdisc) associated with the NIC.

How to Test TCP port connectivity in Linux?

Telnet can be used to test tcp port connections, where as nc can be used to test both tcp/udp ports connectivity. Make sure telnet and nc tools are installed on the Linux server you are trying to test connectivity. Lets see how we can use telnet command to test the TCP port connectivity.

What do you think about TCP/IP and Linux?

There are many aspects of networking and TCP/IP that are particularly fascinating, especially when dealing with a Linux distribution. Don’t forget that you have manual pages (a.k.a. man pages) available right within the Linux installation.

How to Test TCP post connectivity using NC?

The syntax to use nc command for testing TCP post connectivity is as follows: # nc -z -v [hostname/IP address] [port number] Example of successful connection: # nc -z -v 192.168.10.12 22 Connection to 192.118.20.95 22 port [tcp/ssh] succeeded!

What is the TCP server-client implementation in C?

TCP Server-Client implementation in C. If we are creating a connection between client and server using TCP then it has few functionality like, TCP is suited for applications that require high reliability, and transmission time is relatively less critical. It is used by other protocols like HTTP, HTTPs, FTP, SMTP, Telnet.


Video Answer


1 Answers

If we talk about research I strongly recommend you read Engineering with Logic: Rigorous Test-Oracle Specification and Validation for TCP/IP and the Sockets API

It contains section about testing TCP/IP implementation: "EXPERIMENTAL VALIDATION: TESTING INFRASTRUCTURE"

like image 133
sibnick Avatar answered Sep 30 '22 18:09

sibnick