aboutsummaryrefslogtreecommitdiffstats
path: root/src/platform/linux/udp.rs
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2020-02-21 00:31:00 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2020-02-21 00:31:00 +0100
commit8de2305cc73920d838e11634dc9ec619c2608a78 (patch)
tree908d2f34bfd0a7a329f4f7223ad40ba809c66a13 /src/platform/linux/udp.rs
parentMore comprehensive unit tests for router (diff)
downloadwireguard-rs-8de2305cc73920d838e11634dc9ec619c2608a78.tar.xz
wireguard-rs-8de2305cc73920d838e11634dc9ec619c2608a78.zip
Fixed unit tests
Diffstat (limited to 'src/platform/linux/udp.rs')
-rw-r--r--src/platform/linux/udp.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/platform/linux/udp.rs b/src/platform/linux/udp.rs
index 8930266..7b4fa33 100644
--- a/src/platform/linux/udp.rs
+++ b/src/platform/linux/udp.rs
@@ -216,11 +216,11 @@ impl LinuxUDPReader {
let mut control: ControlHeaderV6 = unsafe { mem::MaybeUninit::uninit().assume_init() };
let mut hdr = libc::msghdr {
msg_name: safe_cast(&mut src),
- msg_namelen: mem::size_of::<libc::sockaddr_in6>() as u32,
+ msg_namelen: mem::size_of_val(&src) as u32,
msg_iov: iovs.as_mut_ptr(),
msg_iovlen: iovs.len(),
msg_control: safe_cast(&mut control),
- msg_controllen: mem::size_of::<ControlHeaderV6>(),
+ msg_controllen: mem::size_of_val(&control),
msg_flags: 0,
};
@@ -270,11 +270,11 @@ impl LinuxUDPReader {
let mut control: ControlHeaderV4 = unsafe { mem::MaybeUninit::uninit().assume_init() };
let mut hdr = libc::msghdr {
msg_name: safe_cast(&mut src),
- msg_namelen: mem::size_of::<libc::sockaddr_in>() as u32,
+ msg_namelen: mem::size_of_val(&src) as u32,
msg_iov: iovs.as_mut_ptr(),
msg_iovlen: iovs.len(),
msg_control: safe_cast(&mut control),
- msg_controllen: mem::size_of::<ControlHeaderV4>(),
+ msg_controllen: mem::size_of_val(&control),
msg_flags: 0,
};
@@ -350,7 +350,7 @@ impl LinuxUDPWriter {
let mut hdr = libc::msghdr {
msg_name: safe_cast(&mut dst.dst),
- msg_namelen: mem::size_of_val(&dst.dst).try_into().unwrap(),
+ msg_namelen: mem::size_of_val(&dst.dst) as u32,
msg_iov: iovs.as_mut_ptr(),
msg_iovlen: iovs.len(),
msg_control: safe_cast(&mut control),
@@ -415,7 +415,7 @@ impl LinuxUDPWriter {
let mut hdr = libc::msghdr {
msg_name: safe_cast(&mut dst.dst),
- msg_namelen: mem::size_of_val(&dst.dst).try_into().unwrap(),
+ msg_namelen: mem::size_of_val(&dst.dst) as u32,
msg_iov: iovs.as_mut_ptr(),
msg_iovlen: iovs.len(),
msg_control: safe_cast(&mut control),