Skip to content

Conversation

@vbnogueira
Copy link
Contributor

The redirect_l2 P4 program redirects an IPv4 packet to a specific port and changes the packet's source and destination mac addresses. It does that whenever the source IP address of the parsed packet matches a table entry. The entry's associated action will specify the new source and destination mac addresses along with the port where the program should redirect to.

In this test case, we add a table entry which redirects packets with source IP address 10.0.0.1 to port 1 and changes the mac source and destination addresses, respectively, to 00:01:02:03:04:05 and 06:07:08:09:11:12. The test case will send an IPv4 packet with source address 10.0.0.1 to port 0 and check whether the redirected IPv4 packet was sent to port 1

The redirect_l2 P4 program redirects an IPv4 packet to a specific port and
changes the packet's source and destination mac addresses. It does that
whenever the source IP address of the parsed packet matches a table
entry. The entry's associated action will specify the new source and
destination mac addresses along with the port where the program should
redirect to.

In this test case, we add a table entry which redirects packets with
source IP address 10.0.0.1 to port 1 and changes the mac source and
destination addresses, respectively, to 00:01:02:03:04:05 and
06:07:08:09:11:12. The test case will send an IPv4 packet with source
address 10.0.0.1 to port 0 and check whether the redirected IPv4 packet
was sent to port 1

Signed-off-by: Victor Nogueira <[email protected]>
Co-authored-by: Jamal Hadi Salim <[email protected]>
@vbnogueira vbnogueira requested a review from fruffy October 28, 2025 15:27
@vbnogueira vbnogueira added the p4tc Topics related to the P4-TC back end. On PRs, also triggers p4tc CI tests to run. label Oct 28, 2025
@vbnogueira vbnogueira added this pull request to the merge queue Oct 29, 2025
Merged via the queue into p4lang:main with commit 33b6473 Oct 29, 2025
21 checks passed
@vbnogueira vbnogueira deleted the add_p4tc_redirect_l2_testcase branch October 29, 2025 11:36
jhavrane pushed a commit to jhavrane/p4c that referenced this pull request Dec 19, 2025
Signed-off-by: Victor Nogueira <[email protected]>
Co-authored-by: Jamal Hadi Salim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p4tc Topics related to the P4-TC back end. On PRs, also triggers p4tc CI tests to run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants