diff options
| author | 2019-05-17 06:47:10 +0000 | |
|---|---|---|
| committer | 2019-05-17 06:47:10 +0000 | |
| commit | ea578e49926df1f1278b140d4c3c060b91ceb95c (patch) | |
| tree | 4fca28ced5f3b24d280d4bf26afeda3b252586ca /usr.sbin/tcpdump/print-gre.c | |
| parent | Change a couple of ACS characters to be more sensible and add a few (diff) | |
| download | wireguard-openbsd-ea578e49926df1f1278b140d4c3c060b91ceb95c.tar.xz wireguard-openbsd-ea578e49926df1f1278b140d4c3c060b91ceb95c.zip | |
handle ERSPAN type I
type I and II share their GRE protocol, but you tell them apart by
checking if a sequence number is used. type I does not use a sequence
number and contains a bare ethernet frame. type II contains a
sequence number and a shim header that is already handled by the
code.
tested with a Dell S5048F-ON and an encapsulated remote port mirror setup.
Diffstat (limited to 'usr.sbin/tcpdump/print-gre.c')
| -rw-r--r-- | usr.sbin/tcpdump/print-gre.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/tcpdump/print-gre.c b/usr.sbin/tcpdump/print-gre.c index f2529584954..61751f540f2 100644 --- a/usr.sbin/tcpdump/print-gre.c +++ b/usr.sbin/tcpdump/print-gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-gre.c,v 1.25 2019/04/05 00:59:24 dlg Exp $ */ +/* $OpenBSD: print-gre.c,v 1.26 2019/05/17 06:47:10 dlg Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -83,7 +83,7 @@ void gre_print_0(const u_char *, u_int); void gre_print_1(const u_char *, u_int); void gre_print_pptp(const u_char *, u_int, uint16_t); void gre_print_eoip(const u_char *, u_int, uint16_t); -void gre_print_erspan2(const u_char *, u_int); +void gre_print_erspan(uint16_t, const u_char *, u_int); void gre_print_erspan3(const u_char *, u_int); void gre_sre_print(u_int16_t, u_int8_t, u_int8_t, const u_char *, u_int); void gre_sre_ip_print(u_int8_t, u_int8_t, const u_char *, u_int); @@ -270,7 +270,7 @@ gre_print_0(const u_char *p, u_int length) ether_tryprint(p, length, 0); break; case ERSPAN_II: - gre_print_erspan2(p, length); + gre_print_erspan(flags, p, length); break; case 0x2000: cdp_print(p, length, l, 0); @@ -493,13 +493,19 @@ trunc: #define ERSPAN2_INDEX_MASK (0xfffffU << ERSPAN2_INDEX_SHIFT) void -gre_print_erspan2(const u_char *bp, u_int len) +gre_print_erspan(uint16_t flags, const u_char *bp, u_int len) { uint32_t hdr, ver, vlan, cos, en, sid, index; u_int l; printf("erspan"); + if (!(flags & GRE_SP)) { + printf(" I: "); + ether_tryprint(bp, len, 0); + return; + } + l = snapend - bp; if (l < sizeof(hdr)) goto trunc; |
