Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSA/EDSA: Enable filter functionality #1195

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Hexxel
Copy link

@Hexxel Hexxel commented Jun 1, 2023

We want to use tcpdump filter functionality on a DSA/EDSA link layer device, but there doesn't seem to be supported right now. I'm not well versed in the libpcap implementation so I naively looked at the existing code and did the following changes in this PR. Please don't hit me over the head :/
Is this the right way of doing it or do you have any suggestions where I should look for a better solution/approach?

Best regards,

To be able to use filters on link layer DSA/EDSA, allow
those link types to generate code.

Signed-off-by: Mattias Forsblad <[email protected]>
@Hexxel Hexxel changed the title RFC: DSA/EDSA: Enable filter functionality DSA/EDSA: Enable filter functionality Jun 16, 2023
@Hexxel Hexxel marked this pull request as ready for review June 16, 2023 10:03
@Hexxel
Copy link
Author

Hexxel commented Apr 17, 2024

No actions on this PR?

@infrastation
Copy link
Member

FWIW, I do not see any immediate problems with the proposed change.

Before:

$ ./tcpdump -n -r tests/dsa.pcap -ve icmp
reading from file tests/dsa.pcap, link-type DSA_TAG_DSA (Marvell DSA), snapshot length 262144
tcpdump: Marvell DSA link-layer type filtering not implemented

After:

$ ./tcpdump -n -r tests/dsa.pcap -ve -c 1 'icmp[icmptype] = icmp-echo'
reading from file tests/dsa.pcap, link-type DSA_TAG_DSA (Marvell DSA), snapshot length 262144
23:21:39.544060 00:50:b6:29:10:70 > d6:c5:28:21:3e:af, Marvell DSA mode Forward, dev 0, port 1, untagged, VID 0, FPri 0, ethertype IPv4 (0x0800), length 102: (tos 0x0, ttl 64, id 14057, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.30.1 > 192.168.30.2: ICMP echo request, id 13586, seq 1, length 64

$ ./tcpdump -n -r tests/edsa.pcap -ve -c 1 'arp'
reading from file tests/edsa.pcap, link-type DSA_TAG_EDSA (Marvell EDSA), snapshot length 262144
23:21:49.680084 c6:e8:9f:7d:69:da > 00:50:b6:29:10:7e, Marvell EDSA ethertype 0xdada (Unknown), rsvd 0 0, mode From CPU, target dev 0, port 0, untagged, VID 0, FPri 0, ethertype ARP (0x0806), length 50: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.20.1 tell 192.168.20.2, length 28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants