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 16251127Sdelphij#ifdef HAVE_CONFIG_H 17251127Sdelphij#include "config.h" 18251127Sdelphij#endif 19251127Sdelphij 20251127Sdelphij#include <tcpdump-stdinc.h> 21251127Sdelphij 22251127Sdelphij#include <stdio.h> 23251127Sdelphij#include <stdlib.h> 24251127Sdelphij 25251127Sdelphij#include "interface.h" 26251127Sdelphij#include "extract.h" 27251127Sdelphij#include "addrtoname.h" 28251127Sdelphij 29251127Sdelphij#include "udp.h" 30251127Sdelphij 31251127Sdelphij/* 32251127Sdelphij * VXLAN header, draft-mahalingam-dutt-dcops-vxlan-03 33251127Sdelphij * 34251127Sdelphij * 0 1 2 3 35251127Sdelphij * 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 36251127Sdelphij * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 37251127Sdelphij * |R|R|R|R|I|R|R|R| Reserved | 38251127Sdelphij * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 39251127Sdelphij * | VXLAN Network Identifier (VNI) | Reserved | 40251127Sdelphij * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 41251127Sdelphij */ 42251127Sdelphij 43251127Sdelphijvoid 44251158Sdelphijvxlan_print(const u_char *bp, u_int len) 45251127Sdelphij{ 46251127Sdelphij u_int8_t flags; 47251127Sdelphij u_int32_t vni; 48251127Sdelphij 49251127Sdelphij if (len < 8) { 50251127Sdelphij printf("[|VXLAN]"); 51251127Sdelphij return; 52251127Sdelphij } 53251127Sdelphij 54251127Sdelphij flags = *bp; 55251127Sdelphij bp += 4; 56251127Sdelphij 57251127Sdelphij vni = EXTRACT_24BITS(bp); 58251127Sdelphij bp += 4; 59251127Sdelphij 60251127Sdelphij printf("VXLAN, "); 61251127Sdelphij 62251127Sdelphij fputs("flags [", stdout); 63251127Sdelphij if (flags & 0x08) 64251127Sdelphij fputs("I", stdout); 65251127Sdelphij else 66251127Sdelphij fputs(".", stdout); 67251127Sdelphij fputs("] ", stdout); 68251127Sdelphij 69251127Sdelphij printf("(0x%02x), ", flags); 70251127Sdelphij printf("vni %u\n", vni); 71251127Sdelphij 72251127Sdelphij ether_print(gndo, bp, len - 8, len - 8, NULL, NULL); 73251127Sdelphij return; 74251127Sdelphij} 75