Page 1 of 1

Disable OFFER_Router

Posted: Fri Jun 08, 2018 9:39 pm
by sorenhl
Hi,

I am trying to port a esp8266 project to ESP32, but i am facing issues with one command:

Code: Select all

uint8 mode = 0;
wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, &mode);
It does so iPhones can still surf the internet while being connected to the AP.

It seems like the functionality is inside "apps/dhcpserver.h", but I cannot really figure out how to use the dhcps_set_option_info.

Any idea how to do this now? I have been trying and failing for hours, so any help would be greatly appreciated.


/Søren

Re: Disable OFFER_Router

Posted: Sat Jun 09, 2018 9:47 am
by WiFive
Try

Code: Select all

uint8_t val = 0;
tcpip_adapter_dhcps_option(TCPIP_ADAPTER_OP_SET, ROUTER_SOLICITATION_ADDRESS, &val, sizeof(dhcps_offer_t));

Re: Disable OFFER_Router

Posted: Sat Jun 09, 2018 8:45 pm
by sorenhl
The code you posted works perfect, thank you so much!

If anybody else is trying this, remember to stop, apply line, start the dhcp server for it to work :D

Re: Disable OFFER_Router

Posted: Fri Nov 02, 2018 6:17 pm
by phatpaul
Elsewhere on the web people say to disable dhcp option 3 and option 6.
https://superuser.com/questions/596053/ ... in-openwrt

But you say to use ROUTER_SOLICITATION_ADDRESS which is option 32.

So is it option 3 or 32?
I'm going to also disable option 3 and 6 just to be sure.

Where is the documentation for this?
I only found:
https://www.esp8266.com/viewtopic.php?t=1798

Re: Disable OFFER_Router

Posted: Fri Nov 02, 2018 7:10 pm
by phatpaul
Nevermind, this IDF code is a mess...

It looks like it actually prevents sending ROUTER option 3, even though the API incorrectly uses ROUTER_SOLICITATION_ADDRESS (32) as a flag for that functionality.

But should we not send option 3, or send it with an invalid IP of 0.0.0.0?

Also, by setting
uint8_t opt_val = 0; // don't supply a dns server via dhcps
ESP_ERROR_CHECK(tcpip_adapter_dhcps_option(TCPIP_ADAPTER_OP_SET, TCPIP_ADAPTER_DOMAIN_NAME_SERVER, &opt_val, 1));

It is still sending option 6 - dns server. But it is just sending it's own IP. See
https://github.com/espressif/esp-idf/bl ... ver.c#L344

But shouldn't we be able to prevent sending the option 6 entirely?