This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
is this a bug? (sendto socket call)
- From: Richard dot von dot Lehe at gd-ais dot com
- To: ecos-discuss at ecos dot sourceware dot org
- Cc: Richard dot von dot Lehe at gd-ais dot com
- Date: Tue, 20 Jul 2004 09:25:38 -0500
- Subject: [ECOS] is this a bug? (sendto socket call)
Hi All,
When I debugged deep into the various calls underneath 'sendto', I came across this section of code. The call stack is something like this (not exact):
sendto -> sosend -> udp_send -> udp_output
In udp_output (udp_usrreq.c):
----------------- code -----------------------
if (addr) {
sin = (struct sockaddr_in *)addr;
laddr = inp->inp_laddr;
if (inp->inp_faddr.s_addr != INADDR_ANY) { // <-------------------- ??
error = EISCONN;
goto release;
}
-------------------- end code -----------------------
The string inp_faddr is #defined to be inp_dependfaddr.inp46_foreign.ia46_addr4.
The structure for 'inp' is at the bottom of this email. Anyway, in my debugger I see that inp_dependfaddr.inp46_foreign.ia46_addr4 is my desired remote address and inp_dependladdr.inp46_foreign.ia46_addr4 is one of my local addresses. Of course my remote address is not 0.0.0.0 (INADDR_ANY) and I get the 'is already connected' (EISCONN) error. Does this make sense to anyone else? It doesn't to me. I can include any other information if this isn't enough. I am using 'sendto' in a way that seems to work when I compile and run under Linux instead of eCos.
Thanks,
Rich
(gdb) ptype inp
type = struct inpcb {
struct {
struct inpcb *le_next;
struct inpcb **le_prev;
} inp_hash;
u_short inp_fport;
u_short inp_lport;
struct {
struct inpcb *le_next;
struct inpcb **le_prev;
} inp_list;
u_int32_t inp_flow;
union {
struct in_addr_4in6 inp46_foreign;
struct in6_addr inp6_foreign;
} inp_dependfaddr;
union {
struct in_addr_4in6 inp46_local;
struct in6_addr inp6_local;
} inp_dependladdr;
char *inp_ppcb;
struct inpcbinfo *inp_pcbinfo;
struct socket *inp_socket;
int inp_flags;
union {
struct route inp4_route;
struct route inp6_route;
} inp_dependroute;
struct inpcbpolicy *inp_sp;
u_char inp_vflag;
u_char inp_ip_ttl;
u_char inp_ip_p;
struct {
u_char inp4_ip_tos;
struct mbuf *inp4_options;
struct ip_moptions *inp4_moptions;
} inp_depend4;
struct {
struct mbuf *inp6_options;
struct ip6_recvpktopts *inp6_inputopts;
struct ip6_pktopts *inp6_outputopts;
struct ip6_moptions *inp6_moptions;
struct icmp6_filter *inp6_icmp6filt;
int inp6_cksum;
u_short inp6_ifindex;
short int inp6_hops;
} inp_depend6;
struct {
struct inpcb *le_next;
struct inpcb **le_prev;
} inp_portlist;
struct inpcbport *inp_phd;
inp_gen_t inp_gencnt;
} *
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss