Commit 46974b17 authored by Bertrone Matteo's avatar Bertrone Matteo

http_filter renamed, README fixed

parent 13e74d30
...@@ -116,6 +116,7 @@ Tools: ...@@ -116,6 +116,7 @@ Tools:
Examples: Examples:
- examples/networking/[distributed_bridge/](examples/networking/distributed_bridge): Distributed bridge example. - examples/networking/[distributed_bridge/](examples/networking/distributed_bridge): Distributed bridge example.
- examples/networking/[http_filter/](examples/networking/http_filter): Simple HTTP filter example.
- examples/networking/[simple_tc.py](examples/networking/simple_tc.py): Simple traffic control example. - examples/networking/[simple_tc.py](examples/networking/simple_tc.py): Simple traffic control example.
- examples/networking/[simulation.py](examples/networking/simulation.py): Simulation helper. - examples/networking/[simulation.py](examples/networking/simulation.py): Simulation helper.
- examples/networking/neighbor_sharing/[tc_neighbor_sharing.py](examples/networking/neighbor_sharing/tc_neighbor_sharing.py) examples/networking/neighbor_sharing/[tc_neighbor_sharing.c](examples/networking/neighbor_sharing/tc_neighbor_sharing.c): Per-IP classification and rate limiting. - examples/networking/neighbor_sharing/[tc_neighbor_sharing.py](examples/networking/neighbor_sharing/tc_neighbor_sharing.py) examples/networking/neighbor_sharing/[tc_neighbor_sharing.c](examples/networking/neighbor_sharing/tc_neighbor_sharing.c): Per-IP classification and rate limiting.
......
#Simple HTTP Filter: Project purpose #HTTP Filter
Write an eBPF application that parses HTTP packets and extracts (and prints on screen) the URL contained in the GET/POST request. eBPF application that parses HTTP packets and extracts (and prints on screen) the URL contained in the GET/POST request.
[eBPF HTTP Filter - Short Presentation](https://github.com/iovisor/bpf-docs/blob/master/ebpf_http_filter.pdf) [eBPF HTTP Filter - Short Presentation](https://github.com/iovisor/bpf-docs/blob/master/ebpf_http_filter.pdf)
#Usage Example #Usage Example
```Shell ```Shell
$ sudo python http-parse-v2.py $ sudo python http-parse-complete.py
GET /pipermail/iovisor-dev/ HTTP/1.1 GET /pipermail/iovisor-dev/ HTTP/1.1
HTTP/1.1 200 OK HTTP/1.1 200 OK
GET /favicon.ico HTTP/1.1 GET /favicon.ico HTTP/1.1
...@@ -27,14 +27,14 @@ Matching packets are forwarded to user space, others dropped by the filter.<br / ...@@ -27,14 +27,14 @@ Matching packets are forwarded to user space, others dropped by the filter.<br /
<br /> <br />
Python script reads filtered raw packets from the socket, if necessary reassembles packets belonging to the same session, and prints on stdout the first line of the HTTP GET/POST request. <br /> Python script reads filtered raw packets from the socket, if necessary reassembles packets belonging to the same session, and prints on stdout the first line of the HTTP GET/POST request. <br />
#v1 vs v2 #simple vs complete
First version is the simple one: if the url is too long (splitted in more than one packet) is truncated. <br /> simple version: if the url is too long (splitted in more than one packet) is truncated. <br />
Second version is quite more complex: if necessary reassembles packets belonging to the same session and prints the complete url. complete version: if necessary reassembles packets belonging to the same session and prints the complete url.
#To run: #To run:
```Shell ```Shell
$ sudo python http-parse.py $ sudo python http-parse-simple.py
$ sudo python http-parse-v2.py $ sudo python http-parse-complete.py
``` ```
\ No newline at end of file
...@@ -76,8 +76,8 @@ def cleanup(): ...@@ -76,8 +76,8 @@ def cleanup():
#-----FUNCTIONS-END-------------------------# #-----FUNCTIONS-END-------------------------#
# initialize BPF - load source code from http-parse.c # initialize BPF - load source code from http-parse-complete.c
bpf = BPF(src_file = "http-parse-v2.c",debug = 0) bpf = BPF(src_file = "http-parse-complete.c",debug = 0)
#load eBPF program http_filter of type SOCKET_FILTER into the kernel eBPF vm #load eBPF program http_filter of type SOCKET_FILTER into the kernel eBPF vm
#more info about eBPF program types #more info about eBPF program types
......
...@@ -19,8 +19,8 @@ import sys ...@@ -19,8 +19,8 @@ import sys
import socket import socket
import os import os
# initialize BPF - load source code from http-parse.c # initialize BPF - load source code from http-parse-simple.c
bpf = BPF(src_file = "http-parse.c",debug = 0) bpf = BPF(src_file = "http-parse-simple.c",debug = 0)
#load eBPF program http_filter of type SOCKET_FILTER into the kernel eBPF vm #load eBPF program http_filter of type SOCKET_FILTER into the kernel eBPF vm
#more info about eBPF program types #more info about eBPF program types
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment