Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bootbool/forwarder
Forward any packets to any where depending on your first packet.(support kernel, ebpf, dpdk)
https://github.com/bootbool/forwarder
dpdk ebpf kernel linux lwip network
Last synced: 24 days ago
JSON representation
Forward any packets to any where depending on your first packet.(support kernel, ebpf, dpdk)
- Host: GitHub
- URL: https://github.com/bootbool/forwarder
- Owner: bootbool
- Created: 2024-05-26T13:35:43.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-27T00:17:02.000Z (about 1 month ago)
- Last Synced: 2024-09-30T04:20:54.829Z (about 1 month ago)
- Topics: dpdk, ebpf, kernel, linux, lwip, network
- Language: C
- Homepage:
- Size: 2.48 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Forwarder
This project aims to forward data to any destination you want. Unlike kernel LVS, it makes forward decision by your instruction. After client connects to forwarder, the first package sent is used for making decision, then the following data is transmitted as usual.
# Work mechanism
## Connection procedure
Actor: Client ---> Forwarder ---> Real Server
1. Forwarder create a user program, and listen on a tcp port waiting for client connection.
2. Client call "connect" system call to connect Forwarder, then send *Instruction* to Forwarder.
3. After receiving instruction, Forwarder record the connection file description(fd-c), and parse the instruction data.
4. After parsing instruction data, Forwarder connect the Real Server, and record the connection file description(fd-s).
5. After the dual connection is finished, Forwarder build a data struct containing fd-c, fd-s, and the tcp sequence number difference value. Then a acknowledge response to sent back to Client.
6. Client receives the response, start the normal data transmission.## Program component
- Connection listener, a daemon running on user mode, aims to accept the connection from client and parse the instruction data, and initiate connection to real server. Then notify the kernel forwarder the dual connection file description.
- Kernel forwarder, a netfilter module running on kernel mode, modify the package data , and forward it to real server.# Interface
/proc/forwarder is root folder for configuration, under which the files and the corresponding functionality are listed by the following.
- listen_port, sets the tcp port which is listened by connection listener, accepting new connection from clients.
- forward, listener daemon writes socket file description pair to this file, corresponding to the upper fd-c and fd-s.
- show , shows all connection pairs that are handled by forwarder.