Skip to content

Commit

Permalink
Set the mtu before the interface is up
Browse files Browse the repository at this point in the history
Restore it after it's down
  • Loading branch information
TSRBerry committed Oct 22, 2022
1 parent 8c6c29b commit d17a18f
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions ldn_mitm/source/lan_discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,14 714,17 @@ namespace ams::mitm::ldn {
this->resetStations();
this->inited = false;

rc = nifmRequestCancel(&request);
if (R_FAILED(rc))
{
LogFormat("final nifmRequestCancel failed: %x", rc);
}

LogFormat("final nifmSetNetworkProfile Setting mtu to: %d", &networkProfile.ip_setting_data.mtu);
rc = nifmSetNetworkProfile(&networkProfile, &networkProfile.uuid);
if (R_FAILED(rc)) {
LogFormat("final nifmSetNetworkProfile failed: %x", rc);
}
rc = nifmRequestCancel(&request);
if (R_FAILED(rc)) {
LogFormat("final nifmRequestCancel failed: %x", rc);
}
}

this->setState(CommState::None);
Expand All @@ -734,7 737,22 @@ namespace ams::mitm::ldn {
return 0;
}

Result rc = nifmCreateRequest(&request, true);
Result rc = nifmGetCurrentNetworkProfile(&networkProfile);
if (R_FAILED(rc))
{
LogFormat("nifmGetCurrentNetworkProfile failed: %x", rc);
}

NifmNetworkProfileData np = networkProfile;
np.ip_setting_data.mtu = 1500;

rc = nifmSetNetworkProfile(&np, &np.uuid);
if (R_FAILED(rc))
{
LogFormat("nifmSetNetworkProfile failed: %x", rc);
}

rc = nifmCreateRequest(&request, true);
if (R_FAILED(rc))
{
LogFormat("nifmCreateRequest failed: %x", rc);
Expand All @@ -753,18 771,6 @@ namespace ams::mitm::ldn {
return rc;
}

rc = nifmGetCurrentNetworkProfile(&networkProfile);
if (R_FAILED(rc)) {
LogFormat("nifmGetCurrentNetworkProfile failed: %x", rc);
}

NifmNetworkProfileData np = networkProfile;
np.ip_setting_data.mtu = 1500;
rc = nifmSetNetworkProfile(&np, &np.uuid);
if (R_FAILED(rc)) {
LogFormat("nifmSetNetworkProfile failed: %x", rc);
}

for (auto &i : stations) {
i.discovery = this;
i.nodeInfo = &this->networkInfo.ldn.nodes[i.nodeId];
Expand Down

0 comments on commit d17a18f

Please sign in to comment.