Skip to content
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

fix: ipv4_config byte order already little endian #3073

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Changes from all commits
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
14 changes: 1 addition & 13 deletions src/mesh/eth/ethClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ static int32_t reconnectETH()
return 5000; // every 5 seconds
}

static uint32_t bigToLittleEndian(uint32_t value)
{
return ((value >> 24) & 0xFF) | ((value >> 8) & 0xFF00) | ((value << 8) & 0xFF0000) | ((value << 24) & 0xFF000000);
}

// Startup Ethernet
bool initEthernet()
{
Expand Down Expand Up @@ -130,14 +125,7 @@ bool initEthernet()
status = Ethernet.begin(mac);
} else if (config.network.address_mode == meshtastic_Config_NetworkConfig_AddressMode_STATIC) {
LOG_INFO("starting Ethernet Static\n");

IPAddress ip = IPAddress(bigToLittleEndian(config.network.ipv4_config.ip));
IPAddress dns = IPAddress(bigToLittleEndian(config.network.ipv4_config.dns));
IPAddress gateway = IPAddress(bigToLittleEndian(config.network.ipv4_config.gateway));
IPAddress subnet = IPAddress(bigToLittleEndian(config.network.ipv4_config.subnet));

Ethernet.begin(mac, ip, dns, gateway, subnet);

Ethernet.begin(mac, config.network.ipv4_config.ip, config.network.ipv4_config.dns, config.network.ipv4_config.subnet);
status = 1;
} else {
LOG_INFO("Ethernet Disabled\n");
Expand Down
Loading