From owner-freebsd-questions@FreeBSD.ORG Fri May 16 14:19:47 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DED791065679 for ; Fri, 16 May 2008 14:19:47 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [IPv6:2001:4070:101:2::1]) by mx1.freebsd.org (Postfix) with ESMTP id E6A298FC33 for ; Fri, 16 May 2008 14:19:45 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (localhost [IPv6:::1]) by wojtek.tensor.gdynia.pl (8.14.2/8.14.2) with ESMTP id m4GEJc3G020066; Fri, 16 May 2008 16:19:38 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.2/8.14.2/Submit) with ESMTP id m4GEJcCR020063; Fri, 16 May 2008 16:19:38 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Fri, 16 May 2008 16:19:38 +0200 (CEST) From: Wojciech Puchar To: Steve Randall In-Reply-To: <20080516081903.333b342d@locust> Message-ID: <20080516161816.M20005@wojtek.tensor.gdynia.pl> References: <20080514234101.P2316@wojtek.tensor.gdynia.pl> <20080516081903.333b342d@locust> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-questions@freebsd.org Subject: Re: Unable to talk to tap(4) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 May 2008 14:19:48 -0000 >>>>> unsigned char * buffer = (unsigned char*)malloc(1514); is stdlib.h included (i'm asking for sure)? >>>>> if (buffer = NULL) { > > if (buffer == NULL) { > > >>>>> fprintf (stderr, "No memory available.\n"); >>>>> close (tapFD); >>>>> exit(3); >>>>> } >> >> When I replace the malloc with an automatic array, the >> error goes away and I get the data I am looking for. i.e.: >> >> unsigned char buffer[1514]; >> >> So why can't I use malloc to create that buffer? anyway not using malloc is good habit :) but it should work anyway. try buffer[0]=buffer[1513]=0; to make sure page is actually allocated. if this help - maybe tap driver is buggy.