|
40 | 40 | * header, tags before the HSR tag (e.g. VLAN), and the HSR ethertype field.
|
41 | 41 | * For PRP it includes the PRP suffix.
|
42 | 42 | *
|
| 43 | + * |
| 44 | + * PRP trailer |
| 45 | + * 0 1 2 3 |
| 46 | + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 47 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 48 | + * | Sequence number | LanId | LSDUsize | |
| 49 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 50 | + * | PRP Suffix (0x88fb) | |
| 51 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 52 | + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 53 | + * 0 1 2 3 |
| 54 | + * |
| 55 | + * PRP uses a trailer on the packets, making it harder to parse. The suffix |
| 56 | + * 0x88fb indicates that it is a PRP frame, but since this could occur |
| 57 | + * naturally in a packet there is also the LSDUsize that indicates the size of |
| 58 | + * the packet. If this size does not match then it is not a PRP trailer. |
| 59 | + * Unfortunately, this could still match on other packets if coincidentally |
| 60 | + * both the suffix and LSDUsize matches up. We could also verify that LanId is |
| 61 | + * valid (0xA or 0xB) to further reduce likelihood of bad matches. |
| 62 | + * |
| 63 | + * LanId in HSR header is 0 = LAN A and 1 = LAN B. In PRP frames it is |
| 64 | + * represented as 0xA and 0xB. |
| 65 | + * |
| 66 | + * |
43 | 67 | * HSR/PRP Supervision frame
|
44 | 68 | * 0 1 2 3
|
45 | 69 | * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
@@ -95,6 +119,24 @@ void hsr_print(netdissect_options *ndo, const u_char *bp, u_int length)
|
95 | 119 | nd_print_invalid(ndo);
|
96 | 120 | }
|
97 | 121 |
|
| 122 | +void prp_print(netdissect_options *ndo, const u_char *bp, u_int length) |
| 123 | +{ |
| 124 | + u_int lsdu_size, lanid, seqnr; |
| 125 | + |
| 126 | + lsdu_size = GET_BE_U_2(bp + length - 4) & 0xfff; |
| 127 | + lanid = GET_BE_U_2(bp + length - 4) >> 12; |
| 128 | + |
| 129 | + /* If length does not match LSDUsize or LanId isn't valid it isn't a |
| 130 | + * valid PRP trailer. This length assumes VLAN tags have been stripped |
| 131 | + * away already. |
| 132 | + */ |
| 133 | + if (lsdu_size == length && (lanid == 0xA || lanid == 0xB)) { |
| 134 | + seqnr = GET_BE_U_2(bp + length - 6); |
| 135 | + ND_PRINT("PRP trailer (0x88fb), LSDUsize %d, SeqNr %d, LanId %s, ", |
| 136 | + lsdu_size, seqnr, lanid == 0xA ? "A" : "B"); |
| 137 | + } |
| 138 | +} |
| 139 | + |
98 | 140 | void hsr_prp_supervision_print(netdissect_options *ndo, const u_char *bp, u_int length)
|
99 | 141 | {
|
100 | 142 | int tlvtype, tlvlength;
|
|
0 commit comments