NetBSD Problem Report #34907

From www@NetBSD.org  Wed Oct 25 14:18:52 2006
Return-Path: <www@NetBSD.org>
Received: by narn.NetBSD.org (Postfix, from userid 31301)
	id 58C1563BAA7; Wed, 25 Oct 2006 14:18:52 +0000 (UTC)
Message-Id: <20061025141852.58C1563BAA7@narn.NetBSD.org>
Date: Wed, 25 Oct 2006 14:18:52 +0000 (UTC)
From: tbeadle@nexthop.com
Reply-To: tbeadle@nexthop.com
To: gnats-bugs@NetBSD.org
Subject: Can not send packets on ppp link using BPF
X-Send-Pr-Version: www-1.0

>Number:         34907
>Category:       kern
>Synopsis:       Can not send packets on ppp link using BPF
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 25 14:20:00 +0000 2006
>Last-Modified:  Wed Oct 25 15:05:05 +0000 2006
>Originator:     Tommy Beadle
>Release:        3.0
>Organization:
Nexthop.com
>Environment:
NetBSD rack3-boxb 3.0 NetBSD 3.0 (NEXTHOP-PIM-2) #2: Tue Oct 24 11:25:51 EDT 2006  root@labtest:/usr/src/sys/arch/i386/compile/NEXTHOP-PIM-2 i386
>Description:
When attempting to use the BPF interface for sending packets out a ppp interface, an errno of EIO is returned from write() and the packet is not sent.  Using an ethernet interface, this does not happen.  The reason seems to be that the ioctl call for BIOCGDLT returns a data link type of DLT_PPP_SERIAL and in bpf_movein(), that is not listed as a supported data link type.  DLT_PPP is listed, but not DLT_PPP_SERIAL.  It also seems that the hlen for DLT_PPP in that function is incorrect, as it should be 4 instead of 0.
>How-To-Repeat:
Use something like the following code segment...
==============================================================
fd = open("/dev/bpf0", O_RDWR);

strncpy(ifr.ifr_name, "ppp0", sizeof(ifr.ifr_name));

if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) < 0) {
    printf("bpf_open_write: errno = %d, fd = %d\n", errno, fd);
    (void)close(fd);
    return 0;
}

if (ioctl(fd, BIOCGDLT, (caddr_t)dlt, sizeof(u_int)) < 0 ) {
    printf("Unable to get interface datalink type.\n");
    printf("errno = %d, fd = %d\n", errno, fd);
    (void)close(fd);
    return 0;
}

result = write(fd, buff, total_len);
=================================================================
...write returns a value < 0 and errno is set to EIO.
>Fix:
--- net/bpf.c.old       2006-10-24 11:17:43.000000000 -0400
+++ net/bpf.c   2006-10-24 11:21:24.000000000 -0400
@@ -188,8 +188,9 @@
                break;

        case DLT_PPP:
+       case DLT_PPP_SERIAL:
                sockp->sa_family = AF_UNSPEC;
-               hlen = 0;
+               hlen = 4;
                align = 0;
                break;


>Audit-Trail:
From: Mail Delivery Subsystem <MAILER-DAEMON@epita.fr>
To: undisclosed-recipients: ;
Cc: 
Subject: Re: kern/34907: Can not send packets on ppp link using BPF
Date: Wed, 25 Oct 2006 16:20:08 +0200 (CEST)

 	Désolé, 
         le compte de epibug est actuellement indisponible.
 	Votre e-mail a été délivré mais le destinataire risque temporairement 
         de ne  pas pouvoir y acceder.

         Sorry,
         epibug's account is currently unavailable.
         Your email has been delivered. The recipient may temporarily
         be unable to read it.

From: Martin Husemann <martin@duskware.de>
To: tbeadle@nexthop.com
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/34907: Can not send packets on ppp link using BPF
Date: Wed, 25 Oct 2006 17:02:39 +0200

 On Wed, Oct 25, 2006 at 02:20:00PM +0000, tbeadle@nexthop.com wrote:
 >         case DLT_PPP:
 > +       case DLT_PPP_SERIAL:

 Maybe we should check and probably add some more DLT_* here (the wlan
 stuff and pppoe come to mind)?

 Martin

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.