]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ospf.c
more consistent use of the length: output;
[tcpdump] / print-ospf.c
index 92945b3929f66b85840a5bcb2ea609e4a023917f..cd3f65421bfc3c628b06b33a7e9918fe902c34f2 100644 (file)
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.25 1999-10-17 21:37:14 mcr Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.32 2002-08-01 08:53:22 risso Exp $ (LBL)";
 #endif
 
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/socket.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
+#include <tcpdump-stdinc.h>
 
-#include <ctype.h>
 #include <stdio.h>
 
 #include "interface.h"
@@ -42,6 +39,8 @@ static const char rcsid[] =
 
 #include "ospf.h"
 
+#include "ip.h"
+
 struct bits {
        u_int32_t bit;
        const char *str;
@@ -74,6 +73,10 @@ static struct tok type2str[] = {
 
 static char tstr[] = " [|ospf]";
 
+#ifdef WIN32
+#define inline __inline
+#endif /* WIN32 */
+
 /* Forwards */
 static inline void ospf_print_seqage(u_int32_t, time_t);
 static inline void ospf_print_bits(const struct bits *, u_char);
@@ -399,8 +402,9 @@ ospf_decode_v2(register const struct ospfhdr *op,
                        printf(" bdr %s",
                            ipaddr_string(&op->ospf_hello.hello_bdr));
                if (vflag) {
-                       printf(" nbrs");
                        ap = op->ospf_hello.hello_neighbor;
+                       if ((u_char *)ap < dataend)
+                               printf(" nbrs");
                        while ((u_char *)ap < dataend) {
                                TCHECK(*ap);
                                printf(" %s", ipaddr_string(ap));
@@ -505,10 +509,6 @@ ospf_print(register const u_char *bp, register u_int length,
 
        op = (struct ospfhdr *)bp;
        ip = (struct ip *)bp2;
-       /* Print the source and destination address  */
-       (void) printf("%s > %s:",
-           ipaddr_string(&ip->ip_src),
-           ipaddr_string(&ip->ip_dst));
 
         /* XXX Before we do anything else, strip off the MD5 trailer */
         TCHECK(op->ospf_authtype);
@@ -521,7 +521,7 @@ ospf_print(register const u_char *bp, register u_int length,
        /* value.  If it's not valid, say so and return */
        TCHECK(op->ospf_type);
        cp = tok2str(type2str, "type%d", op->ospf_type);
-       printf(" OSPFv%d-%s %d:", op->ospf_version, cp, length);
+       printf("OSPFv%d-%s %d:", op->ospf_version, cp, length);
        if (*cp == 't')
                return;