DOCGroup / ACE_TAO

ACE and TAO
https://www.dre.vanderbilt.edu/~schmidt/TAO.html
704 stars 380 forks source link

ACE : inet_aton succeed always for Vxworks #1972

Closed TVliegenthart closed 2 years ago

TVliegenthart commented 2 years ago

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)

//#define ACE_HAS_MFC 1
#include "ace/config-win32.h"

else

#define ACE_HAS_SOCKLEN_T      //Platform provides socklen_t type, such as Linux with glibc2
#define NUM_FILES 1000

#define ACE_ANY_OPS_USE_NAMESPACE
//#define TAO_PLATFORM_SVC_CONF_FILE_NOTSUP // skip look for file svc.conf

#include "ace/config-vxworks.h"
#include <iostream>

#undef ACE_MKDIR_LACKS_MODE     // This platform has a mkdir function with a mode argument  

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.

Synopsis

Brief description of the problem

Description

Initial the pipe creation fails. See bug report ACE/TAO Vxworks7SR650, Pipe/Socketpair failed #1971 (Closed)

We look further and seems that a 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) ....

elif defined (ACE_VXWORKS)

// inet_aton() returns OK (0) on success and ERROR (-1) on failure. NOT TRUE: inet_aton() returns OK (1) and on failure 0 for Vxworks 7SR650 // Must reset errno first. Refer to WindRiver SPR# 34949, SPR# 36026 ::errnoSet(0); int result = ERROR; ACE_OSCALL (::inet_aton (const_cast (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 always 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;

Now the pipe/ socket is correctly created without the #define ACE_LOCAL_HOST "127.0.0.1"

Repeat by

What you did to get the error; include test program or session transcript if at all possible.

Sample fix/ workaround

If available

mitza-oci commented 2 years ago

It seems like this was fixed already (but after the 7.0.7 tag) by #1958. Is that correct, @jwillemsen ?

mitza-oci commented 2 years ago

@TVliegenthart please let us know if this is a problem with the current code in the master branch