diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 0f0f064..69a8c23 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: # Keep MSRV in sync with rust-version in Cargo.toml as much as possible. - rust: [stable, beta, nightly, 1.69.0] + rust: [stable, beta, nightly, 1.77.0] runs-on: macos-latest steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index f168c53..5ac6941 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). * **Security**: in case of vulnerabilities. ## [unreleased] +### Added +- Add function for setting and clearing interface flags. + +### Changed +- Bump MSRV to 1.77. ## [0.6.1] - 2024-10-02 diff --git a/Cargo.lock b/Cargo.lock index a049d0c..18be882 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,12 +8,108 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e772942dccdf11b368c31e044e4fca9189f80a773d2f0808379de65894cbf57" +[[package]] +name = "async-channel" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "blocking" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + +[[package]] +name = "bytes" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" + +[[package]] +name = "c2rust-bitfields" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "367e5d1b30f28be590b6b3868da1578361d29d9bfac516d22f497d28ed7c9055" +dependencies = [ + "c2rust-bitfields-derive", +] + +[[package]] +name = "c2rust-bitfields-derive" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a279db9c50c4024eeca1a763b6e0f033848ce74e83e47454bcf8a8a98f7b0b56" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + [[package]] name = "darling" version = "0.20.10" @@ -35,7 +131,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn", + "syn 2.0.89", ] [[package]] @@ -46,7 +142,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn", + "syn 2.0.89", ] [[package]] @@ -67,7 +163,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn", + "syn 2.0.89", ] [[package]] @@ -77,15 +173,141 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" dependencies = [ "derive_builder_core", - "syn", + "syn 2.0.89", +] + +[[package]] +name = "event-listener" +version = "5.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", ] +[[package]] +name = "event-listener-strategy" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-lite" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "getrandom" version = "0.2.15" @@ -109,6 +331,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bd11f3a29434026f5ff98c730b668ba74b1033637b8817940b54d040696133c" +[[package]] +name = "ipnet" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" + [[package]] name = "ipnetwork" version = "0.20.0" @@ -124,6 +352,46 @@ version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +[[package]] +name = "libloading" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +dependencies = [ + "cfg-if", + "windows-targets", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + [[package]] name = "pfctl" version = "0.6.1" @@ -131,17 +399,43 @@ dependencies = [ "assert_matches", "derive_builder", "ioctl-sys", + "ipnet", "ipnetwork", "libc", + "log", "scopeguard", + "tun", "uuid", ] +[[package]] +name = "pin-project-lite" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "piper" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -167,6 +461,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "369633cfe0f0bde1dfc037fb6c5a329d46586a31f981bed14d87487a3439ae37" +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "strsim" version = "0.11.1" @@ -175,15 +478,63 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.71" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + +[[package]] +name = "tun" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9da8b651bb409eded6d02f6fe7887a684f5d2a13de012269009d47f19d85e353" +dependencies = [ + "bytes", + "cfg-if", + "ipnet", + "libc", + "log", + "nix", + "thiserror", + "windows-sys", + "wintun-bindings", +] + [[package]] name = "unicode-ident" version = "1.0.12" @@ -204,3 +555,91 @@ name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wintun-bindings" +version = "0.7.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8aed5bc5516ca7a52018b0a198911566edfa07584bdbfd71ea39161aa13806e" +dependencies = [ + "blocking", + "c2rust-bitfields", + "futures", + "libloading", + "log", + "thiserror", + "windows-sys", +] diff --git a/Cargo.toml b/Cargo.toml index 8f2e4f0..a34a97e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ readme = "README.md" keywords = ["pf", "firewall", "macos", "packet", "filter"] categories = ["network-programming", "os", "os::macos-apis", "api-bindings"] edition = "2021" -rust-version = "1.69.0" +rust-version = "1.77.0" [badges] travis-ci = { repository = "mullvad/pfctl-rs" } @@ -25,3 +25,10 @@ ipnetwork = "0.20.0" assert_matches = "1.1.0" uuid = { version = "1.8.0", features = ["v4"] } scopeguard = "1.0" +tun = "0.7.4" + +# Transitive dependencies with incorrect semver use +# or that no longer compile for some reason. +# All of these belong to 'tun' +ipnet = "2.6.0" +log = "0.4.22" diff --git a/generate_bindings.sh b/generate_bindings.sh index 029e6d3..5688e92 100755 --- a/generate_bindings.sh +++ b/generate_bindings.sh @@ -19,6 +19,7 @@ bindgen \ --allowlist-type pfioc_trans \ --allowlist-type pfioc_states \ --allowlist-type pfioc_state_kill \ + --allowlist-type pfioc_iface \ --allowlist-var PF_.* \ --allowlist-var PFRULE_.* \ --default-enum-style rust \ diff --git a/src/ffi/mod.rs b/src/ffi/mod.rs index 70a6759..fc6fdba 100644 --- a/src/ffi/mod.rs +++ b/src/ffi/mod.rs @@ -63,3 +63,7 @@ ioctl!(readwrite pf_add_addr with b'D', 52; pfvar::pfioc_pooladdr); ioctl!(readwrite pf_begin_trans with b'D', 81; pfvar::pfioc_trans); // DIOCXCOMMIT ioctl!(readwrite pf_commit_trans with b'D', 82; pfvar::pfioc_trans); +// DIOCSETIFFLAG +ioctl!(readwrite pf_set_iface_flag with b'D', 89; pfvar::pfioc_iface); +// DIOCCLRIFFLAG +ioctl!(readwrite pf_clear_iface_flag with b'D', 90; pfvar::pfioc_iface); diff --git a/src/ffi/pfvar.rs b/src/ffi/pfvar.rs index f7737bc..21ff5d7 100644 --- a/src/ffi/pfvar.rs +++ b/src/ffi/pfvar.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.69.4 */ +/* automatically generated by rust-bindgen 0.70.1 */ pub const PF_UNSPEC: u32 = 0; pub const PF_LOCAL: u32 = 1; @@ -145,31 +145,12 @@ pub type sa_family_t = __uint8_t; pub struct in_addr { pub s_addr: in_addr_t, } -#[test] -fn bindgen_test_layout_in_addr() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(in_addr)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in_addr)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).s_addr) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in_addr), - "::", - stringify!(s_addr) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of in_addr"][::std::mem::size_of::() - 4usize]; + ["Alignment of in_addr"][::std::mem::align_of::() - 4usize]; + ["Offset of field: in_addr::s_addr"][::std::mem::offset_of!(in_addr, s_addr) - 0usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub struct in6_addr { @@ -182,77 +163,24 @@ pub union in6_addr__bindgen_ty_1 { pub __u6_addr16: [__uint16_t; 8usize], pub __u6_addr32: [__uint32_t; 4usize], } -#[test] -fn bindgen_test_layout_in6_addr__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr__bindgen_ty_1)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__u6_addr8) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr8) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__u6_addr16) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr16) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__u6_addr32) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr__bindgen_ty_1), - "::", - stringify!(__u6_addr32) - ) - ); -} -#[test] -fn bindgen_test_layout_in6_addr() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(in6_addr)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(in6_addr)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__u6_addr) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(in6_addr), - "::", - stringify!(__u6_addr) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of in6_addr__bindgen_ty_1"][::std::mem::size_of::() - 16usize]; + ["Alignment of in6_addr__bindgen_ty_1"] + [::std::mem::align_of::() - 4usize]; + ["Offset of field: in6_addr__bindgen_ty_1::__u6_addr8"] + [::std::mem::offset_of!(in6_addr__bindgen_ty_1, __u6_addr8) - 0usize]; + ["Offset of field: in6_addr__bindgen_ty_1::__u6_addr16"] + [::std::mem::offset_of!(in6_addr__bindgen_ty_1, __u6_addr16) - 0usize]; + ["Offset of field: in6_addr__bindgen_ty_1::__u6_addr32"] + [::std::mem::offset_of!(in6_addr__bindgen_ty_1, __u6_addr32) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of in6_addr"][::std::mem::size_of::() - 16usize]; + ["Alignment of in6_addr"][::std::mem::align_of::() - 4usize]; + ["Offset of field: in6_addr::__u6_addr"][::std::mem::offset_of!(in6_addr, __u6_addr) - 0usize]; +}; pub const PF_INOUT: _bindgen_ty_6 = _bindgen_ty_6::PF_INOUT; pub const PF_IN: _bindgen_ty_6 = _bindgen_ty_6::PF_IN; pub const PF_OUT: _bindgen_ty_6 = _bindgen_ty_6::PF_OUT; @@ -455,97 +383,28 @@ pub union pf_addr__bindgen_ty_1 { pub _addr16: [u_int16_t; 8usize], pub _addr32: [u_int32_t; 4usize], } -#[test] -fn bindgen_test_layout_pf_addr__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(pf_addr__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pf_addr__bindgen_ty_1)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._v4addr) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr__bindgen_ty_1), - "::", - stringify!(_v4addr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._v6addr) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr__bindgen_ty_1), - "::", - stringify!(_v6addr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._addr8) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr__bindgen_ty_1), - "::", - stringify!(_addr8) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._addr16) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr__bindgen_ty_1), - "::", - stringify!(_addr16) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._addr32) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr__bindgen_ty_1), - "::", - stringify!(_addr32) - ) - ); -} -#[test] -fn bindgen_test_layout_pf_addr() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(pf_addr)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pf_addr)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pfa) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr), - "::", - stringify!(pfa) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_addr__bindgen_ty_1"][::std::mem::size_of::() - 16usize]; + ["Alignment of pf_addr__bindgen_ty_1"] + [::std::mem::align_of::() - 4usize]; + ["Offset of field: pf_addr__bindgen_ty_1::_v4addr"] + [::std::mem::offset_of!(pf_addr__bindgen_ty_1, _v4addr) - 0usize]; + ["Offset of field: pf_addr__bindgen_ty_1::_v6addr"] + [::std::mem::offset_of!(pf_addr__bindgen_ty_1, _v6addr) - 0usize]; + ["Offset of field: pf_addr__bindgen_ty_1::_addr8"] + [::std::mem::offset_of!(pf_addr__bindgen_ty_1, _addr8) - 0usize]; + ["Offset of field: pf_addr__bindgen_ty_1::_addr16"] + [::std::mem::offset_of!(pf_addr__bindgen_ty_1, _addr16) - 0usize]; + ["Offset of field: pf_addr__bindgen_ty_1::_addr32"] + [::std::mem::offset_of!(pf_addr__bindgen_ty_1, _addr32) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_addr"][::std::mem::size_of::() - 16usize]; + ["Alignment of pf_addr"][::std::mem::align_of::() - 4usize]; + ["Offset of field: pf_addr::pfa"][::std::mem::offset_of!(pf_addr, pfa) - 0usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub struct pf_addr_wrap { @@ -569,114 +428,34 @@ pub struct pf_addr_wrap__bindgen_ty_1__bindgen_ty_1 { pub addr: pf_addr, pub mask: pf_addr, } -#[test] -fn bindgen_test_layout_pf_addr_wrap__bindgen_ty_1__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!( - "Size of: ", - stringify!(pf_addr_wrap__bindgen_ty_1__bindgen_ty_1) - ) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!( - "Alignment of ", - stringify!(pf_addr_wrap__bindgen_ty_1__bindgen_ty_1) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).addr) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(addr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).mask) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(mask) - ) - ); -} -#[test] -fn bindgen_test_layout_pf_addr_wrap__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(pf_addr_wrap__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pf_addr_wrap__bindgen_ty_1)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap__bindgen_ty_1), - "::", - stringify!(a) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ifname) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap__bindgen_ty_1), - "::", - stringify!(ifname) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tblname) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap__bindgen_ty_1), - "::", - stringify!(tblname) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rtlabelname) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap__bindgen_ty_1), - "::", - stringify!(rtlabelname) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rtlabel) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap__bindgen_ty_1), - "::", - stringify!(rtlabel) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_addr_wrap__bindgen_ty_1__bindgen_ty_1"] + [::std::mem::size_of::() - 32usize]; + ["Alignment of pf_addr_wrap__bindgen_ty_1__bindgen_ty_1"] + [::std::mem::align_of::() - 4usize]; + ["Offset of field: pf_addr_wrap__bindgen_ty_1__bindgen_ty_1::addr"] + [::std::mem::offset_of!(pf_addr_wrap__bindgen_ty_1__bindgen_ty_1, addr) - 0usize]; + ["Offset of field: pf_addr_wrap__bindgen_ty_1__bindgen_ty_1::mask"] + [::std::mem::offset_of!(pf_addr_wrap__bindgen_ty_1__bindgen_ty_1, mask) - 16usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_addr_wrap__bindgen_ty_1"] + [::std::mem::size_of::() - 32usize]; + ["Alignment of pf_addr_wrap__bindgen_ty_1"] + [::std::mem::align_of::() - 4usize]; + ["Offset of field: pf_addr_wrap__bindgen_ty_1::a"] + [::std::mem::offset_of!(pf_addr_wrap__bindgen_ty_1, a) - 0usize]; + ["Offset of field: pf_addr_wrap__bindgen_ty_1::ifname"] + [::std::mem::offset_of!(pf_addr_wrap__bindgen_ty_1, ifname) - 0usize]; + ["Offset of field: pf_addr_wrap__bindgen_ty_1::tblname"] + [::std::mem::offset_of!(pf_addr_wrap__bindgen_ty_1, tblname) - 0usize]; + ["Offset of field: pf_addr_wrap__bindgen_ty_1::rtlabelname"] + [::std::mem::offset_of!(pf_addr_wrap__bindgen_ty_1, rtlabelname) - 0usize]; + ["Offset of field: pf_addr_wrap__bindgen_ty_1::rtlabel"] + [::std::mem::offset_of!(pf_addr_wrap__bindgen_ty_1, rtlabel) - 0usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub union pf_addr_wrap__bindgen_ty_2 { @@ -685,158 +464,44 @@ pub union pf_addr_wrap__bindgen_ty_2 { pub dyncnt: ::std::os::raw::c_int, pub tblcnt: ::std::os::raw::c_int, } -#[test] -fn bindgen_test_layout_pf_addr_wrap__bindgen_ty_2() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pf_addr_wrap__bindgen_ty_2)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_addr_wrap__bindgen_ty_2)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).dyn_) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap__bindgen_ty_2), - "::", - stringify!(dyn_) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tbl) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap__bindgen_ty_2), - "::", - stringify!(tbl) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).dyncnt) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap__bindgen_ty_2), - "::", - stringify!(dyncnt) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tblcnt) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap__bindgen_ty_2), - "::", - stringify!(tblcnt) - ) - ); -} -#[test] -fn bindgen_test_layout_pf_addr_wrap() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(pf_addr_wrap)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_addr_wrap)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).v) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap), - "::", - stringify!(v) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).p) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap), - "::", - stringify!(p) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap), - "::", - stringify!(type_) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).iflags) as usize - ptr as usize }, - 41usize, - concat!( - "Offset of field: ", - stringify!(pf_addr_wrap), - "::", - stringify!(iflags) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_addr_wrap__bindgen_ty_2"] + [::std::mem::size_of::() - 8usize]; + ["Alignment of pf_addr_wrap__bindgen_ty_2"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_addr_wrap__bindgen_ty_2::dyn_"] + [::std::mem::offset_of!(pf_addr_wrap__bindgen_ty_2, dyn_) - 0usize]; + ["Offset of field: pf_addr_wrap__bindgen_ty_2::tbl"] + [::std::mem::offset_of!(pf_addr_wrap__bindgen_ty_2, tbl) - 0usize]; + ["Offset of field: pf_addr_wrap__bindgen_ty_2::dyncnt"] + [::std::mem::offset_of!(pf_addr_wrap__bindgen_ty_2, dyncnt) - 0usize]; + ["Offset of field: pf_addr_wrap__bindgen_ty_2::tblcnt"] + [::std::mem::offset_of!(pf_addr_wrap__bindgen_ty_2, tblcnt) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_addr_wrap"][::std::mem::size_of::() - 48usize]; + ["Alignment of pf_addr_wrap"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_addr_wrap::v"][::std::mem::offset_of!(pf_addr_wrap, v) - 0usize]; + ["Offset of field: pf_addr_wrap::p"][::std::mem::offset_of!(pf_addr_wrap, p) - 32usize]; + ["Offset of field: pf_addr_wrap::type_"][::std::mem::offset_of!(pf_addr_wrap, type_) - 40usize]; + ["Offset of field: pf_addr_wrap::iflags"] + [::std::mem::offset_of!(pf_addr_wrap, iflags) - 41usize]; +}; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct pf_port_range { pub port: [u_int16_t; 2usize], pub op: u_int8_t, } -#[test] -fn bindgen_test_layout_pf_port_range() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 6usize, - concat!("Size of: ", stringify!(pf_port_range)) - ); - assert_eq!( - ::std::mem::align_of::(), - 2usize, - concat!("Alignment of ", stringify!(pf_port_range)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).port) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_port_range), - "::", - stringify!(port) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).op) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pf_port_range), - "::", - stringify!(op) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_port_range"][::std::mem::size_of::() - 6usize]; + ["Alignment of pf_port_range"][::std::mem::align_of::() - 2usize]; + ["Offset of field: pf_port_range::port"][::std::mem::offset_of!(pf_port_range, port) - 0usize]; + ["Offset of field: pf_port_range::op"][::std::mem::offset_of!(pf_port_range, op) - 4usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub union pf_rule_xport { @@ -844,51 +509,16 @@ pub union pf_rule_xport { pub call_id: u_int16_t, pub spi: u_int32_t, } -#[test] -fn bindgen_test_layout_pf_rule_xport() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pf_rule_xport)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pf_rule_xport)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).range) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_rule_xport), - "::", - stringify!(range) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).call_id) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_rule_xport), - "::", - stringify!(call_id) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).spi) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_rule_xport), - "::", - stringify!(spi) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_rule_xport"][::std::mem::size_of::() - 8usize]; + ["Alignment of pf_rule_xport"][::std::mem::align_of::() - 4usize]; + ["Offset of field: pf_rule_xport::range"] + [::std::mem::offset_of!(pf_rule_xport, range) - 0usize]; + ["Offset of field: pf_rule_xport::call_id"] + [::std::mem::offset_of!(pf_rule_xport, call_id) - 0usize]; + ["Offset of field: pf_rule_xport::spi"][::std::mem::offset_of!(pf_rule_xport, spi) - 0usize]; +}; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct pf_rule_uid { @@ -896,51 +526,14 @@ pub struct pf_rule_uid { pub op: u_int8_t, pub _pad: [u_int8_t; 3usize], } -#[test] -fn bindgen_test_layout_pf_rule_uid() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 12usize, - concat!("Size of: ", stringify!(pf_rule_uid)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pf_rule_uid)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).uid) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_rule_uid), - "::", - stringify!(uid) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).op) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pf_rule_uid), - "::", - stringify!(op) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._pad) as usize - ptr as usize }, - 9usize, - concat!( - "Offset of field: ", - stringify!(pf_rule_uid), - "::", - stringify!(_pad) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_rule_uid"][::std::mem::size_of::() - 12usize]; + ["Alignment of pf_rule_uid"][::std::mem::align_of::() - 4usize]; + ["Offset of field: pf_rule_uid::uid"][::std::mem::offset_of!(pf_rule_uid, uid) - 0usize]; + ["Offset of field: pf_rule_uid::op"][::std::mem::offset_of!(pf_rule_uid, op) - 8usize]; + ["Offset of field: pf_rule_uid::_pad"][::std::mem::offset_of!(pf_rule_uid, _pad) - 9usize]; +}; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct pf_rule_gid { @@ -948,51 +541,14 @@ pub struct pf_rule_gid { pub op: u_int8_t, pub _pad: [u_int8_t; 3usize], } -#[test] -fn bindgen_test_layout_pf_rule_gid() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 12usize, - concat!("Size of: ", stringify!(pf_rule_gid)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pf_rule_gid)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).gid) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_rule_gid), - "::", - stringify!(gid) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).op) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pf_rule_gid), - "::", - stringify!(op) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._pad) as usize - ptr as usize }, - 9usize, - concat!( - "Offset of field: ", - stringify!(pf_rule_gid), - "::", - stringify!(_pad) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_rule_gid"][::std::mem::size_of::() - 12usize]; + ["Alignment of pf_rule_gid"][::std::mem::align_of::() - 4usize]; + ["Offset of field: pf_rule_gid::gid"][::std::mem::offset_of!(pf_rule_gid, gid) - 0usize]; + ["Offset of field: pf_rule_gid::op"][::std::mem::offset_of!(pf_rule_gid, op) - 8usize]; + ["Offset of field: pf_rule_gid::_pad"][::std::mem::offset_of!(pf_rule_gid, _pad) - 9usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub struct pf_rule_addr { @@ -1000,51 +556,14 @@ pub struct pf_rule_addr { pub xport: pf_rule_xport, pub neg: u_int8_t, } -#[test] -fn bindgen_test_layout_pf_rule_addr() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 64usize, - concat!("Size of: ", stringify!(pf_rule_addr)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_rule_addr)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).addr) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_rule_addr), - "::", - stringify!(addr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).xport) as usize - ptr as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(pf_rule_addr), - "::", - stringify!(xport) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).neg) as usize - ptr as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(pf_rule_addr), - "::", - stringify!(neg) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_rule_addr"][::std::mem::size_of::() - 64usize]; + ["Alignment of pf_rule_addr"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_rule_addr::addr"][::std::mem::offset_of!(pf_rule_addr, addr) - 0usize]; + ["Offset of field: pf_rule_addr::xport"][::std::mem::offset_of!(pf_rule_addr, xport) - 48usize]; + ["Offset of field: pf_rule_addr::neg"][::std::mem::offset_of!(pf_rule_addr, neg) - 56usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub struct pf_pooladdr { @@ -1059,138 +578,41 @@ pub struct pf_pooladdr__bindgen_ty_1 { pub tqe_next: *mut pf_pooladdr, pub tqe_prev: *mut *mut pf_pooladdr, } -#[test] -fn bindgen_test_layout_pf_pooladdr__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(pf_pooladdr__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_pooladdr__bindgen_ty_1)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tqe_next) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_pooladdr__bindgen_ty_1), - "::", - stringify!(tqe_next) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tqe_prev) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pf_pooladdr__bindgen_ty_1), - "::", - stringify!(tqe_prev) - ) - ); -} -#[test] -fn bindgen_test_layout_pf_pooladdr() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 88usize, - concat!("Size of: ", stringify!(pf_pooladdr)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_pooladdr)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).addr) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_pooladdr), - "::", - stringify!(addr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).entries) as usize - ptr as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(pf_pooladdr), - "::", - stringify!(entries) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ifname) as usize - ptr as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(pf_pooladdr), - "::", - stringify!(ifname) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).kif) as usize - ptr as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(pf_pooladdr), - "::", - stringify!(kif) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_pooladdr__bindgen_ty_1"] + [::std::mem::size_of::() - 16usize]; + ["Alignment of pf_pooladdr__bindgen_ty_1"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_pooladdr__bindgen_ty_1::tqe_next"] + [::std::mem::offset_of!(pf_pooladdr__bindgen_ty_1, tqe_next) - 0usize]; + ["Offset of field: pf_pooladdr__bindgen_ty_1::tqe_prev"] + [::std::mem::offset_of!(pf_pooladdr__bindgen_ty_1, tqe_prev) - 8usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_pooladdr"][::std::mem::size_of::() - 88usize]; + ["Alignment of pf_pooladdr"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_pooladdr::addr"][::std::mem::offset_of!(pf_pooladdr, addr) - 0usize]; + ["Offset of field: pf_pooladdr::entries"] + [::std::mem::offset_of!(pf_pooladdr, entries) - 48usize]; + ["Offset of field: pf_pooladdr::ifname"][::std::mem::offset_of!(pf_pooladdr, ifname) - 64usize]; + ["Offset of field: pf_pooladdr::kif"][::std::mem::offset_of!(pf_pooladdr, kif) - 80usize]; +}; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct pf_palist { pub tqh_first: *mut pf_pooladdr, pub tqh_last: *mut *mut pf_pooladdr, } -#[test] -fn bindgen_test_layout_pf_palist() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(pf_palist)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_palist)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tqh_first) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_palist), - "::", - stringify!(tqh_first) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tqh_last) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pf_palist), - "::", - stringify!(tqh_last) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_palist"][::std::mem::size_of::() - 16usize]; + ["Alignment of pf_palist"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_palist::tqh_first"] + [::std::mem::offset_of!(pf_palist, tqh_first) - 0usize]; + ["Offset of field: pf_palist::tqh_last"][::std::mem::offset_of!(pf_palist, tqh_last) - 8usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub struct pf_poolhashkey { @@ -1203,77 +625,25 @@ pub union pf_poolhashkey__bindgen_ty_1 { pub key16: [u_int16_t; 8usize], pub key32: [u_int32_t; 4usize], } -#[test] -fn bindgen_test_layout_pf_poolhashkey__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(pf_poolhashkey__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pf_poolhashkey__bindgen_ty_1)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).key8) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_poolhashkey__bindgen_ty_1), - "::", - stringify!(key8) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).key16) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_poolhashkey__bindgen_ty_1), - "::", - stringify!(key16) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).key32) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_poolhashkey__bindgen_ty_1), - "::", - stringify!(key32) - ) - ); -} -#[test] -fn bindgen_test_layout_pf_poolhashkey() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(pf_poolhashkey)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pf_poolhashkey)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pfk) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_poolhashkey), - "::", - stringify!(pfk) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_poolhashkey__bindgen_ty_1"] + [::std::mem::size_of::() - 16usize]; + ["Alignment of pf_poolhashkey__bindgen_ty_1"] + [::std::mem::align_of::() - 4usize]; + ["Offset of field: pf_poolhashkey__bindgen_ty_1::key8"] + [::std::mem::offset_of!(pf_poolhashkey__bindgen_ty_1, key8) - 0usize]; + ["Offset of field: pf_poolhashkey__bindgen_ty_1::key16"] + [::std::mem::offset_of!(pf_poolhashkey__bindgen_ty_1, key16) - 0usize]; + ["Offset of field: pf_poolhashkey__bindgen_ty_1::key32"] + [::std::mem::offset_of!(pf_poolhashkey__bindgen_ty_1, key32) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_poolhashkey"][::std::mem::size_of::() - 16usize]; + ["Alignment of pf_poolhashkey"][::std::mem::align_of::() - 4usize]; + ["Offset of field: pf_poolhashkey::pfk"][::std::mem::offset_of!(pf_poolhashkey, pfk) - 0usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub struct pf_pool { @@ -1287,111 +657,20 @@ pub struct pf_pool { pub opts: u_int8_t, pub af: sa_family_t, } -#[test] -fn bindgen_test_layout_pf_pool() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 72usize, - concat!("Size of: ", stringify!(pf_pool)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_pool)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).list) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_pool), - "::", - stringify!(list) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).cur) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pf_pool), - "::", - stringify!(cur) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pf_pool), - "::", - stringify!(key) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).counter) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(pf_pool), - "::", - stringify!(counter) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tblidx) as usize - ptr as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(pf_pool), - "::", - stringify!(tblidx) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).proxy_port) as usize - ptr as usize }, - 60usize, - concat!( - "Offset of field: ", - stringify!(pf_pool), - "::", - stringify!(proxy_port) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).port_op) as usize - ptr as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(pf_pool), - "::", - stringify!(port_op) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).opts) as usize - ptr as usize }, - 65usize, - concat!( - "Offset of field: ", - stringify!(pf_pool), - "::", - stringify!(opts) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).af) as usize - ptr as usize }, - 66usize, - concat!( - "Offset of field: ", - stringify!(pf_pool), - "::", - stringify!(af) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_pool"][::std::mem::size_of::() - 72usize]; + ["Alignment of pf_pool"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_pool::list"][::std::mem::offset_of!(pf_pool, list) - 0usize]; + ["Offset of field: pf_pool::cur"][::std::mem::offset_of!(pf_pool, cur) - 16usize]; + ["Offset of field: pf_pool::key"][::std::mem::offset_of!(pf_pool, key) - 24usize]; + ["Offset of field: pf_pool::counter"][::std::mem::offset_of!(pf_pool, counter) - 40usize]; + ["Offset of field: pf_pool::tblidx"][::std::mem::offset_of!(pf_pool, tblidx) - 56usize]; + ["Offset of field: pf_pool::proxy_port"][::std::mem::offset_of!(pf_pool, proxy_port) - 60usize]; + ["Offset of field: pf_pool::port_op"][::std::mem::offset_of!(pf_pool, port_op) - 64usize]; + ["Offset of field: pf_pool::opts"][::std::mem::offset_of!(pf_pool, opts) - 65usize]; + ["Offset of field: pf_pool::af"][::std::mem::offset_of!(pf_pool, af) - 66usize]; +}; pub type pf_osfp_t = u_int32_t; #[repr(C)] #[derive(Copy, Clone)] @@ -1399,41 +678,13 @@ pub union pf_rule_ptr { pub ptr: *mut pf_rule, pub nr: u_int32_t, } -#[test] -fn bindgen_test_layout_pf_rule_ptr() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pf_rule_ptr)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_rule_ptr)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_rule_ptr), - "::", - stringify!(ptr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).nr) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_rule_ptr), - "::", - stringify!(nr) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_rule_ptr"][::std::mem::size_of::() - 8usize]; + ["Alignment of pf_rule_ptr"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_rule_ptr::ptr"][::std::mem::offset_of!(pf_rule_ptr, ptr) - 0usize]; + ["Offset of field: pf_rule_ptr::nr"][::std::mem::offset_of!(pf_rule_ptr, nr) - 0usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub struct pf_rule { @@ -1518,839 +769,130 @@ pub struct pf_rule__bindgen_ty_1 { pub tqe_next: *mut pf_rule, pub tqe_prev: *mut *mut pf_rule, } -#[test] -fn bindgen_test_layout_pf_rule__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(pf_rule__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_rule__bindgen_ty_1)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tqe_next) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_rule__bindgen_ty_1), - "::", - stringify!(tqe_next) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tqe_prev) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pf_rule__bindgen_ty_1), - "::", - stringify!(tqe_prev) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_rule__bindgen_ty_1"][::std::mem::size_of::() - 16usize]; + ["Alignment of pf_rule__bindgen_ty_1"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_rule__bindgen_ty_1::tqe_next"] + [::std::mem::offset_of!(pf_rule__bindgen_ty_1, tqe_next) - 0usize]; + ["Offset of field: pf_rule__bindgen_ty_1::tqe_prev"] + [::std::mem::offset_of!(pf_rule__bindgen_ty_1, tqe_prev) - 8usize]; +}; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct pf_rule__bindgen_ty_2 { pub limit: u_int32_t, pub seconds: u_int32_t, } -#[test] -fn bindgen_test_layout_pf_rule__bindgen_ty_2() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pf_rule__bindgen_ty_2)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pf_rule__bindgen_ty_2)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).limit) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_rule__bindgen_ty_2), - "::", - stringify!(limit) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).seconds) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pf_rule__bindgen_ty_2), - "::", - stringify!(seconds) - ) - ); -} -#[test] -fn bindgen_test_layout_pf_rule() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 1040usize, - concat!("Size of: ", stringify!(pf_rule)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_rule)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).src) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(src) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).dst) as usize - ptr as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(dst) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).skip) as usize - ptr as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(skip) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).label) as usize - ptr as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(label) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ifname) as usize - ptr as usize }, - 256usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(ifname) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).qname) as usize - ptr as usize }, - 272usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(qname) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pqname) as usize - ptr as usize }, - 336usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(pqname) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tagname) as usize - ptr as usize }, - 400usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(tagname) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).match_tagname) as usize - ptr as usize }, - 464usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(match_tagname) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).overload_tblname) as usize - ptr as usize }, - 528usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(overload_tblname) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).entries) as usize - ptr as usize }, - 560usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(entries) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rpool) as usize - ptr as usize }, - 576usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(rpool) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).evaluations) as usize - ptr as usize }, - 648usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(evaluations) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).packets) as usize - ptr as usize }, - 656usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(packets) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).bytes) as usize - ptr as usize }, - 672usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(bytes) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ticket) as usize - ptr as usize }, - 688usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(ticket) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).owner) as usize - ptr as usize }, - 696usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(owner) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).priority) as usize - ptr as usize }, - 760usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(priority) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).kif) as usize - ptr as usize }, - 768usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(kif) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).anchor) as usize - ptr as usize }, - 776usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(anchor) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).overload_tbl) as usize - ptr as usize }, - 784usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(overload_tbl) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).os_fingerprint) as usize - ptr as usize }, - 792usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(os_fingerprint) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rtableid) as usize - ptr as usize }, - 796usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(rtableid) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).timeout) as usize - ptr as usize }, - 800usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(timeout) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).states) as usize - ptr as usize }, - 904usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(states) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).max_states) as usize - ptr as usize }, - 908usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(max_states) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).src_nodes) as usize - ptr as usize }, - 912usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(src_nodes) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).max_src_nodes) as usize - ptr as usize }, - 916usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(max_src_nodes) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).max_src_states) as usize - ptr as usize }, - 920usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(max_src_states) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).max_src_conn) as usize - ptr as usize }, - 924usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(max_src_conn) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).max_src_conn_rate) as usize - ptr as usize }, - 928usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(max_src_conn_rate) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).qid) as usize - ptr as usize }, - 936usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(qid) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pqid) as usize - ptr as usize }, - 940usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(pqid) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rt_listid) as usize - ptr as usize }, - 944usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(rt_listid) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).nr) as usize - ptr as usize }, - 948usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(nr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).prob) as usize - ptr as usize }, - 952usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(prob) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).cuid) as usize - ptr as usize }, - 956usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(cuid) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).cpid) as usize - ptr as usize }, - 960usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(cpid) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).return_icmp) as usize - ptr as usize }, - 964usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(return_icmp) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).return_icmp6) as usize - ptr as usize }, - 966usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(return_icmp6) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).max_mss) as usize - ptr as usize }, - 968usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(max_mss) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tag) as usize - ptr as usize }, - 970usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(tag) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).match_tag) as usize - ptr as usize }, - 972usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(match_tag) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).uid) as usize - ptr as usize }, - 976usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(uid) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).gid) as usize - ptr as usize }, - 988usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(gid) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rule_flag) as usize - ptr as usize }, - 1000usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(rule_flag) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).action) as usize - ptr as usize }, - 1004usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(action) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).direction) as usize - ptr as usize }, - 1005usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(direction) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).log) as usize - ptr as usize }, - 1006usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(log) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).logif) as usize - ptr as usize }, - 1007usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(logif) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).quick) as usize - ptr as usize }, - 1008usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(quick) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ifnot) as usize - ptr as usize }, - 1009usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(ifnot) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).match_tag_not) as usize - ptr as usize }, - 1010usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(match_tag_not) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).natpass) as usize - ptr as usize }, - 1011usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(natpass) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).keep_state) as usize - ptr as usize }, - 1012usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(keep_state) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).af) as usize - ptr as usize }, - 1013usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(af) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).proto) as usize - ptr as usize }, - 1014usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(proto) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, - 1015usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(type_) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).code) as usize - ptr as usize }, - 1016usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(code) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, - 1017usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).flagset) as usize - ptr as usize }, - 1018usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(flagset) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).min_ttl) as usize - ptr as usize }, - 1019usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(min_ttl) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).allow_opts) as usize - ptr as usize }, - 1020usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(allow_opts) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rt) as usize - ptr as usize }, - 1021usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(rt) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).return_ttl) as usize - ptr as usize }, - 1022usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(return_ttl) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tos) as usize - ptr as usize }, - 1023usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(tos) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).anchor_relative) as usize - ptr as usize }, - 1024usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(anchor_relative) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).anchor_wildcard) as usize - ptr as usize }, - 1025usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(anchor_wildcard) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).flush) as usize - ptr as usize }, - 1026usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(flush) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).proto_variant) as usize - ptr as usize }, - 1027usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(proto_variant) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).extfilter) as usize - ptr as usize }, - 1028usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(extfilter) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).extmap) as usize - ptr as usize }, - 1029usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(extmap) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).dnpipe) as usize - ptr as usize }, - 1032usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(dnpipe) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).dntype) as usize - ptr as usize }, - 1036usize, - concat!( - "Offset of field: ", - stringify!(pf_rule), - "::", - stringify!(dntype) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_rule__bindgen_ty_2"][::std::mem::size_of::() - 8usize]; + ["Alignment of pf_rule__bindgen_ty_2"] + [::std::mem::align_of::() - 4usize]; + ["Offset of field: pf_rule__bindgen_ty_2::limit"] + [::std::mem::offset_of!(pf_rule__bindgen_ty_2, limit) - 0usize]; + ["Offset of field: pf_rule__bindgen_ty_2::seconds"] + [::std::mem::offset_of!(pf_rule__bindgen_ty_2, seconds) - 4usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_rule"][::std::mem::size_of::() - 1040usize]; + ["Alignment of pf_rule"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_rule::src"][::std::mem::offset_of!(pf_rule, src) - 0usize]; + ["Offset of field: pf_rule::dst"][::std::mem::offset_of!(pf_rule, dst) - 64usize]; + ["Offset of field: pf_rule::skip"][::std::mem::offset_of!(pf_rule, skip) - 128usize]; + ["Offset of field: pf_rule::label"][::std::mem::offset_of!(pf_rule, label) - 192usize]; + ["Offset of field: pf_rule::ifname"][::std::mem::offset_of!(pf_rule, ifname) - 256usize]; + ["Offset of field: pf_rule::qname"][::std::mem::offset_of!(pf_rule, qname) - 272usize]; + ["Offset of field: pf_rule::pqname"][::std::mem::offset_of!(pf_rule, pqname) - 336usize]; + ["Offset of field: pf_rule::tagname"][::std::mem::offset_of!(pf_rule, tagname) - 400usize]; + ["Offset of field: pf_rule::match_tagname"] + [::std::mem::offset_of!(pf_rule, match_tagname) - 464usize]; + ["Offset of field: pf_rule::overload_tblname"] + [::std::mem::offset_of!(pf_rule, overload_tblname) - 528usize]; + ["Offset of field: pf_rule::entries"][::std::mem::offset_of!(pf_rule, entries) - 560usize]; + ["Offset of field: pf_rule::rpool"][::std::mem::offset_of!(pf_rule, rpool) - 576usize]; + ["Offset of field: pf_rule::evaluations"] + [::std::mem::offset_of!(pf_rule, evaluations) - 648usize]; + ["Offset of field: pf_rule::packets"][::std::mem::offset_of!(pf_rule, packets) - 656usize]; + ["Offset of field: pf_rule::bytes"][::std::mem::offset_of!(pf_rule, bytes) - 672usize]; + ["Offset of field: pf_rule::ticket"][::std::mem::offset_of!(pf_rule, ticket) - 688usize]; + ["Offset of field: pf_rule::owner"][::std::mem::offset_of!(pf_rule, owner) - 696usize]; + ["Offset of field: pf_rule::priority"][::std::mem::offset_of!(pf_rule, priority) - 760usize]; + ["Offset of field: pf_rule::kif"][::std::mem::offset_of!(pf_rule, kif) - 768usize]; + ["Offset of field: pf_rule::anchor"][::std::mem::offset_of!(pf_rule, anchor) - 776usize]; + ["Offset of field: pf_rule::overload_tbl"] + [::std::mem::offset_of!(pf_rule, overload_tbl) - 784usize]; + ["Offset of field: pf_rule::os_fingerprint"] + [::std::mem::offset_of!(pf_rule, os_fingerprint) - 792usize]; + ["Offset of field: pf_rule::rtableid"][::std::mem::offset_of!(pf_rule, rtableid) - 796usize]; + ["Offset of field: pf_rule::timeout"][::std::mem::offset_of!(pf_rule, timeout) - 800usize]; + ["Offset of field: pf_rule::states"][::std::mem::offset_of!(pf_rule, states) - 904usize]; + ["Offset of field: pf_rule::max_states"] + [::std::mem::offset_of!(pf_rule, max_states) - 908usize]; + ["Offset of field: pf_rule::src_nodes"][::std::mem::offset_of!(pf_rule, src_nodes) - 912usize]; + ["Offset of field: pf_rule::max_src_nodes"] + [::std::mem::offset_of!(pf_rule, max_src_nodes) - 916usize]; + ["Offset of field: pf_rule::max_src_states"] + [::std::mem::offset_of!(pf_rule, max_src_states) - 920usize]; + ["Offset of field: pf_rule::max_src_conn"] + [::std::mem::offset_of!(pf_rule, max_src_conn) - 924usize]; + ["Offset of field: pf_rule::max_src_conn_rate"] + [::std::mem::offset_of!(pf_rule, max_src_conn_rate) - 928usize]; + ["Offset of field: pf_rule::qid"][::std::mem::offset_of!(pf_rule, qid) - 936usize]; + ["Offset of field: pf_rule::pqid"][::std::mem::offset_of!(pf_rule, pqid) - 940usize]; + ["Offset of field: pf_rule::rt_listid"][::std::mem::offset_of!(pf_rule, rt_listid) - 944usize]; + ["Offset of field: pf_rule::nr"][::std::mem::offset_of!(pf_rule, nr) - 948usize]; + ["Offset of field: pf_rule::prob"][::std::mem::offset_of!(pf_rule, prob) - 952usize]; + ["Offset of field: pf_rule::cuid"][::std::mem::offset_of!(pf_rule, cuid) - 956usize]; + ["Offset of field: pf_rule::cpid"][::std::mem::offset_of!(pf_rule, cpid) - 960usize]; + ["Offset of field: pf_rule::return_icmp"] + [::std::mem::offset_of!(pf_rule, return_icmp) - 964usize]; + ["Offset of field: pf_rule::return_icmp6"] + [::std::mem::offset_of!(pf_rule, return_icmp6) - 966usize]; + ["Offset of field: pf_rule::max_mss"][::std::mem::offset_of!(pf_rule, max_mss) - 968usize]; + ["Offset of field: pf_rule::tag"][::std::mem::offset_of!(pf_rule, tag) - 970usize]; + ["Offset of field: pf_rule::match_tag"][::std::mem::offset_of!(pf_rule, match_tag) - 972usize]; + ["Offset of field: pf_rule::uid"][::std::mem::offset_of!(pf_rule, uid) - 976usize]; + ["Offset of field: pf_rule::gid"][::std::mem::offset_of!(pf_rule, gid) - 988usize]; + ["Offset of field: pf_rule::rule_flag"][::std::mem::offset_of!(pf_rule, rule_flag) - 1000usize]; + ["Offset of field: pf_rule::action"][::std::mem::offset_of!(pf_rule, action) - 1004usize]; + ["Offset of field: pf_rule::direction"][::std::mem::offset_of!(pf_rule, direction) - 1005usize]; + ["Offset of field: pf_rule::log"][::std::mem::offset_of!(pf_rule, log) - 1006usize]; + ["Offset of field: pf_rule::logif"][::std::mem::offset_of!(pf_rule, logif) - 1007usize]; + ["Offset of field: pf_rule::quick"][::std::mem::offset_of!(pf_rule, quick) - 1008usize]; + ["Offset of field: pf_rule::ifnot"][::std::mem::offset_of!(pf_rule, ifnot) - 1009usize]; + ["Offset of field: pf_rule::match_tag_not"] + [::std::mem::offset_of!(pf_rule, match_tag_not) - 1010usize]; + ["Offset of field: pf_rule::natpass"][::std::mem::offset_of!(pf_rule, natpass) - 1011usize]; + ["Offset of field: pf_rule::keep_state"] + [::std::mem::offset_of!(pf_rule, keep_state) - 1012usize]; + ["Offset of field: pf_rule::af"][::std::mem::offset_of!(pf_rule, af) - 1013usize]; + ["Offset of field: pf_rule::proto"][::std::mem::offset_of!(pf_rule, proto) - 1014usize]; + ["Offset of field: pf_rule::type_"][::std::mem::offset_of!(pf_rule, type_) - 1015usize]; + ["Offset of field: pf_rule::code"][::std::mem::offset_of!(pf_rule, code) - 1016usize]; + ["Offset of field: pf_rule::flags"][::std::mem::offset_of!(pf_rule, flags) - 1017usize]; + ["Offset of field: pf_rule::flagset"][::std::mem::offset_of!(pf_rule, flagset) - 1018usize]; + ["Offset of field: pf_rule::min_ttl"][::std::mem::offset_of!(pf_rule, min_ttl) - 1019usize]; + ["Offset of field: pf_rule::allow_opts"] + [::std::mem::offset_of!(pf_rule, allow_opts) - 1020usize]; + ["Offset of field: pf_rule::rt"][::std::mem::offset_of!(pf_rule, rt) - 1021usize]; + ["Offset of field: pf_rule::return_ttl"] + [::std::mem::offset_of!(pf_rule, return_ttl) - 1022usize]; + ["Offset of field: pf_rule::tos"][::std::mem::offset_of!(pf_rule, tos) - 1023usize]; + ["Offset of field: pf_rule::anchor_relative"] + [::std::mem::offset_of!(pf_rule, anchor_relative) - 1024usize]; + ["Offset of field: pf_rule::anchor_wildcard"] + [::std::mem::offset_of!(pf_rule, anchor_wildcard) - 1025usize]; + ["Offset of field: pf_rule::flush"][::std::mem::offset_of!(pf_rule, flush) - 1026usize]; + ["Offset of field: pf_rule::proto_variant"] + [::std::mem::offset_of!(pf_rule, proto_variant) - 1027usize]; + ["Offset of field: pf_rule::extfilter"][::std::mem::offset_of!(pf_rule, extfilter) - 1028usize]; + ["Offset of field: pf_rule::extmap"][::std::mem::offset_of!(pf_rule, extmap) - 1029usize]; + ["Offset of field: pf_rule::dnpipe"][::std::mem::offset_of!(pf_rule, dnpipe) - 1032usize]; + ["Offset of field: pf_rule::dntype"][::std::mem::offset_of!(pf_rule, dntype) - 1036usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub union pf_state_xport { @@ -2358,51 +900,16 @@ pub union pf_state_xport { pub call_id: u_int16_t, pub spi: u_int32_t, } -#[test] -fn bindgen_test_layout_pf_state_xport() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(pf_state_xport)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pf_state_xport)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).port) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_state_xport), - "::", - stringify!(port) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).call_id) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_state_xport), - "::", - stringify!(call_id) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).spi) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_state_xport), - "::", - stringify!(spi) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_state_xport"][::std::mem::size_of::() - 4usize]; + ["Alignment of pf_state_xport"][::std::mem::align_of::() - 4usize]; + ["Offset of field: pf_state_xport::port"] + [::std::mem::offset_of!(pf_state_xport, port) - 0usize]; + ["Offset of field: pf_state_xport::call_id"] + [::std::mem::offset_of!(pf_state_xport, call_id) - 0usize]; + ["Offset of field: pf_state_xport::spi"][::std::mem::offset_of!(pf_state_xport, spi) - 0usize]; +}; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct hook_desc { @@ -2414,41 +921,15 @@ pub struct hook_desc_head { pub tqh_first: *mut hook_desc, pub tqh_last: *mut *mut hook_desc, } -#[test] -fn bindgen_test_layout_hook_desc_head() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(hook_desc_head)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(hook_desc_head)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tqh_first) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(hook_desc_head), - "::", - stringify!(tqh_first) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tqh_last) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(hook_desc_head), - "::", - stringify!(tqh_last) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of hook_desc_head"][::std::mem::size_of::() - 16usize]; + ["Alignment of hook_desc_head"][::std::mem::align_of::() - 8usize]; + ["Offset of field: hook_desc_head::tqh_first"] + [::std::mem::offset_of!(hook_desc_head, tqh_first) - 0usize]; + ["Offset of field: hook_desc_head::tqh_last"] + [::std::mem::offset_of!(hook_desc_head, tqh_last) - 8usize]; +}; #[repr(C, packed)] #[derive(Debug, Copy, Clone)] pub struct pfsync_state_scrub { @@ -2457,61 +938,19 @@ pub struct pfsync_state_scrub { pub scrub_flag: u_int8_t, pub pfss_ts_mod: u_int32_t, } -#[test] -fn bindgen_test_layout_pfsync_state_scrub() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pfsync_state_scrub)) - ); - assert_eq!( - ::std::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(pfsync_state_scrub)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pfss_flags) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_scrub), - "::", - stringify!(pfss_flags) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pfss_ttl) as usize - ptr as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_scrub), - "::", - stringify!(pfss_ttl) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).scrub_flag) as usize - ptr as usize }, - 3usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_scrub), - "::", - stringify!(scrub_flag) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pfss_ts_mod) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_scrub), - "::", - stringify!(pfss_ts_mod) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pfsync_state_scrub"][::std::mem::size_of::() - 8usize]; + ["Alignment of pfsync_state_scrub"][::std::mem::align_of::() - 1usize]; + ["Offset of field: pfsync_state_scrub::pfss_flags"] + [::std::mem::offset_of!(pfsync_state_scrub, pfss_flags) - 0usize]; + ["Offset of field: pfsync_state_scrub::pfss_ttl"] + [::std::mem::offset_of!(pfsync_state_scrub, pfss_ttl) - 2usize]; + ["Offset of field: pfsync_state_scrub::scrub_flag"] + [::std::mem::offset_of!(pfsync_state_scrub, scrub_flag) - 3usize]; + ["Offset of field: pfsync_state_scrub::pfss_ts_mod"] + [::std::mem::offset_of!(pfsync_state_scrub, pfss_ts_mod) - 4usize]; +}; #[repr(C, packed)] #[derive(Copy, Clone)] pub struct pfsync_state_host { @@ -2519,51 +958,17 @@ pub struct pfsync_state_host { pub xport: pf_state_xport, pub pad: [u_int16_t; 2usize], } -#[test] -fn bindgen_test_layout_pfsync_state_host() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(pfsync_state_host)) - ); - assert_eq!( - ::std::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(pfsync_state_host)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).addr) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_host), - "::", - stringify!(addr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).xport) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_host), - "::", - stringify!(xport) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pad) as usize - ptr as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_host), - "::", - stringify!(pad) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pfsync_state_host"][::std::mem::size_of::() - 24usize]; + ["Alignment of pfsync_state_host"][::std::mem::align_of::() - 1usize]; + ["Offset of field: pfsync_state_host::addr"] + [::std::mem::offset_of!(pfsync_state_host, addr) - 0usize]; + ["Offset of field: pfsync_state_host::xport"] + [::std::mem::offset_of!(pfsync_state_host, xport) - 16usize]; + ["Offset of field: pfsync_state_host::pad"] + [::std::mem::offset_of!(pfsync_state_host, pad) - 20usize]; +}; #[repr(C, packed)] #[derive(Debug, Copy, Clone)] pub struct pfsync_state_peer { @@ -2577,111 +982,29 @@ pub struct pfsync_state_peer { pub wscale: u_int8_t, pub pad: [u_int8_t; 6usize], } -#[test] -fn bindgen_test_layout_pfsync_state_peer() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(pfsync_state_peer)) - ); - assert_eq!( - ::std::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(pfsync_state_peer)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).scrub) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_peer), - "::", - stringify!(scrub) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).seqlo) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_peer), - "::", - stringify!(seqlo) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).seqhi) as usize - ptr as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_peer), - "::", - stringify!(seqhi) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).seqdiff) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_peer), - "::", - stringify!(seqdiff) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).max_win) as usize - ptr as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_peer), - "::", - stringify!(max_win) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).mss) as usize - ptr as usize }, - 22usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_peer), - "::", - stringify!(mss) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).state) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_peer), - "::", - stringify!(state) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).wscale) as usize - ptr as usize }, - 25usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_peer), - "::", - stringify!(wscale) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pad) as usize - ptr as usize }, - 26usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state_peer), - "::", - stringify!(pad) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pfsync_state_peer"][::std::mem::size_of::() - 32usize]; + ["Alignment of pfsync_state_peer"][::std::mem::align_of::() - 1usize]; + ["Offset of field: pfsync_state_peer::scrub"] + [::std::mem::offset_of!(pfsync_state_peer, scrub) - 0usize]; + ["Offset of field: pfsync_state_peer::seqlo"] + [::std::mem::offset_of!(pfsync_state_peer, seqlo) - 8usize]; + ["Offset of field: pfsync_state_peer::seqhi"] + [::std::mem::offset_of!(pfsync_state_peer, seqhi) - 12usize]; + ["Offset of field: pfsync_state_peer::seqdiff"] + [::std::mem::offset_of!(pfsync_state_peer, seqdiff) - 16usize]; + ["Offset of field: pfsync_state_peer::max_win"] + [::std::mem::offset_of!(pfsync_state_peer, max_win) - 20usize]; + ["Offset of field: pfsync_state_peer::mss"] + [::std::mem::offset_of!(pfsync_state_peer, mss) - 22usize]; + ["Offset of field: pfsync_state_peer::state"] + [::std::mem::offset_of!(pfsync_state_peer, state) - 24usize]; + ["Offset of field: pfsync_state_peer::wscale"] + [::std::mem::offset_of!(pfsync_state_peer, wscale) - 25usize]; + ["Offset of field: pfsync_state_peer::pad"] + [::std::mem::offset_of!(pfsync_state_peer, pad) - 26usize]; +}; #[repr(C, packed)] #[derive(Copy, Clone)] pub struct pfsync_state { @@ -2717,372 +1040,80 @@ pub struct pfsync_state { pub __pad: u_int8_t, pub flowhash: u_int32_t, } -#[test] -fn bindgen_test_layout_pfsync_state() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 297usize, - concat!("Size of: ", stringify!(pfsync_state)) - ); - assert_eq!( - ::std::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(pfsync_state)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(id) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ifname) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(ifname) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).lan) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(lan) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).gwy) as usize - ptr as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(gwy) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ext_lan) as usize - ptr as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(ext_lan) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ext_gwy) as usize - ptr as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(ext_gwy) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).src) as usize - ptr as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(src) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).dst) as usize - ptr as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(dst) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rt_addr) as usize - ptr as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(rt_addr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).unlink_hooks) as usize - ptr as usize }, - 200usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(unlink_hooks) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rule) as usize - ptr as usize }, - 216usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(rule) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).anchor) as usize - ptr as usize }, - 220usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(anchor) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).nat_rule) as usize - ptr as usize }, - 224usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(nat_rule) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).creation) as usize - ptr as usize }, - 228usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(creation) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).expire) as usize - ptr as usize }, - 236usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(expire) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).packets) as usize - ptr as usize }, - 244usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(packets) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).bytes) as usize - ptr as usize }, - 260usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(bytes) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).creatorid) as usize - ptr as usize }, - 276usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(creatorid) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tag) as usize - ptr as usize }, - 280usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(tag) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).af_lan) as usize - ptr as usize }, - 282usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(af_lan) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).af_gwy) as usize - ptr as usize }, - 283usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(af_gwy) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).proto) as usize - ptr as usize }, - 284usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(proto) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).direction) as usize - ptr as usize }, - 285usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(direction) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).log) as usize - ptr as usize }, - 286usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(log) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).allow_opts) as usize - ptr as usize }, - 287usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(allow_opts) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).timeout) as usize - ptr as usize }, - 288usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(timeout) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).sync_flags) as usize - ptr as usize }, - 289usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(sync_flags) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).updates) as usize - ptr as usize }, - 290usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(updates) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).proto_variant) as usize - ptr as usize }, - 291usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(proto_variant) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__pad) as usize - ptr as usize }, - 292usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(__pad) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).flowhash) as usize - ptr as usize }, - 293usize, - concat!( - "Offset of field: ", - stringify!(pfsync_state), - "::", - stringify!(flowhash) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pfsync_state"][::std::mem::size_of::() - 297usize]; + ["Alignment of pfsync_state"][::std::mem::align_of::() - 1usize]; + ["Offset of field: pfsync_state::id"][::std::mem::offset_of!(pfsync_state, id) - 0usize]; + ["Offset of field: pfsync_state::ifname"] + [::std::mem::offset_of!(pfsync_state, ifname) - 8usize]; + ["Offset of field: pfsync_state::lan"][::std::mem::offset_of!(pfsync_state, lan) - 24usize]; + ["Offset of field: pfsync_state::gwy"][::std::mem::offset_of!(pfsync_state, gwy) - 48usize]; + ["Offset of field: pfsync_state::ext_lan"] + [::std::mem::offset_of!(pfsync_state, ext_lan) - 72usize]; + ["Offset of field: pfsync_state::ext_gwy"] + [::std::mem::offset_of!(pfsync_state, ext_gwy) - 96usize]; + ["Offset of field: pfsync_state::src"][::std::mem::offset_of!(pfsync_state, src) - 120usize]; + ["Offset of field: pfsync_state::dst"][::std::mem::offset_of!(pfsync_state, dst) - 152usize]; + ["Offset of field: pfsync_state::rt_addr"] + [::std::mem::offset_of!(pfsync_state, rt_addr) - 184usize]; + ["Offset of field: pfsync_state::unlink_hooks"] + [::std::mem::offset_of!(pfsync_state, unlink_hooks) - 200usize]; + ["Offset of field: pfsync_state::rule"][::std::mem::offset_of!(pfsync_state, rule) - 216usize]; + ["Offset of field: pfsync_state::anchor"] + [::std::mem::offset_of!(pfsync_state, anchor) - 220usize]; + ["Offset of field: pfsync_state::nat_rule"] + [::std::mem::offset_of!(pfsync_state, nat_rule) - 224usize]; + ["Offset of field: pfsync_state::creation"] + [::std::mem::offset_of!(pfsync_state, creation) - 228usize]; + ["Offset of field: pfsync_state::expire"] + [::std::mem::offset_of!(pfsync_state, expire) - 236usize]; + ["Offset of field: pfsync_state::packets"] + [::std::mem::offset_of!(pfsync_state, packets) - 244usize]; + ["Offset of field: pfsync_state::bytes"] + [::std::mem::offset_of!(pfsync_state, bytes) - 260usize]; + ["Offset of field: pfsync_state::creatorid"] + [::std::mem::offset_of!(pfsync_state, creatorid) - 276usize]; + ["Offset of field: pfsync_state::tag"][::std::mem::offset_of!(pfsync_state, tag) - 280usize]; + ["Offset of field: pfsync_state::af_lan"] + [::std::mem::offset_of!(pfsync_state, af_lan) - 282usize]; + ["Offset of field: pfsync_state::af_gwy"] + [::std::mem::offset_of!(pfsync_state, af_gwy) - 283usize]; + ["Offset of field: pfsync_state::proto"] + [::std::mem::offset_of!(pfsync_state, proto) - 284usize]; + ["Offset of field: pfsync_state::direction"] + [::std::mem::offset_of!(pfsync_state, direction) - 285usize]; + ["Offset of field: pfsync_state::log"][::std::mem::offset_of!(pfsync_state, log) - 286usize]; + ["Offset of field: pfsync_state::allow_opts"] + [::std::mem::offset_of!(pfsync_state, allow_opts) - 287usize]; + ["Offset of field: pfsync_state::timeout"] + [::std::mem::offset_of!(pfsync_state, timeout) - 288usize]; + ["Offset of field: pfsync_state::sync_flags"] + [::std::mem::offset_of!(pfsync_state, sync_flags) - 289usize]; + ["Offset of field: pfsync_state::updates"] + [::std::mem::offset_of!(pfsync_state, updates) - 290usize]; + ["Offset of field: pfsync_state::proto_variant"] + [::std::mem::offset_of!(pfsync_state, proto_variant) - 291usize]; + ["Offset of field: pfsync_state::__pad"] + [::std::mem::offset_of!(pfsync_state, __pad) - 292usize]; + ["Offset of field: pfsync_state::flowhash"] + [::std::mem::offset_of!(pfsync_state, flowhash) - 293usize]; +}; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct pf_rulequeue { pub tqh_first: *mut pf_rule, pub tqh_last: *mut *mut pf_rule, } -#[test] -fn bindgen_test_layout_pf_rulequeue() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(pf_rulequeue)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_rulequeue)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tqh_first) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_rulequeue), - "::", - stringify!(tqh_first) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tqh_last) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pf_rulequeue), - "::", - stringify!(tqh_last) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_rulequeue"][::std::mem::size_of::() - 16usize]; + ["Alignment of pf_rulequeue"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_rulequeue::tqh_first"] + [::std::mem::offset_of!(pf_rulequeue, tqh_first) - 0usize]; + ["Offset of field: pf_rulequeue::tqh_last"] + [::std::mem::offset_of!(pf_rulequeue, tqh_last) - 8usize]; +}; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct pf_ruleset { @@ -3109,229 +1140,61 @@ pub struct pf_ruleset__bindgen_ty_1__bindgen_ty_1 { pub ticket: u_int32_t, pub open: ::std::os::raw::c_int, } -#[test] -fn bindgen_test_layout_pf_ruleset__bindgen_ty_1__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!( - "Size of: ", - stringify!(pf_ruleset__bindgen_ty_1__bindgen_ty_1) - ) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(pf_ruleset__bindgen_ty_1__bindgen_ty_1) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_ruleset__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(ptr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ptr_array) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pf_ruleset__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(ptr_array) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rcount) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pf_ruleset__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(rcount) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rsize) as usize - ptr as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(pf_ruleset__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(rsize) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ticket) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pf_ruleset__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(ticket) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).open) as usize - ptr as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(pf_ruleset__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(open) - ) - ); -} -#[test] -fn bindgen_test_layout_pf_ruleset__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 96usize, - concat!("Size of: ", stringify!(pf_ruleset__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_ruleset__bindgen_ty_1)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).queues) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_ruleset__bindgen_ty_1), - "::", - stringify!(queues) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).active) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(pf_ruleset__bindgen_ty_1), - "::", - stringify!(active) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).inactive) as usize - ptr as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(pf_ruleset__bindgen_ty_1), - "::", - stringify!(inactive) - ) - ); -} -#[test] -fn bindgen_test_layout_pf_ruleset() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 600usize, - concat!("Size of: ", stringify!(pf_ruleset)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_ruleset)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rules) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_ruleset), - "::", - stringify!(rules) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).anchor) as usize - ptr as usize }, - 576usize, - concat!( - "Offset of field: ", - stringify!(pf_ruleset), - "::", - stringify!(anchor) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tticket) as usize - ptr as usize }, - 584usize, - concat!( - "Offset of field: ", - stringify!(pf_ruleset), - "::", - stringify!(tticket) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tables) as usize - ptr as usize }, - 588usize, - concat!( - "Offset of field: ", - stringify!(pf_ruleset), - "::", - stringify!(tables) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).topen) as usize - ptr as usize }, - 592usize, - concat!( - "Offset of field: ", - stringify!(pf_ruleset), - "::", - stringify!(topen) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_ruleset__bindgen_ty_1__bindgen_ty_1"] + [::std::mem::size_of::() - 32usize]; + ["Alignment of pf_ruleset__bindgen_ty_1__bindgen_ty_1"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_ruleset__bindgen_ty_1__bindgen_ty_1::ptr"] + [::std::mem::offset_of!(pf_ruleset__bindgen_ty_1__bindgen_ty_1, ptr) - 0usize]; + ["Offset of field: pf_ruleset__bindgen_ty_1__bindgen_ty_1::ptr_array"] + [::std::mem::offset_of!(pf_ruleset__bindgen_ty_1__bindgen_ty_1, ptr_array) - 8usize]; + ["Offset of field: pf_ruleset__bindgen_ty_1__bindgen_ty_1::rcount"] + [::std::mem::offset_of!(pf_ruleset__bindgen_ty_1__bindgen_ty_1, rcount) - 16usize]; + ["Offset of field: pf_ruleset__bindgen_ty_1__bindgen_ty_1::rsize"] + [::std::mem::offset_of!(pf_ruleset__bindgen_ty_1__bindgen_ty_1, rsize) - 20usize]; + ["Offset of field: pf_ruleset__bindgen_ty_1__bindgen_ty_1::ticket"] + [::std::mem::offset_of!(pf_ruleset__bindgen_ty_1__bindgen_ty_1, ticket) - 24usize]; + ["Offset of field: pf_ruleset__bindgen_ty_1__bindgen_ty_1::open"] + [::std::mem::offset_of!(pf_ruleset__bindgen_ty_1__bindgen_ty_1, open) - 28usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_ruleset__bindgen_ty_1"] + [::std::mem::size_of::() - 96usize]; + ["Alignment of pf_ruleset__bindgen_ty_1"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_ruleset__bindgen_ty_1::queues"] + [::std::mem::offset_of!(pf_ruleset__bindgen_ty_1, queues) - 0usize]; + ["Offset of field: pf_ruleset__bindgen_ty_1::active"] + [::std::mem::offset_of!(pf_ruleset__bindgen_ty_1, active) - 32usize]; + ["Offset of field: pf_ruleset__bindgen_ty_1::inactive"] + [::std::mem::offset_of!(pf_ruleset__bindgen_ty_1, inactive) - 64usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_ruleset"][::std::mem::size_of::() - 600usize]; + ["Alignment of pf_ruleset"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_ruleset::rules"][::std::mem::offset_of!(pf_ruleset, rules) - 0usize]; + ["Offset of field: pf_ruleset::anchor"][::std::mem::offset_of!(pf_ruleset, anchor) - 576usize]; + ["Offset of field: pf_ruleset::tticket"] + [::std::mem::offset_of!(pf_ruleset, tticket) - 584usize]; + ["Offset of field: pf_ruleset::tables"][::std::mem::offset_of!(pf_ruleset, tables) - 588usize]; + ["Offset of field: pf_ruleset::topen"][::std::mem::offset_of!(pf_ruleset, topen) - 592usize]; +}; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct pf_anchor_node { pub rbh_root: *mut pf_anchor, } -#[test] -fn bindgen_test_layout_pf_anchor_node() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pf_anchor_node)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_anchor_node)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rbh_root) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor_node), - "::", - stringify!(rbh_root) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_anchor_node"][::std::mem::size_of::() - 8usize]; + ["Alignment of pf_anchor_node"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_anchor_node::rbh_root"] + [::std::mem::offset_of!(pf_anchor_node, rbh_root) - 0usize]; +}; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct pf_anchor { @@ -3353,52 +1216,18 @@ pub struct pf_anchor__bindgen_ty_1 { pub rbe_right: *mut pf_anchor, pub rbe_parent: *mut pf_anchor, } -#[test] -fn bindgen_test_layout_pf_anchor__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(pf_anchor__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_anchor__bindgen_ty_1)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rbe_left) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor__bindgen_ty_1), - "::", - stringify!(rbe_left) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rbe_right) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor__bindgen_ty_1), - "::", - stringify!(rbe_right) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rbe_parent) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor__bindgen_ty_1), - "::", - stringify!(rbe_parent) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_anchor__bindgen_ty_1"][::std::mem::size_of::() - 24usize]; + ["Alignment of pf_anchor__bindgen_ty_1"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_anchor__bindgen_ty_1::rbe_left"] + [::std::mem::offset_of!(pf_anchor__bindgen_ty_1, rbe_left) - 0usize]; + ["Offset of field: pf_anchor__bindgen_ty_1::rbe_right"] + [::std::mem::offset_of!(pf_anchor__bindgen_ty_1, rbe_right) - 8usize]; + ["Offset of field: pf_anchor__bindgen_ty_1::rbe_parent"] + [::std::mem::offset_of!(pf_anchor__bindgen_ty_1, rbe_parent) - 16usize]; +}; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct pf_anchor__bindgen_ty_2 { @@ -3406,167 +1235,35 @@ pub struct pf_anchor__bindgen_ty_2 { pub rbe_right: *mut pf_anchor, pub rbe_parent: *mut pf_anchor, } -#[test] -fn bindgen_test_layout_pf_anchor__bindgen_ty_2() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(pf_anchor__bindgen_ty_2)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_anchor__bindgen_ty_2)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rbe_left) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor__bindgen_ty_2), - "::", - stringify!(rbe_left) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rbe_right) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor__bindgen_ty_2), - "::", - stringify!(rbe_right) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rbe_parent) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor__bindgen_ty_2), - "::", - stringify!(rbe_parent) - ) - ); -} -#[test] -fn bindgen_test_layout_pf_anchor() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 1824usize, - concat!("Size of: ", stringify!(pf_anchor)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_anchor)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).entry_global) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor), - "::", - stringify!(entry_global) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).entry_node) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor), - "::", - stringify!(entry_node) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).parent) as usize - ptr as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor), - "::", - stringify!(parent) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).children) as usize - ptr as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor), - "::", - stringify!(children) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).path) as usize - ptr as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor), - "::", - stringify!(path) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ruleset) as usize - ptr as usize }, - 1152usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor), - "::", - stringify!(ruleset) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).refcnt) as usize - ptr as usize }, - 1752usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor), - "::", - stringify!(refcnt) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).match_) as usize - ptr as usize }, - 1756usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor), - "::", - stringify!(match_) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).owner) as usize - ptr as usize }, - 1760usize, - concat!( - "Offset of field: ", - stringify!(pf_anchor), - "::", - stringify!(owner) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_anchor__bindgen_ty_2"][::std::mem::size_of::() - 24usize]; + ["Alignment of pf_anchor__bindgen_ty_2"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_anchor__bindgen_ty_2::rbe_left"] + [::std::mem::offset_of!(pf_anchor__bindgen_ty_2, rbe_left) - 0usize]; + ["Offset of field: pf_anchor__bindgen_ty_2::rbe_right"] + [::std::mem::offset_of!(pf_anchor__bindgen_ty_2, rbe_right) - 8usize]; + ["Offset of field: pf_anchor__bindgen_ty_2::rbe_parent"] + [::std::mem::offset_of!(pf_anchor__bindgen_ty_2, rbe_parent) - 16usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_anchor"][::std::mem::size_of::() - 1824usize]; + ["Alignment of pf_anchor"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_anchor::entry_global"] + [::std::mem::offset_of!(pf_anchor, entry_global) - 0usize]; + ["Offset of field: pf_anchor::entry_node"] + [::std::mem::offset_of!(pf_anchor, entry_node) - 24usize]; + ["Offset of field: pf_anchor::parent"][::std::mem::offset_of!(pf_anchor, parent) - 48usize]; + ["Offset of field: pf_anchor::children"][::std::mem::offset_of!(pf_anchor, children) - 56usize]; + ["Offset of field: pf_anchor::name"][::std::mem::offset_of!(pf_anchor, name) - 64usize]; + ["Offset of field: pf_anchor::path"][::std::mem::offset_of!(pf_anchor, path) - 128usize]; + ["Offset of field: pf_anchor::ruleset"][::std::mem::offset_of!(pf_anchor, ruleset) - 1152usize]; + ["Offset of field: pf_anchor::refcnt"][::std::mem::offset_of!(pf_anchor, refcnt) - 1752usize]; + ["Offset of field: pf_anchor::match_"][::std::mem::offset_of!(pf_anchor, match_) - 1756usize]; + ["Offset of field: pf_anchor::owner"][::std::mem::offset_of!(pf_anchor, owner) - 1760usize]; +}; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct pf_status { @@ -3586,171 +1283,33 @@ pub struct pf_status { pub ifname: [::std::os::raw::c_char; 16usize], pub pf_chksum: [u_int8_t; 16usize], } -#[test] -fn bindgen_test_layout_pf_status() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 440usize, - concat!("Size of: ", stringify!(pf_status)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pf_status)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).counters) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(counters) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).lcounters) as usize - ptr as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(lcounters) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).fcounters) as usize - ptr as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(fcounters) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).scounters) as usize - ptr as usize }, - 216usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(scounters) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pcounters) as usize - ptr as usize }, - 240usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(pcounters) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).bcounters) as usize - ptr as usize }, - 336usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(bcounters) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).stateid) as usize - ptr as usize }, - 368usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(stateid) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).running) as usize - ptr as usize }, - 376usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(running) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).states) as usize - ptr as usize }, - 380usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(states) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).src_nodes) as usize - ptr as usize }, - 384usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(src_nodes) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).since) as usize - ptr as usize }, - 392usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(since) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).debug) as usize - ptr as usize }, - 400usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(debug) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).hostid) as usize - ptr as usize }, - 404usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(hostid) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ifname) as usize - ptr as usize }, - 408usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(ifname) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pf_chksum) as usize - ptr as usize }, - 424usize, - concat!( - "Offset of field: ", - stringify!(pf_status), - "::", - stringify!(pf_chksum) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pf_status"][::std::mem::size_of::() - 440usize]; + ["Alignment of pf_status"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pf_status::counters"][::std::mem::offset_of!(pf_status, counters) - 0usize]; + ["Offset of field: pf_status::lcounters"] + [::std::mem::offset_of!(pf_status, lcounters) - 136usize]; + ["Offset of field: pf_status::fcounters"] + [::std::mem::offset_of!(pf_status, fcounters) - 192usize]; + ["Offset of field: pf_status::scounters"] + [::std::mem::offset_of!(pf_status, scounters) - 216usize]; + ["Offset of field: pf_status::pcounters"] + [::std::mem::offset_of!(pf_status, pcounters) - 240usize]; + ["Offset of field: pf_status::bcounters"] + [::std::mem::offset_of!(pf_status, bcounters) - 336usize]; + ["Offset of field: pf_status::stateid"][::std::mem::offset_of!(pf_status, stateid) - 368usize]; + ["Offset of field: pf_status::running"][::std::mem::offset_of!(pf_status, running) - 376usize]; + ["Offset of field: pf_status::states"][::std::mem::offset_of!(pf_status, states) - 380usize]; + ["Offset of field: pf_status::src_nodes"] + [::std::mem::offset_of!(pf_status, src_nodes) - 384usize]; + ["Offset of field: pf_status::since"][::std::mem::offset_of!(pf_status, since) - 392usize]; + ["Offset of field: pf_status::debug"][::std::mem::offset_of!(pf_status, debug) - 400usize]; + ["Offset of field: pf_status::hostid"][::std::mem::offset_of!(pf_status, hostid) - 404usize]; + ["Offset of field: pf_status::ifname"][::std::mem::offset_of!(pf_status, ifname) - 408usize]; + ["Offset of field: pf_status::pf_chksum"] + [::std::mem::offset_of!(pf_status, pf_chksum) - 424usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub struct pfioc_pooladdr { @@ -3764,111 +1323,27 @@ pub struct pfioc_pooladdr { pub anchor: [::std::os::raw::c_char; 1024usize], pub addr: pf_pooladdr, } -#[test] -fn bindgen_test_layout_pfioc_pooladdr() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 1136usize, - concat!("Size of: ", stringify!(pfioc_pooladdr)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pfioc_pooladdr)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).action) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pfioc_pooladdr), - "::", - stringify!(action) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ticket) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pfioc_pooladdr), - "::", - stringify!(ticket) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).nr) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pfioc_pooladdr), - "::", - stringify!(nr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).r_num) as usize - ptr as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pfioc_pooladdr), - "::", - stringify!(r_num) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).r_action) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pfioc_pooladdr), - "::", - stringify!(r_action) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).r_last) as usize - ptr as usize }, - 17usize, - concat!( - "Offset of field: ", - stringify!(pfioc_pooladdr), - "::", - stringify!(r_last) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).af) as usize - ptr as usize }, - 18usize, - concat!( - "Offset of field: ", - stringify!(pfioc_pooladdr), - "::", - stringify!(af) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).anchor) as usize - ptr as usize }, - 19usize, - concat!( - "Offset of field: ", - stringify!(pfioc_pooladdr), - "::", - stringify!(anchor) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).addr) as usize - ptr as usize }, - 1048usize, - concat!( - "Offset of field: ", - stringify!(pfioc_pooladdr), - "::", - stringify!(addr) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pfioc_pooladdr"][::std::mem::size_of::() - 1136usize]; + ["Alignment of pfioc_pooladdr"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pfioc_pooladdr::action"] + [::std::mem::offset_of!(pfioc_pooladdr, action) - 0usize]; + ["Offset of field: pfioc_pooladdr::ticket"] + [::std::mem::offset_of!(pfioc_pooladdr, ticket) - 4usize]; + ["Offset of field: pfioc_pooladdr::nr"][::std::mem::offset_of!(pfioc_pooladdr, nr) - 8usize]; + ["Offset of field: pfioc_pooladdr::r_num"] + [::std::mem::offset_of!(pfioc_pooladdr, r_num) - 12usize]; + ["Offset of field: pfioc_pooladdr::r_action"] + [::std::mem::offset_of!(pfioc_pooladdr, r_action) - 16usize]; + ["Offset of field: pfioc_pooladdr::r_last"] + [::std::mem::offset_of!(pfioc_pooladdr, r_last) - 17usize]; + ["Offset of field: pfioc_pooladdr::af"][::std::mem::offset_of!(pfioc_pooladdr, af) - 18usize]; + ["Offset of field: pfioc_pooladdr::anchor"] + [::std::mem::offset_of!(pfioc_pooladdr, anchor) - 19usize]; + ["Offset of field: pfioc_pooladdr::addr"] + [::std::mem::offset_of!(pfioc_pooladdr, addr) - 1048usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub struct pfioc_rule { @@ -3880,91 +1355,20 @@ pub struct pfioc_rule { pub anchor_call: [::std::os::raw::c_char; 1024usize], pub rule: pf_rule, } -#[test] -fn bindgen_test_layout_pfioc_rule() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 3104usize, - concat!("Size of: ", stringify!(pfioc_rule)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pfioc_rule)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).action) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pfioc_rule), - "::", - stringify!(action) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ticket) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pfioc_rule), - "::", - stringify!(ticket) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pool_ticket) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pfioc_rule), - "::", - stringify!(pool_ticket) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).nr) as usize - ptr as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(pfioc_rule), - "::", - stringify!(nr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).anchor) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(pfioc_rule), - "::", - stringify!(anchor) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).anchor_call) as usize - ptr as usize }, - 1040usize, - concat!( - "Offset of field: ", - stringify!(pfioc_rule), - "::", - stringify!(anchor_call) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rule) as usize - ptr as usize }, - 2064usize, - concat!( - "Offset of field: ", - stringify!(pfioc_rule), - "::", - stringify!(rule) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pfioc_rule"][::std::mem::size_of::() - 3104usize]; + ["Alignment of pfioc_rule"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pfioc_rule::action"][::std::mem::offset_of!(pfioc_rule, action) - 0usize]; + ["Offset of field: pfioc_rule::ticket"][::std::mem::offset_of!(pfioc_rule, ticket) - 4usize]; + ["Offset of field: pfioc_rule::pool_ticket"] + [::std::mem::offset_of!(pfioc_rule, pool_ticket) - 8usize]; + ["Offset of field: pfioc_rule::nr"][::std::mem::offset_of!(pfioc_rule, nr) - 12usize]; + ["Offset of field: pfioc_rule::anchor"][::std::mem::offset_of!(pfioc_rule, anchor) - 16usize]; + ["Offset of field: pfioc_rule::anchor_call"] + [::std::mem::offset_of!(pfioc_rule, anchor_call) - 1040usize]; + ["Offset of field: pfioc_rule::rule"][::std::mem::offset_of!(pfioc_rule, rule) - 2064usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub struct pfioc_state_addr_kill { @@ -3973,62 +1377,20 @@ pub struct pfioc_state_addr_kill { pub neg: u_int8_t, pub xport: pf_rule_xport, } -#[test] -fn bindgen_test_layout_pfioc_state_addr_kill() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 64usize, - concat!("Size of: ", stringify!(pfioc_state_addr_kill)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pfioc_state_addr_kill)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).addr) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pfioc_state_addr_kill), - "::", - stringify!(addr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).reserved_) as usize - ptr as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(pfioc_state_addr_kill), - "::", - stringify!(reserved_) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).neg) as usize - ptr as usize }, - 51usize, - concat!( - "Offset of field: ", - stringify!(pfioc_state_addr_kill), - "::", - stringify!(neg) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).xport) as usize - ptr as usize }, - 52usize, - concat!( - "Offset of field: ", - stringify!(pfioc_state_addr_kill), - "::", - stringify!(xport) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pfioc_state_addr_kill"][::std::mem::size_of::() - 64usize]; + ["Alignment of pfioc_state_addr_kill"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: pfioc_state_addr_kill::addr"] + [::std::mem::offset_of!(pfioc_state_addr_kill, addr) - 0usize]; + ["Offset of field: pfioc_state_addr_kill::reserved_"] + [::std::mem::offset_of!(pfioc_state_addr_kill, reserved_) - 48usize]; + ["Offset of field: pfioc_state_addr_kill::neg"] + [::std::mem::offset_of!(pfioc_state_addr_kill, neg) - 51usize]; + ["Offset of field: pfioc_state_addr_kill::xport"] + [::std::mem::offset_of!(pfioc_state_addr_kill, xport) - 52usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub struct pfioc_state_kill { @@ -4041,101 +1403,27 @@ pub struct pfioc_state_kill { pub psk_ifname: [::std::os::raw::c_char; 16usize], pub psk_ownername: [::std::os::raw::c_char; 64usize], } -#[test] -fn bindgen_test_layout_pfioc_state_kill() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 216usize, - concat!("Size of: ", stringify!(pfioc_state_kill)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pfioc_state_kill)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).psk_af) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pfioc_state_kill), - "::", - stringify!(psk_af) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).psk_proto) as usize - ptr as usize }, - 1usize, - concat!( - "Offset of field: ", - stringify!(pfioc_state_kill), - "::", - stringify!(psk_proto) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).psk_proto_variant) as usize - ptr as usize }, - 2usize, - concat!( - "Offset of field: ", - stringify!(pfioc_state_kill), - "::", - stringify!(psk_proto_variant) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._pad) as usize - ptr as usize }, - 3usize, - concat!( - "Offset of field: ", - stringify!(pfioc_state_kill), - "::", - stringify!(_pad) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).psk_src) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pfioc_state_kill), - "::", - stringify!(psk_src) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).psk_dst) as usize - ptr as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(pfioc_state_kill), - "::", - stringify!(psk_dst) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).psk_ifname) as usize - ptr as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(pfioc_state_kill), - "::", - stringify!(psk_ifname) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).psk_ownername) as usize - ptr as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(pfioc_state_kill), - "::", - stringify!(psk_ownername) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pfioc_state_kill"][::std::mem::size_of::() - 216usize]; + ["Alignment of pfioc_state_kill"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pfioc_state_kill::psk_af"] + [::std::mem::offset_of!(pfioc_state_kill, psk_af) - 0usize]; + ["Offset of field: pfioc_state_kill::psk_proto"] + [::std::mem::offset_of!(pfioc_state_kill, psk_proto) - 1usize]; + ["Offset of field: pfioc_state_kill::psk_proto_variant"] + [::std::mem::offset_of!(pfioc_state_kill, psk_proto_variant) - 2usize]; + ["Offset of field: pfioc_state_kill::_pad"] + [::std::mem::offset_of!(pfioc_state_kill, _pad) - 3usize]; + ["Offset of field: pfioc_state_kill::psk_src"] + [::std::mem::offset_of!(pfioc_state_kill, psk_src) - 8usize]; + ["Offset of field: pfioc_state_kill::psk_dst"] + [::std::mem::offset_of!(pfioc_state_kill, psk_dst) - 72usize]; + ["Offset of field: pfioc_state_kill::psk_ifname"] + [::std::mem::offset_of!(pfioc_state_kill, psk_ifname) - 136usize]; + ["Offset of field: pfioc_state_kill::psk_ownername"] + [::std::mem::offset_of!(pfioc_state_kill, psk_ownername) - 152usize]; +}; #[repr(C)] #[derive(Copy, Clone)] pub struct pfioc_states { @@ -4148,77 +1436,25 @@ pub union pfioc_states__bindgen_ty_1 { pub psu_buf: caddr_t, pub psu_states: *mut pfsync_state, } -#[test] -fn bindgen_test_layout_pfioc_states__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pfioc_states__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pfioc_states__bindgen_ty_1)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).psu_buf) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pfioc_states__bindgen_ty_1), - "::", - stringify!(psu_buf) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).psu_states) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pfioc_states__bindgen_ty_1), - "::", - stringify!(psu_states) - ) - ); -} -#[test] -fn bindgen_test_layout_pfioc_states() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(pfioc_states)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pfioc_states)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ps_len) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pfioc_states), - "::", - stringify!(ps_len) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ps_u) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pfioc_states), - "::", - stringify!(ps_u) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pfioc_states__bindgen_ty_1"] + [::std::mem::size_of::() - 8usize]; + ["Alignment of pfioc_states__bindgen_ty_1"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: pfioc_states__bindgen_ty_1::psu_buf"] + [::std::mem::offset_of!(pfioc_states__bindgen_ty_1, psu_buf) - 0usize]; + ["Offset of field: pfioc_states__bindgen_ty_1::psu_states"] + [::std::mem::offset_of!(pfioc_states__bindgen_ty_1, psu_states) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pfioc_states"][::std::mem::size_of::() - 16usize]; + ["Alignment of pfioc_states"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pfioc_states::ps_len"] + [::std::mem::offset_of!(pfioc_states, ps_len) - 0usize]; + ["Offset of field: pfioc_states::ps_u"][::std::mem::offset_of!(pfioc_states, ps_u) - 8usize]; +}; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct pfioc_trans { @@ -4233,94 +1469,51 @@ pub struct pfioc_trans_pfioc_trans_e { pub anchor: [::std::os::raw::c_char; 1024usize], pub ticket: u_int32_t, } -#[test] -fn bindgen_test_layout_pfioc_trans_pfioc_trans_e() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 1032usize, - concat!("Size of: ", stringify!(pfioc_trans_pfioc_trans_e)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pfioc_trans_pfioc_trans_e)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rs_num) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pfioc_trans_pfioc_trans_e), - "::", - stringify!(rs_num) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).anchor) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pfioc_trans_pfioc_trans_e), - "::", - stringify!(anchor) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ticket) as usize - ptr as usize }, - 1028usize, - concat!( - "Offset of field: ", - stringify!(pfioc_trans_pfioc_trans_e), - "::", - stringify!(ticket) - ) - ); -} -#[test] -fn bindgen_test_layout_pfioc_trans() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(pfioc_trans)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pfioc_trans)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pfioc_trans), - "::", - stringify!(size) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).esize) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(pfioc_trans), - "::", - stringify!(esize) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).array) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(pfioc_trans), - "::", - stringify!(array) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pfioc_trans_pfioc_trans_e"] + [::std::mem::size_of::() - 1032usize]; + ["Alignment of pfioc_trans_pfioc_trans_e"] + [::std::mem::align_of::() - 4usize]; + ["Offset of field: pfioc_trans_pfioc_trans_e::rs_num"] + [::std::mem::offset_of!(pfioc_trans_pfioc_trans_e, rs_num) - 0usize]; + ["Offset of field: pfioc_trans_pfioc_trans_e::anchor"] + [::std::mem::offset_of!(pfioc_trans_pfioc_trans_e, anchor) - 4usize]; + ["Offset of field: pfioc_trans_pfioc_trans_e::ticket"] + [::std::mem::offset_of!(pfioc_trans_pfioc_trans_e, ticket) - 1028usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pfioc_trans"][::std::mem::size_of::() - 16usize]; + ["Alignment of pfioc_trans"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pfioc_trans::size"][::std::mem::offset_of!(pfioc_trans, size) - 0usize]; + ["Offset of field: pfioc_trans::esize"][::std::mem::offset_of!(pfioc_trans, esize) - 4usize]; + ["Offset of field: pfioc_trans::array"][::std::mem::offset_of!(pfioc_trans, array) - 8usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pfioc_iface { + pub pfiio_name: [::std::os::raw::c_char; 16usize], + pub pfiio_buffer: *mut ::std::os::raw::c_void, + pub pfiio_esize: ::std::os::raw::c_int, + pub pfiio_size: ::std::os::raw::c_int, + pub pfiio_nzero: ::std::os::raw::c_int, + pub pfiio_flags: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pfioc_iface"][::std::mem::size_of::() - 40usize]; + ["Alignment of pfioc_iface"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pfioc_iface::pfiio_name"] + [::std::mem::offset_of!(pfioc_iface, pfiio_name) - 0usize]; + ["Offset of field: pfioc_iface::pfiio_buffer"] + [::std::mem::offset_of!(pfioc_iface, pfiio_buffer) - 16usize]; + ["Offset of field: pfioc_iface::pfiio_esize"] + [::std::mem::offset_of!(pfioc_iface, pfiio_esize) - 24usize]; + ["Offset of field: pfioc_iface::pfiio_size"] + [::std::mem::offset_of!(pfioc_iface, pfiio_size) - 28usize]; + ["Offset of field: pfioc_iface::pfiio_nzero"] + [::std::mem::offset_of!(pfioc_iface, pfiio_nzero) - 32usize]; + ["Offset of field: pfioc_iface::pfiio_flags"] + [::std::mem::offset_of!(pfioc_iface, pfiio_flags) - 36usize]; +}; diff --git a/src/lib.rs b/src/lib.rs index 5b76f98..0f19771 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -497,6 +497,37 @@ impl PfCtl { Ok(()) } + /// Set the given interface flags for an interface. + /// + /// These flags can be viewed with 'pfctl -sI -v -i '. + /// See https://man.freebsd.org/cgi/man.cgi?pf(4) + pub fn set_interface_flag( + &mut self, + interface: Interface, + flags: InterfaceFlags, + ) -> Result<()> { + let mut iface = unsafe { mem::zeroed::() }; + interface.try_copy_to(&mut iface.pfiio_name)?; + iface.pfiio_flags = flags as i32; + ioctl_guard!(ffi::pf_set_iface_flag(self.fd(), &mut iface))?; + Ok(()) + } + + /// Clear the given interface flags for an interface. + /// + /// https://man.freebsd.org/cgi/man.cgi?pf(4) + pub fn clear_interface_flag( + &mut self, + interface: Interface, + flags: InterfaceFlags, + ) -> Result<()> { + let mut iface = unsafe { mem::zeroed::() }; + interface.try_copy_to(&mut iface.pfiio_name)?; + iface.pfiio_flags = flags as i32; + ioctl_guard!(ffi::pf_clear_iface_flag(self.fd(), &mut iface))?; + Ok(()) + } + /// Get all states created by stateful rules fn get_states_inner(&mut self) -> Result> { let num_states = self.get_num_states()?; diff --git a/src/rule/interface.rs b/src/rule/interface.rs index 704c6ca..0ae9a92 100644 --- a/src/rule/interface.rs +++ b/src/rule/interface.rs @@ -43,3 +43,11 @@ impl TryCopyTo<[i8]> for Interface { .map_err(|reason| Error::from(ErrorInternal::InvalidInterfaceName(reason))) } } + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[repr(i32)] +pub enum InterfaceFlags { + /// Set or clear the skip flag on an interface. + /// This is equivalent to PFI_IFLAG_SKIP. + Skip = 0x0100, +} diff --git a/tests/helper/pfcli.rs b/tests/helper/pfcli.rs index e7a6796..794e425 100644 --- a/tests/helper/pfcli.rs +++ b/tests/helper/pfcli.rs @@ -87,6 +87,19 @@ pub fn get_all_states() -> Vec { states } +/// Get flags set on interface `iface` +pub fn get_interface_flags(iface: &str) -> Vec { + let output = get_command() + .arg("-sI") + .arg("-v") + .args(["-i", iface]) + .output() + .expect("Failed to run pfctl"); + let output = str_from_stdout(&output.stdout); + let states = output.lines().map(|x| x.trim().to_owned()).collect(); + states +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum FlushOptions { All, diff --git a/tests/interface.rs b/tests/interface.rs new file mode 100644 index 0000000..3723d3f --- /dev/null +++ b/tests/interface.rs @@ -0,0 +1,39 @@ +use helper::pfcli::get_interface_flags; +use pfctl::InterfaceFlags; +use tun::{AbstractDevice, Configuration}; + +#[allow(dead_code)] +mod helper; + +fn before_each() {} +fn after_each() {} + +test!(set_and_reset_interface_flag { + let temp_tun = tun::Device::new(&Configuration::default()).unwrap(); + let temp_tun_name = temp_tun.tun_name().unwrap(); + + let mut pf = pfctl::PfCtl::new().unwrap(); + + let interface = pfctl::Interface::from(&temp_tun_name); + + assert_eq!( + get_interface_flags(&temp_tun_name), + &[temp_tun_name.clone()], + ); + + pf.set_interface_flag(interface.clone(), InterfaceFlags::Skip).unwrap(); + + assert_eq!( + get_interface_flags(&temp_tun_name), + &[format!("{temp_tun_name} (skip)")], + "expected skip flag to be set", + ); + + pf.clear_interface_flag(interface, InterfaceFlags::Skip).unwrap(); + + assert_eq!( + get_interface_flags(&temp_tun_name), + &[temp_tun_name], + "expected skip flag to be cleared", + ); +});