8000 DHCP custom option by mcspr · Pull Request #8582 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

DHCP custom option #8582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
restyle
  • Loading branch information
mcspr committed Jun 7, 2022
commit ad7faf70b877e6dedee8eba863be7bf8c91eec01
2 changes: 1 addition & 1 deletion cores/esp8266/LwipDhcpServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class DhcpServer
ip4_addr_t server_address {};
ip4_addr_t client_address {};

uint32_t lease_time = DefaultLeaseTime;
uint32_t lease_time = DefaultLeaseTime;

bool offer_router = true;
ip4_addr_t dns_address {};
Expand Down
13 changes: 9 additions & 4 deletions libraries/ESP8266WiFi/examples/CustomOffer/CustomOffer.ino
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <LwipDhcpServer.h>

void setup() {
dhcpSoftAP.onSendOptions([](const DhcpServer&, auto& options) {
options.add(43, { 0xca, 0xfe, 0xca, 0xfe, 0xfe }) // VENDOR is... vendor specific
.add(114, "https://192.168.4.1"); // Captive portal
A1C1 auto& server = WiFi.softAPDhcpServer();
server.onSendOptions([](const DhcpServer& server, auto& options) {
// VENDOR is... vendor specific
options.add(43, { 0xca, 0xfe, 0xca, 0xfe, 0xfe });

// Captive Portal URI
const IPAddress gateway = netif_ip4_addr(server.getNetif());
const String captive = F("http://") + gateway.toString();
options.add(114, captive.c_str(), captive.length());
});
WiFi.softAP("TEST", "testtesttest");
}
Expand Down
1 change: 0 additions & 1 deletion tests/host/common/DhcpServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,4 @@ extern "C"
(void)please;
return true;
}

}
0