How do I enable LWIP's DNS_LOCAL_HOSTLIST_IS_DYNAMIC?

detlier
Posts: 15
Joined: Tue Nov 06, 2018 3:44 am

How do I enable LWIP's DNS_LOCAL_HOSTLIST_IS_DYNAMIC?

Postby detlier » Wed Dec 05, 2018 4:37 am

I would like to add the ESP device itself to LWIP's local list of DNS entries. To do this I need to enable "dns_local_addhost()" by defining the "DNS_LOCAL_HOSTLIST_IS_DYNAMIC" macro (see lwip/dns.h). But I can't figure out how to do this via CMake.

It can't be done via sdkconfig.defaults because ESP doesn't expose it that way. It can't be done with component_compile_options() in my own component because that only turns it on for my component. I can't see how to enable this for the LWIP component and anything that depends on it (similar to the target_compile_definitions() CMake command with API or PUBLIC). How do I enable it?

(I'm only asking this because it seems to be the only way to have ESP resolve its own name/address via DNS. If there's a better way, post it to here.)

detlier
Posts: 15
Joined: Tue Nov 06, 2018 3:44 am

Re: How do I enable LWIP's DNS_LOCAL_HOSTLIST_IS_DYNAMIC?

Postby detlier » Wed Dec 05, 2018 5:14 am

Not even this seems to work (in the top level CMakeLists.txt, same one that has the project() def):

Code: Select all

component_get_target(LWIP_NAME lwip)

message(STATUS "LWIP target name: ${LWIP_NAME}")

target_compile_definitions(
    ${LWIP_NAME}
    PUBLIC
        DNS_LOCAL_HOSTLIST_IS_DYNAMIC
    )
It sets the macro for my source files, but not for LWIP.

detlier
Posts: 15
Joined: Tue Nov 06, 2018 3:44 am

Re: How do I enable LWIP's DNS_LOCAL_HOSTLIST_IS_DYNAMIC?

Postby detlier » Wed Dec 05, 2018 5:36 am

Arg, I needed to define DNS_LOCAL_HOSTLIST as well! Putting this in the component or main CMakeLists.txt does the trick:

Code: Select all

component_get_target(LWIP_NAME lwip)

target_compile_definitions(
    ${LWIP_NAME}
    INTERFACE
        DNS_LOCAL_HOSTLIST
        DNS_LOCAL_HOSTLIST_IS_DYNAMIC
    )

detlier
Posts: 15
Joined: Tue Nov 06, 2018 3:44 am

Re: How do I enable LWIP's DNS_LOCAL_HOSTLIST_IS_DYNAMIC?

Postby detlier » Wed Dec 05, 2018 9:46 pm

I realised later this was a pointless exercise since this enables DNS client calling code, not server. Still, now I know.

Who is online

Users browsing this forum: No registered users and 126 guests