Skip to content

[BUG] Deprecation warning for slirp_pollfds_fill in MBuffNetifBackendLibslirp.c with libslirp >= 4.9.0 #1325

@bakshansky

Description

@bakshansky

Describe the bug

Building FreeRTOS-Plus-TCP with libslirp >= 4.9.0 triggers a deprecation warning for slirp_pollfds_fill in MBuffNetifBackendLibslirp.c.

Expected behavior

No deprecation warnings with modern libslirp versions.

Actual behavior

/FreeRTOS/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/libslirp/MBuffNetifBackendLibslirp.c: In function 'vReceiveThread':
/FreeRTOS/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/libslirp/MBuffNetifBackendLibslirp.c:709:13: warning: 'slirp_pollfds_fill' is deprecated [-Wdeprecated-declarations]
709 | slirp_pollfds_fill( pxCtx->pxSlirp, &ulPollerTimeoutMs, lSlirpAddPollCallback, pxCtx );
| ^~~~~~~~~~~~~~~~~~
In file included from /FreeRTOS/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/libslirp/MBuffNetifBackendLibslirp.c:33:
/usr/include/slirp/libslirp.h:273:6: note: declared here
273 | void slirp_pollfds_fill(Slirp *slirp, uint32_t *timeout,
| ^~~~~~~~~~~~~~~~~~

Additional context

  • libslirp version: >= 4.9.0 (can be checked with pkg-config --modversion libslirp).
  • The function slirp_pollfds_fill was deprecated in libslirp 4.9.0. The new API uses slirp_pollfds_fill_socket and requires changes in callback signatures (e.g., using slirp_os_socket instead of int for file descriptors).
  • Examples of migration can be found in other projects like QEMU or FreeBSD bhyve.
  • The warning does not break the build but indicates technical debt that should be addressed for future compatibility with upcoming libslirp releases.

Possible solution

  • Add conditional compilation based on SLIRP_CHECK_VERSION to use the new API when available.
  • Update the callback registration to match the new signatures.

I'm a complete beginner and don't understand anything in this project. I've never worked with any networking stack before. But I'd still like to try fixing this warning if possible — I'm willing to learn and put in the effort. However, I realize that my attempt might create more work for maintainers than it's worth. Let me know if it makes sense for me to try, and if so, could someone point me in the right direction (which files to look at, what needs to be done, examples, etc.)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions