diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-08-14 02:28:11 +0200 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-08-14 02:28:11 +0200 |
commit | 84e48b38334bf659e1df143ba7dee71e29548d40 (patch) | |
tree | 4391fa2092fe04d752b990bcddca1c1a934a5a82 | |
parent | 82fbc754f2124c47b7557c42434e37b16f1283d3 (diff) |
fix address swapping: shift remaining address to the right
-rw-r--r-- | netlinkd_sys/Cargo.toml | 2 | ||||
-rw-r--r-- | netlinkd_sys/src/tunnel.rs | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/netlinkd_sys/Cargo.toml b/netlinkd_sys/Cargo.toml index f63fead..fb10f78 100644 --- a/netlinkd_sys/Cargo.toml +++ b/netlinkd_sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rsdsl_netlinkd_sys" -version = "0.4.5" +version = "0.4.7" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/netlinkd_sys/src/tunnel.rs b/netlinkd_sys/src/tunnel.rs index 264b06f..df1de92 100644 --- a/netlinkd_sys/src/tunnel.rs +++ b/netlinkd_sys/src/tunnel.rs @@ -74,11 +74,24 @@ impl IpIp6 { let mut loctets = laddr.octets(); + // Swap last 32 bits to the front. loctets.swap(0, 12); loctets.swap(1, 13); loctets.swap(2, 14); loctets.swap(3, 15); + // Swap second 32 bit segment to the right by 32 bits. + loctets.swap(4, 8); + loctets.swap(5, 9); + loctets.swap(6, 10); + loctets.swap(7, 11); + + // Swap second 32 bit segment to the back (by 64 bits). + loctets.swap(4, 12); + loctets.swap(5, 13); + loctets.swap(6, 14); + loctets.swap(7, 15); + let err = unsafe { internal::netlinkd_create_4in6( tnlname, |