diff options
Diffstat (limited to 'contrib/tcpdump/print-bfd.c')
-rw-r--r-- | contrib/tcpdump/print-bfd.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/contrib/tcpdump/print-bfd.c b/contrib/tcpdump/print-bfd.c index 6406168..f157684 100644 --- a/contrib/tcpdump/print-bfd.c +++ b/contrib/tcpdump/print-bfd.c @@ -171,13 +171,17 @@ bfd_print(register const u_char *pptr, register u_int len, register u_int port) { const struct bfd_header_t *bfd_header; const struct bfd_auth_header_t *bfd_auth_header; - u_int8_t version; + u_int8_t version = 0; bfd_header = (const struct bfd_header_t *)pptr; - TCHECK(*bfd_header); - version = BFD_EXTRACT_VERSION(bfd_header->version_diag); - - switch (port << 8 | version) { + if (port == BFD_CONTROL_PORT) { + TCHECK(*bfd_header); + version = BFD_EXTRACT_VERSION(bfd_header->version_diag); + } else if (port == BFD_ECHO_PORT) { + /* Echo is BFD v1 only */ + version = 1; + } + switch ((port << 8) | version) { /* BFDv0 */ case (BFD_CONTROL_PORT << 8): |