From owner-freebsd-net@FreeBSD.ORG Fri Jul 2 10:10:15 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1491B16A4E9 for ; Fri, 2 Jul 2004 10:10:15 +0000 (GMT) Received: from smtp-out4.iol.cz (smtp-out4.iol.cz [194.228.2.92]) by mx1.FreeBSD.org (Postfix) with ESMTP id CBBDD43D1F for ; Fri, 2 Jul 2004 10:10:14 +0000 (GMT) (envelope-from bln@bln.no-ip.org) Received: from 172.16.1.2 (168.18.broadband2.iol.cz [83.208.18.168]) 3915331145 for ; Fri, 2 Jul 2004 10:10:48 +0200 (CEST) From: Ondra Holecek To: freebsd-net@freebsd.org Date: Fri, 2 Jul 2004 11:10:56 +0200 User-Agent: KMail/1.5.4 References: <20040702090540.990.qmail@web13010.mail.yahoo.com> In-Reply-To: <20040702090540.990.qmail@web13010.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200407021110.56087.bln@bln.no-ip.org> Subject: Re: newbie: segmentation fault X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2004 10:10:15 -0000 On Friday 02 July 2004 11:05, kamal kc wrote: > first of all thanks for solving my previous problem. > my previous problem was about the ip and ethernet header. > this is how i solved it: > -------- > char *sender,*dest; > char *ptr; > struct ether_header eth; > ptr=pcap_next(..); > sender=ether_ntoa(ether->s_host); > printf("%s", sender); > dest=ether_ntoa(ether->d_host); > printf("%s",dest); > ------------------------------------------------------------------------- > The above code did the trick. > > NOW i face a bizarre problem; > when i write the following piece of code it successfully gets compiled but > generates segmentation fault when run. > ---- > struct sockaddr_in *sock; what about allocating the memory? sock = (struct sockaddr_in *)malloc(sizeof(struct sockaddr_in)); > sock->sin_family=AF_INET; > /* rest of the code */ > ------ > And i also don't know much about the segmentation fault error message. > By the way can i know about it in the man pages. if there are any please > mention. Kamal > > > --------------------------------- > Do you Yahoo!? > New and Improved Yahoo! Mail - 100MB free storage! > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"