From owner-freebsd-bugs@FreeBSD.ORG Tue May 6 00:10:25 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 672D437B404 for ; Tue, 6 May 2003 00:10:25 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4628943F93 for ; Tue, 6 May 2003 00:10:24 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h467ANUp080672 for ; Tue, 6 May 2003 00:10:23 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h467ANlf080671; Tue, 6 May 2003 00:10:23 -0700 (PDT) Resent-Date: Tue, 6 May 2003 00:10:23 -0700 (PDT) Resent-Message-Id: <200305060710.h467ANlf080671@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Vincent Jardin Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3EDA437B401 for ; Tue, 6 May 2003 00:10:06 -0700 (PDT) Received: from mwinf0102.wanadoo.fr (smtp8.wanadoo.fr [193.252.22.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 09E2943F75 for ; Tue, 6 May 2003 00:10:05 -0700 (PDT) (envelope-from vjardin@wanadoo.fr) Received: from venus.vincentjardin.net (AVelizy-102-1-5-134.abo.wanadoo.fr [80.13.229.134]) by mwinf0102.wanadoo.fr (SMTP Server) with ESMTP id 913AF1BFFFBF for ; Tue, 6 May 2003 09:10:03 +0200 (CEST) Message-Id: <200305060910.09348.vjardin@wanadoo.fr> Date: Tue, 6 May 2003 09:10:09 +0200 From: Vincent Jardin To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/51831: ATM/HARP BPF support X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Vincent Jardin List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 May 2003 07:10:25 -0000 >Number: 51831 >Category: kern >Synopsis: ATM/HARP BPF support >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: wish >Submitter-Id: current-users >Arrival-Date: Tue May 06 00:10:23 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Vincent Jardin >Release: Patch for FreeBSD 4.x, 5.x and later >Organization: Vincent Jardin >Environment: n/a >Description: 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). >How-To-Repeat: tcpdump -ni atm0 >Fix: Currently, I am using the following patch on FreeBSD 4.7: netatm/atm_cm.c: --- 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 =20 +#include + #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: netatm/atm_device.c: --- atm_device.c.orig Mon Apr 21 02:45:20 2003 +++ atm_device.c Tue May 6 08:58:17 2003 @@ -37,6 +37,8 @@ =20 #include =20 +#include + #ifndef lint __RCSID("@(#) $FreeBSD: src/sys/netatm/atm_device.c,v 1.5 1999/08/28 00:= 48:35=20 peter Exp $"); #endif @@ -351,6 +353,16 @@ tok, state ); KB_FREEALL((KBuffer *)arg1); break; + } + + /* + * Send the packet to the interface's bpf if this vc has = one. + */ + if (cvcp->cvc_vcc && cvcp->cvc_vcc->vc_nif) { + struct ifnet *ifp =3D (struct ifnet=20 *)cvcp->cvc_vcc->vc_nif; + + if (ifp->if_bpf) + bpf_mtap(ifp, (KBuffer *)arg1); } =20 /* netatm/atm_if.c: --- atm_if.c.orig Thu Apr 17 01:28:43 2003 +++ atm_if.c Tue May 6 09:01:42 2003 @@ -37,6 +37,8 @@ =20 #include =20 +#include + #ifndef lint __RCSID("@(#) $FreeBSD: src/sys/netatm/atm_if.c,v 1.5 1999/08/28 00:48:3= 5=20 peter Exp $"); #endif @@ -51,8 +53,10 @@ */ static int atm_physif_ioctl __P((int, caddr_t, caddr_t)); #if (defined(BSD) && (BSD >=3D 199306)) +#if defined(__FreeBSD__) && (__FreeBSD_version < 440000) static int atm_netif_rtdel __P((struct radix_node *, void *)); #endif +#endif static int atm_if_ioctl __P((struct ifnet *, u_long, caddr_t)); static int atm_ifparse __P((char *, char *, int, int *)); =20 @@ -762,6 +766,13 @@ if_attach(ifp); =20 /* + * Add to BPF interface list + * DLT_ATM_RFC1483 cannot be used because both NULL and LLC/SNAP = could + * be provisionned. + */ + bpfattach(ifp, DLT_ATM_CLIP, T_ATM_LLC_MAX_LEN); + + /* * Add to physical interface list */ LINK2TAIL(nip, struct atm_nif, pip->pif_nif, nif_pnext); @@ -807,11 +818,14 @@ struct atm_nif *nip; { struct atm_ncm *ncp; - int s, i; + int s; struct ifnet *ifp =3D &nip->nif_if; +#if defined(__FreeBSD__) && (__FreeBSD_version < 440000) + int i; struct ifaddr *ifa; struct in_ifaddr *ia; struct radix_node_head *rnh; +#endif 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 /* >Release-Note: >Audit-Trail: >Unformatted: