Skip to content

gethostid() and gethostname() not supported by lwIP network #1513

@mafoste3

Description

@mafoste3

Describe the bug
The lwIP network stack, compatible with RTEMS, does not support either gethostid() and gethostname() calls. If the OSAL networking module is included then the build will fail to link the module with undefined reference to gethostname and gethostid errors.

To Reproduce
Steps to reproduce the behavior:

  • Build cFS and link with rtems-lwip (-llwip) network library

Expected behavior
To mitigate the undefined reference build errors:

  • Replace the the default os-impl-network.c module with '../portable/os-impl-no-network-gethostid.c' and '../portable/os-impl-no-network-gethostid.c'
  • Comment out linking the RTEMS networking library
    FROM:
    # Leverage the "standard" BSD socket code if network is enabled
    if (OSAL_CONFIG_INCLUDE_NETWORK)
    list(APPEND RTEMS_IMPL_SRCLIST
    src/os-impl-network.c
    ../portable/os-impl-bsd-sockets.c
    ../portable/os-impl-bsd-select.c
    )
    # In RTEMS 6+ the networking subsystem is not included with the default libs,
    # it needs to be explicitly added to the final link. Note the "VERSION_GREATER_EQUAL"
    # operation was not added until CMake 3.7, so this uses not "VERSION_LESS" instead.
    if(NOT CMAKE_SYSTEM_VERSION VERSION_LESS 6.0)
    target_link_libraries(osal_public_api INTERFACE
    networking
    )
    endif()
    else()
    list(APPEND RTEMS_IMPL_SRCLIST
    ../portable/os-impl-no-network.c
    ../portable/os-impl-no-sockets.c
    ../portable/os-impl-no-select.c
    )
    endif ()
    # Defines an OBJECT target named "osal_rtems_impl" with selected source files
    add_library(osal_rtems_impl OBJECT

    TO:
# Leverage the "standard" BSD socket code if network is enabled
if (OSAL_CONFIG_INCLUDE_NETWORK)
    list(APPEND RTEMS_IMPL_SRCLIST
        ../portable/os-impl-no-network-gethostid.c
        ../portable/os-impl-no-network-gethostname.c
        ../portable/os-impl-bsd-sockets.c
        ../portable/os-impl-bsd-select.c
    )

    # In RTEMS 6+ the networking subsystem is not included with the default libs,
    # it needs to be explicitly added to the final link.  Note the "VERSION_GREATER_EQUAL"
    # operation was not added until CMake 3.7, so this uses not "VERSION_LESS" instead.
    if(NOT CMAKE_SYSTEM_VERSION VERSION_LESS 6.0)
        target_link_libraries(osal_public_api INTERFACE
#            networking
        )
    endif()
else()
    list(APPEND RTEMS_IMPL_SRCLIST
        ../portable/os-impl-no-network-gethostid.c
        ../portable/os-impl-no-network-gethostname.c
        ../portable/os-impl-no-sockets.c
        ../portable/os-impl-no-select.c
    )
endif ()

System observed on:

Reporter Info
Mark Foster
NASA / Johnson Space Center / ER6

Metadata

Metadata

Assignees

No one assigned

    Labels

    CCB:ReadyPull request is ready for discussion at the Configuration Control Board (CCB)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions