X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/b7b72b7c6335fb22b712688b144a538be4ae96e9..c518a9aab149da1a6b83c0cbeddaff5265d05dcb:/netdissect.c diff --git a/netdissect.c b/netdissect.c index 15594de8..7e46d6aa 100644 --- a/netdissect.c +++ b/netdissect.c @@ -123,14 +123,14 @@ nd_load_smi_module(const char *module, char *errbuf, size_t errbuf_size) { #ifdef USE_LIBSMI if (smiLoadModule(module) == 0) { - nd_snprintf(errbuf, errbuf_size, "could not load MIB module %s", + snprintf(errbuf, errbuf_size, "could not load MIB module %s", module); return (-1); } nd_smi_module_loaded = 1; return (0); #else - nd_snprintf(errbuf, errbuf_size, "MIB module %s not loaded: no libsmi support", + snprintf(errbuf, errbuf_size, "MIB module %s not loaded: no libsmi support", module); return (-1); #endif @@ -193,6 +193,27 @@ nd_push_snapend(netdissect_options *ndo, const u_char *new_snapend) return (1); /* success */ } +/* + * Change an already-pushed snapshot end. This may increase the + * snapshot end, as it may be used, for example, for a Jumbo Payload + * option in IPv6. It must not increase it past the snapshot length + * atop which the current one was pushed, however. + */ +void +nd_change_snapend(netdissect_options *ndo, const u_char *new_snapend) +{ + struct netdissect_saved_packet_info *ndspi; + + ndspi = ndo->ndo_packet_info_stack; + if (ndspi->ndspi_prev != NULL) { + if (new_snapend <= ndspi->ndspi_prev->ndspi_snapend) + ndo->ndo_snapend = new_snapend; + } else { + if (new_snapend < ndo->ndo_snapend) + ndo->ndo_snapend = new_snapend; + } +} + void nd_pop_packet_info(netdissect_options *ndo) {