Coder Social home page Coder Social logo

aclapolli / ddosd-p4 Goto Github PK

View Code? Open in Web Editor NEW
34.0 34.0 13.0 30 KB

"Offloading Real-time DDoS Attack Detection to Programmable Data Planes" P4 description

License: GNU General Public License v3.0

Makefile 3.86% Shell 11.68% P4 76.10% Dockerfile 8.37%

ddosd-p4's People

Contributors

aclapolli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ddosd-p4's Issues

veth4 cant't receive any packet

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
image (4)

if i try tcpreplay -i veth4 -p 200 IoT_DDoS_traffic.pcap , tcpdump can capture but no any blocking.
image (5)
And when i use tcpdump in veth2 , it can capture packets from veth0.
136038461_156125032656926_758529988359756215_n

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

make file Error

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 error

$ 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

ERROR

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)
278654006_368831921874729_159485901511751122_n

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.