get_myaddress problem
ARQUER Stephane
stephane.arquer at c-s.fr
Mon Jan 26 14:06:17 UTC 2009
Hello,
I've a problem with the function get_myadress, each time I try to
connect a client using rpc I obtain a seg fault on the following line
of get_myadress:
if (((ifreq.ifr_flags & IFF_UP) &&
ifr->ifr_addr.sa_family == AF_INET &&
!(ifreq.ifr_flags & IFF_LOOPBACK)) ||
(loopback == 1 && (ifreq.ifr_flags & IFF_LOOPBACK)
&& (ifr->ifr_addr.sa_family == AF_INET)
&& (ifreq.ifr_flags & IFF_UP))) {
*addr = *((struct sockaddr_in *)&ifr->ifr_addr); <- here the error
addr->sin_port = htons(PMAPPORT);
gotit = 1;
break;
}
Does anyone have an idea ?
Thanks.
sa
This is my network config file:
/*
* Network configuration
*
* Fichier de configuration de l'interface reseau
* ce fihier tient compte du type de cible
* rtems_host 192.168.0.5 cible PC
* leon 192.168.0.6 cible leon2
*
* $Id: networkconfig.h,v 1.8 2001/08/31 18:11:43 joel Exp $
*/
#ifndef _RTEMS_NETWORKCONFIG_H_
#define _RTEMS_NETWORKCONFIG_H_
/*
* The following will normally be set by the BSP if it supports
* a single network device driver. In the event, it supports
* multiple network device drivers, then the user's default
* network device driver will have to be selected by a BSP
* specific mechanism.
*/
#ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
#warning "RTEMS_BSP_NETWORK_DRIVER_NAME is not defined"
#define RTEMS_BSP_NETWORK_DRIVER_NAME "no_network1"
#endif
#ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH
#warning "RTEMS_BSP_NETWORK_DRIVER_ATTACH is not defined"
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH 0
#endif
//#define RTEMS_USE_BOOTP
#include <bsp.h>
/*
* Define RTEMS_SET_ETHERNET_ADDRESS if you want to specify the
* Ethernet address here. If RTEMS_SET_ETHERNET_ADDRESS is not
* defined the driver will choose an address.
*/
//#define RTEMS_SET_ETHERNET_ADDRESS
#if (defined (RTEMS_SET_ETHERNET_ADDRESS))
/* static char ethernet_address[6] = { 0x08, 0x00, 0x3e, 0x12, 0x28,
0xb1 }; */
/*static char ethernet_address[6] = { 0x00, 0x80, 0x7F, 0x22, 0x61,
0x77 }; */ //PC brahms
static char ethernet_address[6] = { 0x00, 0x01, 0x02, 0x13, 0x8f, 0x5e };
#endif
#ifdef RTEMS_USE_LOOPBACK
/*
* Loopback interface
*/
extern void rtems_bsdnet_loopattach();
static struct rtems_bsdnet_ifconfig loopback_config = {
"lo0", /* name */
rtems_bsdnet_loopattach, /* attach function */
NULL, /* link to next interface */
"127.0.0.1", /* IP address */
"255.0.0.0", /* IP net mask */
};
#endif
/*
* Default network interface
*/
static struct rtems_bsdnet_ifconfig netdriver_config = {
RTEMS_BSP_NETWORK_DRIVER_NAME, /* name */
RTEMS_BSP_NETWORK_DRIVER_ATTACH, /* attach function */
#ifdef RTEMS_USE_LOOPBACK
&loopback_config, /* link to next interface */
#else
NULL, /* No more interfaces */
#endif
#if (defined (RTEMS_USE_BOOTP))
NULL, /* BOOTP supplies IP address */
NULL, /* BOOTP supplies IP net mask */
#else
# ifdef pc386
"192.168.0.5", /* IP address de la cible PC*/
# else
"192.168.0.6", /* IP address du leon*/
# endif /* pc386 */
"255.255.255.0", /* IP net mask */
#endif /* !RTEMS_USE_BOOTP */
#if (defined (RTEMS_SET_ETHERNET_ADDRESS))
ethernet_address, /* Ethernet hardware address */
#else
NULL, /* Driver supplies hardware address */
#endif
0 /* Use default driver parameters */
};
/*
* Network configuration
*/
struct rtems_bsdnet_config rtems_bsdnet_config = {
&netdriver_config,
#if (defined (RTEMS_USE_BOOTP))
rtems_bsdnet_do_bootp,
#else
NULL,
#endif
#ifdef pc386
20, /* Default network task priority */
256*1024, /* Default mbuf capacity */
256*1024, /* Default mbuf cluster capacity */
#else
0, /* Default network task priority */
0, /* Default mbuf capacity */
0, /* Default mbuf cluster capacity */
#endif /* pc386 */
#if (!defined (RTEMS_USE_BOOTP))
#ifdef pc386
"rtems_host", /* Host name */
#else
"leon",
#endif /* pc386 */
"nodomain.com", /* Domain name */
"192.168.0.1", /* Gateway */
"192.168.0.1", /* Log host */
{"192.168.0.1" }, /* Name server(s) */
{"192.168.0.1" }, /* NTP server(s) */
#endif /* !RTEMS_USE_BOOTP */
};
/*
* For TFTP test application
*/
#if (defined (RTEMS_USE_BOOTP))
#define RTEMS_TFTP_TEST_HOST_NAME "BOOTP_HOST"
#define RTEMS_TFTP_TEST_FILE_NAME "BOOTP_FILE"
#else
#define RTEMS_TFTP_TEST_HOST_NAME "192.168.0.5"
#define RTEMS_TFTP_TEST_FILE_NAME "tftptest"
#endif
#endif /* _RTEMS_NETWORKCONFIG_H_ */
----------------------------------------------------------------
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