Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Jul 2004 11:10:56 +0200
From:      Ondra Holecek <bln@bln.no-ip.org>
To:        freebsd-net@freebsd.org
Subject:   Re: newbie: segmentation fault
Message-ID:  <200407021110.56087.bln@bln.no-ip.org>
In-Reply-To: <20040702090540.990.qmail@web13010.mail.yahoo.com>
References:  <20040702090540.990.qmail@web13010.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407021110.56087.bln>