Updating NAL to support TCP port randomization
This commit is contained in:
parent
c24eb17d1e
commit
1b4d31dbd9
|
@ -437,6 +437,12 @@ dependencies = [
|
||||||
"heapless 0.6.1",
|
"heapless 0.6.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nanorand"
|
||||||
|
version = "0.5.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ac1378b66f7c93a1c0f8464a19bf47df8795083842e5090f4b7305973d5a22d0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nb"
|
name = "nb"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
|
@ -710,10 +716,11 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smoltcp-nal"
|
name = "smoltcp-nal"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/quartiq/smoltcp-nal.git?rev=7572183#757218316620e074405bc38ff5502ef17a8a3499"
|
source = "git+https://github.com/quartiq/smoltcp-nal.git?branch=feature/random-port#462adc56a8cc95bc1324f6d96fdbe82e85ca6d36"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"embedded-nal",
|
"embedded-nal",
|
||||||
"heapless 0.6.1",
|
"heapless 0.6.1",
|
||||||
|
"nanorand",
|
||||||
"smoltcp",
|
"smoltcp",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ rev = "314fa5587d"
|
||||||
|
|
||||||
[dependencies.smoltcp-nal]
|
[dependencies.smoltcp-nal]
|
||||||
git = "https://github.com/quartiq/smoltcp-nal.git"
|
git = "https://github.com/quartiq/smoltcp-nal.git"
|
||||||
rev = "7572183"
|
branch = "feature/random-port"
|
||||||
|
|
||||||
[patch.crates-io.minimq]
|
[patch.crates-io.minimq]
|
||||||
git = "https://github.com/quartiq/minimq.git"
|
git = "https://github.com/quartiq/minimq.git"
|
||||||
|
|
|
@ -594,13 +594,25 @@ pub fn setup(
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
NetworkDevices {
|
let random_seed = {
|
||||||
stack: smoltcp_nal::NetworkStack::new(
|
let mut rng =
|
||||||
|
device.RNG.constrain(ccdr.peripheral.RNG, &ccdr.clocks);
|
||||||
|
let mut data = [0u8; 4];
|
||||||
|
rng.fill(&mut data).unwrap();
|
||||||
|
data
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut stack = smoltcp_nal::NetworkStack::new(
|
||||||
interface,
|
interface,
|
||||||
sockets,
|
sockets,
|
||||||
&handles,
|
&handles,
|
||||||
Some(dhcp_client),
|
Some(dhcp_client),
|
||||||
),
|
);
|
||||||
|
|
||||||
|
stack.seed_random_port(&random_seed);
|
||||||
|
|
||||||
|
NetworkDevices {
|
||||||
|
stack,
|
||||||
phy: lan8742a,
|
phy: lan8742a,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue