source: rtems-libbsd/freebsd/contrib/tcpdump/print-vxlan.c @ 8440506

4.1155-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since 8440506 was 8440506, checked in by Chris Johns <chrisj@…>, on 06/15/15 at 07:42:23

Add tcpdump and libpcap.

  • Update the file builder generator to handle generator specific cflags and includes. The tcpdump and libpcap have localised headers and need specific headers paths to see them. There are also module specific flags and these need to be passed to the lex and yacc generators.
  • Add the tcpdump support.
  • Property mode set to 100644
File size: 2.0 KB
Line 
1#include <machine/rtems-bsd-user-space.h>
2
3/*
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that: (1) source code
6 * distributions retain the above copyright notice and this paragraph
7 * in its entirety, and (2) distributions including binary code include
8 * the above copyright notice and this paragraph in its entirety in
9 * the documentation or other materials provided with the distribution.
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
11 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
12 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13 * FOR A PARTICULAR PURPOSE.
14 *
15 * Original code by Francesco Fondelli (francesco dot fondelli, gmail dot com)
16 */
17
18#ifdef HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <tcpdump-stdinc.h>
23
24#include <stdio.h>
25#include <stdlib.h>
26
27#include "interface.h"
28#include "extract.h"
29#include "addrtoname.h"
30
31#include "udp.h"
32
33/*
34 * VXLAN header, draft-mahalingam-dutt-dcops-vxlan-03
35 *
36 *     0                   1                   2                   3
37 *     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
38 *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
39 *    |R|R|R|R|I|R|R|R|            Reserved                           |
40 *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41 *    |                VXLAN Network Identifier (VNI) |   Reserved    |
42 *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43 */
44
45void
46vxlan_print(const u_char *bp, u_int len)
47{
48    u_int8_t flags;
49    u_int32_t vni;
50   
51    if (len < 8) {
52        printf("[|VXLAN]");
53        return;
54    }
55
56    flags = *bp;
57    bp += 4;
58
59    vni = EXTRACT_24BITS(bp);
60    bp += 4;
61
62    printf("VXLAN, ");
63
64    fputs("flags [", stdout);
65    if (flags & 0x08)
66        fputs("I", stdout);
67    else
68        fputs(".", stdout);
69    fputs("] ", stdout);
70
71    printf("(0x%02x), ", flags);
72    printf("vni %u\n", vni);
73
74    ether_print(gndo, bp, len - 8, len - 8, NULL, NULL);
75    return;
76}
Note: See TracBrowser for help on using the repository browser.