2
2
### The TCP/IP stack written in Python
3
3
<br >
4
4
5
- [ ![ GitHub release] ( https ://img.shields.io/github/v/release/ccie18643/PyTCP)] ( https ://github.com/ccie18643/PyTCP/releases)
6
- [ ![ OS] ( https ://img.shields.io/badge/os-Linux-blue)] ( https ://kernel.org)
7
- [ ![ Supported Versions] ( https ://img.shields.io/pypi/pyversions/PyTCP.svg)] ( https ://pypi.org/project/PyTCP)
8
- [ ![ GitHub License] ( https ://img.shields.io/badge/license-GPL--3.0-yellowgreen)] ( https ://github.com/ccie18643/PyTCP/blob/master /LICENSE)
9
- [ ![ CI] ( https ://github.com/ccie18643/PyTCP/actions/workflows/ci.yml/badge.svg)] ( https ://github.com/ccie18643/PyTCP/actions/workflows/ci.yml)
5
+ [ ![ GitHub release] ( http ://img.shields.io/github/v/release/ccie18643/PyTCP)] ( http ://github.com/ccie18643/PyTCP/releases)
6
+ [ ![ OS] ( http ://img.shields.io/badge/os-Linux-blue)] ( http ://kernel.org)
7
+ [ ![ Supported Versions] ( http ://img.shields.io/pypi/pyversions/PyTCP.svg)] ( http ://pypi.org/project/PyTCP)
8
+ [ ![ GitHub License] ( http ://img.shields.io/badge/license-GPL--3.0-yellowgreen)] ( http ://pytcp.io /LICENSE)
9
+ [ ![ CI] ( http ://github.com/ccie18643/PyTCP/actions/workflows/ci.yml/badge.svg)] ( http ://github.com/ccie18643/PyTCP/actions/workflows/ci.yml)
10
10
11
- [ ![ GitHub watchers] ( https ://img.shields.io/github/watchers/ccie18643/PyTCP.svg?style=social&label=Watch&maxAge=2592000)] ( https ://GitHub.com/ccie18643/PyTCP/watchers/)
12
- [ ![ GitHub forks] ( https ://img.shields.io/github/forks/ccie18643/PyTCP.svg?style=social&label=Fork&maxAge=2592000)] ( https ://GitHub.com/ccie18643/PyTCP/network/)
13
- [ ![ GitHub stars] ( https ://img.shields.io/github/stars/ccie18643/PyTCP.svg?style=social&label=Star&maxAge=2592000)] ( https ://GitHub.com/ccie18643/PyTCP/stargazers/)
11
+ [ ![ GitHub watchers] ( http ://img.shields.io/github/watchers/ccie18643/PyTCP.svg?style=social&label=Watch&maxAge=2592000)] ( http ://GitHub.com/ccie18643/PyTCP/watchers/)
12
+ [ ![ GitHub forks] ( http ://img.shields.io/github/forks/ccie18643/PyTCP.svg?style=social&label=Fork&maxAge=2592000)] ( http ://GitHub.com/ccie18643/PyTCP/network/)
13
+ [ ![ GitHub stars] ( http ://img.shields.io/github/stars/ccie18643/PyTCP.svg?style=social&label=Star&maxAge=2592000)] ( http ://GitHub.com/ccie18643/PyTCP/stargazers/)
14
14
15
15
<br >
16
16
@@ -25,8 +25,8 @@ I welcome any contributions and help from anyone interested in network programmi
25
25
I still need to fix.
26
26
27
27
Please feel free to check my two other related projects:
28
- - [ RusTCP] ( https ://github.com/ccie18643/RusTCP) - Attempt to rewrite some of PyTCP funcionality in Rust and use it to create IPv6/SRv6 lab router.
29
- - [ SeaTCP] ( https ://github.com/ccie18643/SeaTCP) - Attempt to create low latency stack using C and Assembly languages.
28
+ - [ RusTCP] ( http ://github.com/ccie18643/RusTCP) - Attempt to rewrite some of PyTCP funcionality in Rust and use it to create IPv6/SRv6 lab router.
29
+ - [ SeaTCP] ( http ://github.com/ccie18643/SeaTCP) - Attempt to create low latency stack using C and Assembly languages.
30
30
31
31
---
32
32
@@ -57,11 +57,11 @@ directly by calling one of the ```_*_phtx()``` methods from ```PacketHandler```
57
57
58
58
### Clonning PyTCP from the GitHub repository
59
59
60
- In most cases, PyTCP should be cloned directly from the [ GitHub repository] ( https ://github.com/ccie18643/PyTCP) ,
60
+ In most cases, PyTCP should be cloned directly from the [ GitHub repository] ( http ://github.com/ccie18643/PyTCP) ,
61
61
as this type of installation provides full development and testing environment.
62
62
63
63
``` shell
64
- git clone https ://github.com/ccie18643/PyTCP
64
+ git clone http ://github.com/ccie18643/PyTCP
65
65
```
66
66
67
67
After cloning, we can run one of the included examples:
@@ -80,7 +80,7 @@ To fine-tune various stack operational parameters, please edit the ```pytcp/conf
80
80
81
81
### Installing PyTCP from the PyPi repository
82
82
83
- PyTCP can also be installed as a regular module from the [ PyPi repository] ( https ://pypi.org/project/PyTCP/) .
83
+ PyTCP can also be installed as a regular module from the [ PyPi repository] ( http ://pypi.org/project/PyTCP/) .
84
84
85
85
``` console
86
86
python -m pip install PyTCP
@@ -200,17 +200,17 @@ stack.stop()
200
200
201
201
#### Several ping packets and two monkeys were delivered via TCP over the IPv6 protocol.
202
202
203
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/malpi_00.png)
204
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/malpi_01.png)
205
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/malpi_02.png)
206
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/malpi_03.png)
207
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/malpi_04.png)
208
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/malpi_05.png)
209
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/malpi_06.png)
210
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/malpi_07.png)
211
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/malpi_08.png)
212
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/malpi_09.png)
213
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/malpi_10.png)
203
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/malpi_00.png)
204
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/malpi_01.png)
205
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/malpi_02.png)
206
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/malpi_03.png)
207
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/malpi_04.png)
208
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/malpi_05.png)
209
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/malpi_06.png)
210
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/malpi_07.png)
211
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/malpi_08.png)
212
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/malpi_09.png)
213
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/malpi_10.png)
214
214
215
215
<br >
216
216
@@ -225,11 +225,11 @@ stack.stop()
225
225
- Stack doesn't receive any Neighbor Advertisement for the address it generated, so it assigns it to its interface.
226
226
- After all the addresses are assigned, stack sends out one more Multicast Listener report listing all the multicast addresses it wants to listen to.
227
227
228
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/ipv6_nd_dad_01.png)
229
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/ipv6_nd_dad_02.png)
230
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/ipv6_nd_dad_03.png)
231
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/ipv6_nd_dad_04.png)
232
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/ipv6_nd_dad_05.png)
228
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/ipv6_nd_dad_01.png)
229
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/ipv6_nd_dad_02.png)
230
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/ipv6_nd_dad_03.png)
231
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/ipv6_nd_dad_04.png)
232
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/ipv6_nd_dad_05.png)
233
233
234
234
<br >
235
235
@@ -238,10 +238,10 @@ stack.stop()
238
238
- Peer notices the inconsistency in packet SEQ numbers and sends out a 'fast retransmit request'.
239
239
- Stack receives the request and retransmits the lost packet.
240
240
241
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_tx_fst_ret_01.png)
242
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_tx_fst_ret_02.png)
243
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_tx_fst_ret_03.png)
244
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_tx_fst_ret_04.png)
241
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_tx_fst_ret_01.png)
242
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_tx_fst_ret_02.png)
243
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_tx_fst_ret_03.png)
244
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_tx_fst_ret_04.png)
245
245
246
246
<br >
247
247
@@ -253,12 +253,12 @@ stack.stop()
253
253
- Stack receives the lost packet, pulls all the packets stored in the out-of-order queue, and processes them.
254
254
- Stacks sends out ACK packet to acknowledge the latest packets pulled from the queue.
255
255
256
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_ooo_ret_01.png)
257
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_ooo_ret_02.png)
258
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_ooo_ret_03.png)
259
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_ooo_ret_04.png)
260
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_ooo_ret_05.png)
261
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_ooo_ret_06.png)
256
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_ooo_ret_01.png)
257
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_ooo_ret_02.png)
258
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_ooo_ret_03.png)
259
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_ooo_ret_04.png)
260
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_ooo_ret_05.png)
261
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_ooo_ret_06.png)
262
262
263
263
<br >
264
264
@@ -268,10 +268,10 @@ stack.stop()
268
268
- Stack echoes the data back.
269
269
- Peer closes the connection.
270
270
271
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_fsm_srv_01.png)
272
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_fsm_srv_02.png)
273
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_fsm_srv_03.png)
274
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_fsm_srv_04.png)
271
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_fsm_srv_01.png)
272
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_fsm_srv_02.png)
273
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_fsm_srv_03.png)
274
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_fsm_srv_04.png)
275
275
276
276
<br >
277
277
@@ -281,10 +281,10 @@ stack.stop()
281
281
- Peer echoes the data back.
282
282
- Stack closes the connection.
283
283
284
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_fsm_clt_01.png)
285
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_fsm_clt_02.png)
286
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_fsm_clt_03.png)
287
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/tcp_fsm_clt_04.png)
284
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_fsm_clt_01.png)
285
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_fsm_clt_02.png)
286
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_fsm_clt_03.png)
287
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/tcp_fsm_clt_04.png)
288
288
289
289
<br >
290
290
@@ -293,9 +293,9 @@ stack.stop()
293
293
- The second screenshot shows the stack with the sanity check turned on. A malformed ICMPv6 packet is discarded before being passed to the ICMPv6 protocol parser.
294
294
- The third screenshot shows the malformed packet. The number of MA records field has been set to 777 even though the packet contains only one record.
295
295
296
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/pre_sanity_chk_01.png)
297
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/pre_sanity_chk_02.png)
298
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/pre_sanity_chk_03.png)
296
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/pre_sanity_chk_01.png)
297
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/pre_sanity_chk_02.png)
298
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/pre_sanity_chk_03.png)
299
299
300
300
<br >
301
301
@@ -304,10 +304,10 @@ stack.stop()
304
304
- One of the IP addresses (192.168.9.102) is already taken, so the stack gets notified about it and skips it.
305
305
- The rest of the IP addresses are free, so stack claims them by sending ARP Announcement for each of them.
306
306
307
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/ip_arp_probe_01.png)
308
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/ip_arp_probe_02.png)
309
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/ip_arp_probe_03.png)
310
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/ip_arp_probe_04.png)
307
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/ip_arp_probe_01.png)
308
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/ip_arp_probe_02.png)
309
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/ip_arp_probe_03.png)
310
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/ip_arp_probe_04.png)
311
311
312
312
<br >
313
313
@@ -316,8 +316,8 @@ stack.stop()
316
316
- Stack responds by sending an ARP Reply packet (stack doesn't need to send out its request since it already made a note of the host's MAC from the host's request).
317
317
- Host sends ping packets, and stack responds to them.
318
318
319
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/arp_ping_01.png)
320
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/arp_ping_02.png)
319
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/arp_ping_01.png)
320
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/arp_ping_02.png)
321
321
322
322
<br >
323
323
@@ -328,7 +328,7 @@ stack.stop()
328
328
- UDP datagram is passed to the IP protocol handler, which creates an IP packet, and after checking that it exceeds the link, MTU fragments it into three separate IP packets.
329
329
- IP packets are encapsulated in Ethernet frames and put on a TX ring.
330
330
331
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/ip_udp_frag_01.png)
332
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/ip_udp_frag_02.png)
333
- ![ Sample PyTCP log output] ( https ://github.com/ccie18643/PyTCP/blob/master /docs/images/ip_udp_frag_03.png)
331
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/ip_udp_frag_01.png)
332
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/ip_udp_frag_02.png)
333
+ ![ Sample PyTCP log output] ( http ://pytcp.io /docs/images/ip_udp_frag_03.png)
334
334
0 commit comments