print-atm.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. /*
  2. * Copyright (c) 1994, 1995, 1996, 1997
  3. * The Regents of the University of California. All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that: (1) source code distributions
  7. * retain the above copyright notice and this paragraph in its entirety, (2)
  8. * distributions including binary code include the above copyright notice and
  9. * this paragraph in its entirety in the documentation or other materials
  10. * provided with the distribution, and (3) all advertising materials mentioning
  11. * features or use of this software display the following acknowledgement:
  12. * ``This product includes software developed by the University of California,
  13. * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
  14. * the University nor the names of its contributors may be used to endorse
  15. * or promote products derived from this software without specific prior
  16. * written permission.
  17. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  18. * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  19. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  20. */
  21. /* \summary: Asynchronous Transfer Mode (ATM) printer */
  22. #ifdef HAVE_CONFIG_H
  23. #include "config.h"
  24. #endif
  25. #include <netdissect-stdinc.h>
  26. #include "netdissect.h"
  27. #include "extract.h"
  28. #include "addrtoname.h"
  29. #include "atm.h"
  30. #include "llc.h"
  31. /* start of the original atmuni31.h */
  32. /*
  33. * Copyright (c) 1997 Yen Yen Lim and North Dakota State University
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. * 1. Redistributions of source code must retain the above copyright
  40. * notice, this list of conditions and the following disclaimer.
  41. * 2. Redistributions in binary form must reproduce the above copyright
  42. * notice, this list of conditions and the following disclaimer in the
  43. * documentation and/or other materials provided with the distribution.
  44. * 3. All advertising materials mentioning features or use of this software
  45. * must display the following acknowledgement:
  46. * This product includes software developed by Yen Yen Lim and
  47. North Dakota State University
  48. * 4. The name of the author may not be used to endorse or promote products
  49. * derived from this software without specific prior written permission.
  50. *
  51. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  52. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  53. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  54. * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  55. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  56. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  57. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  58. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  59. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  60. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  61. * POSSIBILITY OF SUCH DAMAGE.
  62. */
  63. /* Based on UNI3.1 standard by ATM Forum */
  64. /* ATM traffic types based on VPI=0 and (the following VCI */
  65. #define VCI_PPC 0x05 /* Point-to-point signal msg */
  66. #define VCI_BCC 0x02 /* Broadcast signal msg */
  67. #define VCI_OAMF4SC 0x03 /* Segment OAM F4 flow cell */
  68. #define VCI_OAMF4EC 0x04 /* End-to-end OAM F4 flow cell */
  69. #define VCI_METAC 0x01 /* Meta signal msg */
  70. #define VCI_ILMIC 0x10 /* ILMI msg */
  71. /* Q.2931 signalling messages */
  72. #define CALL_PROCEED 0x02 /* call proceeding */
  73. #define CONNECT 0x07 /* connect */
  74. #define CONNECT_ACK 0x0f /* connect_ack */
  75. #define SETUP 0x05 /* setup */
  76. #define RELEASE 0x4d /* release */
  77. #define RELEASE_DONE 0x5a /* release_done */
  78. #define RESTART 0x46 /* restart */
  79. #define RESTART_ACK 0x4e /* restart ack */
  80. #define STATUS 0x7d /* status */
  81. #define STATUS_ENQ 0x75 /* status ack */
  82. #define ADD_PARTY 0x80 /* add party */
  83. #define ADD_PARTY_ACK 0x81 /* add party ack */
  84. #define ADD_PARTY_REJ 0x82 /* add party rej */
  85. #define DROP_PARTY 0x83 /* drop party */
  86. #define DROP_PARTY_ACK 0x84 /* drop party ack */
  87. /* Information Element Parameters in the signalling messages */
  88. #define CAUSE 0x08 /* cause */
  89. #define ENDPT_REF 0x54 /* endpoint reference */
  90. #define AAL_PARA 0x58 /* ATM adaptation layer parameters */
  91. #define TRAFF_DESCRIP 0x59 /* atm traffic descriptors */
  92. #define CONNECT_ID 0x5a /* connection identifier */
  93. #define QOS_PARA 0x5c /* quality of service parameters */
  94. #define B_HIGHER 0x5d /* broadband higher layer information */
  95. #define B_BEARER 0x5e /* broadband bearer capability */
  96. #define B_LOWER 0x5f /* broadband lower information */
  97. #define CALLING_PARTY 0x6c /* calling party number */
  98. #define CALLED_PARTY 0x70 /* called party nmber */
  99. #define Q2931 0x09
  100. /* Q.2931 signalling general messages format */
  101. #define PROTO_POS 0 /* offset of protocol discriminator */
  102. #define CALL_REF_POS 2 /* offset of call reference value */
  103. #define MSG_TYPE_POS 5 /* offset of message type */
  104. #define MSG_LEN_POS 7 /* offset of mesage length */
  105. #define IE_BEGIN_POS 9 /* offset of first information element */
  106. /* format of signalling messages */
  107. #define TYPE_POS 0
  108. #define LEN_POS 2
  109. #define FIELD_BEGIN_POS 4
  110. /* end of the original atmuni31.h */
  111. static const char tstr[] = "[|atm]";
  112. #define OAM_CRC10_MASK 0x3ff
  113. #define OAM_PAYLOAD_LEN 48
  114. #define OAM_FUNCTION_SPECIFIC_LEN 45 /* this excludes crc10 and cell-type/function-type */
  115. #define OAM_CELLTYPE_FUNCTYPE_LEN 1
  116. static const struct tok oam_f_values[] = {
  117. { VCI_OAMF4SC, "OAM F4 (segment)" },
  118. { VCI_OAMF4EC, "OAM F4 (end)" },
  119. { 0, NULL }
  120. };
  121. static const struct tok atm_pty_values[] = {
  122. { 0x0, "user data, uncongested, SDU 0" },
  123. { 0x1, "user data, uncongested, SDU 1" },
  124. { 0x2, "user data, congested, SDU 0" },
  125. { 0x3, "user data, congested, SDU 1" },
  126. { 0x4, "VCC OAM F5 flow segment" },
  127. { 0x5, "VCC OAM F5 flow end-to-end" },
  128. { 0x6, "Traffic Control and resource Mgmt" },
  129. { 0, NULL }
  130. };
  131. #define OAM_CELLTYPE_FM 0x1
  132. #define OAM_CELLTYPE_PM 0x2
  133. #define OAM_CELLTYPE_AD 0x8
  134. #define OAM_CELLTYPE_SM 0xf
  135. static const struct tok oam_celltype_values[] = {
  136. { OAM_CELLTYPE_FM, "Fault Management" },
  137. { OAM_CELLTYPE_PM, "Performance Management" },
  138. { OAM_CELLTYPE_AD, "activate/deactivate" },
  139. { OAM_CELLTYPE_SM, "System Management" },
  140. { 0, NULL }
  141. };
  142. #define OAM_FM_FUNCTYPE_AIS 0x0
  143. #define OAM_FM_FUNCTYPE_RDI 0x1
  144. #define OAM_FM_FUNCTYPE_CONTCHECK 0x4
  145. #define OAM_FM_FUNCTYPE_LOOPBACK 0x8
  146. static const struct tok oam_fm_functype_values[] = {
  147. { OAM_FM_FUNCTYPE_AIS, "AIS" },
  148. { OAM_FM_FUNCTYPE_RDI, "RDI" },
  149. { OAM_FM_FUNCTYPE_CONTCHECK, "Continuity Check" },
  150. { OAM_FM_FUNCTYPE_LOOPBACK, "Loopback" },
  151. { 0, NULL }
  152. };
  153. static const struct tok oam_pm_functype_values[] = {
  154. { 0x0, "Forward Monitoring" },
  155. { 0x1, "Backward Reporting" },
  156. { 0x2, "Monitoring and Reporting" },
  157. { 0, NULL }
  158. };
  159. static const struct tok oam_ad_functype_values[] = {
  160. { 0x0, "Performance Monitoring" },
  161. { 0x1, "Continuity Check" },
  162. { 0, NULL }
  163. };
  164. #define OAM_FM_LOOPBACK_INDICATOR_MASK 0x1
  165. static const struct tok oam_fm_loopback_indicator_values[] = {
  166. { 0x0, "Reply" },
  167. { 0x1, "Request" },
  168. { 0, NULL }
  169. };
  170. static const struct tok *oam_functype_values[16] = {
  171. NULL,
  172. oam_fm_functype_values, /* 1 */
  173. oam_pm_functype_values, /* 2 */
  174. NULL,
  175. NULL,
  176. NULL,
  177. NULL,
  178. NULL,
  179. oam_ad_functype_values, /* 8 */
  180. NULL,
  181. NULL,
  182. NULL,
  183. NULL,
  184. NULL,
  185. NULL,
  186. NULL
  187. };
  188. /*
  189. * Print an RFC 1483 LLC-encapsulated ATM frame.
  190. */
  191. static u_int
  192. atm_llc_print(netdissect_options *ndo,
  193. const u_char *p, int length, int caplen)
  194. {
  195. int llc_hdrlen;
  196. llc_hdrlen = llc_print(ndo, p, length, caplen, NULL, NULL);
  197. if (llc_hdrlen < 0) {
  198. /* packet not known, print raw packet */
  199. if (!ndo->ndo_suppress_default_print)
  200. ND_DEFAULTPRINT(p, caplen);
  201. llc_hdrlen = -llc_hdrlen;
  202. }
  203. return (llc_hdrlen);
  204. }
  205. /*
  206. * Given a SAP value, generate the LLC header value for a UI packet
  207. * with that SAP as the source and destination SAP.
  208. */
  209. #define LLC_UI_HDR(sap) ((sap)<<16 | (sap<<8) | 0x03)
  210. /*
  211. * This is the top level routine of the printer. 'p' points
  212. * to the LLC/SNAP header of the packet, 'h->ts' is the timestamp,
  213. * 'h->len' is the length of the packet off the wire, and 'h->caplen'
  214. * is the number of bytes actually captured.
  215. */
  216. u_int
  217. atm_if_print(netdissect_options *ndo,
  218. const struct pcap_pkthdr *h, const u_char *p)
  219. {
  220. u_int caplen = h->caplen;
  221. u_int length = h->len;
  222. uint32_t llchdr;
  223. u_int hdrlen = 0;
  224. if (caplen < 1 || length < 1) {
  225. ND_PRINT((ndo, "%s", tstr));
  226. return (caplen);
  227. }
  228. /* Cisco Style NLPID ? */
  229. if (*p == LLC_UI) {
  230. if (ndo->ndo_eflag)
  231. ND_PRINT((ndo, "CNLPID "));
  232. isoclns_print(ndo, p + 1, length - 1);
  233. return hdrlen;
  234. }
  235. /*
  236. * Must have at least a DSAP, an SSAP, and the first byte of the
  237. * control field.
  238. */
  239. if (caplen < 3 || length < 3) {
  240. ND_PRINT((ndo, "%s", tstr));
  241. return (caplen);
  242. }
  243. /*
  244. * Extract the presumed LLC header into a variable, for quick
  245. * testing.
  246. * Then check for a header that's neither a header for a SNAP
  247. * packet nor an RFC 2684 routed NLPID-formatted PDU nor
  248. * an 802.2-but-no-SNAP IP packet.
  249. */
  250. llchdr = EXTRACT_24BITS(p);
  251. if (llchdr != LLC_UI_HDR(LLCSAP_SNAP) &&
  252. llchdr != LLC_UI_HDR(LLCSAP_ISONS) &&
  253. llchdr != LLC_UI_HDR(LLCSAP_IP)) {
  254. /*
  255. * XXX - assume 802.6 MAC header from Fore driver.
  256. *
  257. * Unfortunately, the above list doesn't check for
  258. * all known SAPs, doesn't check for headers where
  259. * the source and destination SAP aren't the same,
  260. * and doesn't check for non-UI frames. It also
  261. * runs the risk of an 802.6 MAC header that happens
  262. * to begin with one of those values being
  263. * incorrectly treated as an 802.2 header.
  264. *
  265. * So is that Fore driver still around? And, if so,
  266. * is it still putting 802.6 MAC headers on ATM
  267. * packets? If so, could it be changed to use a
  268. * new DLT_IEEE802_6 value if we added it?
  269. */
  270. if (caplen < 20 || length < 20) {
  271. ND_PRINT((ndo, "%s", tstr));
  272. return (caplen);
  273. }
  274. if (ndo->ndo_eflag)
  275. ND_PRINT((ndo, "%08x%08x %08x%08x ",
  276. EXTRACT_32BITS(p),
  277. EXTRACT_32BITS(p+4),
  278. EXTRACT_32BITS(p+8),
  279. EXTRACT_32BITS(p+12)));
  280. p += 20;
  281. length -= 20;
  282. caplen -= 20;
  283. hdrlen += 20;
  284. }
  285. hdrlen += atm_llc_print(ndo, p, length, caplen);
  286. return (hdrlen);
  287. }
  288. /*
  289. * ATM signalling.
  290. */
  291. static const struct tok msgtype2str[] = {
  292. { CALL_PROCEED, "Call_proceeding" },
  293. { CONNECT, "Connect" },
  294. { CONNECT_ACK, "Connect_ack" },
  295. { SETUP, "Setup" },
  296. { RELEASE, "Release" },
  297. { RELEASE_DONE, "Release_complete" },
  298. { RESTART, "Restart" },
  299. { RESTART_ACK, "Restart_ack" },
  300. { STATUS, "Status" },
  301. { STATUS_ENQ, "Status_enquiry" },
  302. { ADD_PARTY, "Add_party" },
  303. { ADD_PARTY_ACK, "Add_party_ack" },
  304. { ADD_PARTY_REJ, "Add_party_reject" },
  305. { DROP_PARTY, "Drop_party" },
  306. { DROP_PARTY_ACK, "Drop_party_ack" },
  307. { 0, NULL }
  308. };
  309. static void
  310. sig_print(netdissect_options *ndo,
  311. const u_char *p)
  312. {
  313. uint32_t call_ref;
  314. ND_TCHECK(p[PROTO_POS]);
  315. if (p[PROTO_POS] == Q2931) {
  316. /*
  317. * protocol:Q.2931 for User to Network Interface
  318. * (UNI 3.1) signalling
  319. */
  320. ND_PRINT((ndo, "Q.2931"));
  321. ND_TCHECK(p[MSG_TYPE_POS]);
  322. ND_PRINT((ndo, ":%s ",
  323. tok2str(msgtype2str, "msgtype#%d", p[MSG_TYPE_POS])));
  324. /*
  325. * The call reference comes before the message type,
  326. * so if we know we have the message type, which we
  327. * do from the caplen test above, we also know we have
  328. * the call reference.
  329. */
  330. call_ref = EXTRACT_24BITS(&p[CALL_REF_POS]);
  331. ND_PRINT((ndo, "CALL_REF:0x%06x", call_ref));
  332. } else {
  333. /* SCCOP with some unknown protocol atop it */
  334. ND_PRINT((ndo, "SSCOP, proto %d ", p[PROTO_POS]));
  335. }
  336. return;
  337. trunc:
  338. ND_PRINT((ndo, " %s", tstr));
  339. }
  340. /*
  341. * Print an ATM PDU (such as an AAL5 PDU).
  342. */
  343. void
  344. atm_print(netdissect_options *ndo,
  345. u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length,
  346. u_int caplen)
  347. {
  348. if (ndo->ndo_eflag)
  349. ND_PRINT((ndo, "VPI:%u VCI:%u ", vpi, vci));
  350. if (vpi == 0) {
  351. switch (vci) {
  352. case VCI_PPC:
  353. sig_print(ndo, p);
  354. return;
  355. case VCI_BCC:
  356. ND_PRINT((ndo, "broadcast sig: "));
  357. return;
  358. case VCI_OAMF4SC: /* fall through */
  359. case VCI_OAMF4EC:
  360. oam_print(ndo, p, length, ATM_OAM_HEC);
  361. return;
  362. case VCI_METAC:
  363. ND_PRINT((ndo, "meta: "));
  364. return;
  365. case VCI_ILMIC:
  366. ND_PRINT((ndo, "ilmi: "));
  367. snmp_print(ndo, p, length);
  368. return;
  369. }
  370. }
  371. switch (traftype) {
  372. case ATM_LLC:
  373. default:
  374. /*
  375. * Assumes traffic is LLC if unknown.
  376. */
  377. atm_llc_print(ndo, p, length, caplen);
  378. break;
  379. case ATM_LANE:
  380. lane_print(ndo, p, length, caplen);
  381. break;
  382. }
  383. }
  384. struct oam_fm_loopback_t {
  385. uint8_t loopback_indicator;
  386. uint8_t correlation_tag[4];
  387. uint8_t loopback_id[12];
  388. uint8_t source_id[12];
  389. uint8_t unused[16];
  390. };
  391. struct oam_fm_ais_rdi_t {
  392. uint8_t failure_type;
  393. uint8_t failure_location[16];
  394. uint8_t unused[28];
  395. };
  396. void
  397. oam_print (netdissect_options *ndo,
  398. const u_char *p, u_int length, u_int hec)
  399. {
  400. uint32_t cell_header;
  401. uint16_t vpi, vci, cksum, cksum_shouldbe, idx;
  402. uint8_t cell_type, func_type, payload, clp;
  403. union {
  404. const struct oam_fm_loopback_t *oam_fm_loopback;
  405. const struct oam_fm_ais_rdi_t *oam_fm_ais_rdi;
  406. } oam_ptr;
  407. ND_TCHECK(*(p+ATM_HDR_LEN_NOHEC+hec));
  408. cell_header = EXTRACT_32BITS(p+hec);
  409. cell_type = ((*(p+ATM_HDR_LEN_NOHEC+hec))>>4) & 0x0f;
  410. func_type = (*(p+ATM_HDR_LEN_NOHEC+hec)) & 0x0f;
  411. vpi = (cell_header>>20)&0xff;
  412. vci = (cell_header>>4)&0xffff;
  413. payload = (cell_header>>1)&0x7;
  414. clp = cell_header&0x1;
  415. ND_PRINT((ndo, "%s, vpi %u, vci %u, payload [ %s ], clp %u, length %u",
  416. tok2str(oam_f_values, "OAM F5", vci),
  417. vpi, vci,
  418. tok2str(atm_pty_values, "Unknown", payload),
  419. clp, length));
  420. if (!ndo->ndo_vflag) {
  421. return;
  422. }
  423. ND_PRINT((ndo, "\n\tcell-type %s (%u)",
  424. tok2str(oam_celltype_values, "unknown", cell_type),
  425. cell_type));
  426. if (oam_functype_values[cell_type] == NULL)
  427. ND_PRINT((ndo, ", func-type unknown (%u)", func_type));
  428. else
  429. ND_PRINT((ndo, ", func-type %s (%u)",
  430. tok2str(oam_functype_values[cell_type],"none",func_type),
  431. func_type));
  432. p += ATM_HDR_LEN_NOHEC + hec;
  433. switch (cell_type << 4 | func_type) {
  434. case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_LOOPBACK):
  435. oam_ptr.oam_fm_loopback = (const struct oam_fm_loopback_t *)(p + OAM_CELLTYPE_FUNCTYPE_LEN);
  436. ND_TCHECK(*oam_ptr.oam_fm_loopback);
  437. ND_PRINT((ndo, "\n\tLoopback-Indicator %s, Correlation-Tag 0x%08x",
  438. tok2str(oam_fm_loopback_indicator_values,
  439. "Unknown",
  440. oam_ptr.oam_fm_loopback->loopback_indicator & OAM_FM_LOOPBACK_INDICATOR_MASK),
  441. EXTRACT_32BITS(&oam_ptr.oam_fm_loopback->correlation_tag)));
  442. ND_PRINT((ndo, "\n\tLocation-ID "));
  443. for (idx = 0; idx < sizeof(oam_ptr.oam_fm_loopback->loopback_id); idx++) {
  444. if (idx % 2) {
  445. ND_PRINT((ndo, "%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_loopback->loopback_id[idx])));
  446. }
  447. }
  448. ND_PRINT((ndo, "\n\tSource-ID "));
  449. for (idx = 0; idx < sizeof(oam_ptr.oam_fm_loopback->source_id); idx++) {
  450. if (idx % 2) {
  451. ND_PRINT((ndo, "%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_loopback->source_id[idx])));
  452. }
  453. }
  454. break;
  455. case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_AIS):
  456. case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_RDI):
  457. oam_ptr.oam_fm_ais_rdi = (const struct oam_fm_ais_rdi_t *)(p + OAM_CELLTYPE_FUNCTYPE_LEN);
  458. ND_TCHECK(*oam_ptr.oam_fm_ais_rdi);
  459. ND_PRINT((ndo, "\n\tFailure-type 0x%02x", oam_ptr.oam_fm_ais_rdi->failure_type));
  460. ND_PRINT((ndo, "\n\tLocation-ID "));
  461. for (idx = 0; idx < sizeof(oam_ptr.oam_fm_ais_rdi->failure_location); idx++) {
  462. if (idx % 2) {
  463. ND_PRINT((ndo, "%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_ais_rdi->failure_location[idx])));
  464. }
  465. }
  466. break;
  467. case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_CONTCHECK):
  468. /* FIXME */
  469. break;
  470. default:
  471. break;
  472. }
  473. /* crc10 checksum verification */
  474. ND_TCHECK2(*(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN), 2);
  475. cksum = EXTRACT_16BITS(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN)
  476. & OAM_CRC10_MASK;
  477. cksum_shouldbe = verify_crc10_cksum(0, p, OAM_PAYLOAD_LEN);
  478. ND_PRINT((ndo, "\n\tcksum 0x%03x (%scorrect)",
  479. cksum,
  480. cksum_shouldbe == 0 ? "" : "in"));
  481. return;
  482. trunc:
  483. ND_PRINT((ndo, "[|oam]"));
  484. return;
  485. }