Community
Participate
Working Groups
This is causing socket failure on VxWorks with latest IPNET code which now check validity of this size... This default size should be replaced by: sizeof (struct sockaddr); static ChannelServer * channel_server_create(PeerServer * ps, int sock) { ServerTCP * si = (ServerTCP *)loc_alloc_zero(sizeof *si); /* TODO: need to investigate usage of sizeof(sockaddr_storage) for address buffer size */ si->addr_len = 0x1000;
Hello, I did not realize that this code has been recently changed to use SOCK_MAXADDRLEN if defined. While this seems good, this size defined as 255 for VxWorks is still too large and does not please the latest IPNET accept() code which raise an error... In this case, as the allocated buffer is a "struct sockaddr", I don't understand why we do not simply set si->addr_len to sizeof(sockaddr) ... static ChannelServer * channel_server_create(PeerServer * ps, int sock) { ServerTCP * si = (ServerTCP *)loc_alloc_zero(sizeof *si); /* TODO: need to investigate usage of sizeof(sockaddr_storage) for address buffer size */ #if defined(SOCK_MAXADDRLEN) si->addr_len = SOCK_MAXADDRLEN; #else si->addr_len = 0x1000; #endif si->addr_buf = (struct sockaddr *)loc_alloc_zero(si->addr_len); Regards, Jean-Michel
> has been recently changed to use SOCK_MAXADDRLEN ... The change is 5 years old > I don't understand why we do not simply set si->addr_len to sizeof(sockaddr) It, probably, would not work when the channel is connected to UNIX domain socket. I have added: #if defined(_WRS_KERNEL) si->addr_len = sizeof(struct sockaddr); Fixed.
Thanks!