This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Problem Establishing socket Connection
- From: kevin_lemay at agilent dot com
- To: ecos-discuss at sources dot redhat dot com
- Date: Mon, 10 Nov 2003 11:12:30 -0700
- Subject: [ECOS] Problem Establishing socket Connection
I am trying to port some working vxWorks code over the eCos. This includes some standard BSD socket connections.
I am encountering a problem within eCos. It has decided that I am trying to establish a network connection to a multicast socket, which is not the case.
We are attempting to connect to 130.30.174.109 (x821eae6d), port 5678.
I am using the CVS version of eCos as of Friday on an i386 platform.
The error occurs in tcp_usrrec.c at line 341
336 /*
337 * Must disallow TCP ``connections'' to multicast addresses.
338 */
339 sinp = (struct sockaddr_in *)nam;
- 340 if (sinp->sin_family == AF_INET
- 341 && IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) {
- 342 error = EAFNOSUPPORT;
- 343 goto out;
344 }
(gdb) p nam
$2 = (struct sockaddr *) 0x185ba0
(gdb) x/16w nam
0x185ba0 <main_stack+6816>: 0x2e160200 0x6dae1e82 0x00000000 0x00000000
0x185bb0 <main_stack+6832>: 0x00000000 0x00000000 0x00000000 0x00000000
0x185bc0 <main_stack+6848>: 0x00000002 0x11110000 0x00185be8 0x001349e0
0x185bd0 <main_stack+6864>: 0x00173dd1 0x0000162e 0x52725c78 0x00000004
(gdb)
The code that attempts to connect is:
int rc;
struct sockaddr_in servAddr;
int socketId;
/* Server side */
bzero(&servAddr, sizeof(servAddr));
servAddr.sin_family = AF_INET;
inet_aton(srvIpAddress, &servAddr.sin_addr);
servAddr.sin_port = htons(port);
/* create socket */
socketId = socket(AF_INET, SOCK_STREAM, 0);
if (socketId < 0)
{
return( -1 );
}
/* connect to server */
rc = connect(socketId, (struct sockaddr *) &servAddr,
sizeof(servAddr));
if (rc<0)
{
close(socketId);
socketId = 0;
return(-1);
}
return(socketId);
Debug Console Output:
0x0000ccf8 in ?? () at
/opt/ecos/ecos_cvs/ecos/packages/net/common/current/src/getserv.c:60
Loading section .text, size 0x69799 lma 0x108000
Loading section .rodata, size 0xa7ab lma 0x1717a0
Loading section .data, size 0x1bb0 lma 0x17bf50
Start address 0x108000, load size 482036
Transfer rate: 192814 bits/sec, 319 bytes/write.
[cyg_net_init] Init: mbinit(0x00000000)
[cyg_net_init] Init: cyg_net_init_devs(0x00000000)
Init device 'i82559_eth0'
[cyg_net_init] Init: loopattach(0x00000000)
[cyg_net_init] Init: ifinit(0x00000000)
[cyg_net_init] Init: domaininit(0x00000000)
[cyg_net_init] Init: cyg_net_add_domain(0x0017d300)
New domain internet at 0x00000000
[cyg_net_init] Init: cyg_net_add_domain(0x0017cc40)
New domain route at 0x00000000
[cyg_net_init] Init: call_route_init(0x00000000)
[cyg_net_init] Done
[New Thread 4]
[Switching to Thread 4]
Breakpoint 5, main () at osmain.c:78
(gdb) info break
Num Type Disp Enb Address What
1 breakpoint keep y 0x0013ed40 in walkPciCreatePorts at
osmain.c:451
2 breakpoint keep y 0x0013d394 in openSocket at
/home/klemay/prj/TestbaseV2/c/oslib.c:81
3 breakpoint keep y 0x0014259e in bsd_connect at
/opt/ecos/ecos_cvs/ecos/packages/net/bsd_tcpip/current/src/sys/kern/sockio.c:267
5 breakpoint keep y 0x0013e92d in main at osmain.c:78
breakpoint already hit 1 time
(gdb) c
Continuing.
BOOTP[eth0] op: REQUEST
htype: Ethernet
hlen: 6
hops: 0
xid: 0xa1d2024b
secs: 0
flags: 0x80
hw_addr: 00:02:b3:1f:02:4b
client IP: 0.0.0.0
my IP: 130.30.173.222
server IP: 156.140.232.41
gateway IP: 130.30.172.1
options:
DHCP message: 3 REQUEST
DHCP server id: 156.140.232.41
DHCP time 51: 604800
DHCP time 58: 302400
DHCP time 59: 529200
subnet mask: 255.255.252.0
gateway: 130.30.172.1
domain server: 156.140.238.22, 156.140.232.41
domain name: rose.agilent.com.
IP broadcast: 255.255.255.255
Unknown option: 2c/44.8: 130 29 152 23 130 29 154 21
Unknown option: 2e/46.1: 8
host name: rg-dhcp7.
DHCP option: 37/55.9: 54 51 58 59 1 3 6 15 28
DHCP option: 39/57.2: 576
DHCP requested ip: 130.30.173.222
Any help would be appreciated.
Kevin Lemay
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss