Closed TVliegenthart closed 2 years ago
We found the issue.
We have add in config.h:
This solved the issue and no change in code is required.
We look further and see that an vxworks error is not correctly handled in ACE. define ACE_LOCALHOST "127.0.0.1" is then not required:
See OS_NS_arpa_inet.cpp
int ACE_OS::inet_aton (const char host_name, struct in_addr addr) ....
// inet_aton() returns OK (0) on success and ERROR (-1) on failure. // Must reset errno first. Refer to WindRiver SPR# 34949, SPR# 36026 ::errnoSet(0); int result = 0; //error for inet_aton ACE_OSCALL (::inet_aton (const_cast <char*>(host_name), addr), int, result); return (result == ERROR) ? 0 : 1;
In Vxworks ERROR is defined as -1 ::inet_aton return 1 when succeed and 0 when failed this seems not correct: return (result == ERROR) ? 0 : 1; In case of failure (inet_aton) this result in zero and is compared with -1 what result in 1 (succeed for this function) That seems not correct.
I use the following code: int result = 0; //error for inet_aton ACE_OSCALL (::inet_aton (const_cast <char*>(host_name), addr), int, result); return (result != 0 ) ? 1 : 0;
No the pipe/ socket is correctly created without the #define ACE_LOCAL_HOST "127.0.0.1"
No the pipe/ socket is correctly created without the #define ACE_LOCAL_HOST "127.0.0.1" Now the pipe/ socket is correctly created without the #define ACE_LOCAL_HOST "127.0.0.1"
Version
ACE+TAO-7.0.7
Host machine and operating system
Lenovo workstation, Intel I7, Windows10
Target machine and operating system (if different from host)
Kontron 6062, Vxworks 7SR650
Compiler name and version (including patch level)
Clang (Vxworks)
The $ACE_ROOT/ace/config.h file
if defined (_MSC_VER)
else
endif
If you use a link to a platform-specific file, simply state which one
The $ACE_ROOT/include/makeinclude/platform_macros.GNU file
debug ?= 1 SOEXT ?= a static_libs_only ?= 1 rtp ?= 0
ifeq ("$(TOOL_FAMILY)","llvm") CPPFLAGS += -D_WRS_CONFIG_SMP CPPFLAGS += -d endif VSB_DIR =C:\WindRiver\VxWorks7SR650\vxworks-7\target\vsb_ilp32_kontron_smp_vm606x
include $(ACE_ROOT)/include/makeinclude/platform_vxworks.GNU
if you use a link to a platform-specific file, simply state which one (unless this isn't used in this case, e.g., with Microsoft Visual C++)
Contents of $ACE_ROOT/bin/MakeProjectCreator/config/default.features
Used by MPC when you generate your own makefiles
AREA/CLASS/EXAMPLE AFFECTED:
orbOptions += "-ORBDottedDecimalAddresses 1" orbOptions += " -ORBEndpoint "; Endpoint = "iiop://:7012" CORBA::ORB_init( argc, argv ); Fails when started up.
What example failed?
The problem effects:
Does it affect compilation, linking, or execution. Please indicate whether ACE/TAO, your application, or both are affected. Issue occurs while starting up the vxworks application and initialize corba.
Synopsis
Brief description of the problem
Description
Creation SocketPair in ACE :Pipe.cpp /SOCK_Acceptor.cpp The socket acceptor is created without local inet address "127.0.0.1"
SOCK_Acceptor.cpp: :ACE_SOCK_Acceptor::shared_open(..) .... if (protocol_family == PF_INET) { sockaddr_in local_inet_addr; ACE_OS::memset (reinterpret_cast<void *> (&local_inet_addr), 0, sizeof local_inet_addr);
It fails in Pipe.cpp at connector.connect(.....) if (result != -1 ) { //ACE_INET_Addr sv_addr (my_addr.get_port_number (), // ACE_LOCALHOST); // NOT WORKING: ACE_LOCALHOST = "localhost": ACE_OS::inet_aton can not translate "localhost" to "127.0.0.1" Command accept only a.b.c.d. notation. inet_aton gives no error with input "localhost"
The connector can not connect to a acceptor socket which is not connected to the local innet domain or with IPNET "0.0.0.0"
Detailed description of problem. Don't just say " doesn't work, here's a fix," explain what your program does to get to the state.
Repeat by
What you did to get the error; include test program or session transcript if at all possible.
Sample fix/ workaround
Add: SOCK_Acceptor.cpp local_inet_addr.sin_addr.s_addr = inet_addr("127.0.0.1"); pipe.cpp //ACE_INET_Addr sv_addr (my_addr.get_port_number (), // ACE_LOCALHOST); ->ACE_INET_Addr sv_addr (my_addr);
This is not the final solution, but gives an indication about the root cause. If available Pipe.zip