static inline NORETURN void
nd_trunc(netdissect_options *ndo)
{
- longjmp(ndo->ndo_truncated, 1);
+ longjmp(ndo->ndo_early_end, ND_TRUNCATED);
}
/* get_u_1 and get_s_1 */
struct netdissect_saved_packet_info *ndspi_prev; /* previous buffer on the stack */
};
+/* 'val' value(s) for longjmp */
+#define ND_TRUNCATED 1
+
struct netdissect_options {
int ndo_bflag; /* print 4 byte ASes in ASDOT notation */
int ndo_eflag; /* print ethernet header */
*/
int ndo_Hflag; /* dissect 802.11s draft mesh standard */
const char *ndo_protocol; /* protocol */
- jmp_buf ndo_truncated; /* jmp_buf for setjmp()/longjmp() */
+ jmp_buf ndo_early_end; /* jmp_buf for setjmp()/longjmp() */
void *ndo_last_mem_p; /* pointer to the last allocated memory chunk */
int ndo_packet_number; /* print a packet number in the beginning of line */
int ndo_suppress_default_print; /* don't use default_print() for unknown packet types */
ndo->ndo_protocol = "";
ndo->ndo_ll_hdr_len = 0;
- if (setjmp(ndo->ndo_truncated) == 0) {
+ switch (setjmp(ndo->ndo_early_end)) {
+ case 0:
/* Print the packet. */
(ndo->ndo_if_printer)(ndo, h, sp);
- } else {
+ break;
+ case ND_TRUNCATED:
/* A printer quit because the packet was truncated; report it */
nd_print_trunc(ndo);
+ break;
}
hdrlen = ndo->ndo_ll_hdr_len;