Nmap Development mailing list archives

[Patch] ifdefs for DLT_LINUX_SLL


From: Stuart Henderson <stu () spacehopper org>
Date: Tue, 3 Jun 2014 10:32:26 +0000 (UTC)

I'd like to reduce some of the diffs to nmap that we have in OpenBSD
ports. Would it be possible to apply this or similar? Thanks.


Index: libnetutil/netutil.cc
===================================================================
--- libnetutil/netutil.cc       (revision 32933)
+++ libnetutil/netutil.cc       (working copy)
@@ -4084,9 +4084,11 @@
 {
   if (datalink == DLT_EN10MB)
     return ETH_HDR_LEN;
+#ifdef DLT_LINUX_SLL
   else if (datalink == DLT_LINUX_SLL)
     /* The datalink type is Linux "cooked" sockets. See pcap-linktype(7). */
     return 16;
+#endif
   else
     return -1;
 }
@@ -4123,7 +4125,11 @@
     netutil_fatal("Cannot obtain datalink information: %s", pcap_geterr(pd));
   ioffset = datalink_offset(*datalink);
   if (ioffset < 0)
+#ifdef DLT_LINUX_SLL
     netutil_fatal("datalink_offset failed for type %d (DLT_EN10MB = %d, DLT_LINUX_SLL = %d)", *datalink, DLT_EN10MB, 
DLT_LINUX_SLL);
+#else
+    netutil_fatal("datalink_offset failed for type %d (DLT_EN10MB = %d)", *datalink, DLT_EN10MB);
+#endif
   *offset = (unsigned int) ioffset;
 
   if (to_usec > 0) {
@@ -4223,10 +4229,12 @@
 
   if (datalink == DLT_EN10MB) {
     return ntohs(*((u16 *) (p + 12))) == ETH_TYPE_ARP;
+#ifdef DLT_LINUX_SLL
   } else if (datalink == DLT_LINUX_SLL) {
     return ntohs(*((u16 *) (p + 2))) == ARPHRD_ETHER && /* sll_hatype */
       ntohs(*((u16 *) (p + 4))) == 6 && /* sll_halen */
       ntohs(*((u16 *) (p + 14))) == ETH_TYPE_ARP; /* sll_protocol */
+#endif
   } else {
     return false;
   }


_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: