On Thu, Apr 11, 2019 at 08:28:37AM +1000, David Gwynne wrote:
> seeing the key-id in particular helped me debug a problem here.
>
> ok?

OK bluhm@

> Index: ospf.h
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/ospf.h,v
> retrieving revision 1.10
> diff -u -p -r1.10 ospf.h
> --- ospf.h    4 Aug 2010 16:47:01 -0000       1.10
> +++ ospf.h    10 Apr 2019 22:27:29 -0000
> @@ -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
> Index: print-ospf.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-ospf.c,v
> retrieving revision 1.20
> diff -u -p -r1.20 print-ospf.c
> --- print-ospf.c      16 Nov 2015 00:16:39 -0000      1.20
> +++ print-ospf.c      10 Apr 2019 22:27:29 -0000
> @@ -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 lengt
>                       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));

Reply via email to