tcpdump mailing list archives

Re: libpcap: patches required for OpenSolaris/SXCE


From: Darren Reed <Darren.Reed () Sun COM>
Date: Fri, 27 Nov 2009 13:32:38 -0800

Guy Harris wrote:

On Nov 24, 2009, at 3:55 PM, Darren Reed wrote:

--- Makefile.in.dist    Mon Oct 27 18:26:13 2008
+++ Makefile.in    Wed Oct 21 21:36:27 2009
@@ -44,6 +44,7 @@
# You shouldn't need to edit anything below.
#

+LD = /usr/bin/ld
CC = @CC@
CCOPT = @V_CCOPT@
INCLS = -I. @V_INCLS@
@@ -326,7 +327,7 @@
#
libpcap.so: $(OBJ)
    @rm -f $@
- $(CC) -shared -Wl,-soname,$@.1 -o $@.`cat $(srcdir)/VERSION` $(OBJ) $(DAGLIBS) + $(LD) -shared -Wl,-soname,$@.1 -o $@.`cat $(srcdir)/VERSION` $(OBJ) $(DAGLIBS)

This doesn't apply any more. Please look at the top-of-tree Git version of libpcap, rather than 1.0.0; the command used to build a shared library is set in the AC_LBL_C_INIT macro in aclocal.m4.

Hmmm, ok... I'll wait and see what the next release of libpcap has.


#
# The following rule succeeds, but the result is untested.
--- pcap/bpf.h    Fri Oct 10 19:42:44 2008
+++ pcap/bpf.h.new    Tue Sep 15 21:06:40 2009
@@ -821,8 +821,17 @@
 */
#define DLT_IEEE802_15_4_NONASK_PHY    215

+#define    DLT_IPNET        226    /* Assigned by tcpdump.org */

This is already set in the top-of-tree Git pcap/bpf.h.

My diffs were against 1.0.0.
I'll look forward to a new release :)


+#define DLT_IPOIB 162 /* Private until we know what it is */

162 is DLT_USER15, so we shouldn't advertise it as being any particular link-layer type - and DLT_IPOIB isn't used by any of the post-patch code, so it doesn't need to be defined.

I'll remove both of those from the top-of-tree version.

I understand, that's fine.
Getting access to IB boxes has proven harder than I thought, but when
I do I should be able to provide details about what the header format is.


/*
+ * IPNET
+ */
+#define    IPNET_OUTBOUND        1
+#define    IPNET_INBOUND        2

Perhaps this belongs in a pcap/ipnet.h header, instead.

Seems sensible.


--- configure.in.dist    Tue Sep 25 19:09:46 2007
+++ configure.in    Fri Jul 17 13:08:17 2009
@@ -187,7 +187,7 @@
AC_MSG_CHECKING(packet capture type)
if test ! -z "$with_pcap" ; then
    V_PCAP="$withval"
-elif test -r /dev/bpf ; then
+elif test -r /dev/bpf -o -h /dev/bpf ; then
    #
    # Cloning BPF device.
    #

The test(1) man page on OS X says of "-h":

-h file True if file exists and is a symbolic link. This operator is retained for compatibility with previous versions of this program. Do not rely on its existence; use -L instead.

        ...

     -L file       True if file exists and is a symbolic link.

Is there a flag to test that tests for a symlink and that's guaranteed to work on all UN*Xes - or, at least, all sufficiently modern UN*Xes?

Solaris supports both with the same comment as you have above for "-L".
Which is more correct? I've no idea.

If someone has access toe which ever X/Open or Unix specification is
the most recent, maybe consult with that?


***************
*** 7250,7255 ****
--- 7288,7305 ----
               dir);
         break;

+ #ifdef DL_IPNET
+     case DLT_IPNET:
+         if (dir) {
+             /* match outgoing packets */
+             b0 = gen_cmp(OR_LINK, 2, BPF_H, IPNET_OUTBOUND);
+         } else {
+             /* match incoming packets */
+             b0 = gen_cmp(OR_LINK, 2, BPF_H, IPNET_INBOUND);
+         }
+         break;
+ #endif
+

Why the #ifdef protection? It's not as if the code won't compile if DLT_IPNET isn't defined, and elsewhere the code just assumes DLT_IPNET is defined (which it is, in the top-of-tree version).

Presumably this was dictacted by which other section of code I did
a copy-paste-modify from, so there would be no specific reason for
the #ifdef.

Darren

-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: