]> The Tcpdump Group git mirrors - tcpdump/blobdiff - netdissect.c
ICMP: Fix a typo in a comment.
[tcpdump] / netdissect.c
index 15594de8f374435db6d2ecd03dc3044427547a42..7e46d6aa3d3176ede396fefee8c788d7a053db03 100644 (file)
@@ -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)
 {