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

Add printing for HSR/PRP protocols #1126

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

cappe987
Copy link
Contributor

@cappe987 cappe987 commented Feb 1, 2024

HSR and PRP are redundancy protocols that duplicates frames and then eliminates the duplicates to ensure only one copy arrives at the destination. The protocols are interoperable and can be converted between. They are defined in the standard IEC62439-3.

Though, PRP is a bit odd so I'm not sure it can even be merged. It uses a trailer at the end of the packet to store the information. So parsing the packet means when need to search from the back. The trailer also holds the packet size to help verify that it is an actual PRP packet, but there's no guarantee. It could match on data in a non-PRP packet that just happens to coincide with the protocol specification. I didn't see any good way to handle this, but if you have ideas I could give it a try. If not possible I can remove the commit.

HSR tags work similar to VLAN tags, and are always placed after any VLAN tags.

HSR is a redundancy protocol that duplicates traffic and sends it two
ways in a ring with an HSR header that includes a sequence number. Other
devices in the ring will forward the first occurrence of a packet, and
discard the duplicate (based on SMAC + sequence number). This enables
zero packet loss when a link goes down.

Signed-off-by: Casper Andersson <[email protected]>
Supervision frames are sent out by the nodes to notify about their
existence, and in the case of a RedBox it will notify about the
upstream devices.

Signed-off-by: Casper Andersson <[email protected]>
PRP is a redundancy protocol, like HSR, that duplicates packets and
includes a sequence number. However, PRP uses a trailer on the packet,
making the parsing a bit tricky. The trailer includes the packet size
that can be used to help ascertain it is a valid PRP trailer, however it
is still possible that this can appear naturally in a packet somewhere
in a network that doesn't use PRP.

Signed-off-by: Casper Andersson <[email protected]>
Test setup used:
ip link add link veth1 type veth peer name veth2
ip link set dev veth1 up
ip link set dev veth2 up
ip link add name hsr0 type hsr slave1 veth1 slave2 veth2 version 1 proto 0
ip link set dev hsr0 up

And same but with PRP:
ip link add name prp0 type hsr slave1 veth1 slave2 veth2 proto 1

Supervision frames are automatically sent out by the kernel on HSR/PRP
interfaces.

Signed-off-by: Casper Andersson <[email protected]>
@cappe987
Copy link
Contributor Author

cappe987 commented Feb 2, 2024

I suppose we could have some flag (new or maybe some existing that fits) for the PRP trailer (and potentially other protocols that could mismatch. Not that I can think of any, but maybe there exists more).

I also noticed that I can't filter (like tcpdump -i eth0 arp) for HSR tagged packets. I'm guessing this that needs support in libpcap?

@infrastation
Copy link
Member

Does ether proto 0x892f as the filter match the packets you expect?

@cappe987
Copy link
Contributor Author

cappe987 commented Feb 2, 2024

Does ether proto 0x892f as the filter match the packets you expect?

Yes that matches all HSR tagged packets. I meant if I want to filter on HSR tagged ARP packets I can't do that. I just realized you can't do ether proto 0x8100 for VLAN, I assume the filtering is transparent to VLAN tags (unless specified with vlan X). So should HSR tags behave the same perhaps?

@infrastation
Copy link
Member

I am not familiar with these protocols, and I get an impression one has to understand the matter well before implementing more code. Please have patience and do not commit too much into preparing libpcap code changes yet.

@cappe987
Copy link
Contributor Author

cappe987 commented Feb 2, 2024

Yes. Take your time. I haven't started any libpcap work.

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

Successfully merging this pull request may close these issues.

None yet

2 participants