| Summary: | ATM/HARP BPF support | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Vincent Jardin <vjardin> | ||||||
| Component: | kern | Assignee: | Hartmut Brandt <harti> | ||||||
| Status: | Closed FIXED | ||||||||
| Severity: | Affects Only Me | ||||||||
| Priority: | Normal | ||||||||
| Version: | Unspecified | ||||||||
| Hardware: | Any | ||||||||
| OS: | Any | ||||||||
| Attachments: |
|
||||||||
For example, now you can get the LLC/SNAP header with tcpdump:
su-2.05b# atm add pvc hva1 3 40 AAL5 SNAP IP atm0 1.1.2.3
su-2.05b# atm show ipvcc
Net Intf VPI VCI State Flags IP Address
atm0 1 40 ACTIVE PM 1.1.2.2
atm0 3 40 ACTIVE PLM 1.1.2.3
su-2.05b# atm show vcc
Interface VPI VCI AAL Type Dir State Encaps Owner
hva1 1 40 AAL5 PVC InOut ACTIVE Null IP
hva1 3 40 AAL5 PVC InOut ACTIVE LLC/SNAP IP
su-2.05b# ifconfig atm0
atm0: flags=3D43<UP,BROADCAST,RUNNING> mtu 9180
inet 1.1.1.1 netmask 0xffff0000 broadcast 1.1.255.255
ether 00:19:e1:6a:a3:f2
$ ping 1.1.2.3
su-2.05b# tcpdump -nXi atm0
tcpdump: listening on atm0
09:22:20.540119 1.1.1.1 > 1.1.2.3: icmp: echo request
0x0000 aaaa 0300 0000 0800 4500 0054 05c6 0000 ........E..T....
0x0010 4001 6fde 0101 0101 0101 0203 0800 cc1b @.o.............
0x0020 f702 1500 ac62 b73e c93c 0800 0809 0a0b .....b.>.<......
0x0030 0c0d 0e0f 1011 1213 1415 1617 1819 1a1b ................
0x0040 1c1d 1e1f 2021 2223 2425 2627 2829 2a2b .....!"#$%&'()*+
0x0050 2c2d 2e2f 3031 3233 3435 3637 ,-./01234567
su-2.05b# tcpdump -nvi atm0
tcpdump: listening on atm0
09:22:25.590190 snap 0:0:0:8:0 1.1.1.1 > 1.1.2.3: icmp: echo request (ttl=
64,=20
id 1493, len 84)
Responsible Changed From-To: freebsd-bugs->harti Hi Harti, this sounds like your area... State Changed From-To: open->closed Committed to -current. MFC in 2 weeks. |
Currently, the NBMA interfaces of the HARP/ATM stack do not support tcpdu= mp=20 whereas FreeBSD's tcpdump already support Classical IP (see DLT_ATM_CLIP). Fix: Currently, I am using the following patch on FreeBSD 4.7: netatm/atm_cm.c: netatm/atm_device.c: netatm/atm_if.c: s =3D splimp(); @@ -823,6 +837,7 @@ (void) (*ncp->ncm_stat)(NCM_DETACH, nip, 0); } =20 +#if !defined(__FreeBSD__) || (__FreeBSD_version < 440000) /* * Mark interface down */ @@ -864,6 +879,20 @@ * Remove from system interface list (ie. if_detach()) */ TAILQ_REMOVE(&ifnet, ifp, if_link); +#else + /* + * Remove from BPF interface list + */ + bpfdetach(ifp); + + /* + * Free all interface routes and addresses, + * Delete all remaining routes using this interface, + * then remove from system interface list + */ + if_detach(ifp); + +#endif /* (__FreeBSD_version < 440000) */ =20 /* * Remove from physical interface list @@ -874,6 +903,7 @@ } =20 =20 +#if defined(__FreeBSD__) && (__FreeBSD_version < 440000) /* * Delete Routes for a Network Interface *=20 @@ -917,6 +947,7 @@ =20 return (0); } +#endif /* __FreeBSD_version < 440000 */ =20 =20 /*--amxH05CL6QDWIbnonMnAiUcTE7CfDG1LOSLX3Q53PQsAOk8c Content-Type: text/plain; name="file.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="file.diff" --- atm_cm.c.orig Sat Aug 28 02:48:34 1999 +++ atm_cm.c Sun Apr 20 03:37:34 2003 @@ -37,6 +37,8 @@ =20 #include <netatm/kern_include.h> =20 +#include <net/bpf.h> + #ifndef lint __RCSID("@(#) $FreeBSD: src/sys/netatm/atm_cm.c,v 1.6 1999/08/28 00:48:3= 4=20 peter Exp $"); #endif @@ -2877,6 +2879,17 @@ * Locate packet's connection */ cop =3D cvp->cvc_conn; + + /* + * Send the packet to the interface's bpf if this vc has = one. + */ =20 + if (cvp->cvc_vcc && cvp->cvc_vcc->vc_nif) { + struct ifnet *ifp =3D (struct ifnet=20 *)cvp->cvc_vcc->vc_nif; + + if (ifp->if_bpf) + bpf_mtap(ifp, m); + } + switch (cop->co_mpx) { =20 case ATM_ENC_NULL: How-To-Repeat: tcpdump -ni atm0