get_myaddress problem

ARQUER Stephane stephane.arquer at c-s.fr
Thu Jan 29 08:16:33 UTC 2009


Hello,

Thanks for your answer,

After some investigations, I don't think my probleme is in this file.  
The error is caused by an abnormal thread terminaition which cause an  
exit. I have to look for the reason now.

Thanks again.

sa


> Hi,
>
> I had a quick look at this the other day and couldn't see anything
> obvious wrong, but I have put some comments in your email below:
>
>
> ARQUER Stephane wrote:
>> Hello,
>>
>> I'm trying to debug my problem of get_myadress seg fault, I don't    
>> understand something strange:
>>
>> the function  get_myadress use a struct sockaddr_in * as input    
>> parameter : addr.
>>
>> but the struct ifreq doesn't have a struct sockaddr_in field ?
>> The ifr->ifr_addr (ifr->ifr_ifru.ifru_addr) is a struct sockaddr .
>> Is it normal ?
>
> This appears to be normal in the networking code.  sockaddr is defined
> in cpukit/libnetworking/sys/scoket.h as:
>
> struct sockaddr {
> 	unsigned char	sa_len;			/* total length */
> 	sa_family_t	sa_family;		/* address family */
> 	char	sa_data[14];		/* actually longer; address value */
> };
>
> where as sockaddr_in is the internet style of a sockaddr defined in
> cpukit/libnetworking/netinet/in.h as:
>
> /* Socket address, internet style. */
> struct sockaddr_in {
> 	uint8_t	sin_len;
> 	sa_family_t	sin_family;
> 	in_port_t	sin_port;
> 	struct	in_addr sin_addr;
> 	char	sin_zero[8];
> };
>
> In get_myaddress it is cast to the sockaddr_in format, and looking at
> the two structures, the first two elements are the same.
>
> The sockaddr then has an array of 14 chars where sockaddr_in contains
> sin_port which is defined as uint16_t and sin_addr which is a uint32_t
> followed by 8 chars, and if packed would be 14 chars.
>
> The only thing I could think that it could be would be some sort of
> packing issue, but I couldn't really see that the sockaddr would be
> bigger than the sockaddr_in.
>
> regards,
>
> Ian Caddy
>
>
>
> -- 
> Ian Caddy
> Goanna Technologies Pty Ltd
> +61 8 9444 2634



----------------------------------------------------------------

Ce message electronique et tous les fichiers joints qu'il contient  
(ci-apres "le message") sont confidentiels et destines exclusivement a  
l'usage des destinataires indiques ou des personnes dument habilitees  
a les recevoir a leur place.

Si vous recevez ce message par erreur, merci de bien vouloir le  
detruire et d'en avertir l'emetteur.

Toute utilisation de ce message non conforme a sa destination, toute  
diffusion ou toute publication totale ou partielle est interdite sauf  
autorisation expresse de l'emetteur.

Les idees et opinions exprimees dans ce message sont celles de son  
auteur et ne representent pas necessairement celles de CS  
Communication & Systemes ou de ses filiales.

Malgre toutes les dispositions prises par CS Communication & Systemes  
et ses filiales pour minimiser les risques de virus, les fichiers  
joints a ce message peuvent contenir des virus qui pourraient  
endommager votre systeme informatique. Il vous appartient d'effectuer  
vos propres controles anti-virus avant d'ouvrir les fichiers joints.  
CS Communication & Systemes et ses filiales declinent toute  
responsabilite pour toute perte ou dommage resultant de l'utilisation  
de ce message et/ou des fichiers joints.

This e-mail and any file attached hereto (hereinafter 'the e-mail')  
are confidential and intended solely for the use of the adressees  
indicated below or the persons duly entitled to receive them in their  
place.

If you receive this e-mail in error, please delete it and notify the sender.

Any use of this e-mail not in accordance with its purpose, any  
dissemination or disclosure, either whole or partial, is prohibited,  
unless formally approved by the sender.

The ideas or opinions expressed in this e-mail are solely those of its  
author and do not necessarily represent those of CS Communication &  
Systeme or its affiliates.

Despite all the measures taken by CS Communication & Systeme and its  
affiliates in order to minimize the risks of virus, the files attached  
to this e-mail may contain virus which could damage your information  
system. You are responsible for processing your own anti-virus  
checking before opening any file attached hereto. Neither CS  
Communication & Systemes, nor its affiliates, shall be held liable for  
any loss or damage due to the use of this e-mail or any file attached  
hereto.






More information about the users mailing list