|
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
|
@@ -93,6 +117,24 @@ void hsr_print(netdissect_options *ndo, const u_char *bp, u_int length)
|
93 | 117 | nd_print_invalid(ndo);
|
94 | 118 | }
|
95 | 119 |
|
| 120 | +void prp_print(netdissect_options *ndo, const u_char *bp, u_int length) |
| 121 | +{ |
| 122 | + u_int lsdu_size, lanid, seqnr; |
| 123 | + |
| 124 | + lsdu_size = GET_BE_U_2(bp + length - 4) & 0xfff; |
| 125 | + lanid = GET_BE_U_2(bp + length - 4) >> 12; |
| 126 | + |
| 127 | + /* If length does not match LSDUsize or LanId isn't valid it isn't a |
| 128 | + * valid PRP trailer. This length assumes VLAN tags have been stripped |
| 129 | + * away already. |
| 130 | + */ |
| 131 | + if (lsdu_size == length && (lanid == 0xA || lanid == 0xB)) { |
| 132 | + seqnr = GET_BE_U_2(bp + length - 6); |
| 133 | + ND_PRINT("PRP trailer (0x88fb), LSDUsize %d, SeqNr %d, LanId %s, ", |
| 134 | + lsdu_size, seqnr, lanid == 0xA ? "A" : "B"); |
| 135 | + } |
| 136 | +} |
| 137 | + |
96 | 138 | void hsr_prp_supervision_print(netdissect_options *ndo, const u_char *bp, u_int length)
|
97 | 139 | {
|
98 | 140 | int tlvtype, tlvlength;
|
|
0 commit comments