source: libpacketdump/link_22.c @ a82a9e8

cachetimestampsdevelopetsiliverc-4.0.4ringdecrementfixringperformance
Last change on this file since a82a9e8 was a82a9e8, checked in by Shane Alcock <salcock@…>, 3 years ago

Fix bad link ID for ETSI headers in libpacketdump.

The recent merge with the ERF provenance support had bumped ETSI
from linktype 21 to linktype 22, causing libpacketdump decoding
to fail because there was no module for linktype 22.

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[b663d33]1#include "libtrace.h"
2#include "libpacketdump.h"
3
4#include <libwandder_etsili.h>
5
6DLLEXPORT void decode(int link_type UNUSED, const char *packet, unsigned len) {
7
8        char linespace[4096];
9        int i;
10        uint8_t *cchdr = NULL;
11        uint32_t rem = len;
[00365c6]12        wandder_etsispec_t *dec;
13        wandder_decoder_t *basedec = NULL;
[b663d33]14
[00365c6]15        dec = wandder_create_etsili_decoder();
16        wandder_attach_etsili_buffer(dec, (uint8_t *)packet, len, false);
17
18        basedec = wandder_get_etsili_base_decoder(dec);
19        while (wandder_etsili_get_next_fieldstr(dec, linespace, 4096)) {
[b663d33]20                printf(" ETSILI: ");
[00365c6]21                for (i = 0; i < wandder_get_level(basedec); i++) {
[b663d33]22                        printf("  ");
23                }
24                printf("%s\n", linespace);
25        }
26
[00365c6]27        cchdr = wandder_etsili_get_cc_contents(dec, &rem);
[b663d33]28
[00365c6]29        wandder_free_etsili_decoder(dec);
[b663d33]30
31        if (cchdr) {
32                /* XXX What if there is an IPv7?? */
33                decode_next((const char *)cchdr, rem, "eth",
34                                ((*cchdr) & 0xf0) == 0x40 ? TRACE_ETHERTYPE_IP :
35                                TRACE_ETHERTYPE_IPV6);
36        }
37        return;
38}
Note: See TracBrowser for help on using the repository browser.