Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
P4labs 2023
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ANET
P4labs 2023
Commits
bc71db27
Commit
bc71db27
authored
1 year ago
by
Djojomoenawie, N.E. (Nathan, Student M-CS)
Browse files
Options
Downloads
Patches
Plain Diff
Add set_direction() stub
parent
8fb945aa
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
assignments/firewall/firewall.p4
+8
-5
8 additions, 5 deletions
assignments/firewall/firewall.p4
with
8 additions
and
5 deletions
assignments/firewall/firewall.p4
+
8
−
5
View file @
bc71db27
...
...
@@ -86,7 +86,7 @@ parser MyParser(packet_in packet,
************ C H E C K S U M V E R I F I C A T I O N *************
*************************************************************************/
control
MyVerifyChecksum
(
inout
headers hdr
,
inout
metadata meta
)
{
control
MyVerifyChecksum
(
inout
headers hdr
,
inout
metadata meta
)
{
apply
{
}
}
...
...
@@ -108,7 +108,7 @@ control MyIngress(inout headers hdr,
action
drop
()
{
mark_to_drop
(
standard_metadata
);
}
action
compute_hashes
(
ip4Addr_t
ipAddr1
,
ip4Addr_t
ipAddr2
,
bit
<
16
>
port1
,
bit
<
16
>
port2
){
//Get register position
hash
(
reg_pos_one
,
HashAlgorithm
.
crc16
,
(
bit
<
32
>
)
0
,
{
ipAddr1
,
...
...
@@ -128,7 +128,10 @@ control MyIngress(inout headers hdr,
action
ipv4_forward
(
macAddr_t
dstAddr
,
egressSpec_t
port
)
{
}
action
set_direction
(
bit
dir
){
}
table
ipv4_lpm
{
key
=
{
hdr
.
ipv4
.
dstAddr
:
lpm
;
...
...
@@ -154,7 +157,7 @@ control MyIngress(inout headers hdr,
size
=
1024
;
default_action
=
NoAction
();
}
apply
{
ipv4_lpm
.
apply
();
/*
...
...
@@ -179,7 +182,7 @@ control MyIngress(inout headers hdr,
Here is a PSEUDOCODE of a possible solution.
if(tcp_is_valid(packet)):
if(packet_ports_must_be_filtered(packet)):
packet_flow = direction
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment