aclapolli / ddosd-p4 Goto Github PK
View Code? Open in Web Editor NEW"Offloading Real-time DDoS Attack Detection to Programmable Data Planes" P4 description
License: GNU General Public License v3.0
"Offloading Real-time DDoS Attack Detection to Programmable Data Planes" P4 description
License: GNU General Public License v3.0
Hi @aclapolli ,
Follow your guide ๏ผ
I run run.sh in the background . then
open one terminal to replay a workload by typing tcpreplay -i veth0 -p 200 IoT_DDoS_traffic.pcap and
typing sudo tcpdump -n -i veth4
but there is not captured in veth4 like picture 1 below
if i try tcpreplay -i veth4 -p 200 IoT_DDoS_traffic.pcap , tcpdump can capture but no any blocking.
And when i use tcpdump in veth2 , it can capture packets from veth0.
I think whether is the topo not ping success .
So I try ping -I veth4 127.0.0.1 command and set /proc/sys/net/ipv4/conf/veth4/accept_local to 1 by
echo 1 > /proc/sys/net/ipv4/conf/veth4/accept_local
but not ping successfully
PS: I use the pcap in this link:
https://cloudstor.aarnet.edu.au/plus/s/umT99TnxvbpkkoE?path=%2FPCAPs%2FDDoS%2FDDoS_UDP
Best regards,
Pin-Yu
Hello,
I am trying to replicate your finding from the paper "Offloading Real-time DDoS Attack detection to Programmable Data Planes".
I have installed p4 and bmv2 as pre-req and ran the make file after downloading your Git.
gs7563@vclient15:~/ddosd-p4$ make
p4c -b bmv2 -Isrc -o build src/ddosd.p4
src/ddosd.p4(104): [--Werror=type-error] error: HashAlgorithm.h1: Invalid enum tag
hash(h1, HashAlgorithm.h1, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
src/ddosd.p4(104): [--Werror=type-error] error: hash: Cannot unify Type(HashAlgorithm) to HashAlgorithm
hash(h1, HashAlgorithm.h1, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/local/share/p4c/p4include/v1model.p4(331)
enum HashAlgorithm {
^^^^^^^^^^^^^
I am not sure where the changes to the HashAlgorithm enum needs to be made.
Can you help me with this?
Thanks,
Gopinath
$ make
p4c -b bmv2 -Isrc -o build src/ddosd.p4
src/ddosd.p4(59): [--Wwarn=deprecated] warning: mark_to_drop: Using deprecated feature mark_to_drop. Please use mark_to_drop(standard_metadata) instead.
mark_to_drop();
^^^^^^^^^^^^
/usr/local/share/p4c/p4include/v1model.p4(415)
extern void mark_to_drop();
^^^^^^^^^^^^
src/ddosd.p4(104): [--Werror=type-error] error: HashAlgorithm.h1: Invalid enum tag
hash(h1, HashAlgorithm.h1, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
src/ddosd.p4(104): [--Werror=type-error] error: hash
hash(h1, HashAlgorithm.h1, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
---- Actual error:
/usr/local/share/p4c/p4include/v1model.p4(403): Cannot unify type 'Type(HashAlgorithm)' with type 'HashAlgorithm'
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
src/ddosd.p4(104): Type of argument 'HashAlgorithm.h1' (Type(HashAlgorithm)) does not match type of parameter 'algo' (HashAlgorithm)
hash(h1, HashAlgorithm.h1, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
/usr/local/share/p4c/p4include/v1model.p4(453)
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
/usr/local/share/p4c/p4include/v1model.p4(403)
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
/usr/local/share/p4c/p4include/v1model.p4(453): Function type 'hash' does not match invocation type ''
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
src/ddosd.p4(104)
hash(h1, HashAlgorithm.h1, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Where 'T' is bound to 'bit<32>'
Where 'D' is bound to 'Tuple(1)'
Where 'M' is bound to 'bit<32>'
src/ddosd.p4(105): [--Werror=type-error] error: HashAlgorithm.h2: Invalid enum tag
hash(h2, HashAlgorithm.h2, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
src/ddosd.p4(105): [--Werror=type-error] error: hash
hash(h2, HashAlgorithm.h2, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
---- Actual error:
/usr/local/share/p4c/p4include/v1model.p4(403): Cannot unify type 'Type(HashAlgorithm)' with type 'HashAlgorithm'
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
src/ddosd.p4(105): Type of argument 'HashAlgorithm.h2' (Type(HashAlgorithm)) does not match type of parameter 'algo' (HashAlgorithm)
hash(h2, HashAlgorithm.h2, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
/usr/local/share/p4c/p4include/v1model.p4(453)
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
/usr/local/share/p4c/p4include/v1model.p4(403)
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
/usr/local/share/p4c/p4include/v1model.p4(453): Function type 'hash' does not match invocation type ''
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
src/ddosd.p4(105)
hash(h2, HashAlgorithm.h2, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Where 'T' is bound to 'bit<32>'
Where 'D' is bound to 'Tuple(1)'
Where 'M' is bound to 'bit<32>'
src/ddosd.p4(106): [--Werror=type-error] error: HashAlgorithm.h3: Invalid enum tag
hash(h3, HashAlgorithm.h3, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
src/ddosd.p4(106): [--Werror=type-error] error: hash
hash(h3, HashAlgorithm.h3, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
---- Actual error:
/usr/local/share/p4c/p4include/v1model.p4(403): Cannot unify type 'Type(HashAlgorithm)' with type 'HashAlgorithm'
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
src/ddosd.p4(106): Type of argument 'HashAlgorithm.h3' (Type(HashAlgorithm)) does not match type of parameter 'algo' (HashAlgorithm)
hash(h3, HashAlgorithm.h3, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
/usr/local/share/p4c/p4include/v1model.p4(453)
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
/usr/local/share/p4c/p4include/v1model.p4(403)
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
/usr/local/share/p4c/p4include/v1model.p4(453): Function type 'hash' does not match invocation type ''
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
src/ddosd.p4(106)
hash(h3, HashAlgorithm.h3, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Where 'T' is bound to 'bit<32>'
Where 'D' is bound to 'Tuple(1)'
Where 'M' is bound to 'bit<32>'
src/ddosd.p4(107): [--Werror=type-error] error: HashAlgorithm.h4: Invalid enum tag
hash(h4, HashAlgorithm.h4, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
src/ddosd.p4(107): [--Werror=type-error] error: hash
hash(h4, HashAlgorithm.h4, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
---- Actual error:
/usr/local/share/p4c/p4include/v1model.p4(403): Cannot unify type 'Type(HashAlgorithm)' with type 'HashAlgorithm'
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
src/ddosd.p4(107): Type of argument 'HashAlgorithm.h4' (Type(HashAlgorithm)) does not match type of parameter 'algo' (HashAlgorithm)
hash(h4, HashAlgorithm.h4, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
/usr/local/share/p4c/p4include/v1model.p4(453)
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
/usr/local/share/p4c/p4include/v1model.p4(403)
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
/usr/local/share/p4c/p4include/v1model.p4(453): Function type 'hash' does not match invocation type ''
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
src/ddosd.p4(107)
hash(h4, HashAlgorithm.h4, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Where 'T' is bound to 'bit<32>'
Where 'D' is bound to 'Tuple(1)'
Where 'M' is bound to 'bit<32>'
src/ddosd.p4(111): [--Werror=type-error] error: HashAlgorithm.g1: Invalid enum tag
hash(g1, HashAlgorithm.g1, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
src/ddosd.p4(111): [--Werror=type-error] error: hash
hash(g1, HashAlgorithm.g1, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
---- Actual error:
/usr/local/share/p4c/p4include/v1model.p4(403): Cannot unify type 'Type(HashAlgorithm)' with type 'HashAlgorithm'
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
src/ddosd.p4(111): Type of argument 'HashAlgorithm.g1' (Type(HashAlgorithm)) does not match type of parameter 'algo' (HashAlgorithm)
hash(g1, HashAlgorithm.g1, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
/usr/local/share/p4c/p4include/v1model.p4(453)
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
/usr/local/share/p4c/p4include/v1model.p4(403)
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
/usr/local/share/p4c/p4include/v1model.p4(453): Function type 'hash' does not match invocation type ''
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
src/ddosd.p4(111)
hash(g1, HashAlgorithm.g1, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Where 'T' is bound to 'bit<32>'
Where 'D' is bound to 'Tuple(1)'
Where 'M' is bound to 'bit<32>'
src/ddosd.p4(112): [--Werror=type-error] error: HashAlgorithm.g2: Invalid enum tag
hash(g2, HashAlgorithm.g2, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
src/ddosd.p4(112): [--Werror=type-error] error: hash
hash(g2, HashAlgorithm.g2, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
---- Actual error:
/usr/local/share/p4c/p4include/v1model.p4(403): Cannot unify type 'Type(HashAlgorithm)' with type 'HashAlgorithm'
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
src/ddosd.p4(112): Type of argument 'HashAlgorithm.g2' (Type(HashAlgorithm)) does not match type of parameter 'algo' (HashAlgorithm)
hash(g2, HashAlgorithm.g2, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
/usr/local/share/p4c/p4include/v1model.p4(453)
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
/usr/local/share/p4c/p4include/v1model.p4(403)
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
/usr/local/share/p4c/p4include/v1model.p4(453): Function type 'hash' does not match invocation type ''
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
src/ddosd.p4(112)
hash(g2, HashAlgorithm.g2, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Where 'T' is bound to 'bit<32>'
Where 'D' is bound to 'Tuple(1)'
Where 'M' is bound to 'bit<32>'
src/ddosd.p4(113): [--Werror=type-error] error: HashAlgorithm.g3: Invalid enum tag
hash(g3, HashAlgorithm.g3, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
src/ddosd.p4(113): [--Werror=type-error] error: hash
hash(g3, HashAlgorithm.g3, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
---- Actual error:
/usr/local/share/p4c/p4include/v1model.p4(403): Cannot unify type 'Type(HashAlgorithm)' with type 'HashAlgorithm'
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
src/ddosd.p4(113): Type of argument 'HashAlgorithm.g3' (Type(HashAlgorithm)) does not match type of parameter 'algo' (HashAlgorithm)
hash(g3, HashAlgorithm.g3, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
/usr/local/share/p4c/p4include/v1model.p4(453)
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
/usr/local/share/p4c/p4include/v1model.p4(403)
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
/usr/local/share/p4c/p4include/v1model.p4(453): Function type 'hash' does not match invocation type ''
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
src/ddosd.p4(113)
hash(g3, HashAlgorithm.g3, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Where 'T' is bound to 'bit<32>'
Where 'D' is bound to 'Tuple(1)'
Where 'M' is bound to 'bit<32>'
src/ddosd.p4(114): [--Werror=type-error] error: HashAlgorithm.g4: Invalid enum tag
hash(g4, HashAlgorithm.g4, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
src/ddosd.p4(114): [--Werror=type-error] error: hash
hash(g4, HashAlgorithm.g4, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
---- Actual error:
/usr/local/share/p4c/p4include/v1model.p4(403): Cannot unify type 'Type(HashAlgorithm)' with type 'HashAlgorithm'
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
src/ddosd.p4(114): Type of argument 'HashAlgorithm.g4' (Type(HashAlgorithm)) does not match type of parameter 'algo' (HashAlgorithm)
hash(g4, HashAlgorithm.g4, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^
/usr/local/share/p4c/p4include/v1model.p4(453)
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
/usr/local/share/p4c/p4include/v1model.p4(403)
enum HashAlgorithm {
^^^^^^^^^^^^^
---- Originating from:
/usr/local/share/p4c/p4include/v1model.p4(453): Function type 'hash' does not match invocation type ''
extern void hash<O, T, D, M>(out O result, in HashAlgorithm algo, in T base, in D data, in M max);
^^^^
src/ddosd.p4(114)
hash(g4, HashAlgorithm.g4, 32w0, {ipv4_addr}, 32w0xffffffff);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Where 'T' is bound to 'bit<32>'
Where 'D' is bound to 'Tuple(1)'
Where 'M' is bound to 'bit<32>'
Makefile:12: recipe for target 'ddosd' failed
make: *** [ddosd] Error 1
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find PCAP (missing: PCAP_LIBRARY PCAP_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
cmake/Modules/FindPCAP.cmake:37 (find_package_handle_standard_args)
CMakeLists.txt:17 (find_package)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.