]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ospf.c
Make "-x" and "-X" work with PPPoE interfaces; based on code from Darren
[tcpdump] / print-ospf.c
index 4d24755691e7c3bcf584a334942d87e9be2726bf..95874cef6f99edd9ca83ae89e2b3341331c5426f 100644 (file)
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.26 1999-10-30 05:11:19 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.31 2001-06-28 04:34:51 fenner Exp $ (LBL)";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
 #endif
 
 #include <sys/param.h>
@@ -31,9 +35,6 @@ static const char rcsid[] =
 #include <sys/socket.h>
 
 #include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/ip_var.h>
 
 #include <ctype.h>
 #include <stdio.h>
@@ -43,6 +44,8 @@ static const char rcsid[] =
 
 #include "ospf.h"
 
+#include "ip.h"
+
 struct bits {
        u_int32_t bit;
        const char *str;
@@ -400,8 +403,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));
@@ -506,12 +510,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  */
-#if 0
-       (void) printf("%s > %s:",
-           ipaddr_string(&ip->ip_src),
-           ipaddr_string(&ip->ip_dst));
-#endif
 
         /* XXX Before we do anything else, strip off the MD5 trailer */
         TCHECK(op->ospf_authtype);
@@ -524,7 +522,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;