components/libpcap/patches/40-ipoib.patch
changeset 442 d0e244fcfff1
equal deleted inserted replaced
441:8a584a286658 442:d0e244fcfff1
       
     1 diff -u libpcap-1.1.1/gencode.c libpcap-1.1.1.new/gencode.c
       
     2 --- libpcap-1.1.1/gencode.c	Thu Mar 11 17:56:54 2010
       
     3 +++ libpcap-1.1.1.new/gencode.c	Thu Jul 14 08:29:39 2011
       
     4 @@ -1588,6 +1588,13 @@
       
     5  		off_nl = 0;
       
     6  		off_nl_nosnap = -1;
       
     7  		return;
       
     8 +
       
     9 +	case DLT_IPOIB:
       
    10 +		off_linktype = 40;
       
    11 +		off_macpl = 44;		/* IPoIB mac_ib prefix length */
       
    12 +		off_nl = 0;
       
    13 +		off_nl_nosnap = -1;
       
    14 +		return;
       
    15  	}
       
    16  	bpf_error("unknown data link type %d", linktype);
       
    17  	/* NOTREACHED */
       
    18 @@ -2048,6 +2055,16 @@
       
    19  	return gen_false();
       
    20  }
       
    21  
       
    22 +static struct block *
       
    23 +gen_ipoib_linktype(proto)
       
    24 +	register int proto;
       
    25 +{
       
    26 +	/*
       
    27 +	 * This is an Ethernet type, so compare the length field with it.
       
    28 +	 */
       
    29 +	return gen_cmp(OR_LINK, off_linktype, BPF_H, (bpf_int32)proto);
       
    30 +}
       
    31 +
       
    32  /*
       
    33   * Generate code to match a particular packet type.
       
    34   *
       
    35 @@ -3474,6 +3491,9 @@
       
    36  	case DLT_IPNET:
       
    37  		return gen_ipnet_linktype(proto);
       
    38  
       
    39 +	case DLT_IPOIB:
       
    40 +		return gen_ipoib_linktype(proto);
       
    41 +
       
    42  	case DLT_LINUX_IRDA:
       
    43  		bpf_error("IrDA link-layer type filtering not implemented");
       
    44  
       
    45 diff -u libpcap-1.1.1/pcap-common.c libpcap-1.1.1.new/pcap-common.c
       
    46 --- libpcap-1.1.1/pcap-common.c	Thu Mar 11 17:56:54 2010
       
    47 +++ libpcap-1.1.1.new/pcap-common.c	Thu Jul 14 08:25:56 2011
       
    48 @@ -278,6 +278,11 @@
       
    49  #define LINKTYPE_USER15		162
       
    50  
       
    51  /*
       
    52 + * IPoIB for Solaris.
       
    53 + */
       
    54 +#define	LINKTYPE_IPOIB		DLT_IPOIB
       
    55 +
       
    56 +/*
       
    57   * For future use with 802.11 captures - defined by AbsoluteValue
       
    58   * Systems to store a number of bits of link-layer information
       
    59   * including radio information:
       
    60 @@ -1067,6 +1072,9 @@
       
    61  	/* Solaris IPNET */
       
    62  	{ DLT_IPNET,		LINKTYPE_IPNET },
       
    63  
       
    64 +	/* Solaris IPoIB */
       
    65 +	{ DLT_IPOIB,		LINKTYPE_IPOIB },
       
    66 +
       
    67  	/* CAN frames with SocketCAN headers */
       
    68  	{ DLT_CAN_SOCKETCAN,	LINKTYPE_CAN_SOCKETCAN },
       
    69  
       
    70 diff -u libpcap-1.1.1/pcap.c libpcap-1.1.1.new/pcap.c
       
    71 --- libpcap-1.1.1/pcap.c	Thu Mar 11 17:56:54 2010
       
    72 +++ libpcap-1.1.1.new/pcap.c	Thu Jul 14 08:29:55 2011
       
    73 @@ -670,6 +670,7 @@
       
    74  	DLT_CHOICE(DLT_FC_2, "Fibre Channel FC-2"),
       
    75  	DLT_CHOICE(DLT_FC_2_WITH_FRAME_DELIMS, "Fibre Channel FC-2 with frame delimiters"),
       
    76  	DLT_CHOICE(DLT_IPNET, "Solaris ipnet"),
       
    77 +	DLT_CHOICE(DLT_IPOIB, "Solaris IPoIB"),
       
    78  	DLT_CHOICE(DLT_CAN_SOCKETCAN, "CAN-bus with SocketCAN headers"),
       
    79  	DLT_CHOICE(DLT_IPV4, "Raw IPv4"),
       
    80  	DLT_CHOICE(DLT_IPV6, "Raw IPv6"),
       
    81 --- libpcap-1.1.1/pcap/bpf.h.dist	2010-03-11 17:56:54.000000000 -0800
       
    82 +++ libpcap-1.1.1/pcap/bpf.h	2011-07-27 03:06:09.410830949 -0700
       
    83 @@ -502,6 +502,8 @@
       
    84  #define DLT_USER14		161
       
    85  #define DLT_USER15		162
       
    86  
       
    87 +#define	DLT_IPOIB		DLT_USER15
       
    88 +
       
    89  /*
       
    90   * For future use with 802.11 captures - defined by AbsoluteValue
       
    91   * Systems to store a number of bits of link-layer information