newbie: segmentation fault

Ondra Holecek bln at bln.no-ip.org
Fri Jul 2 03:10:15 PDT 2004


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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"



More information about the freebsd-net mailing list