From 9ea0401e385e1dd3f1579a4e772aa876a5e21288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Eckl?= Date: Wed, 1 Aug 2018 20:09:22 +0200 Subject: src: Expose socket mark via socket expression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This can be used like ct mark or meta mark except it cannot be set. doc and tests are included. Signed-off-by: Máté Eckl Signed-off-by: Pablo Neira Ayuso --- tests/py/inet/socket.t | 2 ++ tests/py/inet/socket.t.json | 14 ++++++++++++++ tests/py/inet/socket.t.payload | 15 +++++++++++++++ 3 files changed, 31 insertions(+) (limited to 'tests/py') diff --git a/tests/py/inet/socket.t b/tests/py/inet/socket.t index 8edfa78d..91846e8e 100644 --- a/tests/py/inet/socket.t +++ b/tests/py/inet/socket.t @@ -7,3 +7,5 @@ socket transparent 0;ok socket transparent 1;ok socket transparent 2;fail + +socket mark 0x00000005;ok diff --git a/tests/py/inet/socket.t.json b/tests/py/inet/socket.t.json index c1ac1d12..235c3e94 100644 --- a/tests/py/inet/socket.t.json +++ b/tests/py/inet/socket.t.json @@ -26,3 +26,17 @@ } ] +# socket mark 0x00000005 +[ + { + "match": { + "left": { + "socket": { + "key": "mark" + } + }, + "right": 5 + } + } +] + diff --git a/tests/py/inet/socket.t.payload b/tests/py/inet/socket.t.payload index acad2ace..687b7a45 100644 --- a/tests/py/inet/socket.t.payload +++ b/tests/py/inet/socket.t.payload @@ -28,3 +28,18 @@ inet sockin sockchain [ socket load transparent => reg 1 ] [ cmp eq reg 1 0x00000001 ] +# socket mark 0x00000005 +ip sockip4 sockchain + [ socket load mark => reg 1 ] + [ cmp eq reg 1 0x00000005 ] + +# socket mark 0x00000005 +ip6 sockip6 sockchain + [ socket load mark => reg 1 ] + [ cmp eq reg 1 0x00000005 ] + +# socket mark 0x00000005 +inet sockin sockchain + [ socket load mark => reg 1 ] + [ cmp eq reg 1 0x00000005 ] + -- cgit v1.2.3