1251127Sdelphij/* 2251127Sdelphij * Redistribution and use in source and binary forms, with or without 3251127Sdelphij * modification, are permitted provided that: (1) source code 4251127Sdelphij * distributions retain the above copyright notice and this paragraph 5251127Sdelphij * in its entirety, and (2) distributions including binary code include 6251127Sdelphij * the above copyright notice and this paragraph in its entirety in 7251127Sdelphij * the documentation or other materials provided with the distribution. 8251127Sdelphij * THIS SOFTWARE IS PROVIDED ``AS IS'' AND 9251127Sdelphij * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT 10251127Sdelphij * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 11251127Sdelphij * FOR A PARTICULAR PURPOSE. 12251127Sdelphij * 13251127Sdelphij * Original code by Francesco Fondelli (francesco dot fondelli, gmail dot com) 14251127Sdelphij */ 15251127Sdelphij 16276788Sdelphij#define NETDISSECT_REWORKED 17251127Sdelphij#ifdef HAVE_CONFIG_H 18251127Sdelphij#include "config.h" 19251127Sdelphij#endif 20251127Sdelphij 21251127Sdelphij#include <tcpdump-stdinc.h> 22251127Sdelphij 23251127Sdelphij#include "interface.h" 24251127Sdelphij#include "extract.h" 25251127Sdelphij 26251127Sdelphij/* 27251127Sdelphij * OTV header, draft-hasmit-otv-04 28251127Sdelphij * 29251127Sdelphij * 0 1 2 3 30251127Sdelphij * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 31251127Sdelphij * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 32251127Sdelphij * |R|R|R|R|I|R|R|R| Overlay ID | 33251127Sdelphij * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 34251127Sdelphij * | Instance ID | Reserved | 35251127Sdelphij * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 36251127Sdelphij */ 37251127Sdelphij 38251127Sdelphijvoid 39276788Sdelphijotv_print(netdissect_options *ndo, const u_char *bp, u_int len) 40251127Sdelphij{ 41276788Sdelphij uint8_t flags; 42276788Sdelphij uint32_t overlay_id; 43276788Sdelphij uint32_t instance_id; 44276788Sdelphij 45251127Sdelphij if (len < 8) { 46276788Sdelphij ND_PRINT((ndo, "[|OTV]")); 47251127Sdelphij return; 48251127Sdelphij } 49251127Sdelphij 50251127Sdelphij flags = *bp; 51251127Sdelphij bp += 1; 52251127Sdelphij 53251127Sdelphij overlay_id = EXTRACT_24BITS(bp); 54251127Sdelphij bp += 3; 55251127Sdelphij 56251127Sdelphij instance_id = EXTRACT_24BITS(bp); 57251127Sdelphij bp += 4; 58251127Sdelphij 59276788Sdelphij ND_PRINT((ndo, "OTV, ")); 60276788Sdelphij ND_PRINT((ndo, "flags [%s] (0x%02x), ", flags & 0x08 ? "I" : ".", flags)); 61276788Sdelphij ND_PRINT((ndo, "overlay %u, ", overlay_id)); 62276788Sdelphij ND_PRINT((ndo, "instance %u\n", instance_id)); 63251127Sdelphij 64276788Sdelphij ether_print(ndo, bp, len - 8, len - 8, NULL, NULL); 65251127Sdelphij} 66