*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.179 2002-08-11 18:27:13 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.180 2002-10-18 08:46:13 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
static struct block *gen_fhostop(const u_char *, int);
static struct block *gen_thostop(const u_char *, int);
static struct block *gen_wlanhostop(const u_char *, int);
+static struct block *gen_ipfchostop(const u_char *, int);
static struct block *gen_dnhostop(bpf_u_int32, int, u_int);
static struct block *gen_host(bpf_u_int32, bpf_u_int32, int, int);
#ifdef INET6
off_nl_nosnap = 0; /* no 802.2 LLC */
return;
+ case DLT_IP_OVER_FC:
+ /*
+ * RFC 2625 IP-over-Fibre-Channel doesn't really have a
+ * link-level type field. We set "off_linktype" to the
+ * offset of the LLC header.
+ *
+ * To check for Ethernet types, we assume that SSAP = SNAP
+ * is being used and pick out the encapsulated Ethernet type.
+ * XXX - should we generate code to check for SNAP? RFC
+ * 2625 says SNAP should be used.
+ */
+ off_linktype = 16;
+ off_nl = 24; /* IPFC+802.2+SNAP */
+ off_nl_nosnap = 19; /* IPFC+802.2 */
+ return;
+
case DLT_FRELAY:
/*
* XXX - we should set this to handle SNAP-encapsulated
case DLT_IEEE802:
case DLT_ATM_RFC1483:
case DLT_ATM_CLIP:
+ case DLT_IP_OVER_FC:
return gen_llc(proto);
break;
/* NOTREACHED */
}
+/*
+ * Like gen_ehostop, but for RFC 2625 IP-over-Fibre-Channel.
+ * (We assume that the addresses are IEEE 48-bit MAC addresses,
+ * as the RFC states.)
+ */
+static struct block *
+gen_ipfchostop(eaddr, dir)
+ register const u_char *eaddr;
+ register int dir;
+{
+ register struct block *b0, *b1;
+
+ switch (dir) {
+ case Q_SRC:
+ return gen_bcmp(10, 6, eaddr);
+
+ case Q_DST:
+ return gen_bcmp(2, 6, eaddr);
+
+ case Q_AND:
+ b0 = gen_ipfchostop(eaddr, Q_SRC);
+ b1 = gen_ipfchostop(eaddr, Q_DST);
+ gen_and(b0, b1);
+ return b1;
+
+ case Q_DEFAULT:
+ case Q_OR:
+ b0 = gen_ipfchostop(eaddr, Q_SRC);
+ b1 = gen_ipfchostop(eaddr, Q_DST);
+ gen_or(b0, b1);
+ return b1;
+ }
+ abort();
+ /* NOTREACHED */
+}
+
/*
* This is quite tricky because there may be pad bytes in front of the
* DECNET header, and then there are two possible data packet formats that
*/
b0 = gen_ehostop(eaddr, Q_OR);
gen_and(b1, b0);
- } else
+ } else if (linktype == DLT_IP_OVER_FC)
+ b0 = gen_ipfchostop(eaddr, Q_OR);
+ else
bpf_error(
- "'gateway' supported only on ethernet/FDDI/token ring/802.11");
+ "'gateway' supported only on ethernet/FDDI/token ring/802.11/Fibre Channel");
b1 = gen_host(**alist++, 0xffffffff, proto, Q_OR);
while (*alist) {
free(eaddr);
return b;
+ case DLT_IP_OVER_FC:
+ eaddr = pcap_ether_hostton(name);
+ if (eaddr == NULL)
+ bpf_error(
+ "unknown Fibre Channel host '%s'", name);
+ b = gen_ipfchostop(eaddr, dir);
+ free(eaddr);
+ return b;
+
case DLT_SUNATM:
if (!is_lane)
break;
return b;
}
- bpf_error("only ethernet/FDDI/token ring/802.11/ATM LANE supports link-level host name");
+ bpf_error("only ethernet/FDDI/token ring/802.11/ATM LANE/Fibre Channel supports link-level host name");
} else if (proto == Q_DECNET) {
unsigned short dn_addr = __pcap_nametodnaddr(name);
/*
gen_and(tmp, b);
return b;
}
- bpf_error("ethernet addresses supported only on ethernet/FDDI/token ring/802.11/ATM LANE");
+ if (linktype == DLT_IP_OVER_FC)
+ return gen_ipfchostop(eaddr, (int)q.dir);
+ bpf_error("ethernet addresses supported only on ethernet/FDDI/token ring/802.11/ATM LANE/Fibre Channel");
}
bpf_error("ethernet address used in non-ether expression");
/* NOTREACHED */
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.67 2002-10-09 19:02:56 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.68 2002-10-18 08:46:15 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#define LINKTYPE_CISCO_IOS 118 /* For Cisco-internal use */
#define LINKTYPE_PRISM_HEADER 119 /* 802.11+Prism II monitor mode */
#define LINKTYPE_AIRONET_HEADER 120 /* FreeBSD Aironet driver stuff */
+#define LINKTYPE_IP_OVER_FC 122 /* RFC 2625 IP-over-Fibre Channel */
#define LINKTYPE_SUNATM 123 /* Solaris+SunATM */
/*
#define LINKTYPE_IPFILTER 116 /* IP Filter capture files */
#define LINKTYPE_PFLOG 117 /* OpenBSD DLT_PFLOG */
#define LINKTYPE_HHDLC 121 /* Siemens HiPath HDLC */
-#define LINKTYPE_IP_OVER_FC 122 /* RFC 2625 IP-over-Fibre Channel */
#define LINKTYPE_RIO 123 /* RapidIO */
#define LINKTYPE_PCI_EXP 124 /* PCI Express */
#define LINKTYPE_AURORA 125 /* Xilinx Aurora link layer */