]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-sctp.c
Avoiding conditional directives that break statements
[tcpdump] / print-sctp.c
index d48202f50326b5cfa22ece83eefbcb127a0a032c..49d1cbba789a14b15496f707a083f1f5e2be70a1 100644 (file)
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "addrtoname.h"
-#include "extract.h"                   /* must come after interface.h */
+#include "extract.h"
 #include "ip.h"
-#ifdef INET6
 #include "ip6.h"
-#endif
 
 /* Definitions from:
  *
@@ -497,9 +495,7 @@ void sctp_print(netdissect_options *ndo,
 {
   const struct sctpHeader *sctpPktHdr;
   const struct ip *ip;
-#ifdef INET6
   const struct ip6_hdr *ip6;
-#endif
   const void *endPacketPtr;
   u_short sourcePort, destPort;
   int chunkCount;
@@ -514,13 +510,11 @@ void sctp_print(netdissect_options *ndo,
 
   if( (u_long) endPacketPtr > (u_long) ndo->ndo_snapend)
     endPacketPtr = (const void *) ndo->ndo_snapend;
-  ip = (struct ip *)bp2;
-#ifdef INET6
+  ip = (const struct ip *)bp2;
   if (IP_V(ip) == 6)
     ip6 = (const struct ip6_hdr *)bp2;
   else
     ip6 = NULL;
-#endif /*INET6*/
   ND_TCHECK(*sctpPktHdr);
 
   if (sctpPacketLength < sizeof(struct sctpHeader))
@@ -536,7 +530,6 @@ void sctp_print(netdissect_options *ndo,
   sourcePort = EXTRACT_16BITS(&sctpPktHdr->source);
   destPort = EXTRACT_16BITS(&sctpPktHdr->destination);
 
-#ifdef INET6
   if (ip6) {
     ND_PRINT((ndo, "%s.%d > %s.%d: sctp",
       ip6addr_string(ndo, &ip6->ip6_src),
@@ -544,7 +537,6 @@ void sctp_print(netdissect_options *ndo,
       ip6addr_string(ndo, &ip6->ip6_dst),
       destPort));
   } else
-#endif /*INET6*/
   {
     ND_PRINT((ndo, "%s.%d > %s.%d: sctp",
       ipaddr_string(ndo, &ip->ip_src),
@@ -588,7 +580,7 @@ void sctp_print(netdissect_options *ndo,
         break;
       }
 
-      ND_TCHECK2(*((uint8_t *)chunkDescPtr), chunkLength);
+      ND_TCHECK2(*((const uint8_t *)chunkDescPtr), chunkLength);
       chunkEnd = ((const u_char*)chunkDescPtr + chunkLength);
 
       align=chunkLength % 4;