Skip to content

Commit 12164ee

Browse files
corubbainfrastation
authored andcommitted
slow: Add OSSP support
Add basic printing of "Organization Specific Slow Protocol" (OSSP), which is standardized in IEEE 802.3 Annex 57B. Since this is used for non-standardized protocols and thus carries mostly unknown-structured data, most of the packet is still printed verbatim.
1 parent efc8f2e commit 12164ee

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

print-slow.c

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#define SLOW_PROTO_LACP 1
3535
#define SLOW_PROTO_MARKER 2
3636
#define SLOW_PROTO_OAM 3
37+
#define SLOW_PROTO_OSSP 10
3738

3839
#define LACP_VERSION 1
3940
#define MARKER_VERSION 1
@@ -42,6 +43,7 @@ static const struct tok slow_proto_values[] = {
4243
{ SLOW_PROTO_LACP, "LACP" },
4344
{ SLOW_PROTO_MARKER, "MARKER" },
4445
{ SLOW_PROTO_OAM, "OAM" },
46+
{ SLOW_PROTO_OSSP, "OSSP" },
4547
{ 0, NULL}
4648
};
4749

@@ -239,6 +241,7 @@ struct lacp_marker_tlv_terminator_t {
239241

240242
static void slow_marker_lacp_print(netdissect_options *, const u_char *, u_int, u_int);
241243
static void slow_oam_print(netdissect_options *, const u_char *, u_int);
244+
static void slow_ossp_print(netdissect_options *, const u_char *, u_int);
242245

243246
void
244247
slow_print(netdissect_options *ndo,
@@ -278,7 +281,8 @@ slow_print(netdissect_options *ndo,
278281
print_version = 1;
279282
break;
280283

281-
case SLOW_PROTO_OAM: /* fall through */
284+
case SLOW_PROTO_OAM:
285+
case SLOW_PROTO_OSSP:
282286
print_version = 0;
283287
break;
284288

@@ -313,6 +317,13 @@ slow_print(netdissect_options *ndo,
313317
default: /* should not happen */
314318
break;
315319

320+
case SLOW_PROTO_OSSP:
321+
/* skip subtype */
322+
len -= 1;
323+
pptr += 1;
324+
slow_ossp_print(ndo, pptr, len);
325+
break;
326+
316327
case SLOW_PROTO_OAM:
317328
/* skip subtype */
318329
len -= 1;
@@ -733,3 +744,29 @@ slow_oam_print(netdissect_options *ndo,
733744
tooshort:
734745
ND_PRINT("\n\t\t packet is too short");
735746
}
747+
748+
/*
749+
* Print Organization Specific Slow Protocol. (802.3 Annex 57B)
750+
*/
751+
static void
752+
slow_ossp_print(netdissect_options *ndo,
753+
const u_char *tptr, u_int tlen)
754+
{
755+
uint32_t oui;
756+
757+
ND_ICHECKMSG_U("length", tlen, <, 3);
758+
759+
oui = GET_BE_U_3(tptr);
760+
ND_PRINT("\n\tOUI: %s (0x%06x)",
761+
tok2str(oui_values, "Unknown", oui),
762+
oui);
763+
tlen -= 3;
764+
tptr += 3;
765+
766+
print_unknown_data(ndo, tptr, "\n\t", tlen);
767+
768+
return;
769+
770+
invalid:
771+
nd_print_invalid(ndo);
772+
}

tests/TESTLIST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ lldp_mud-v lldp_mudurl.pcap lldp_mudurl-v.out -e -v
505505
lldp_mud-vv lldp_mudurl.pcap lldp_mudurl-vv.out -e -vv
506506
lldp_8021_linkagg-v lldp_8021_linkagg.pcap lldp_8021_linkagg-v.out -v
507507
lldp_8021_linkagg-vv lldp_8021_linkagg.pcap lldp_8021_linkagg-vv.out -vv
508+
slow-ossp slow-ossp.pcap slow-ossp.out -v
508509
# fuzzed pcap
509510
udld-inf-loop-1-v udld-inf-loop-1.pcapng udld-inf-loop-1-v.out -v
510511

tests/slow-ossp.out

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
1 2025-09-23 15:00:00.000000 OSSP, length 52
2+
OUI: Unknown (0x0019a7)
3+
0x0000: 0001 1000 0000 0100 0404 0000 0000 0000
4+
0x0010: 0000 0000 0000 0000 0000 0000 0000 0000
5+
0x0020: 0000 0000 0000 0000 0000 0000 0000 0000

tests/slow-ossp.pcap

106 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)