summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2019-04-14 00:37:31 +0000
committerdlg <dlg@openbsd.org>2019-04-14 00:37:31 +0000
commit62302bca68813874581cce2bf6794d643952afb7 (patch)
treeb014e45b13e350258ac1109203887a51bee00686
parentAdd a test for the bn_to_string() function introduced in v3_utl.c r1.32. (diff)
downloadwireguard-openbsd-62302bca68813874581cce2bf6794d643952afb7.tar.xz
wireguard-openbsd-62302bca68813874581cce2bf6794d643952afb7.zip
md5 auth has useful information on the wire that helps when fixing issues
print at least the key-id, and seq when -v is set, and the offset and len when -vv is set. ok sthen@ bluhm@
-rw-r--r--usr.sbin/tcpdump/ospf.h9
-rw-r--r--usr.sbin/tcpdump/print-ospf.c18
2 files changed, 23 insertions, 4 deletions
diff --git a/usr.sbin/tcpdump/ospf.h b/usr.sbin/tcpdump/ospf.h
index 007d1e26e26..8656a784856 100644
--- a/usr.sbin/tcpdump/ospf.h
+++ b/usr.sbin/tcpdump/ospf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospf.h,v 1.10 2010/08/04 16:47:01 sthen Exp $ */
+/* $OpenBSD: ospf.h,v 1.11 2019/04/14 00:37:31 dlg Exp $ */
/*
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
@@ -220,6 +220,13 @@ struct ospfhdr {
} ospf_un ;
} ;
+struct ospf_md5_authdata {
+ uint16_t auth_md5_offset;
+ uint8_t auth_keyid;
+ uint8_t auth_len;
+ uint32_t auth_seq;
+};
+
#define ospf_hello ospf_un.un_hello
#define ospf_db ospf_un.un_db
#define ospf_lsr ospf_un.un_lsr
diff --git a/usr.sbin/tcpdump/print-ospf.c b/usr.sbin/tcpdump/print-ospf.c
index deb5a7fa56b..28b0716aeba 100644
--- a/usr.sbin/tcpdump/print-ospf.c
+++ b/usr.sbin/tcpdump/print-ospf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ospf.c,v 1.20 2015/11/16 00:16:39 mmcc Exp $ */
+/* $OpenBSD: print-ospf.c,v 1.21 2019/04/14 00:37:31 dlg Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997
@@ -32,6 +32,7 @@
#include <ctype.h>
#include <stdio.h>
+#include <string.h>
#include "interface.h"
#include "addrtoname.h"
@@ -554,9 +555,20 @@ ospf_print(const u_char *bp, u_int length, const u_char *bp2)
printf("\"");
break;
- case OSPF_AUTH_MD5:
- printf(" auth MD5");
+ case OSPF_AUTH_MD5: {
+ struct ospf_md5_authdata auth;
+ memcpy(&auth, op->ospf_authdata, sizeof(auth));
+
+ printf(" auth MD5 key-id %u", auth.auth_keyid);
+ if (vflag)
+ printf(" seq %u", ntohl(auth.auth_seq));
+ if (vflag > 1) {
+ printf(" off %u len %u",
+ ntohs(auth.auth_md5_offset),
+ auth.auth_len);
+ }
break;
+ }
default:
printf(" ??authtype-%d??", ntohs(op->ospf_authtype));