Showing preview only (1,325K chars total). Download the full file or copy to clipboard to get everything.
Repository: little-dude/netlink
Branch: master
Commit: 8fc3843dcc5d
Files: 373
Total size: 1.2 MB
Directory structure:
gitextract_sbpvo7hy/
├── .github/
│ └── workflows/
│ ├── clippy-rustfmt.yml
│ ├── license.yml
│ └── main.yml
├── .gitignore
├── .licenserc.yaml
├── CHANGELOG
├── Cargo.toml
├── LICENSE-MIT
├── README.md
├── RELEASE_PROCESS.md
├── audit/
│ ├── Cargo.toml
│ ├── examples/
│ │ ├── add_rules.rs
│ │ ├── dump_audit_rules.rs
│ │ ├── events.rs
│ │ └── events_async.rs
│ └── src/
│ ├── errors.rs
│ ├── handle.rs
│ └── lib.rs
├── ethtool/
│ ├── Cargo.toml
│ ├── examples/
│ │ ├── dump_coalesce.rs
│ │ ├── dump_features.rs
│ │ ├── dump_link_mode.rs
│ │ ├── dump_pause.rs
│ │ └── dump_rings.rs
│ ├── src/
│ │ ├── coalesce/
│ │ │ ├── attr.rs
│ │ │ ├── get.rs
│ │ │ ├── handle.rs
│ │ │ └── mod.rs
│ │ ├── connection.rs
│ │ ├── error.rs
│ │ ├── feature/
│ │ │ ├── attr.rs
│ │ │ ├── get.rs
│ │ │ ├── handle.rs
│ │ │ └── mod.rs
│ │ ├── handle.rs
│ │ ├── header.rs
│ │ ├── lib.rs
│ │ ├── link_mode/
│ │ │ ├── attr.rs
│ │ │ ├── get.rs
│ │ │ ├── handle.rs
│ │ │ └── mod.rs
│ │ ├── macros.rs
│ │ ├── message.rs
│ │ ├── pause/
│ │ │ ├── attr.rs
│ │ │ ├── get.rs
│ │ │ ├── handle.rs
│ │ │ └── mod.rs
│ │ └── ring/
│ │ ├── attr.rs
│ │ ├── get.rs
│ │ ├── handle.rs
│ │ └── mod.rs
│ └── tests/
│ ├── dump_link_modes.rs
│ └── get_features_lo.rs
├── genetlink/
│ ├── Cargo.toml
│ ├── examples/
│ │ ├── dump_family_policy.rs
│ │ └── list_genetlink_family.rs
│ └── src/
│ ├── connection.rs
│ ├── error.rs
│ ├── handle.rs
│ ├── lib.rs
│ ├── message.rs
│ └── resolver.rs
├── mptcp-pm/
│ ├── Cargo.toml
│ ├── examples/
│ │ └── dump_mptcp.rs
│ ├── src/
│ │ ├── address/
│ │ │ ├── attr.rs
│ │ │ ├── get.rs
│ │ │ ├── handle.rs
│ │ │ └── mod.rs
│ │ ├── connection.rs
│ │ ├── error.rs
│ │ ├── handle.rs
│ │ ├── lib.rs
│ │ ├── limits/
│ │ │ ├── attr.rs
│ │ │ ├── get.rs
│ │ │ ├── handle.rs
│ │ │ └── mod.rs
│ │ ├── macros.rs
│ │ └── message.rs
│ └── tests/
│ └── dump_mptcp.rs
├── netlink-packet-audit/
│ ├── Cargo.toml
│ ├── fuzz/
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ └── fuzz_targets/
│ │ └── netlink.rs
│ └── src/
│ ├── buffer.rs
│ ├── codec.rs
│ ├── constants.rs
│ ├── lib.rs
│ ├── message.rs
│ ├── rules/
│ │ ├── action.rs
│ │ ├── buffer.rs
│ │ ├── field.rs
│ │ ├── flags.rs
│ │ ├── mod.rs
│ │ ├── rule.rs
│ │ ├── syscalls.rs
│ │ └── tests.rs
│ └── status.rs
├── netlink-packet-core/
│ ├── Cargo.toml
│ ├── examples/
│ │ ├── protocol.rs
│ │ └── rtnetlink.rs
│ └── src/
│ ├── buffer.rs
│ ├── constants.rs
│ ├── error.rs
│ ├── header.rs
│ ├── lib.rs
│ ├── message.rs
│ ├── payload.rs
│ └── traits.rs
├── netlink-packet-generic/
│ ├── Cargo.toml
│ ├── examples/
│ │ └── list_generic_family.rs
│ ├── src/
│ │ ├── buffer.rs
│ │ ├── constants.rs
│ │ ├── ctrl/
│ │ │ ├── mod.rs
│ │ │ └── nlas/
│ │ │ ├── mcast.rs
│ │ │ ├── mod.rs
│ │ │ ├── oppolicy.rs
│ │ │ ├── ops.rs
│ │ │ └── policy.rs
│ │ ├── header.rs
│ │ ├── lib.rs
│ │ ├── message.rs
│ │ └── traits.rs
│ └── tests/
│ └── query_family_id.rs
├── netlink-packet-netfilter/
│ ├── Cargo.toml
│ ├── examples/
│ │ └── nflog.rs
│ └── src/
│ ├── buffer.rs
│ ├── constants.rs
│ ├── lib.rs
│ ├── message.rs
│ └── nflog/
│ ├── message.rs
│ ├── mod.rs
│ └── nlas/
│ ├── config/
│ │ ├── config_cmd.rs
│ │ ├── config_flags.rs
│ │ ├── config_mode.rs
│ │ ├── mod.rs
│ │ ├── nla.rs
│ │ └── timeout.rs
│ ├── mod.rs
│ └── packet/
│ ├── hw_addr.rs
│ ├── mod.rs
│ ├── nla.rs
│ ├── packet_hdr.rs
│ └── timestamp.rs
├── netlink-packet-route/
│ ├── Cargo.toml
│ ├── benches/
│ │ ├── link_message.rs
│ │ └── rtnetlink_dump.rs
│ ├── data/
│ │ ├── README.md
│ │ └── rtnetlink.pcap
│ ├── examples/
│ │ ├── dump_neighbours.rs
│ │ ├── dump_packet_link_bridge_vlan.rs
│ │ ├── dump_packet_links.rs
│ │ ├── dump_rules.rs
│ │ └── new_rule.rs
│ ├── fuzz/
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ └── fuzz_targets/
│ │ └── netlink.rs
│ └── src/
│ ├── lib.rs
│ └── rtnl/
│ ├── address/
│ │ ├── buffer.rs
│ │ ├── message.rs
│ │ ├── mod.rs
│ │ └── nlas/
│ │ ├── cache_info.rs
│ │ └── mod.rs
│ ├── buffer.rs
│ ├── constants.rs
│ ├── link/
│ │ ├── buffer.rs
│ │ ├── header.rs
│ │ ├── message.rs
│ │ ├── mod.rs
│ │ └── nlas/
│ │ ├── af_spec_bridge.rs
│ │ ├── af_spec_inet.rs
│ │ ├── bond.rs
│ │ ├── inet/
│ │ │ ├── dev_conf.rs
│ │ │ └── mod.rs
│ │ ├── inet6/
│ │ │ ├── cache.rs
│ │ │ ├── dev_conf.rs
│ │ │ ├── icmp6_stats.rs
│ │ │ ├── mod.rs
│ │ │ └── stats.rs
│ │ ├── link_infos.rs
│ │ ├── link_state.rs
│ │ ├── map.rs
│ │ ├── mod.rs
│ │ ├── prop_list.rs
│ │ ├── stats.rs
│ │ ├── stats64.rs
│ │ └── tests.rs
│ ├── message.rs
│ ├── mod.rs
│ ├── neighbour/
│ │ ├── buffer.rs
│ │ ├── header.rs
│ │ ├── message.rs
│ │ ├── mod.rs
│ │ └── nlas/
│ │ ├── cache_info.rs
│ │ └── mod.rs
│ ├── neighbour_table/
│ │ ├── buffer.rs
│ │ ├── header.rs
│ │ ├── message.rs
│ │ ├── mod.rs
│ │ └── nlas/
│ │ ├── config.rs
│ │ ├── mod.rs
│ │ └── stats.rs
│ ├── nsid/
│ │ ├── buffer.rs
│ │ ├── header.rs
│ │ ├── message.rs
│ │ ├── mod.rs
│ │ └── nlas.rs
│ ├── route/
│ │ ├── buffer.rs
│ │ ├── header.rs
│ │ ├── message.rs
│ │ ├── mod.rs
│ │ ├── nlas/
│ │ │ ├── cache_info.rs
│ │ │ ├── metrics.rs
│ │ │ ├── mfc_stats.rs
│ │ │ ├── mod.rs
│ │ │ ├── mpls_ip_tunnel.rs
│ │ │ └── next_hops.rs
│ │ └── test.rs
│ ├── rule/
│ │ ├── buffer.rs
│ │ ├── header.rs
│ │ ├── message.rs
│ │ ├── mod.rs
│ │ └── nlas/
│ │ └── mod.rs
│ ├── tc/
│ │ ├── buffer.rs
│ │ ├── constants.rs
│ │ ├── message.rs
│ │ ├── mod.rs
│ │ ├── nlas/
│ │ │ ├── action/
│ │ │ │ ├── mirred.rs
│ │ │ │ └── mod.rs
│ │ │ ├── filter/
│ │ │ │ ├── mod.rs
│ │ │ │ └── u32.rs
│ │ │ ├── mod.rs
│ │ │ ├── options.rs
│ │ │ ├── qdisc/
│ │ │ │ └── mod.rs
│ │ │ ├── stats.rs
│ │ │ ├── stats_basic.rs
│ │ │ ├── stats_queue.rs
│ │ │ └── test.rs
│ │ └── test.rs
│ └── test.rs
├── netlink-packet-sock-diag/
│ ├── Cargo.toml
│ ├── examples/
│ │ └── dump_ipv4.rs
│ └── src/
│ ├── buffer.rs
│ ├── constants.rs
│ ├── inet/
│ │ ├── mod.rs
│ │ ├── nlas.rs
│ │ ├── request.rs
│ │ ├── response.rs
│ │ ├── socket_id.rs
│ │ └── tests.rs
│ ├── lib.rs
│ ├── message.rs
│ └── unix/
│ ├── mod.rs
│ ├── nlas.rs
│ ├── request.rs
│ ├── response.rs
│ └── tests.rs
├── netlink-packet-utils/
│ ├── Cargo.toml
│ └── src/
│ ├── errors.rs
│ ├── lib.rs
│ ├── macros.rs
│ ├── nla.rs
│ ├── parsers.rs
│ └── traits.rs
├── netlink-packet-wireguard/
│ ├── Cargo.toml
│ ├── examples/
│ │ └── get_wireguard_info.rs
│ └── src/
│ ├── constants.rs
│ ├── lib.rs
│ ├── nlas/
│ │ ├── allowedip.rs
│ │ ├── device.rs
│ │ ├── mod.rs
│ │ └── peer.rs
│ └── raw.rs
├── netlink-proto/
│ ├── Cargo.toml
│ ├── examples/
│ │ ├── audit_netlink_events.rs
│ │ ├── dump_links.rs
│ │ └── dump_links_async.rs
│ └── src/
│ ├── codecs.rs
│ ├── connection.rs
│ ├── errors.rs
│ ├── framed.rs
│ ├── handle.rs
│ ├── lib.rs
│ └── protocol/
│ ├── mod.rs
│ ├── protocol.rs
│ └── request.rs
├── netlink-sys/
│ ├── Cargo.toml
│ ├── examples/
│ │ ├── audit_events.rs
│ │ ├── audit_events_async_std.rs
│ │ ├── audit_events_tokio.rs
│ │ └── audit_events_tokio_manual_thread_builder.rs
│ └── src/
│ ├── addr.rs
│ ├── async_socket.rs
│ ├── async_socket_ext.rs
│ ├── constants.rs
│ ├── lib.rs
│ ├── mio.rs
│ ├── smol.rs
│ ├── socket.rs
│ └── tokio.rs
├── rtnetlink/
│ ├── Cargo.toml
│ ├── examples/
│ │ ├── add_address.rs
│ │ ├── add_neighbour.rs
│ │ ├── add_netns.rs
│ │ ├── add_netns_async.rs
│ │ ├── add_route.rs
│ │ ├── add_route_pref_src.rs
│ │ ├── add_rule.rs
│ │ ├── add_tc_qdisc_ingress.rs
│ │ ├── create_bond.rs
│ │ ├── create_bridge.rs
│ │ ├── create_macvlan.rs
│ │ ├── create_macvtap.rs
│ │ ├── create_veth.rs
│ │ ├── create_vxlan.rs
│ │ ├── del_link.rs
│ │ ├── del_netns.rs
│ │ ├── del_netns_async.rs
│ │ ├── flush_addresses.rs
│ │ ├── get_address.rs
│ │ ├── get_links.rs
│ │ ├── get_links_async.rs
│ │ ├── get_links_thread_builder.rs
│ │ ├── get_neighbours.rs
│ │ ├── get_route.rs
│ │ ├── get_rule.rs
│ │ ├── ip_monitor.rs
│ │ ├── listen.rs
│ │ ├── property_altname.rs
│ │ └── set_link_down.rs
│ └── src/
│ ├── addr/
│ │ ├── add.rs
│ │ ├── del.rs
│ │ ├── get.rs
│ │ ├── handle.rs
│ │ └── mod.rs
│ ├── connection.rs
│ ├── constants.rs
│ ├── errors.rs
│ ├── handle.rs
│ ├── lib.rs
│ ├── link/
│ │ ├── add.rs
│ │ ├── del.rs
│ │ ├── get.rs
│ │ ├── handle.rs
│ │ ├── mod.rs
│ │ ├── property_add.rs
│ │ ├── property_del.rs
│ │ ├── set.rs
│ │ └── test.rs
│ ├── macros.rs
│ ├── neighbour/
│ │ ├── add.rs
│ │ ├── del.rs
│ │ ├── get.rs
│ │ ├── handle.rs
│ │ └── mod.rs
│ ├── ns.rs
│ ├── route/
│ │ ├── add.rs
│ │ ├── del.rs
│ │ ├── get.rs
│ │ ├── handle.rs
│ │ └── mod.rs
│ ├── rule/
│ │ ├── add.rs
│ │ ├── del.rs
│ │ ├── get.rs
│ │ ├── handle.rs
│ │ └── mod.rs
│ └── traffic_control/
│ ├── add_filter.rs
│ ├── add_qdisc.rs
│ ├── del_qdisc.rs
│ ├── get.rs
│ ├── handle.rs
│ ├── mod.rs
│ └── test.rs
└── rustfmt.toml
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/clippy-rustfmt.yml
================================================
name: Rustfmt and clippy check
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
jobs:
rustfmt_clippy:
strategy:
fail-fast: true
name: Rustfmt and clippy check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust Nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy
- name: rustfmt
run: cargo fmt --all -- --check
- name: clippy-tokio-socket
run: cargo clippy --workspace
- name: clippy-smol-socket
run: cargo clippy --no-default-features --features smol_socket --workspace
================================================
FILE: .github/workflows/license.yml
================================================
name: license
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
jobs:
check-license:
name: Check License
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@v3
- name: Check License Header
uses: apache/skywalking-eyes@v0.3.0
================================================
FILE: .github/workflows/main.yml
================================================
name: CI
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
jobs:
ci:
name: CI (stable)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust Stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: test (netlink-sys)
run: |
cargo test -p netlink-sys
cargo test -p netlink-sys --features tokio_socket
- name: test (netlink-packet-audit)
run: cargo test -p netlink-packet-audit
- name: test (netlink-packet-core)
run: cargo test -p netlink-packet-core
- name: test (netlink-packet-generic)
run: cargo test -p netlink-packet-generic
- name: test (netlink-packet-netfilter)
run: cargo test -p netlink-packet-netfilter
- name: test (netlink-packet-route)
run: |
cargo test -p netlink-packet-route
cargo test -p netlink-packet-route --features rich_nlas
- name: test (netlink-packet-sock-diag)
run: cargo test -p netlink-packet-sock-diag
- name: test (netlink-packet-utils)
run: cargo test -p netlink-packet-utils
- name: test (netlink-packet-wireguard)
run: cargo test -p netlink-packet-wireguard
- name: test (netlink-proto)
run: cargo test -p netlink-proto
- name: test (rtnetlink)
env:
# Needed for the `link::test::create_get_delete_w` test to pass.
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: "sudo -E"
run: cargo test -p rtnetlink
- name: test (audit)
run: cargo test -p audit
- name: test (genetlink)
run: cargo test -p genetlink --features tokio_socket
- name: test (ethtool)
run: cargo test -p ethtool
- name: test (mptcp-pm)
env:
# Needed root permission to modify MPTCP
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: "sudo -E"
run: cargo test -p mptcp-pm
================================================
FILE: .gitignore
================================================
**/target
**/*.rs.bk
Cargo.lock
.idea
================================================
FILE: .licenserc.yaml
================================================
header:
license:
content: |
SPDX-License-Identifier: MIT
paths-ignore:
- 'target'
- '**/*.toml'
- '**/*.lock'
- '**/*.yml'
- '**/*.md'
- 'CHANGELOG'
- 'LICENSE-MIT'
- '.gitignore'
comment: on-failure
================================================
FILE: CHANGELOG
================================================
# Changelog
## On-going
### Versioning
### Breaking Changes
### New Features
### Bug fixes
## [20220715] 2022-07-15
### Versioning
* rtnetlink 0.10.1 -> 0.11.0
* netlink-packet-route 0.12.0 -> 0.13.0
### Breaking Changes
* netlink-packet-route: `rtnl::link::nlas::InfoData::Bond` changed from
`Vec<u8>` to `Vec<InfoBond>`. (99b5765)
### New Features
* Add support bond. (99b5765)
### Bug fixes
* Fix the flag of link deletion. (9dccf92)
## [20220624] 2022-06-24
### Versioning
* audit 0.7.0 -> 0.7.1
* ethtool 0.2.2 -> 0.2.3
* genetlink 0.2.2 -> 0.2.3
* mptcp-pm 0.1.0 -> 0.1.1
* netlink-packet-audit 0.4.1 -> 0.4.2
* netlink-packet-wireguard 0.2.1 -> 0.2.2
* rtnetlink 0.10.0 -> 0.10.1
### Breaking Changes
* netlink-proto: removed `netlink-proto::ErrorKind`. (3d799df)
### New Features
* N/A
### Bug fixes
* N/A
## [20220623] 2022-06-23
### Versioning
* audit 0.6.0 -> 0.7.0
* genetlink 0.2.1 -> 0.2.2
* mptcp-pm NULL -> 0.1.0
* netlink-packet-generic 0.2.0 -> 0.3.1
* netlink-packet-audit 0.4.0 -> 0.4.1
* netlink-packet-route 0.11.0 -> 0.12.0
* netlink-proto 0.9.2 -> 0.9.3
* netlink-sys 0.8.2 -> 0.8.3
* rtnetlink 0.9.1 -> 0.10.0
### Breaking Changes
* audit: removed `audit::proto::ErrorKind`. (3d799df)
* netlink-packet-route: changed from `AfSpecBridge::VlanInfo(Vec<u8>)` to
`AfSpecBridge::VlanInfo(BridgeVlanInfo)`. (f21ddb2)
* netlink-packet-route: changed from `Nla::AfSpecBridge(Vec<u8>)` to
`Nla::AfSpecBridge(Vec<AfSpecBridge>)`. (f21ddb2)
* netlink-packet-route: removed `InfoBridge::Flags` and `InfoBridge::VlanInfo`
as they should in `Nla::AfSpecBridge`. (b688737)
* netlink-packet-route: changed `NextHop.gateway` to
`NextHop.nlas`. (f6b3b9a)
* rtnetlink: Removed `rtnetlink::proto::ErrorKind`. (3d799df)
### New Features
* New crate mptcp-pm for MPTCP path manager. (1903b39)
* netlink-packet-route: Add tc filter support. (2c41fb0)
* netlink-packet-route: Add tc qdisc support. (921a936)
* rtnetlink: Add tc filter support. (2c41fb0)
* rtnetlink: Add tc qdisc support. (921a936)
### Bug fixes
* netlink-packet-audit: Simplfied codec error handling.
(33cc558, 0027b82, 9cdc870)
* netlink-packet-route: Fixed tc buffer error. (d2a5109)
* netlink-proto: fix netlink_proto::Error recursive problem. (3d799df)
* netlink-proto: Simplfied codec error handling. (0027b82, 9cdc870)
## [20220220] 2022-02-20
### Versioning
* netlink-packet-netfilter NULL -> 0.1.0
* netlink-sys 0.8.1 -> 0.8.2
* netlink-packet-core 0.4.1 -> 0.4.2
* netlink-packet-utils 0.5.0 -> 0.5.1
* netlink-packet-route 0.10.0 -> 0.11.0
* netlink-packet-sock-diag 0.3.0 -> 0.3.1
* netlink-packet-wireguard 0.2.0 -> 0.2.1
* netlink-proto 0.9.1 -> 0.9.2
* ethtool 0.2.1 -> 0.2.2
* rtnetlink 0.9.0 -> 0.9.1
### New Features
* **new crate netlink-packet-netfilter!** Thank you @dzamlo :) (https://github.com/little-dude/netlink/pull/235)
* netlink-packet-utils: speed up computation of netlink attributes paddins (https://github.com/little-dude/netlink/pull/229)
* netlink-packet-route: support additional MPLS attributes (https://github.com/little-dude/netlink/pull/233)
### Bug fixes
* netlink-packet-sys, netlink-packet-sock-diag, netlink-packet-route, netlink-packet-wireguard, ethtool, netlink-packet-core: clippy fixes (https://github.com/little-dude/netlink/pull/238)
* netlink-packet-route: fix encoding of link info attribute (https://github.com/little-dude/netlink/pull/239)
## [20220212] 2022-02-12
### Versioning
* netlink-packet-wireguard 0.1.1 -> 0.2
### Breaking changes
* netlink-packet-wireguard (https://github.com/little-dude/netlink/pull/225):
* In `netlink_packet_wireguard::nlas::device`: `WgDeviceAttrs::Peers(Vec<Vec<WgPeerAttrs>>)` is now `WgDeviceAttrs::Peers(Vec<WgPeer>>)`
* In `netlink_packet_wireguard::nlas::peer`: `WgDeviceAttrs::AllowedIps(Vec<Vec<WgAllowedIpAttrs>>)` is now `WgDeviceAttrs::AllowedIps(Vec<WgAllowedIp>>)`
### New Features
None
### Bug fixes
* netlink-packet-wireguard (https://github.com/little-dude/netlink/pull/225): various serialization fixes
## [20211229] 2022-01-15
### Versioning
* ethtool 0.2.0 -> 0.2.1 (0.2.0 yanked)
* genetlink 0.2.0 -> 0.2.1 (0.2.0 yanked)
* netlink-packet-wireguard -> 0.1.1 (0.1.0 yanked)
### Breaking changes
None
### New Features
None
### Bug fixes
Fix dependencies in the netlink generic crates. See: https://github.com/little-dude/netlink/pull/223/files
## [20211229] 2021-12-29
### Versioning
* audit 0.4.0 -> 0.6.0 (botched 0.5.0 release)
* ethtool 0.1.0 -> 0.2.0
* genetlink 0.1.0 -> 0.2.0
* netlink-packet-audit 0.2.2 -> 0.4.0 (botched 0.4.0 release)
* netlink-packet-core 0.2.4 -> 0.4.1 (botched 0.3.0 release, 0.4.0 was published with downgraded dependencies to break cycles)
* netlink-packet-generic 0.1.0 -> 0.2.0
* netlink-packet-route 0.8.0 -> 0.10.0 (botched 0.9.0 release)
* netlink-packet-sock-diag 0.1.0 -> 0.3.0 (botched 0.2.0 release)
* netlink-packet-utils 0.4.1 -> 0.5
* netlink-packet-wireguard NULL -> 0.1.0
* netlink-proto 0.7.0 -> 0.9.1 (botched 0.8.0 release, 0.9.0 was published with downgraded dev-dependences to break cycles)
* netlink-sys 0.7.0 -> 0.8.1 (0.8.0 was published with downgraded dev-dependencies to break cycles)
* rtnetlink 0.8.1 -> 0.9.0
### Breaking Changes
- `netlink-packet-route`:
- add `InfoBridge::VlanInfo` (https://github.com/little-dude/netlink/pull/212 https://github.com/little-dude/netlink/pull/213)
- `rtnetlink`:
- add `LinkGetRequest::match_name` to filter links by name more efficiently, and remove `LinkGetRequest::set_name_filter` (https://github.com/little-dude/netlink/pull/208)
- refactor `netlink_packet_core::traits::NetlinkSerializable` and `netlink_packet_core::trait::NetlinkDeserializable` such that they are not generic (https://github.com/little-dude/netlink/pull/195/, specifically https://github.com/little-dude/netlink/pull/195/commits/94c263282d9a34d01422513de6a7f683ac08addc)
- `netlink-proto`: Add new type parameter for `Connection` which represents the socket (https://github.com/little-dude/netlink/pull/195, specifically 944307ce292682283891f41db8a0ec4706419664)
### New Features
- new `netlink-packet-wireguard` crate for the wireguard netlink protocol (https://github.com/little-dude/netlink/pull/191)
- new `rich_nlas` feature for `netlink-packet-route` that enables parsing more message types (https://github.com/little-dude/netlink/pull/199 https://github.com/little-dude/netlink/pull/205)
- `rtnetlink`:
- add `NeighbourAddRequest::add_bridge` helper to create a bridge interface (https://github.com/little-dude/netlink/pull/203)
- allow the requests to be built with the `NLM_F_REPLACE` flag to optimize "create or update" operations (https://github.com/little-dude/netlink/pull/202)
- add helper to create macvlan links (https://github.com/little-dude/netlink/pull/194)
- `netlink-packet-utils`: add `parse_ip` function
### Bug fixes
- fix UB in unsafe code (https://github.com/little-dude/netlink/pull/195/ specifically 7e6cfd743bf822e917e260eb24fbf5b2c541922e)
- fix `netlink_sys::SmolSocket::recv` error handling (https://github.com/little-dude/netlink/pull/195/ specifically 1cd3e0fbb8d77d6b9c4fe43b8c4aa745fa6ba66c)
- various fixes in the `netlink-proto` encoder (https://github.com/little-dude/netlink/pull/168)
## [20210927] 2021-09-27
### Versioning
* audit 0.4.0
* ethtool NULL -> 0.1.0
* genetlink NULL -> 0.1.0
* netlink-packet-audit 0.2.2
* netlink-packet-core 0.2.4
* netlink-packet-generic NULL -> 0.1.0
* netlink-packet-route 0.7.0 -> 0.8.0
* netlink-packet-sock-diag 0.1.0
* netlink-packet-utils 0.4.1
* netlink-proto 0.7.0
* netlink-sys 0.7.0
* rtnetlink 0.8.0 -> 0.8.1
### Breaking Changes
* `netlink_packet_route::rtnl::link::nlas::Nla::PropList` changed from
`PropList(Vec<u8>)` to `PropList(Vec<Prop>)` (b4b3c46)
### New Features
* ethtool: New crate for ethtool netlink protocol (7998f8c, 2b79197, bc43fd6,
2ec5f17, cb8738b)
* genetlink: New create for higher level abstraction of generic netlink
protocol (89ee697)
* netlink-packet-generic: New crate for generic netlink protocol (89ee697)
* netlink-packet-route: Add support of property addition and deletion (cc073b3)
* rtnetlink: Add support of preferred source address (720e764)
### Bug fixes
* netlink-packet-route: vlan: Fix endianness when creating VLAN (b0fd2ea)
* rtnetlink: drop byteordered dependency (8bca238)
================================================
FILE: Cargo.toml
================================================
[workspace]
members = [
"netlink-sys",
"netlink-packet-core",
"netlink-packet-utils",
"netlink-packet-generic",
"netlink-packet-route",
"netlink-packet-route/fuzz",
"netlink-packet-audit",
"netlink-packet-audit/fuzz",
"netlink-packet-sock-diag",
"netlink-packet-netfilter",
"netlink-packet-wireguard",
"netlink-proto",
"ethtool",
"genetlink",
"rtnetlink",
"audit",
"mptcp-pm",
]
# omit fuzz projects
default-members = [
"netlink-sys",
"netlink-packet-core",
"netlink-packet-utils",
"netlink-packet-generic",
"netlink-packet-route",
"netlink-packet-audit",
"netlink-packet-sock-diag",
"netlink-packet-netfilter",
"netlink-packet-wireguard",
"netlink-proto",
"ethtool",
"genetlink",
"rtnetlink",
"audit",
"mptcp-pm",
]
================================================
FILE: LICENSE-MIT
================================================
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Distributions of all or part of the Software intended to be used by the
recipients as they would use the unmodified Software, containing modifications
that substantially alter, remove, or disable functionality of the Software,
outside of the documented configuration mechanisms provided by the Software,
shall be modified such that the Original Author's bug reporting email addresses
and urls are either replaced with the contact information of the parties
responsible for the changes, or removed entirely.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
[](https://travis-ci.org/little-dude/netlink)
# This repository has been deprecated. Subsequent development will take place [@rust-netlink](https://github.com/rust-netlink).
# Netlink
This project aims at providing building blocks for [netlink][man-netlink] (see `man 7 netlink`).
## Organization
- the [`netlink_sys`](./netlink-sys) crate provides netlink sockets. Integration with [`mio`][mio] and [`tokio`][tokio]
is optional.
- Each netlink protocol has a `netlink-packet-<protocol_name>` crate that provides the packets for this protocol:
- [`netlink-packet-route`](./netlink-packet-route) provides messages for the [route protocol][man-rtnetlink]
- [`netlink-packet-audit`](./netlink-packet-audit) provides messages for the [audit][man-audit] protocol
- [`netlink-packet-sock-diag`](./netlink-packet-sock-diag) provides messages for the [sock-diag][man-sock-diag]
protocol
- [`netlink-packet-generic`](./netlink-packet-generic) provides message for the [generic netlink][man-genl]
protocol
- [`netlink-packet-netfilter`](./netlink-packet-netfilter) provides message for the `NETLINK_NETFILTER`
protocol
- the [`netlink-packet-core`](./netlink-packet-core) is the glue for all the other `netlink-packet-*` crates. It
provides a `NetlinkMessage<T>` type that represent any netlink message for any sub-protocol.
- the [`netlink_proto`](./netlink-proto) crate is an asynchronous implementation of the netlink protocol. It only
depends on `netlink-packet-core` for the `NetlinkMessage` type and `netlink-sys` for the socket.
- the [`rtnetlink`](./rtnetlink) crate provides higher level abstraction for the [route protocol][man-rtnetlink]
- the [`audit`](./audit) crate provides higher level abstractions for the audit protocol.
- the [`genetlink`](./genetlink) crate provide higher level abstraction for the
[generic netlink protocol][man-genl]
- the [`ethtool`](./ethtool) crate provide higher level abstraction for
[ethtool netlink protocol][ethtool-kernel-doc]
## Altnernatives
- https://github.com/jbaublitz/neli: the main alternative to these crates, as it is actively developed.
- Other but less actively developed alternatives:
- https://github.com/achanda/netlink
- https://github.com/polachok/pnetlink
- https://github.com/crhino/netlink-rs
- https://github.com/carrotsrc/rsnl
- https://github.com/TaborKelly/nl-utils
## Credits
My main resource so far has been the source code of [`pyroute2`][pyroute2] (python) and [`netlink`][netlink-go] (golang)
a lot. These two projects are great, and very nicely written. As someone who does not read C fluently, and that does not
know much about netlink, they have been invaluable.
I'd also like to praise [`libnl`][libnl] for its documentation. It helped me a lot in understanding the protocol basics.
The whole packet parsing logic is inspired by @whitequark excellent blog posts ([part 1][whitequark-1], [part
2][whitequark-2] and [part 3][whitequark-3], although I've only really used the concepts described in the first blog
post).
Thanks also to the people behind [tokio](tokio.rs) for the amazing
tool they are building, and the support they provide.
[man-netlink]: https://www.man7.org/linux/man-pages/man7/netlink.7.html
[man-audit]: https://man7.org/linux/man-pages/man3/audit_open.3.html
[man-sock-diag]: https://www.man7.org/linux/man-pages/man7/sock_diag.7.html
[man-rtnetlink]: https://www.man7.org/linux/man-pages/man7/rtnetlink.7.html
[man-genl]: https://www.man7.org/linux/man-pages/man8/genl.8.html
[generic-netlink-lwn]: https://lwn.net/Articles/208755/
[mio]: https://github.com/tokio-rs/mio
[tokio]: https://github.com/tokio-rs/tokio
[route-proto-doc]: https://www.infradead.org/~tgr/libnl/doc/route.html
[netlink-go]: https://github.com/vishvananda/netlink
[pyroute2]: https://github.com/svinota/pyroute2/tree/master/pyroute2/netlink
[libnl]: https://www.infradead.org/~tgr/libnl
[whitequark-1]: https://lab.whitequark.org/notes/2016-12-13/abstracting-over-mutability-in-rust
[whitequark-2]: https://lab.whitequark.org/notes/2016-12-17/owning-collections-in-heap-less-rust
[whitequark-3]: https://lab.whitequark.org/notes/2017-01-16/abstracting-over-mutability-in-rust-macros
[ethtool-kernel-doc]: https://www.kernel.org/doc/html/latest/networking/ethtool-netlink.html
================================================
FILE: RELEASE_PROCESS.md
================================================
# Release process
## Summary
- bump the versions in the Cargo.toml using `git blame` and `git log`,
starting from the `netlink-packet-*` and `netlink-sys` crates
- Update the `CHANGELOG` file with version changes, new features, bug fixes
and breaking changes
- Check that `cargo test` still works once your done
- Create pull request for the changes for CHANGELOG and version dumping.
- Create new tag via command `git tag --sign $(date +%Y%m%d)`
- Publish the tag to github via command `git push --tags upstream`
- Create new release page at [github webpage][github_new_release]
- Publish the crates via command `cargo publish` in changed crate folders
## Detailed process
### Crate groups
First, distinguish three groups of crates:
- `netlink-packet-*` crates
- `netlink-sys`
- `netlink-proto`, `audit` and `rtnetlink`, which depend on the two other groups
Usually start by bumping the versions of the first group of crates,
then `netlink-sys`, and then the last group of crates.
### Dependency graph
Here are the dependency tree for each group.
```
netlink-packet-utils v0.4.0
netlink-packet-core v0.2.4
└── netlink-packet-utils v0.4.0
[dev-dependencies]
└── netlink-packet-route v0.7.0
├── netlink-packet-core v0.2.4
└── netlink-packet-utils v0.4.0
netlink-packet-route v0.7.0
├── netlink-packet-core v0.2.4
│ └── netlink-packet-utils v0.4.0
└── netlink-packet-utils v0.4.0
[dev-dependencies]
└── netlink-sys v0.6.0
netlink-packet-audit v0.2.2
├── netlink-packet-core v0.2.4
│ └── netlink-packet-utils v0.4.0
└── netlink-packet-utils v0.4.0
netlink-packet-sock-diag v0.1.0
├── netlink-packet-core v0.2.4
│ └── netlink-packet-utils v0.4.0
└── netlink-packet-utils v0.4.0
[dev-dependencies]
└── netlink-sys v0.6.0
```
Then `netlink-sys`:
```
netlink-sys v0.6.0
[dev-dependencies]
└── netlink-packet-audit v0.2.2
├── netlink-packet-core v0.2.4
│ └── netlink-packet-utils v0.4.0
└── netlink-packet-utils v0.4.0
```
Finally, `netlink-proto`, `audit` and `rtnetlink`, which use both the
`netlink-packet-*` crates and `netlink-sys`:
```
netlink-proto v0.6.0
├── netlink-packet-core v0.2.4
│ └── netlink-packet-utils v0.4.0
└── netlink-sys v0.6.0
[dev-dependencies]
├── netlink-packet-audit v0.2.2
└── netlink-packet-route v0.7.0
audit v0.3.1
├── netlink-packet-audit v0.2.2
│ ├── netlink-packet-core v0.2.4
│ │ └── netlink-packet-utils v0.4.0
│ └── netlink-packet-utils v0.4.0
└── netlink-proto v0.6.0
├── netlink-packet-core v0.2.4
└── netlink-sys v0.6.0
rtnetlink v0.7.0
├── netlink-packet-route v0.7.0
│ ├── netlink-packet-core v0.2.4
│ │ └── netlink-packet-utils v0.4.0
│ └── netlink-packet-utils v0.4.0
└── netlink-proto v0.6.0
├── netlink-packet-core v0.2.4
└── netlink-sys v0.6.0
```
### Version bump
For each crate, look at when was the last time the version was
changed. For instance for `rtnetlink`:
```
$ git blame rtnetlink/Cargo.toml | grep "version = "
88dde610 rtnetlink/Cargo.toml (little-dude 2021-01-20 20:09:23 +0100 3) version = "0.7.0"
2f721807 rtnetlink/Cargo.toml (Stefan Bühler 2021-06-06 14:20:15 +0200 26) netlink-proto = { default-features = false, version = "0.6" }
83da33e2 rtnetlink/Cargo.toml (gabrik 2021-01-22 16:22:16 +0100 29) tokio = { version = "1.0.1", features = ["rt"], optional = true}
83da33e2 rtnetlink/Cargo.toml (gabrik 2021-01-22 16:22:16 +0100 30) async-std = { version = "1.9.0", features = ["unstable"], optional = true}
ef3a79a8 rtnetlink/Cargo.toml (Tim Zhang 2021-01-15 19:31:38 +0800 35) tokio = { version = "1.0.1", features = ["macros", "rt", "rt-multi-thread"] }
83da33e2 rtnetlink/Cargo.toml (gabrik 2021-01-22 16:22:16 +0100 36) async-std = { version = "1.9.0", features = ["attributes"]}
$ git log --oneline 88dde610.. rtnetlink/
2f72180 Cargo.toml: move path specs to workspace [patch.crates-io] section
1e8bc53 CI: Fix rtnetlink example
cae6e09 Merge pull request #97 from SkamDart/SkamDart/ip-monitor
35b6cb9 use `unwrap()` instead of `.is_ok()` so that the error is printed
2f0877a (origin/release) rustfmt, clippy
5c39136 Merge pull request #130 from benjumanji/wireguard-type
af1ee71 Merge pull request #137 from little-dude/rtnetlink-macros
83da33e added features and examples to rtnetlink
079b5f3 (origin/rtnetlink-macros) rtnetlink: use macros in response handling
b681f35 Add basic test for bringing up interface
5201dcd ip monitor clone
```
Based on the changes, decide whether bumping the patch or minor
version. For crates that like `rtnetlink`, usually just bump the
minor version. For `netlink-packet-*` and `netlink-sys`, try to bump
it only if really necessary, because bumping it means bumping all the
crates that depend on it.
Once we have bumped all the version locally, push to a `release`
branch to have CI running. If CI passes, just go with `cargo publish`,
again starting from the `netlink-packet-*` and `netlink-sys`
crates. `--dry-run` is nice but it doesn't really work. For instance
if `netlink-packet-utils` is bumped from 0.x to 0.x+1,
then `cargo publish --dry-run` will not work for `netlink-packet-core`,
because the crate depends on `netlink-packet-utils` 0.x+1, which hasn't be
published yet.
[github_new_release]: https://github.com/little-dude/netlink/releases/new
================================================
FILE: audit/Cargo.toml
================================================
[package]
name = "audit"
version = "0.7.1"
authors = ["Corentin Henry <corentinhenry@gmail.com>"]
edition = "2018"
homepage = "https://github.com/little-dude/netlink"
keywords = ["netlink", "ip", "linux", "audit"]
license = "MIT"
readme = "../README.md"
repository = "https://github.com/little-dude/netlink"
description = "linux audit via netlink"
[dependencies]
futures = "0.3.11"
thiserror = "1"
netlink-packet-audit = { version = "0.4.1", path = "../netlink-packet-audit" }
netlink-proto = { default-features = false, version = "0.10.0", path = "../netlink-proto" }
[features]
default = ["tokio_socket"]
tokio_socket = ["netlink-proto/tokio_socket"]
smol_socket = ["netlink-proto/smol_socket"]
[dev-dependencies]
tokio = { version = "1.0.1", default-features = false, features = ["macros", "rt-multi-thread"] }
async-std = { version = "1.9.0", features = ["attributes"] }
env_logger = "0.8.2"
[[example]]
name = "events_async"
required-features = ["smol_socket"]
================================================
FILE: audit/examples/add_rules.rs
================================================
// SPDX-License-Identifier: MIT
//! In this example, we create two rules which is equivalent to the following commands:
//!
//! auditctl -w /etc/passwd -p rwxa -k my_key
//! auditctl -a always,exit -F arch=b64 -S personality -F key=bypass
use audit::{
new_connection,
packet::{
constants::AUDIT_ARCH_X86_64,
RuleAction,
RuleField,
RuleFieldFlags,
RuleFlags,
RuleMessage,
RuleSyscalls,
},
Error,
Handle,
};
#[tokio::main]
async fn main() -> Result<(), String> {
let (connection, handle, _) = new_connection().map_err(|e| format!("{}", e))?;
tokio::spawn(connection);
add_rules(handle).await.map_err(|e| format!("{}", e))
}
async fn add_rules(mut handle: Handle) -> Result<(), Error> {
let etc_passwd_rule = RuleMessage {
flags: RuleFlags::FilterExit,
action: RuleAction::Always,
fields: vec![
(
RuleField::Watch("/etc/passwd".into()),
RuleFieldFlags::Equal,
),
(RuleField::Perm(15), RuleFieldFlags::Equal),
(RuleField::Filterkey("my_key".into()), RuleFieldFlags::Equal),
],
syscalls: RuleSyscalls::new_maxed(),
};
handle.add_rule(etc_passwd_rule).await?;
let mut syscalls = RuleSyscalls::new_zeroed();
syscalls.set(135);
let personality_syscall_rule = RuleMessage {
flags: RuleFlags::FilterExit,
action: RuleAction::Always,
fields: vec![
(RuleField::Arch(AUDIT_ARCH_X86_64), RuleFieldFlags::Equal),
(RuleField::Filterkey("bypass".into()), RuleFieldFlags::Equal),
],
syscalls,
};
handle.add_rule(personality_syscall_rule).await?;
Ok(())
}
================================================
FILE: audit/examples/dump_audit_rules.rs
================================================
// SPDX-License-Identifier: MIT
//! In this example, we create a netlink connection, and send a request to retrieve the list of
//! rules. We receive a stream of rule messages that we just prints to the terminal.
use audit::{new_connection, Error, Handle};
use futures::stream::TryStreamExt;
#[tokio::main]
async fn main() -> Result<(), String> {
let (connection, handle, _) = new_connection().map_err(|e| format!("{}", e))?;
tokio::spawn(connection);
list_rules(handle).await.map_err(|e| format!("{}", e))
}
async fn list_rules(mut handle: Handle) -> Result<(), Error> {
let mut rules = handle.list_rules();
while let Some(rule) = rules.try_next().await? {
println!("{:?}", rule);
}
Ok(())
}
================================================
FILE: audit/examples/events.rs
================================================
// SPDX-License-Identifier: MIT
//! This example opens a netlink socket, enables audit events, and prints the events that are being
//! received.
use audit::new_connection;
use futures::stream::StreamExt;
#[tokio::main]
async fn main() -> Result<(), String> {
let (connection, mut handle, mut messages) = new_connection().map_err(|e| format!("{}", e))?;
tokio::spawn(connection);
handle.enable_events().await.map_err(|e| format!("{}", e))?;
env_logger::init();
while let Some((msg, _)) = messages.next().await {
println!("{:?}", msg);
}
Ok(())
}
================================================
FILE: audit/examples/events_async.rs
================================================
// SPDX-License-Identifier: MIT
//! This example opens a netlink socket, enables audit events, and prints the events that are being
//! received.
use audit::new_connection;
use futures::stream::StreamExt;
#[async_std::main]
async fn main() -> Result<(), String> {
let (connection, mut handle, mut messages) = new_connection().map_err(|e| format!("{}", e))?;
async_std::task::spawn(connection);
handle.enable_events().await.map_err(|e| format!("{}", e))?;
env_logger::init();
while let Some((msg, _)) = messages.next().await {
println!("{:?}", msg);
}
Ok(())
}
================================================
FILE: audit/src/errors.rs
================================================
// SPDX-License-Identifier: MIT
use thiserror::Error;
use crate::packet::{AuditMessage, ErrorMessage, NetlinkMessage};
#[derive(Clone, Eq, PartialEq, Debug, Error)]
pub enum Error {
#[error("Received an unexpected message {0:?}")]
UnexpectedMessage(NetlinkMessage<AuditMessage>),
#[error("Received a netlink error message {0:?}")]
NetlinkError(ErrorMessage),
#[error("Request failed")]
RequestFailed,
}
================================================
FILE: audit/src/handle.rs
================================================
// SPDX-License-Identifier: MIT
use std::process;
use futures::{
future::{self, Either},
stream::{Stream, StreamExt, TryStream},
FutureExt,
};
use netlink_proto::{sys::SocketAddr, ConnectionHandle};
use crate::packet::{
rules::RuleMessage,
AuditMessage,
NetlinkMessage,
NetlinkPayload,
StatusMessage,
NLM_F_ACK,
NLM_F_CREATE,
NLM_F_DUMP,
NLM_F_EXCL,
NLM_F_NONREC,
NLM_F_REQUEST,
};
// ==========================================
// mask values
// ==========================================
pub const AUDIT_STATUS_ENABLED: u32 = 1;
pub const AUDIT_STATUS_FAILURE: u32 = 2;
pub const AUDIT_STATUS_PID: u32 = 4;
pub const AUDIT_STATUS_RATE_LIMIT: u32 = 8;
pub const AUDIT_STATUS_BACKLOG_LIMIT: u32 = 16;
pub const AUDIT_STATUS_BACKLOG_WAIT_TIME: u32 = 32;
pub const AUDIT_STATUS_LOST: u32 = 64;
pub const AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT: u32 = 1;
pub const AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME: u32 = 2;
pub const AUDIT_FEATURE_BITMAP_EXECUTABLE_PATH: u32 = 4;
pub const AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND: u32 = 8;
pub const AUDIT_FEATURE_BITMAP_SESSIONID_FILTER: u32 = 16;
pub const AUDIT_FEATURE_BITMAP_LOST_RESET: u32 = 32;
pub const AUDIT_FEATURE_BITMAP_FILTER_FS: u32 = 64;
pub const AUDIT_FEATURE_BITMAP_ALL: u32 = 127;
pub const AUDIT_VERSION_LATEST: u32 = 127;
pub const AUDIT_VERSION_BACKLOG_LIMIT: u32 = 1;
pub const AUDIT_VERSION_BACKLOG_WAIT_TIME: u32 = 2;
use crate::Error;
/// A handle to the netlink connection, used to send and receive netlink messsage
#[derive(Clone, Debug)]
pub struct Handle(ConnectionHandle<AuditMessage>);
impl Handle {
pub(crate) fn new(conn: ConnectionHandle<AuditMessage>) -> Self {
Handle(conn)
}
/// Send a netlink message, and get the reponse as a stream of messages.
pub fn request(
&mut self,
message: NetlinkMessage<AuditMessage>,
) -> Result<impl Stream<Item = NetlinkMessage<AuditMessage>>, Error> {
self.0
.request(message, SocketAddr::new(0, 0))
.map_err(|_| Error::RequestFailed)
}
/// Send a netlink message that expects an acknowledgement. The returned future resolved when
/// that ACK is received. If anything else is received, the future resolves into an error.
async fn acked_request(&mut self, message: NetlinkMessage<AuditMessage>) -> Result<(), Error> {
let mut response = self.request(message)?;
if let Some(message) = response.next().await {
let (header, payload) = message.into_parts();
// NetlinkError and AuditMessage are forwarded to the
// handle. Ack is signaled by the stream finishing.
if let NetlinkPayload::Error(err_msg) = payload {
Err(Error::NetlinkError(err_msg))
} else {
Err(Error::UnexpectedMessage(NetlinkMessage::new(
header, payload,
)))
}
} else {
Ok(())
}
}
/// Add the given rule
pub async fn add_rule(&mut self, rule: RuleMessage) -> Result<(), Error> {
let mut req = NetlinkMessage::from(AuditMessage::AddRule(rule));
req.header.flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE;
self.acked_request(req).await
}
/// Deletes a given rule
pub async fn del_rule(&mut self, rule: RuleMessage) -> Result<(), Error> {
let mut req = NetlinkMessage::from(AuditMessage::DelRule(rule));
req.header.flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_NONREC;
self.acked_request(req).await
}
/// List the current rules
pub fn list_rules(&mut self) -> impl TryStream<Ok = RuleMessage, Error = Error> {
let mut req = NetlinkMessage::from(AuditMessage::ListRules(None));
req.header.flags = NLM_F_REQUEST | NLM_F_DUMP;
match self.request(req) {
Ok(response) => Either::Left(response.map(move |msg| {
let (header, payload) = msg.into_parts();
match payload {
NetlinkPayload::InnerMessage(AuditMessage::ListRules(Some(rule_msg))) => {
Ok(rule_msg)
}
NetlinkPayload::Error(err_msg) => Err(Error::NetlinkError(err_msg)),
_ => Err(Error::UnexpectedMessage(NetlinkMessage::new(
header, payload,
))),
}
})),
Err(e) => Either::Right(future::err::<RuleMessage, Error>(e).into_stream()),
}
}
/// Enable receiving audit events
pub async fn enable_events(&mut self) -> Result<(), Error> {
let mut status = StatusMessage::new();
status.enabled = 1;
status.pid = process::id();
status.mask = AUDIT_STATUS_ENABLED | AUDIT_STATUS_PID;
let mut req = NetlinkMessage::from(AuditMessage::SetStatus(status));
req.header.flags = NLM_F_REQUEST | NLM_F_ACK;
self.acked_request(req).await
}
/// Get current audit status
pub async fn get_status(&mut self) -> Result<StatusMessage, Error> {
let mut req = NetlinkMessage::from(AuditMessage::GetStatus(None));
req.header.flags = NLM_F_REQUEST | NLM_F_DUMP;
let mut request = self.request(req)?;
let response = request.next().await.ok_or(Error::RequestFailed)?;
match response.into_parts() {
(_, NetlinkPayload::InnerMessage(AuditMessage::GetStatus(Some(status)))) => Ok(status),
(header, payload) => Err(Error::UnexpectedMessage(NetlinkMessage::new(
header, payload,
))),
}
}
}
================================================
FILE: audit/src/lib.rs
================================================
// SPDX-License-Identifier: MIT
mod handle;
pub use crate::handle::*;
mod errors;
pub use crate::errors::*;
pub use netlink_packet_audit as packet;
pub mod proto {
pub use netlink_proto::{Connection, ConnectionHandle, Error};
}
pub use netlink_proto::sys;
use std::io;
use futures::channel::mpsc::UnboundedReceiver;
#[allow(clippy::type_complexity)]
#[cfg(feature = "tokio_socket")]
pub fn new_connection() -> io::Result<(
proto::Connection<packet::AuditMessage, sys::TokioSocket, packet::NetlinkAuditCodec>,
Handle,
UnboundedReceiver<(
packet::NetlinkMessage<packet::AuditMessage>,
sys::SocketAddr,
)>,
)> {
new_connection_with_socket()
}
#[allow(clippy::type_complexity)]
pub fn new_connection_with_socket<S>() -> io::Result<(
proto::Connection<packet::AuditMessage, S, packet::NetlinkAuditCodec>,
Handle,
UnboundedReceiver<(
packet::NetlinkMessage<packet::AuditMessage>,
sys::SocketAddr,
)>,
)>
where
S: sys::AsyncSocket,
{
let (conn, handle, messages) =
netlink_proto::new_connection_with_codec(sys::protocols::NETLINK_AUDIT)?;
Ok((conn, Handle::new(handle), messages))
}
================================================
FILE: ethtool/Cargo.toml
================================================
[package]
name = "ethtool"
version = "0.2.3"
authors = ["Gris Ge <fge@redhat.com>"]
license = "MIT"
edition = "2018"
description = "Linux Ethtool Communication Library"
keywords = ["network"]
categories = ["network-programming", "os"]
readme = "../README.md"
[lib]
name = "ethtool"
path = "src/lib.rs"
crate-type = ["lib"]
[features]
default = ["tokio_socket"]
tokio_socket = ["netlink-proto/tokio_socket", "tokio"]
smol_socket = ["netlink-proto/smol_socket", "async-std"]
[dependencies]
anyhow = "1.0.44"
async-std = { version = "1.9.0", optional = true}
byteorder = "1.4.3"
futures = "0.3.17"
log = "0.4.14"
genetlink = { default-features = false, version = "0.2.1", path = "../genetlink" }
netlink-packet-core = { version = "0.4.2", path = "../netlink-packet-core" }
netlink-packet-generic = { version = "0.3.1", path = "../netlink-packet-generic" }
netlink-packet-utils = { version = "0.5.1", path = "../netlink-packet-utils" }
netlink-proto = { default-features = false, version = "0.10", path = "../netlink-proto" }
netlink-sys = { version = "0.8.3", path = "../netlink-sys" }
thiserror = "1.0.29"
tokio = { version = "1.0.1", features = ["rt"], optional = true}
[dev-dependencies]
tokio = { version = "1.11.0", features = ["macros", "rt", "rt-multi-thread"] }
env_logger = "0.9.0"
[[example]]
name = "dump_pause"
required-features = ["tokio_socket"]
================================================
FILE: ethtool/examples/dump_coalesce.rs
================================================
// SPDX-License-Identifier: MIT
use futures::stream::TryStreamExt;
// Once we find a way to load netsimdev kernel module in CI, we can convert this
// to a test
fn main() {
let rt = tokio::runtime::Builder::new_current_thread()
.enable_io()
.build()
.unwrap();
rt.block_on(get_coalesce(None));
}
async fn get_coalesce(iface_name: Option<&str>) {
let (connection, mut handle, _) = ethtool::new_connection().unwrap();
tokio::spawn(connection);
let mut coalesce_handle = handle.coalesce().get(iface_name).execute().await;
let mut msgs = Vec::new();
while let Some(msg) = coalesce_handle.try_next().await.unwrap() {
msgs.push(msg);
}
assert!(!msgs.is_empty());
for msg in msgs {
println!("{:?}", msg);
}
}
================================================
FILE: ethtool/examples/dump_features.rs
================================================
// SPDX-License-Identifier: MIT
use futures::stream::TryStreamExt;
// Once we find a way to load netsimdev kernel module in CI, we can convert this
// to a test
fn main() {
let rt = tokio::runtime::Builder::new_current_thread()
.enable_io()
.build()
.unwrap();
rt.block_on(get_feature(None));
}
async fn get_feature(iface_name: Option<&str>) {
let (connection, mut handle, _) = ethtool::new_connection().unwrap();
tokio::spawn(connection);
let mut feature_handle = handle.feature().get(iface_name).execute().await;
let mut msgs = Vec::new();
while let Some(msg) = feature_handle.try_next().await.unwrap() {
msgs.push(msg);
}
assert!(!msgs.is_empty());
for msg in msgs {
println!("{:?}", msg);
}
}
================================================
FILE: ethtool/examples/dump_link_mode.rs
================================================
// SPDX-License-Identifier: MIT
use futures::stream::TryStreamExt;
// Once we find a way to load netsimdev kernel module in CI, we can convert this
// to a test
fn main() {
let rt = tokio::runtime::Builder::new_current_thread()
.enable_io()
.build()
.unwrap();
rt.block_on(get_link_mode(None));
}
async fn get_link_mode(iface_name: Option<&str>) {
let (connection, mut handle, _) = ethtool::new_connection().unwrap();
tokio::spawn(connection);
let mut link_mode_handle = handle.link_mode().get(iface_name).execute().await;
let mut msgs = Vec::new();
while let Some(msg) = link_mode_handle.try_next().await.unwrap() {
msgs.push(msg);
}
assert!(!msgs.is_empty());
for msg in msgs {
println!("{:?}", msg);
}
}
================================================
FILE: ethtool/examples/dump_pause.rs
================================================
// SPDX-License-Identifier: MIT
use futures::stream::TryStreamExt;
// Once we find a way to load netsimdev kernel module in CI, we can convert this
// to a test
fn main() {
env_logger::init();
let rt = tokio::runtime::Builder::new_current_thread()
.enable_io()
.build()
.unwrap();
rt.block_on(get_pause(None));
}
async fn get_pause(iface_name: Option<&str>) {
let (connection, mut handle, _) = ethtool::new_connection().unwrap();
tokio::spawn(connection);
let mut pause_handle = handle.pause().get(iface_name).execute().await;
let mut msgs = Vec::new();
while let Some(msg) = pause_handle.try_next().await.unwrap() {
msgs.push(msg);
}
assert!(!msgs.is_empty());
println!("{:?}", msgs);
}
================================================
FILE: ethtool/examples/dump_rings.rs
================================================
// SPDX-License-Identifier: MIT
use futures::stream::TryStreamExt;
// Once we find a way to load netsimdev kernel module in CI, we can convert this
// to a test
fn main() {
let rt = tokio::runtime::Builder::new_current_thread()
.enable_io()
.build()
.unwrap();
rt.block_on(get_ring(None));
}
async fn get_ring(iface_name: Option<&str>) {
let (connection, mut handle, _) = ethtool::new_connection().unwrap();
tokio::spawn(connection);
let mut ring_handle = handle.ring().get(iface_name).execute().await;
let mut msgs = Vec::new();
while let Some(msg) = ring_handle.try_next().await.unwrap() {
msgs.push(msg);
}
assert!(!msgs.is_empty());
for msg in msgs {
println!("{:?}", msg);
}
}
================================================
FILE: ethtool/src/coalesce/attr.rs
================================================
// SPDX-License-Identifier: MIT
use anyhow::Context;
use byteorder::{ByteOrder, NativeEndian};
use netlink_packet_utils::{
nla::{DefaultNla, Nla, NlaBuffer, NlasIterator, NLA_F_NESTED},
parsers::{parse_u32, parse_u8},
DecodeError,
Emitable,
Parseable,
};
use crate::{EthtoolAttr, EthtoolHeader};
const ETHTOOL_A_COALESCE_HEADER: u16 = 1;
const ETHTOOL_A_COALESCE_RX_USECS: u16 = 2;
const ETHTOOL_A_COALESCE_RX_MAX_FRAMES: u16 = 3;
const ETHTOOL_A_COALESCE_RX_USECS_IRQ: u16 = 4;
const ETHTOOL_A_COALESCE_RX_MAX_FRAMES_IRQ: u16 = 5;
const ETHTOOL_A_COALESCE_TX_USECS: u16 = 6;
const ETHTOOL_A_COALESCE_TX_MAX_FRAMES: u16 = 7;
const ETHTOOL_A_COALESCE_TX_USECS_IRQ: u16 = 8;
const ETHTOOL_A_COALESCE_TX_MAX_FRAMES_IRQ: u16 = 9;
const ETHTOOL_A_COALESCE_STATS_BLOCK_USECS: u16 = 10;
const ETHTOOL_A_COALESCE_USE_ADAPTIVE_RX: u16 = 11;
const ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX: u16 = 12;
const ETHTOOL_A_COALESCE_PKT_RATE_LOW: u16 = 13;
const ETHTOOL_A_COALESCE_RX_USECS_LOW: u16 = 14;
const ETHTOOL_A_COALESCE_RX_MAX_FRAMES_LOW: u16 = 15;
const ETHTOOL_A_COALESCE_TX_USECS_LOW: u16 = 16;
const ETHTOOL_A_COALESCE_TX_MAX_FRAMES_LOW: u16 = 17;
const ETHTOOL_A_COALESCE_PKT_RATE_HIGH: u16 = 18;
const ETHTOOL_A_COALESCE_RX_USECS_HIGH: u16 = 19;
const ETHTOOL_A_COALESCE_RX_MAX_FRAMES_HIGH: u16 = 20;
const ETHTOOL_A_COALESCE_TX_USECS_HIGH: u16 = 21;
const ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH: u16 = 22;
const ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL: u16 = 23;
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum EthtoolCoalesceAttr {
Header(Vec<EthtoolHeader>),
RxUsecs(u32),
RxMaxFrames(u32),
RxUsecsIrq(u32),
RxMaxFramesIrq(u32),
TxUsecs(u32),
TxMaxFrames(u32),
TxUsecsIrq(u32),
TxMaxFramesIrq(u32),
StatsBlockUsecs(u32),
UseAdaptiveRx(bool),
UseAdaptiveTx(bool),
PktRateLow(u32),
RxUsecsLow(u32),
RxMaxFramesLow(u32),
TxUsecsLow(u32),
TxMaxFramesLow(u32),
PktRateHigh(u32),
RxUsecsHigh(u32),
RxMaxFramesHigh(u32),
TxUsecsHigh(u32),
TxMaxFramesHigh(u32),
RateSampleInterval(u32),
Other(DefaultNla),
}
impl Nla for EthtoolCoalesceAttr {
fn value_len(&self) -> usize {
match self {
Self::Header(hdrs) => hdrs.as_slice().buffer_len(),
Self::RxUsecs(_)
| Self::RxMaxFrames(_)
| Self::RxUsecsIrq(_)
| Self::RxMaxFramesIrq(_)
| Self::TxUsecs(_)
| Self::TxMaxFrames(_)
| Self::TxUsecsIrq(_)
| Self::TxMaxFramesIrq(_)
| Self::StatsBlockUsecs(_)
| Self::PktRateLow(_)
| Self::RxUsecsLow(_)
| Self::RxMaxFramesLow(_)
| Self::TxUsecsLow(_)
| Self::TxMaxFramesLow(_)
| Self::PktRateHigh(_)
| Self::RxUsecsHigh(_)
| Self::RxMaxFramesHigh(_)
| Self::TxUsecsHigh(_)
| Self::TxMaxFramesHigh(_)
| Self::RateSampleInterval(_) => 4,
Self::UseAdaptiveRx(_) | Self::UseAdaptiveTx(_) => 1,
Self::Other(attr) => attr.value_len(),
}
}
fn kind(&self) -> u16 {
match self {
Self::Header(_) => ETHTOOL_A_COALESCE_HEADER | NLA_F_NESTED,
Self::RxUsecs(_) => ETHTOOL_A_COALESCE_RX_USECS,
Self::RxMaxFrames(_) => ETHTOOL_A_COALESCE_RX_MAX_FRAMES,
Self::RxUsecsIrq(_) => ETHTOOL_A_COALESCE_RX_USECS_IRQ,
Self::RxMaxFramesIrq(_) => ETHTOOL_A_COALESCE_RX_MAX_FRAMES_IRQ,
Self::TxUsecs(_) => ETHTOOL_A_COALESCE_TX_USECS,
Self::TxMaxFrames(_) => ETHTOOL_A_COALESCE_TX_MAX_FRAMES,
Self::TxUsecsIrq(_) => ETHTOOL_A_COALESCE_TX_USECS_IRQ,
Self::TxMaxFramesIrq(_) => ETHTOOL_A_COALESCE_TX_MAX_FRAMES_IRQ,
Self::StatsBlockUsecs(_) => ETHTOOL_A_COALESCE_STATS_BLOCK_USECS,
Self::UseAdaptiveRx(_) => ETHTOOL_A_COALESCE_USE_ADAPTIVE_RX,
Self::UseAdaptiveTx(_) => ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX,
Self::PktRateLow(_) => ETHTOOL_A_COALESCE_PKT_RATE_LOW,
Self::RxUsecsLow(_) => ETHTOOL_A_COALESCE_RX_USECS_LOW,
Self::RxMaxFramesLow(_) => ETHTOOL_A_COALESCE_RX_MAX_FRAMES_LOW,
Self::TxUsecsLow(_) => ETHTOOL_A_COALESCE_TX_USECS_LOW,
Self::TxMaxFramesLow(_) => ETHTOOL_A_COALESCE_TX_MAX_FRAMES_LOW,
Self::PktRateHigh(_) => ETHTOOL_A_COALESCE_PKT_RATE_HIGH,
Self::RxUsecsHigh(_) => ETHTOOL_A_COALESCE_RX_USECS_HIGH,
Self::RxMaxFramesHigh(_) => ETHTOOL_A_COALESCE_RX_MAX_FRAMES_HIGH,
Self::TxUsecsHigh(_) => ETHTOOL_A_COALESCE_TX_USECS_HIGH,
Self::TxMaxFramesHigh(_) => ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH,
Self::RateSampleInterval(_) => ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL,
Self::Other(attr) => attr.kind(),
}
}
fn emit_value(&self, buffer: &mut [u8]) {
match self {
Self::Header(ref nlas) => nlas.as_slice().emit(buffer),
Self::Other(ref attr) => attr.emit(buffer),
Self::RxUsecs(d)
| Self::RxMaxFrames(d)
| Self::RxUsecsIrq(d)
| Self::RxMaxFramesIrq(d)
| Self::TxUsecs(d)
| Self::TxMaxFrames(d)
| Self::TxUsecsIrq(d)
| Self::TxMaxFramesIrq(d)
| Self::StatsBlockUsecs(d)
| Self::PktRateLow(d)
| Self::RxUsecsLow(d)
| Self::RxMaxFramesLow(d)
| Self::TxUsecsLow(d)
| Self::TxMaxFramesLow(d)
| Self::PktRateHigh(d)
| Self::RxUsecsHigh(d)
| Self::RxMaxFramesHigh(d)
| Self::TxUsecsHigh(d)
| Self::TxMaxFramesHigh(d)
| Self::RateSampleInterval(d) => NativeEndian::write_u32(buffer, *d),
Self::UseAdaptiveRx(d) | Self::UseAdaptiveTx(d) => buffer[0] = if *d { 1 } else { 0 },
}
}
}
impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>> for EthtoolCoalesceAttr {
fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
let payload = buf.value();
Ok(match buf.kind() {
ETHTOOL_A_COALESCE_HEADER => {
let mut nlas = Vec::new();
let error_msg = "failed to parse coalesce header attributes";
for nla in NlasIterator::new(payload) {
let nla = &nla.context(error_msg)?;
let parsed = EthtoolHeader::parse(nla).context(error_msg)?;
nlas.push(parsed);
}
Self::Header(nlas)
}
ETHTOOL_A_COALESCE_RX_USECS => Self::RxUsecs(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_RX_USECS value")?,
),
ETHTOOL_A_COALESCE_RX_MAX_FRAMES => Self::RxMaxFrames(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_RX_MAX_FRAMES value")?,
),
ETHTOOL_A_COALESCE_RX_USECS_IRQ => Self::RxUsecsIrq(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_RX_USECS_IRQ value")?,
),
ETHTOOL_A_COALESCE_RX_MAX_FRAMES_IRQ => Self::RxMaxFramesIrq(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_RX_MAX_FRAMES_IRQ value")?,
),
ETHTOOL_A_COALESCE_TX_USECS => Self::TxUsecs(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_TX_USECS value")?,
),
ETHTOOL_A_COALESCE_TX_MAX_FRAMES => Self::TxMaxFrames(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_TX_MAX_FRAMES value")?,
),
ETHTOOL_A_COALESCE_TX_USECS_IRQ => Self::TxUsecsIrq(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_TX_USECS_IRQ value")?,
),
ETHTOOL_A_COALESCE_TX_MAX_FRAMES_IRQ => Self::TxMaxFramesIrq(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_TX_MAX_FRAMES_IRQ value")?,
),
ETHTOOL_A_COALESCE_STATS_BLOCK_USECS => Self::StatsBlockUsecs(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_STATS_BLOCK_USECS value")?,
),
ETHTOOL_A_COALESCE_USE_ADAPTIVE_RX => Self::UseAdaptiveRx(
parse_u8(payload).context("Invalid ETHTOOL_A_COALESCE_USE_ADAPTIVE_RX value")? == 1,
),
ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX => Self::UseAdaptiveTx(
parse_u8(payload).context("Invalid ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX value")? == 1,
),
ETHTOOL_A_COALESCE_PKT_RATE_LOW => Self::PktRateLow(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_PKT_RATE_LOW value")?,
),
ETHTOOL_A_COALESCE_RX_USECS_LOW => Self::RxUsecsLow(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_RX_USECS_LOW value")?,
),
ETHTOOL_A_COALESCE_RX_MAX_FRAMES_LOW => Self::RxMaxFramesLow(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_RX_MAX_FRAMES_LOW value")?,
),
ETHTOOL_A_COALESCE_TX_USECS_LOW => Self::TxUsecsLow(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_TX_USECS_LOW value")?,
),
ETHTOOL_A_COALESCE_TX_MAX_FRAMES_LOW => Self::TxMaxFramesLow(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_TX_MAX_FRAMES_LOW value")?,
),
ETHTOOL_A_COALESCE_PKT_RATE_HIGH => Self::PktRateHigh(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_PKT_RATE_HIGH value")?,
),
ETHTOOL_A_COALESCE_RX_USECS_HIGH => Self::RxUsecsHigh(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_RX_USECS_HIGH value")?,
),
ETHTOOL_A_COALESCE_RX_MAX_FRAMES_HIGH => Self::RxMaxFramesHigh(
parse_u32(payload)
.context("Invalid ETHTOOL_A_COALESCE_RX_MAX_FRAMES_HIGH value")?,
),
ETHTOOL_A_COALESCE_TX_USECS_HIGH => Self::TxUsecsHigh(
parse_u32(payload).context("Invalid ETHTOOL_A_COALESCE_TX_USECS_HIGH value")?,
),
ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH => Self::TxMaxFramesHigh(
parse_u32(payload)
.context("Invalid ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH value")?,
),
ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL => Self::RateSampleInterval(
parse_u32(payload)
.context("Invalid ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL value")?,
),
_ => Self::Other(DefaultNla::parse(buf).context("invalid NLA (unknown kind)")?),
})
}
}
pub(crate) fn parse_coalesce_nlas(buffer: &[u8]) -> Result<Vec<EthtoolAttr>, DecodeError> {
let mut nlas = Vec::new();
for nla in NlasIterator::new(buffer) {
let error_msg = format!(
"Failed to parse ethtool coalesce message attribute {:?}",
nla
);
let nla = &nla.context(error_msg.clone())?;
let parsed = EthtoolCoalesceAttr::parse(nla).context(error_msg)?;
nlas.push(EthtoolAttr::Coalesce(parsed));
}
Ok(nlas)
}
================================================
FILE: ethtool/src/coalesce/get.rs
================================================
// SPDX-License-Identifier: MIT
use futures::TryStream;
use netlink_packet_generic::GenlMessage;
use crate::{ethtool_execute, EthtoolError, EthtoolHandle, EthtoolMessage};
pub struct EthtoolCoalesceGetRequest {
handle: EthtoolHandle,
iface_name: Option<String>,
}
impl EthtoolCoalesceGetRequest {
pub(crate) fn new(handle: EthtoolHandle, iface_name: Option<&str>) -> Self {
EthtoolCoalesceGetRequest {
handle,
iface_name: iface_name.map(|i| i.to_string()),
}
}
pub async fn execute(
self,
) -> impl TryStream<Ok = GenlMessage<EthtoolMessage>, Error = EthtoolError> {
let EthtoolCoalesceGetRequest {
mut handle,
iface_name,
} = self;
let ethtool_msg = EthtoolMessage::new_coalesce_get(iface_name.as_deref());
ethtool_execute(&mut handle, iface_name.is_none(), ethtool_msg).await
}
}
================================================
FILE: ethtool/src/coalesce/handle.rs
================================================
// SPDX-License-Identifier: MIT
use crate::{EthtoolCoalesceGetRequest, EthtoolHandle};
pub struct EthtoolCoalesceHandle(EthtoolHandle);
impl EthtoolCoalesceHandle {
pub fn new(handle: EthtoolHandle) -> Self {
EthtoolCoalesceHandle(handle)
}
/// Retrieve the ethtool coalesces of a interface (equivalent to `ethtool -c eth1`)
pub fn get(&mut self, iface_name: Option<&str>) -> EthtoolCoalesceGetRequest {
EthtoolCoalesceGetRequest::new(self.0.clone(), iface_name)
}
}
================================================
FILE: ethtool/src/coalesce/mod.rs
================================================
// SPDX-License-Identifier: MIT
mod attr;
mod get;
mod handle;
pub(crate) use attr::parse_coalesce_nlas;
pub use attr::EthtoolCoalesceAttr;
pub use get::EthtoolCoalesceGetRequest;
pub use handle::EthtoolCoalesceHandle;
================================================
FILE: ethtool/src/connection.rs
================================================
// SPDX-License-Identifier: MIT
use std::io;
use futures::channel::mpsc::UnboundedReceiver;
use genetlink::message::RawGenlMessage;
use netlink_packet_core::NetlinkMessage;
use netlink_proto::Connection;
use netlink_sys::{AsyncSocket, SocketAddr};
use crate::EthtoolHandle;
#[cfg(feature = "tokio_socket")]
#[allow(clippy::type_complexity)]
pub fn new_connection() -> io::Result<(
Connection<RawGenlMessage>,
EthtoolHandle,
UnboundedReceiver<(NetlinkMessage<RawGenlMessage>, SocketAddr)>,
)> {
new_connection_with_socket()
}
#[allow(clippy::type_complexity)]
pub fn new_connection_with_socket<S>() -> io::Result<(
Connection<RawGenlMessage, S>,
EthtoolHandle,
UnboundedReceiver<(NetlinkMessage<RawGenlMessage>, SocketAddr)>,
)>
where
S: AsyncSocket,
{
let (conn, handle, messages) = genetlink::new_connection_with_socket()?;
Ok((conn, EthtoolHandle::new(handle), messages))
}
================================================
FILE: ethtool/src/error.rs
================================================
// SPDX-License-Identifier: MIT
use thiserror::Error;
use netlink_packet_core::{ErrorMessage, NetlinkMessage};
use netlink_packet_generic::GenlMessage;
use crate::EthtoolMessage;
#[derive(Clone, Eq, PartialEq, Debug, Error)]
pub enum EthtoolError {
#[error("Received an unexpected message {0:?}")]
UnexpectedMessage(NetlinkMessage<GenlMessage<EthtoolMessage>>),
#[error("Received a netlink error message {0}")]
NetlinkError(ErrorMessage),
#[error("A netlink request failed")]
RequestFailed(String),
#[error("A bug in this crate")]
Bug(String),
}
================================================
FILE: ethtool/src/feature/attr.rs
================================================
// SPDX-License-Identifier: MIT
use anyhow::Context;
use log::warn;
use netlink_packet_utils::{
nla::{DefaultNla, Nla, NlaBuffer, NlasIterator, NLA_F_NESTED},
parsers::{parse_string, parse_u32},
DecodeError,
Emitable,
Parseable,
};
use crate::{EthtoolAttr, EthtoolHeader};
const ETHTOOL_A_FEATURES_HEADER: u16 = 1;
const ETHTOOL_A_FEATURES_HW: u16 = 2; // User changable features
const ETHTOOL_A_FEATURES_WANTED: u16 = 3; // User requested fatures
const ETHTOOL_A_FEATURES_ACTIVE: u16 = 4; // Active features
const ETHTOOL_A_FEATURES_NOCHANGE: u16 = 5;
const ETHTOOL_A_BITSET_BITS: u16 = 3;
const ETHTOOL_A_BITSET_BITS_BIT: u16 = 1;
const ETHTOOL_A_BITSET_BIT_INDEX: u16 = 1;
const ETHTOOL_A_BITSET_BIT_NAME: u16 = 2;
const ETHTOOL_A_BITSET_BIT_VALUE: u16 = 3;
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct EthtoolFeatureBit {
pub index: u32,
pub name: String,
pub value: bool,
}
impl EthtoolFeatureBit {
fn new(has_mask: bool) -> Self {
Self {
index: 0,
name: "".into(),
value: !has_mask,
}
}
}
fn feature_bits_len(_feature_bits: &[EthtoolFeatureBit]) -> usize {
todo!("Does not support changing ethtool feature yet")
}
fn feature_bits_emit(_feature_bits: &[EthtoolFeatureBit], _buffer: &mut [u8]) {
todo!("Does not support changing ethtool feature yet")
}
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum EthtoolFeatureAttr {
Header(Vec<EthtoolHeader>),
Hw(Vec<EthtoolFeatureBit>),
Wanted(Vec<EthtoolFeatureBit>),
Active(Vec<EthtoolFeatureBit>),
NoChange(Vec<EthtoolFeatureBit>),
Other(DefaultNla),
}
impl Nla for EthtoolFeatureAttr {
fn value_len(&self) -> usize {
match self {
Self::Header(hdrs) => hdrs.as_slice().buffer_len(),
Self::Hw(feature_bits)
| Self::Wanted(feature_bits)
| Self::Active(feature_bits)
| Self::NoChange(feature_bits) => feature_bits_len(feature_bits.as_slice()),
Self::Other(attr) => attr.value_len(),
}
}
fn kind(&self) -> u16 {
match self {
Self::Header(_) => ETHTOOL_A_FEATURES_HEADER | NLA_F_NESTED,
Self::Hw(_) => ETHTOOL_A_FEATURES_HW | NLA_F_NESTED,
Self::Wanted(_) => ETHTOOL_A_FEATURES_WANTED | NLA_F_NESTED,
Self::Active(_) => ETHTOOL_A_FEATURES_ACTIVE | NLA_F_NESTED,
Self::NoChange(_) => ETHTOOL_A_FEATURES_NOCHANGE | NLA_F_NESTED,
Self::Other(attr) => attr.kind(),
}
}
fn emit_value(&self, buffer: &mut [u8]) {
match self {
Self::Header(ref nlas) => nlas.as_slice().emit(buffer),
Self::Hw(feature_bits)
| Self::Wanted(feature_bits)
| Self::Active(feature_bits)
| Self::NoChange(feature_bits) => feature_bits_emit(feature_bits.as_slice(), buffer),
Self::Other(ref attr) => attr.emit(buffer),
}
}
}
impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>> for EthtoolFeatureAttr {
fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
let payload = buf.value();
Ok(match buf.kind() {
ETHTOOL_A_FEATURES_HEADER => {
let mut nlas = Vec::new();
let error_msg = "failed to parse feature header attributes";
for nla in NlasIterator::new(payload) {
let nla = &nla.context(error_msg)?;
let parsed = EthtoolHeader::parse(nla).context(error_msg)?;
nlas.push(parsed);
}
Self::Header(nlas)
}
ETHTOOL_A_FEATURES_HW => {
Self::Hw(parse_bitset_bits_nlas(
payload, true, /* ETHTOOL_A_FEATURES_HW is using mask */
)?)
}
ETHTOOL_A_FEATURES_WANTED => {
Self::Wanted(parse_bitset_bits_nlas(
payload, false, /* ETHTOOL_A_FEATURES_WANTED does not use mask */
)?)
}
ETHTOOL_A_FEATURES_ACTIVE => {
Self::Active(parse_bitset_bits_nlas(
payload, false, /* ETHTOOL_A_FEATURES_ACTIVE does not use mask */
)?)
}
ETHTOOL_A_FEATURES_NOCHANGE => {
Self::NoChange(parse_bitset_bits_nlas(
payload, false, /* ETHTOOL_A_FEATURES_NOCHANGE does not use mask */
)?)
}
_ => Self::Other(DefaultNla::parse(buf).context("invalid NLA (unknown kind)")?),
})
}
}
fn parse_bitset_bits_nlas(
raw: &[u8],
has_mask: bool,
) -> Result<Vec<EthtoolFeatureBit>, DecodeError> {
let error_msg = "failed to parse feature bit sets";
for nla in NlasIterator::new(raw) {
let nla = &nla.context(error_msg)?;
if nla.kind() == ETHTOOL_A_BITSET_BITS {
return parse_bitset_bits_nla(nla.value(), has_mask);
}
}
Err("No ETHTOOL_A_BITSET_BITS NLA found".into())
}
fn parse_bitset_bits_nla(
raw: &[u8],
has_mask: bool,
) -> Result<Vec<EthtoolFeatureBit>, DecodeError> {
let mut feature_bits = Vec::new();
let error_msg = "Failed to parse ETHTOOL_A_BITSET_BITS attributes";
for bit_nla in NlasIterator::new(raw) {
let bit_nla = &bit_nla.context(error_msg)?;
match bit_nla.kind() {
ETHTOOL_A_BITSET_BITS_BIT => {
let error_msg = "Failed to parse ETHTOOL_A_BITSET_BITS_BIT attributes";
let nlas = NlasIterator::new(bit_nla.value());
let mut cur_bit_info = EthtoolFeatureBit::new(has_mask);
for nla in nlas {
let nla = &nla.context(error_msg)?;
let payload = nla.value();
match nla.kind() {
ETHTOOL_A_BITSET_BIT_INDEX => {
if cur_bit_info.index != 0 && !&cur_bit_info.name.is_empty() {
feature_bits.push(cur_bit_info);
cur_bit_info = EthtoolFeatureBit::new(has_mask);
}
cur_bit_info.index = parse_u32(payload)
.context("Invald ETHTOOL_A_BITSET_BIT_INDEX value")?;
}
ETHTOOL_A_BITSET_BIT_NAME => {
cur_bit_info.name = parse_string(payload)
.context("Invald ETHTOOL_A_BITSET_BIT_NAME value")?;
}
ETHTOOL_A_BITSET_BIT_VALUE => {
cur_bit_info.value = true;
}
_ => {
warn!(
"Unknown ETHTOOL_A_BITSET_BITS_BIT {} {:?}",
nla.kind(),
nla.value(),
);
}
}
}
if cur_bit_info.index != 0 && !&cur_bit_info.name.is_empty() {
feature_bits.push(cur_bit_info);
}
}
_ => {
warn!(
"Unknown ETHTOOL_A_BITSET_BITS kind {}, {:?}",
bit_nla.kind(),
bit_nla.value()
);
}
};
}
Ok(feature_bits)
}
pub(crate) fn parse_feature_nlas(buffer: &[u8]) -> Result<Vec<EthtoolAttr>, DecodeError> {
let mut nlas = Vec::new();
for nla in NlasIterator::new(buffer) {
let error_msg = format!(
"Failed to parse ethtool feature message attribute {:?}",
nla
);
let nla = &nla.context(error_msg.clone())?;
let parsed = EthtoolFeatureAttr::parse(nla).context(error_msg)?;
nlas.push(EthtoolAttr::Feature(parsed));
}
Ok(nlas)
}
================================================
FILE: ethtool/src/feature/get.rs
================================================
// SPDX-License-Identifier: MIT
use futures::TryStream;
use netlink_packet_generic::GenlMessage;
use crate::{ethtool_execute, EthtoolError, EthtoolHandle, EthtoolMessage};
pub struct EthtoolFeatureGetRequest {
handle: EthtoolHandle,
iface_name: Option<String>,
}
impl EthtoolFeatureGetRequest {
pub(crate) fn new(handle: EthtoolHandle, iface_name: Option<&str>) -> Self {
EthtoolFeatureGetRequest {
handle,
iface_name: iface_name.map(|i| i.to_string()),
}
}
pub async fn execute(
self,
) -> impl TryStream<Ok = GenlMessage<EthtoolMessage>, Error = EthtoolError> {
let EthtoolFeatureGetRequest {
mut handle,
iface_name,
} = self;
let ethtool_msg = EthtoolMessage::new_feature_get(iface_name.as_deref());
ethtool_execute(&mut handle, iface_name.is_none(), ethtool_msg).await
}
}
================================================
FILE: ethtool/src/feature/handle.rs
================================================
// SPDX-License-Identifier: MIT
use crate::{EthtoolFeatureGetRequest, EthtoolHandle};
pub struct EthtoolFeatureHandle(EthtoolHandle);
impl EthtoolFeatureHandle {
pub fn new(handle: EthtoolHandle) -> Self {
EthtoolFeatureHandle(handle)
}
/// Retrieve the ethtool features of a interface (equivalent to `ethtool -k eth1`)
pub fn get(&mut self, iface_name: Option<&str>) -> EthtoolFeatureGetRequest {
EthtoolFeatureGetRequest::new(self.0.clone(), iface_name)
}
}
================================================
FILE: ethtool/src/feature/mod.rs
================================================
// SPDX-License-Identifier: MIT
mod attr;
mod get;
mod handle;
pub(crate) use attr::parse_feature_nlas;
pub use attr::{EthtoolFeatureAttr, EthtoolFeatureBit};
pub use get::EthtoolFeatureGetRequest;
pub use handle::EthtoolFeatureHandle;
================================================
FILE: ethtool/src/handle.rs
================================================
// SPDX-License-Identifier: MIT
use futures::{future::Either, FutureExt, Stream, StreamExt, TryStream};
use genetlink::GenetlinkHandle;
use netlink_packet_core::{NetlinkMessage, NLM_F_ACK, NLM_F_DUMP, NLM_F_REQUEST};
use netlink_packet_generic::GenlMessage;
use netlink_packet_utils::DecodeError;
use crate::{
try_ethtool,
EthtoolCoalesceHandle,
EthtoolError,
EthtoolFeatureHandle,
EthtoolLinkModeHandle,
EthtoolMessage,
EthtoolPauseHandle,
EthtoolRingHandle,
};
#[derive(Clone, Debug)]
pub struct EthtoolHandle {
pub handle: GenetlinkHandle,
}
impl EthtoolHandle {
pub(crate) fn new(handle: GenetlinkHandle) -> Self {
EthtoolHandle { handle }
}
pub fn pause(&mut self) -> EthtoolPauseHandle {
EthtoolPauseHandle::new(self.clone())
}
pub fn feature(&mut self) -> EthtoolFeatureHandle {
EthtoolFeatureHandle::new(self.clone())
}
pub fn link_mode(&mut self) -> EthtoolLinkModeHandle {
EthtoolLinkModeHandle::new(self.clone())
}
pub fn ring(&mut self) -> EthtoolRingHandle {
EthtoolRingHandle::new(self.clone())
}
pub fn coalesce(&mut self) -> EthtoolCoalesceHandle {
EthtoolCoalesceHandle::new(self.clone())
}
pub async fn request(
&mut self,
message: NetlinkMessage<GenlMessage<EthtoolMessage>>,
) -> Result<
impl Stream<Item = Result<NetlinkMessage<GenlMessage<EthtoolMessage>>, DecodeError>>,
EthtoolError,
> {
self.handle
.request(message)
.await
.map_err(|e| EthtoolError::RequestFailed(format!("BUG: Request failed with {}", e)))
}
}
pub(crate) async fn ethtool_execute(
handle: &mut EthtoolHandle,
is_dump: bool,
ethtool_msg: EthtoolMessage,
) -> impl TryStream<Ok = GenlMessage<EthtoolMessage>, Error = EthtoolError> {
let nl_header_flags = if is_dump {
// The NLM_F_ACK is required due to bug of kernel:
// https://bugzilla.redhat.com/show_bug.cgi?id=1953847
// without `NLM_F_MULTI`, rust-netlink will not parse
// multiple netlink message in single socket reply.
// Using NLM_F_ACK will force rust-netlink to parse all till
// acked at the end.
NLM_F_DUMP | NLM_F_REQUEST | NLM_F_ACK
} else {
NLM_F_REQUEST
};
let mut nl_msg = NetlinkMessage::from(GenlMessage::from_payload(ethtool_msg));
nl_msg.header.flags = nl_header_flags;
match handle.request(nl_msg).await {
Ok(response) => Either::Left(response.map(move |msg| Ok(try_ethtool!(msg)))),
Err(e) => Either::Right(
futures::future::err::<GenlMessage<EthtoolMessage>, EthtoolError>(e).into_stream(),
),
}
}
================================================
FILE: ethtool/src/header.rs
================================================
// SPDX-License-Identifier: MIT
use std::ffi::CString;
use anyhow::Context;
use byteorder::{ByteOrder, NativeEndian};
use netlink_packet_utils::{
nla::{DefaultNla, Nla, NlaBuffer},
parsers::{parse_string, parse_u32},
DecodeError,
Parseable,
};
const ALTIFNAMSIZ: usize = 128;
const ETHTOOL_A_HEADER_DEV_INDEX: u16 = 1;
const ETHTOOL_A_HEADER_DEV_NAME: u16 = 2;
const ETHTOOL_A_HEADER_FLAGS: u16 = 3;
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum EthtoolHeader {
DevIndex(u32),
DevName(String),
Flags(u32),
Other(DefaultNla),
}
impl Nla for EthtoolHeader {
fn value_len(&self) -> usize {
match self {
Self::DevIndex(_) | Self::Flags(_) => 4,
Self::DevName(s) => {
if s.len() + 1 > ALTIFNAMSIZ {
ALTIFNAMSIZ
} else {
s.len() + 1
}
}
Self::Other(attr) => attr.value_len(),
}
}
fn kind(&self) -> u16 {
match self {
Self::DevIndex(_) => ETHTOOL_A_HEADER_DEV_INDEX,
Self::DevName(_) => ETHTOOL_A_HEADER_DEV_NAME,
Self::Flags(_) => ETHTOOL_A_HEADER_FLAGS,
Self::Other(attr) => attr.kind(),
}
}
fn emit_value(&self, buffer: &mut [u8]) {
match self {
Self::DevIndex(value) | Self::Flags(value) => NativeEndian::write_u32(buffer, *value),
Self::DevName(s) => str_to_zero_ended_u8_array(s, buffer, ALTIFNAMSIZ),
Self::Other(ref attr) => attr.emit_value(buffer),
}
}
}
impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>> for EthtoolHeader {
fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
let payload = buf.value();
Ok(match buf.kind() {
ETHTOOL_A_HEADER_DEV_INDEX => Self::DevIndex(
parse_u32(payload).context("invalid ETHTOOL_A_HEADER_DEV_INDEX value")?,
),
ETHTOOL_A_HEADER_FLAGS => {
Self::Flags(parse_u32(payload).context("invalid ETHTOOL_A_HEADER_FLAGS value")?)
}
ETHTOOL_A_HEADER_DEV_NAME => Self::DevName(
parse_string(payload).context("invalid ETHTOOL_A_HEADER_DEV_NAME value")?,
),
_ => Self::Other(DefaultNla::parse(buf).context("invalid NLA (unknown kind)")?),
})
}
}
fn str_to_zero_ended_u8_array(src_str: &str, buffer: &mut [u8], max_size: usize) {
if let Ok(src_cstring) = CString::new(src_str.as_bytes()) {
let src_null_ended_str = src_cstring.into_bytes_with_nul();
if src_null_ended_str.len() > max_size {
buffer[..max_size].clone_from_slice(&src_null_ended_str[..max_size])
} else {
buffer[..src_null_ended_str.len()].clone_from_slice(&src_null_ended_str)
}
}
}
================================================
FILE: ethtool/src/lib.rs
================================================
// SPDX-License-Identifier: MIT
mod coalesce;
mod connection;
mod error;
mod feature;
mod handle;
mod header;
mod link_mode;
mod macros;
mod message;
mod pause;
mod ring;
pub use coalesce::{EthtoolCoalesceAttr, EthtoolCoalesceGetRequest, EthtoolCoalesceHandle};
#[cfg(feature = "tokio_socket")]
pub use connection::new_connection;
pub use connection::new_connection_with_socket;
pub use error::EthtoolError;
pub use feature::{
EthtoolFeatureAttr,
EthtoolFeatureBit,
EthtoolFeatureGetRequest,
EthtoolFeatureHandle,
};
pub use handle::EthtoolHandle;
pub use header::EthtoolHeader;
pub use link_mode::{
EthtoolLinkModeAttr,
EthtoolLinkModeDuplex,
EthtoolLinkModeGetRequest,
EthtoolLinkModeHandle,
};
pub use message::{EthtoolAttr, EthtoolCmd, EthtoolMessage};
pub use pause::{
EthtoolPauseAttr,
EthtoolPauseGetRequest,
EthtoolPauseHandle,
EthtoolPauseStatAttr,
};
pub use ring::{EthtoolRingAttr, EthtoolRingGetRequest, EthtoolRingHandle};
pub(crate) use handle::ethtool_execute;
================================================
FILE: ethtool/src/link_mode/attr.rs
================================================
// SPDX-License-Identifier: MIT
use anyhow::Context;
use log::warn;
use netlink_packet_utils::{
nla::{DefaultNla, Nla, NlaBuffer, NlasIterator, NLA_F_NESTED},
parsers::{parse_string, parse_u32, parse_u8},
DecodeError,
Emitable,
Parseable,
};
use crate::{EthtoolAttr, EthtoolHeader};
const ETHTOOL_A_LINKMODES_HEADER: u16 = 1;
const ETHTOOL_A_LINKMODES_AUTONEG: u16 = 2;
const ETHTOOL_A_LINKMODES_OURS: u16 = 3;
const ETHTOOL_A_LINKMODES_PEER: u16 = 4;
const ETHTOOL_A_LINKMODES_SPEED: u16 = 5;
const ETHTOOL_A_LINKMODES_DUPLEX: u16 = 6;
const ETHTOOL_A_LINKMODES_SUBORDINATE_CFG: u16 = 7;
const ETHTOOL_A_LINKMODES_SUBORDINATE_STATE: u16 = 8;
const ETHTOOL_A_LINKMODES_LANES: u16 = 9;
const ETHTOOL_A_BITSET_BITS: u16 = 3;
const ETHTOOL_A_BITSET_BITS_BIT: u16 = 1;
const ETHTOOL_A_BITSET_BIT_INDEX: u16 = 1;
const ETHTOOL_A_BITSET_BIT_NAME: u16 = 2;
const ETHTOOL_A_BITSET_BIT_VALUE: u16 = 3;
const DUPLEX_HALF: u8 = 0x00;
const DUPLEX_FULL: u8 = 0x01;
const DUPLEX_UNKNOWN: u8 = 0xff;
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum EthtoolLinkModeDuplex {
Half,
Full,
Unknown,
Other(u8),
}
impl From<u8> for EthtoolLinkModeDuplex {
fn from(d: u8) -> Self {
match d {
DUPLEX_HALF => Self::Half,
DUPLEX_FULL => Self::Full,
DUPLEX_UNKNOWN => Self::Unknown,
_ => Self::Other(d),
}
}
}
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum EthtoolLinkModeAttr {
Header(Vec<EthtoolHeader>),
Autoneg(bool),
Ours(Vec<String>),
Peer(Vec<String>),
Speed(u32),
Duplex(EthtoolLinkModeDuplex),
ControllerSubordinateCfg(u8),
ControllerSubordinateState(u8),
Lanes(u32),
Other(DefaultNla),
}
impl Nla for EthtoolLinkModeAttr {
fn value_len(&self) -> usize {
match self {
Self::Header(hdrs) => hdrs.as_slice().buffer_len(),
Self::Autoneg(_)
| Self::Duplex(_)
| Self::ControllerSubordinateCfg(_)
| Self::ControllerSubordinateState(_) => 1,
Self::Ours(_) => {
todo!("Does not support changing ethtool link mode yet")
}
Self::Peer(_) => {
todo!("Does not support changing ethtool link mode yet")
}
Self::Speed(_) | Self::Lanes(_) => 4,
Self::Other(attr) => attr.value_len(),
}
}
fn kind(&self) -> u16 {
match self {
Self::Header(_) => ETHTOOL_A_LINKMODES_HEADER | NLA_F_NESTED,
Self::Autoneg(_) => ETHTOOL_A_LINKMODES_AUTONEG,
Self::Ours(_) => ETHTOOL_A_LINKMODES_OURS,
Self::Peer(_) => ETHTOOL_A_LINKMODES_PEER,
Self::Speed(_) => ETHTOOL_A_LINKMODES_SPEED,
Self::Duplex(_) => ETHTOOL_A_LINKMODES_DUPLEX,
Self::ControllerSubordinateCfg(_) => ETHTOOL_A_LINKMODES_SUBORDINATE_CFG,
Self::ControllerSubordinateState(_) => ETHTOOL_A_LINKMODES_SUBORDINATE_STATE,
Self::Lanes(_) => ETHTOOL_A_LINKMODES_LANES,
Self::Other(attr) => attr.kind(),
}
}
fn emit_value(&self, buffer: &mut [u8]) {
match self {
Self::Header(ref nlas) => nlas.as_slice().emit(buffer),
Self::Other(ref attr) => attr.emit(buffer),
_ => todo!("Does not support changing ethtool link mode yet"),
}
}
}
impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>> for EthtoolLinkModeAttr {
fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
let payload = buf.value();
Ok(match buf.kind() {
ETHTOOL_A_LINKMODES_HEADER => {
let mut nlas = Vec::new();
let error_msg = "failed to parse link_mode header attributes";
for nla in NlasIterator::new(payload) {
let nla = &nla.context(error_msg)?;
let parsed = EthtoolHeader::parse(nla).context(error_msg)?;
nlas.push(parsed);
}
Self::Header(nlas)
}
ETHTOOL_A_LINKMODES_AUTONEG => Self::Autoneg(
parse_u8(payload).context("Invalid ETHTOOL_A_LINKMODES_AUTONEG value")? == 1,
),
ETHTOOL_A_LINKMODES_OURS => Self::Ours(parse_bitset_bits_nlas(payload)?),
ETHTOOL_A_LINKMODES_PEER => Self::Peer(parse_bitset_bits_nlas(payload)?),
ETHTOOL_A_LINKMODES_SPEED => {
Self::Speed(parse_u32(payload).context("Invalid ETHTOOL_A_LINKMODES_SPEED value")?)
}
ETHTOOL_A_LINKMODES_DUPLEX => Self::Duplex(
parse_u8(payload)
.context("Invalid ETHTOOL_A_LINKMODES_DUPLEX value")?
.into(),
),
ETHTOOL_A_LINKMODES_SUBORDINATE_CFG => Self::ControllerSubordinateCfg(
parse_u8(payload).context("Invalid ETHTOOL_A_LINKMODES_SUBORDINATE_CFG value")?,
),
ETHTOOL_A_LINKMODES_SUBORDINATE_STATE => Self::ControllerSubordinateState(
parse_u8(payload).context("Invalid ETHTOOL_A_LINKMODES_SUBORDINATE_STATE value")?,
),
ETHTOOL_A_LINKMODES_LANES => {
Self::Lanes(parse_u32(payload).context("Invalid ETHTOOL_A_LINKMODES_LANES value")?)
}
_ => Self::Other(DefaultNla::parse(buf).context("invalid NLA (unknown kind)")?),
})
}
}
fn parse_bitset_bits_nlas(raw: &[u8]) -> Result<Vec<String>, DecodeError> {
let error_msg = "failed to parse mode bit sets";
for nla in NlasIterator::new(raw) {
let nla = &nla.context(error_msg)?;
if nla.kind() == ETHTOOL_A_BITSET_BITS {
return parse_bitset_bits_nla(nla.value());
}
}
Err("No ETHTOOL_A_BITSET_BITS NLA found".into())
}
fn parse_bitset_bits_nla(raw: &[u8]) -> Result<Vec<String>, DecodeError> {
let mut modes = Vec::new();
let error_msg = "Failed to parse ETHTOOL_A_BITSET_BITS attributes";
for bit_nla in NlasIterator::new(raw) {
let bit_nla = &bit_nla.context(error_msg)?;
match bit_nla.kind() {
ETHTOOL_A_BITSET_BITS_BIT => {
let error_msg = "Failed to parse ETHTOOL_A_BITSET_BITS_BIT attributes";
let nlas = NlasIterator::new(bit_nla.value());
for nla in nlas {
let nla = &nla.context(error_msg)?;
let payload = nla.value();
match nla.kind() {
ETHTOOL_A_BITSET_BIT_INDEX | ETHTOOL_A_BITSET_BIT_VALUE => {
// ignored
}
ETHTOOL_A_BITSET_BIT_NAME => {
modes.push(
parse_string(payload)
.context("Invald ETHTOOL_A_BITSET_BIT_NAME value")?,
);
}
_ => {
warn!(
"Unknown ETHTOOL_A_BITSET_BITS_BIT {} {:?}",
nla.kind(),
nla.value(),
);
}
}
}
}
_ => {
warn!(
"Unknown ETHTOOL_A_BITSET_BITS kind {}, {:?}",
bit_nla.kind(),
bit_nla.value()
);
}
};
}
Ok(modes)
}
pub(crate) fn parse_link_mode_nlas(buffer: &[u8]) -> Result<Vec<EthtoolAttr>, DecodeError> {
let mut nlas = Vec::new();
for nla in NlasIterator::new(buffer) {
let error_msg = format!(
"Failed to parse ethtool link_mode message attribute {:?}",
nla
);
let nla = &nla.context(error_msg.clone())?;
let parsed = EthtoolLinkModeAttr::parse(nla).context(error_msg)?;
nlas.push(EthtoolAttr::LinkMode(parsed));
}
Ok(nlas)
}
================================================
FILE: ethtool/src/link_mode/get.rs
================================================
// SPDX-License-Identifier: MIT
use futures::TryStream;
use netlink_packet_generic::GenlMessage;
use crate::{ethtool_execute, EthtoolError, EthtoolHandle, EthtoolMessage};
pub struct EthtoolLinkModeGetRequest {
handle: EthtoolHandle,
iface_name: Option<String>,
}
impl EthtoolLinkModeGetRequest {
pub(crate) fn new(handle: EthtoolHandle, iface_name: Option<&str>) -> Self {
EthtoolLinkModeGetRequest {
handle,
iface_name: iface_name.map(|i| i.to_string()),
}
}
pub async fn execute(
self,
) -> impl TryStream<Ok = GenlMessage<EthtoolMessage>, Error = EthtoolError> {
let EthtoolLinkModeGetRequest {
mut handle,
iface_name,
} = self;
let ethtool_msg = EthtoolMessage::new_link_mode_get(iface_name.as_deref());
ethtool_execute(&mut handle, iface_name.is_none(), ethtool_msg).await
}
}
================================================
FILE: ethtool/src/link_mode/handle.rs
================================================
// SPDX-License-Identifier: MIT
use crate::{EthtoolHandle, EthtoolLinkModeGetRequest};
pub struct EthtoolLinkModeHandle(EthtoolHandle);
impl EthtoolLinkModeHandle {
pub fn new(handle: EthtoolHandle) -> Self {
EthtoolLinkModeHandle(handle)
}
/// Retrieve the ethtool link_modes(duplex, link speed and etc) of a interface
pub fn get(&mut self, iface_name: Option<&str>) -> EthtoolLinkModeGetRequest {
EthtoolLinkModeGetRequest::new(self.0.clone(), iface_name)
}
}
================================================
FILE: ethtool/src/link_mode/mod.rs
================================================
// SPDX-License-Identifier: MIT
mod attr;
mod get;
mod handle;
pub(crate) use attr::parse_link_mode_nlas;
pub use attr::{EthtoolLinkModeAttr, EthtoolLinkModeDuplex};
pub use get::EthtoolLinkModeGetRequest;
pub use handle::EthtoolLinkModeHandle;
================================================
FILE: ethtool/src/macros.rs
================================================
// SPDX-License-Identifier: MIT
#[macro_export]
macro_rules! try_ethtool {
($msg: expr) => {{
use netlink_packet_core::{NetlinkMessage, NetlinkPayload};
use $crate::EthtoolError;
match $msg {
Ok(msg) => {
let (header, payload) = msg.into_parts();
match payload {
NetlinkPayload::InnerMessage(msg) => msg,
NetlinkPayload::Error(err) => return Err(EthtoolError::NetlinkError(err)),
_ => {
return Err(EthtoolError::UnexpectedMessage(NetlinkMessage::new(
header, payload,
)))
}
}
}
Err(e) => return Err(EthtoolError::Bug(format!("BUG: decode error {:?}", e))),
}
}};
}
================================================
FILE: ethtool/src/message.rs
================================================
// SPDX-License-Identifier: MIT
use netlink_packet_core::DecodeError;
use netlink_packet_generic::{GenlFamily, GenlHeader};
use netlink_packet_utils::{nla::Nla, Emitable, ParseableParametrized};
use crate::{
coalesce::{parse_coalesce_nlas, EthtoolCoalesceAttr},
feature::{parse_feature_nlas, EthtoolFeatureAttr},
link_mode::{parse_link_mode_nlas, EthtoolLinkModeAttr},
pause::{parse_pause_nlas, EthtoolPauseAttr},
ring::{parse_ring_nlas, EthtoolRingAttr},
EthtoolHeader,
};
const ETHTOOL_MSG_PAUSE_GET: u8 = 21;
const ETHTOOL_MSG_PAUSE_GET_REPLY: u8 = 22;
const ETHTOOL_MSG_FEATURES_GET: u8 = 11;
const ETHTOOL_MSG_FEATURES_GET_REPLY: u8 = 11;
const ETHTOOL_MSG_LINKMODES_GET: u8 = 4;
const ETHTOOL_MSG_LINKMODES_GET_REPLY: u8 = 4;
const ETHTOOL_MSG_RINGS_GET: u8 = 15;
const ETHTOOL_MSG_RINGS_GET_REPLY: u8 = 16;
const ETHTOOL_MSG_COALESCE_GET: u8 = 19;
const ETHTOOL_MSG_COALESCE_GET_REPLY: u8 = 20;
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum EthtoolCmd {
PauseGet,
PauseGetReply,
FeatureGet,
FeatureGetReply,
LinkModeGet,
LinkModeGetReply,
RingGet,
RingGetReply,
CoalesceGet,
CoalesceGetReply,
}
impl From<EthtoolCmd> for u8 {
fn from(cmd: EthtoolCmd) -> Self {
match cmd {
EthtoolCmd::PauseGet => ETHTOOL_MSG_PAUSE_GET,
EthtoolCmd::PauseGetReply => ETHTOOL_MSG_PAUSE_GET_REPLY,
EthtoolCmd::FeatureGet => ETHTOOL_MSG_FEATURES_GET,
EthtoolCmd::FeatureGetReply => ETHTOOL_MSG_FEATURES_GET_REPLY,
EthtoolCmd::LinkModeGet => ETHTOOL_MSG_LINKMODES_GET,
EthtoolCmd::LinkModeGetReply => ETHTOOL_MSG_LINKMODES_GET_REPLY,
EthtoolCmd::RingGet => ETHTOOL_MSG_RINGS_GET,
EthtoolCmd::RingGetReply => ETHTOOL_MSG_RINGS_GET_REPLY,
EthtoolCmd::CoalesceGet => ETHTOOL_MSG_COALESCE_GET,
EthtoolCmd::CoalesceGetReply => ETHTOOL_MSG_COALESCE_GET_REPLY,
}
}
}
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum EthtoolAttr {
Pause(EthtoolPauseAttr),
Feature(EthtoolFeatureAttr),
LinkMode(EthtoolLinkModeAttr),
Ring(EthtoolRingAttr),
Coalesce(EthtoolCoalesceAttr),
}
impl Nla for EthtoolAttr {
fn value_len(&self) -> usize {
match self {
Self::Pause(attr) => attr.value_len(),
Self::Feature(attr) => attr.value_len(),
Self::LinkMode(attr) => attr.value_len(),
Self::Ring(attr) => attr.value_len(),
Self::Coalesce(attr) => attr.value_len(),
}
}
fn kind(&self) -> u16 {
match self {
Self::Pause(attr) => attr.kind(),
Self::Feature(attr) => attr.kind(),
Self::LinkMode(attr) => attr.kind(),
Self::Ring(attr) => attr.kind(),
Self::Coalesce(attr) => attr.kind(),
}
}
fn emit_value(&self, buffer: &mut [u8]) {
match self {
Self::Pause(attr) => attr.emit_value(buffer),
Self::Feature(attr) => attr.emit_value(buffer),
Self::LinkMode(attr) => attr.emit_value(buffer),
Self::Ring(attr) => attr.emit_value(buffer),
Self::Coalesce(attr) => attr.emit_value(buffer),
}
}
}
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct EthtoolMessage {
pub cmd: EthtoolCmd,
pub nlas: Vec<EthtoolAttr>,
}
impl GenlFamily for EthtoolMessage {
fn family_name() -> &'static str {
"ethtool"
}
fn version(&self) -> u8 {
1
}
fn command(&self) -> u8 {
self.cmd.into()
}
}
impl EthtoolMessage {
pub fn new_pause_get(iface_name: Option<&str>) -> Self {
let nlas = match iface_name {
Some(s) => vec![EthtoolAttr::Pause(EthtoolPauseAttr::Header(vec![
EthtoolHeader::DevName(s.to_string()),
]))],
None => vec![EthtoolAttr::Pause(EthtoolPauseAttr::Header(vec![]))],
};
EthtoolMessage {
cmd: EthtoolCmd::PauseGet,
nlas,
}
}
pub fn new_feature_get(iface_name: Option<&str>) -> Self {
let nlas = match iface_name {
Some(s) => vec![EthtoolAttr::Feature(EthtoolFeatureAttr::Header(vec![
EthtoolHeader::DevName(s.to_string()),
]))],
None => vec![EthtoolAttr::Feature(EthtoolFeatureAttr::Header(vec![]))],
};
EthtoolMessage {
cmd: EthtoolCmd::FeatureGet,
nlas,
}
}
pub fn new_link_mode_get(iface_name: Option<&str>) -> Self {
let nlas = match iface_name {
Some(s) => vec![EthtoolAttr::LinkMode(EthtoolLinkModeAttr::Header(vec![
EthtoolHeader::DevName(s.to_string()),
]))],
None => vec![EthtoolAttr::LinkMode(EthtoolLinkModeAttr::Header(vec![]))],
};
EthtoolMessage {
cmd: EthtoolCmd::LinkModeGet,
nlas,
}
}
pub fn new_ring_get(iface_name: Option<&str>) -> Self {
let nlas = match iface_name {
Some(s) => vec![EthtoolAttr::Ring(EthtoolRingAttr::Header(vec![
EthtoolHeader::DevName(s.to_string()),
]))],
None => vec![EthtoolAttr::Ring(EthtoolRingAttr::Header(vec![]))],
};
EthtoolMessage {
cmd: EthtoolCmd::RingGet,
nlas,
}
}
pub fn new_coalesce_get(iface_name: Option<&str>) -> Self {
let nlas = match iface_name {
Some(s) => vec![EthtoolAttr::Coalesce(EthtoolCoalesceAttr::Header(vec![
EthtoolHeader::DevName(s.to_string()),
]))],
None => vec![EthtoolAttr::Coalesce(EthtoolCoalesceAttr::Header(vec![]))],
};
EthtoolMessage {
cmd: EthtoolCmd::CoalesceGet,
nlas,
}
}
}
impl Emitable for EthtoolMessage {
fn buffer_len(&self) -> usize {
self.nlas.as_slice().buffer_len()
}
fn emit(&self, buffer: &mut [u8]) {
self.nlas.as_slice().emit(buffer)
}
}
impl ParseableParametrized<[u8], GenlHeader> for EthtoolMessage {
fn parse_with_param(buffer: &[u8], header: GenlHeader) -> Result<Self, DecodeError> {
Ok(match header.cmd {
ETHTOOL_MSG_PAUSE_GET_REPLY => Self {
cmd: EthtoolCmd::PauseGetReply,
nlas: parse_pause_nlas(buffer)?,
},
ETHTOOL_MSG_FEATURES_GET_REPLY => Self {
cmd: EthtoolCmd::FeatureGetReply,
nlas: parse_feature_nlas(buffer)?,
},
ETHTOOL_MSG_LINKMODES_GET_REPLY => Self {
cmd: EthtoolCmd::LinkModeGetReply,
nlas: parse_link_mode_nlas(buffer)?,
},
ETHTOOL_MSG_RINGS_GET_REPLY => Self {
cmd: EthtoolCmd::RingGetReply,
nlas: parse_ring_nlas(buffer)?,
},
ETHTOOL_MSG_COALESCE_GET_REPLY => Self {
cmd: EthtoolCmd::CoalesceGetReply,
nlas: parse_coalesce_nlas(buffer)?,
},
cmd => {
return Err(DecodeError::from(format!(
"Unsupported ethtool reply command: {}",
cmd
)))
}
})
}
}
================================================
FILE: ethtool/src/pause/attr.rs
================================================
// SPDX-License-Identifier: MIT
use anyhow::Context;
use byteorder::{ByteOrder, NativeEndian};
use netlink_packet_utils::{
nla::{DefaultNla, Nla, NlaBuffer, NlasIterator, NLA_F_NESTED},
parsers::{parse_u64, parse_u8},
DecodeError,
Emitable,
Parseable,
};
use crate::{EthtoolAttr, EthtoolHeader};
const ETHTOOL_A_PAUSE_HEADER: u16 = 1;
const ETHTOOL_A_PAUSE_AUTONEG: u16 = 2;
const ETHTOOL_A_PAUSE_RX: u16 = 3;
const ETHTOOL_A_PAUSE_TX: u16 = 4;
const ETHTOOL_A_PAUSE_STATS: u16 = 5;
const ETHTOOL_A_PAUSE_STAT_TX_FRAMES: u16 = 2;
const ETHTOOL_A_PAUSE_STAT_RX_FRAMES: u16 = 3;
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum EthtoolPauseStatAttr {
Rx(u64),
Tx(u64),
Other(DefaultNla),
}
impl Nla for EthtoolPauseStatAttr {
fn value_len(&self) -> usize {
match self {
Self::Rx(_) | Self::Tx(_) => 8,
Self::Other(attr) => attr.value_len(),
}
}
fn kind(&self) -> u16 {
match self {
Self::Rx(_) => ETHTOOL_A_PAUSE_STAT_RX_FRAMES,
Self::Tx(_) => ETHTOOL_A_PAUSE_STAT_RX_FRAMES,
Self::Other(attr) => attr.kind(),
}
}
fn emit_value(&self, buffer: &mut [u8]) {
match self {
Self::Rx(value) | Self::Tx(value) => NativeEndian::write_u64(buffer, *value),
Self::Other(ref attr) => attr.emit_value(buffer),
}
}
}
impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>> for EthtoolPauseStatAttr {
fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
let payload = buf.value();
Ok(match buf.kind() {
ETHTOOL_A_PAUSE_STAT_TX_FRAMES => Self::Tx(
parse_u64(payload).context("invalid ETHTOOL_A_PAUSE_STAT_TX_FRAMES value")?,
),
ETHTOOL_A_PAUSE_STAT_RX_FRAMES => Self::Rx(
parse_u64(payload).context("invalid ETHTOOL_A_PAUSE_STAT_RX_FRAMES value")?,
),
_ => Self::Other(DefaultNla::parse(buf).context("invalid NLA (unknown kind)")?),
})
}
}
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum EthtoolPauseAttr {
Header(Vec<EthtoolHeader>),
AutoNeg(bool),
Rx(bool),
Tx(bool),
Stats(Vec<EthtoolPauseStatAttr>),
Other(DefaultNla),
}
impl Nla for EthtoolPauseAttr {
fn value_len(&self) -> usize {
match self {
Self::Header(hdrs) => hdrs.as_slice().buffer_len(),
Self::AutoNeg(_) | Self::Rx(_) | Self::Tx(_) => 1,
Self::Stats(ref nlas) => nlas.as_slice().buffer_len(),
Self::Other(attr) => attr.value_len(),
}
}
fn kind(&self) -> u16 {
match self {
Self::Header(_) => ETHTOOL_A_PAUSE_HEADER | NLA_F_NESTED,
Self::AutoNeg(_) => ETHTOOL_A_PAUSE_AUTONEG,
Self::Rx(_) => ETHTOOL_A_PAUSE_RX,
Self::Tx(_) => ETHTOOL_A_PAUSE_TX,
Self::Stats(_) => ETHTOOL_A_PAUSE_STATS | NLA_F_NESTED,
Self::Other(attr) => attr.kind(),
}
}
fn emit_value(&self, buffer: &mut [u8]) {
match self {
Self::Header(ref nlas) => nlas.as_slice().emit(buffer),
Self::AutoNeg(value) | Self::Rx(value) | Self::Tx(value) => buffer[0] = *value as u8,
Self::Stats(ref nlas) => nlas.as_slice().emit(buffer),
Self::Other(ref attr) => attr.emit(buffer),
}
}
}
impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>> for EthtoolPauseAttr {
fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
let payload = buf.value();
Ok(match buf.kind() {
ETHTOOL_A_PAUSE_HEADER => {
let mut nlas = Vec::new();
let error_msg = "failed to parse pause header attributes";
for nla in NlasIterator::new(payload) {
let nla = &nla.context(error_msg)?;
let parsed = EthtoolHeader::parse(nla).context(error_msg)?;
nlas.push(parsed);
}
Self::Header(nlas)
}
ETHTOOL_A_PAUSE_AUTONEG => Self::AutoNeg(
parse_u8(payload).context("invalid ETHTOOL_A_PAUSE_AUTONEG value")? == 1,
),
ETHTOOL_A_PAUSE_RX => {
Self::Rx(parse_u8(payload).context("invalid ETHTOOL_A_PAUSE_RX value")? == 1)
}
ETHTOOL_A_PAUSE_TX => {
Self::Tx(parse_u8(payload).context("invalid ETHTOOL_A_PAUSE_TX value")? == 1)
}
ETHTOOL_A_PAUSE_STATS => {
let mut nlas = Vec::new();
let error_msg = "failed to parse pause stats attributes";
for nla in NlasIterator::new(payload) {
let nla = &nla.context(error_msg)?;
let parsed = EthtoolPauseStatAttr::parse(nla).context(error_msg)?;
nlas.push(parsed);
}
Self::Stats(nlas)
}
_ => Self::Other(DefaultNla::parse(buf).context("invalid NLA (unknown kind)")?),
})
}
}
pub(crate) fn parse_pause_nlas(buffer: &[u8]) -> Result<Vec<EthtoolAttr>, DecodeError> {
let mut nlas = Vec::new();
for nla in NlasIterator::new(buffer) {
let error_msg = format!("Failed to parse ethtool pause message attribute {:?}", nla);
let nla = &nla.context(error_msg.clone())?;
let parsed = EthtoolPauseAttr::parse(nla).context(error_msg)?;
nlas.push(EthtoolAttr::Pause(parsed));
}
Ok(nlas)
}
================================================
FILE: ethtool/src/pause/get.rs
================================================
// SPDX-License-Identifier: MIT
use futures::TryStream;
use netlink_packet_generic::GenlMessage;
use crate::{ethtool_execute, EthtoolError, EthtoolHandle, EthtoolMessage};
pub struct EthtoolPauseGetRequest {
handle: EthtoolHandle,
iface_name: Option<String>,
}
impl EthtoolPauseGetRequest {
pub(crate) fn new(handle: EthtoolHandle, iface_name: Option<&str>) -> Self {
EthtoolPauseGetRequest {
handle,
iface_name: iface_name.map(|i| i.to_string()),
}
}
pub async fn execute(
self,
) -> impl TryStream<Ok = GenlMessage<EthtoolMessage>, Error = EthtoolError> {
let EthtoolPauseGetRequest {
mut handle,
iface_name,
} = self;
let ethtool_msg = EthtoolMessage::new_pause_get(iface_name.as_deref());
ethtool_execute(&mut handle, iface_name.is_none(), ethtool_msg).await
}
}
================================================
FILE: ethtool/src/pause/handle.rs
================================================
// SPDX-License-Identifier: MIT
use crate::{EthtoolHandle, EthtoolPauseGetRequest};
pub struct EthtoolPauseHandle(EthtoolHandle);
impl EthtoolPauseHandle {
pub fn new(handle: EthtoolHandle) -> Self {
EthtoolPauseHandle(handle)
}
/// Retrieve the pause setting of a interface (equivalent to `ethtool -a eth1`)
pub fn get(&mut self, iface_name: Option<&str>) -> EthtoolPauseGetRequest {
EthtoolPauseGetRequest::new(self.0.clone(), iface_name)
}
}
================================================
FILE: ethtool/src/pause/mod.rs
================================================
// SPDX-License-Identifier: MIT
mod attr;
mod get;
mod handle;
pub(crate) use attr::parse_pause_nlas;
pub use attr::{EthtoolPauseAttr, EthtoolPauseStatAttr};
pub use get::EthtoolPauseGetRequest;
pub use handle::EthtoolPauseHandle;
================================================
FILE: ethtool/src/ring/attr.rs
================================================
// SPDX-License-Identifier: MIT
use anyhow::Context;
use byteorder::{ByteOrder, NativeEndian};
use netlink_packet_utils::{
nla::{DefaultNla, Nla, NlaBuffer, NlasIterator, NLA_F_NESTED},
parsers::parse_u32,
DecodeError,
Emitable,
Parseable,
};
use crate::{EthtoolAttr, EthtoolHeader};
const ETHTOOL_A_RINGS_HEADER: u16 = 1;
const ETHTOOL_A_RINGS_RX_MAX: u16 = 2;
const ETHTOOL_A_RINGS_RX_MINI_MAX: u16 = 3;
const ETHTOOL_A_RINGS_RX_JUMBO_MAX: u16 = 4;
const ETHTOOL_A_RINGS_TX_MAX: u16 = 5;
const ETHTOOL_A_RINGS_RX: u16 = 6;
const ETHTOOL_A_RINGS_RX_MINI: u16 = 7;
const ETHTOOL_A_RINGS_RX_JUMBO: u16 = 8;
const ETHTOOL_A_RINGS_TX: u16 = 9;
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum EthtoolRingAttr {
Header(Vec<EthtoolHeader>),
RxMax(u32),
RxMiniMax(u32),
RxJumboMax(u32),
TxMax(u32),
Rx(u32),
RxMini(u32),
RxJumbo(u32),
Tx(u32),
Other(DefaultNla),
}
impl Nla for EthtoolRingAttr {
fn value_len(&self) -> usize {
match self {
Self::Header(hdrs) => hdrs.as_slice().buffer_len(),
Self::RxMax(_)
| Self::RxMiniMax(_)
| Self::RxJumboMax(_)
| Self::TxMax(_)
| Self::Rx(_)
| Self::RxMini(_)
| Self::RxJumbo(_)
| Self::Tx(_) => 4,
Self::Other(attr) => attr.value_len(),
}
}
fn kind(&self) -> u16 {
match self {
Self::Header(_) => ETHTOOL_A_RINGS_HEADER | NLA_F_NESTED,
Self::RxMax(_) => ETHTOOL_A_RINGS_RX_MAX,
Self::RxMiniMax(_) => ETHTOOL_A_RINGS_RX_MINI_MAX,
Self::RxJumboMax(_) => ETHTOOL_A_RINGS_RX_JUMBO_MAX,
Self::TxMax(_) => ETHTOOL_A_RINGS_TX_MAX,
Self::Rx(_) => ETHTOOL_A_RINGS_RX,
Self::RxMini(_) => ETHTOOL_A_RINGS_RX_MINI,
Self::RxJumbo(_) => ETHTOOL_A_RINGS_RX_JUMBO,
Self::Tx(_) => ETHTOOL_A_RINGS_TX,
Self::Other(attr) => attr.kind(),
}
}
fn emit_value(&self, buffer: &mut [u8]) {
match self {
Self::Header(ref nlas) => nlas.as_slice().emit(buffer),
Self::RxMax(d)
| Self::RxMiniMax(d)
| Self::RxJumboMax(d)
| Self::TxMax(d)
| Self::Rx(d)
| Self::RxMini(d)
| Self::RxJumbo(d)
| Self::Tx(d) => NativeEndian::write_u32(buffer, *d),
Self::Other(ref attr) => attr.emit(buffer),
}
}
}
impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>> for EthtoolRingAttr {
fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
let payload = buf.value();
Ok(match buf.kind() {
ETHTOOL_A_RINGS_HEADER => {
let mut nlas = Vec::new();
let error_msg = "failed to parse ring header attributes";
for nla in NlasIterator::new(payload) {
let nla = &nla.context(error_msg)?;
let parsed = EthtoolHeader::parse(nla).context(error_msg)?;
nlas.push(parsed);
}
Self::Header(nlas)
}
ETHTOOL_A_RINGS_RX_MAX => {
Self::RxMax(parse_u32(payload).context("Invalid ETHTOOL_A_RINGS_RX_MAX value")?)
}
ETHTOOL_A_RINGS_RX_MINI_MAX => Self::RxMiniMax(
parse_u32(payload).context("Invalid ETHTOOL_A_RINGS_RX_MINI_MAX value")?,
),
ETHTOOL_A_RINGS_RX_JUMBO_MAX => Self::RxJumboMax(
parse_u32(payload).context("Invalid ETHTOOL_A_RINGS_RX_JUMBO_MAX value")?,
),
ETHTOOL_A_RINGS_TX_MAX => {
Self::TxMax(parse_u32(payload).context("Invalid ETHTOOL_A_RINGS_TX_MAX value")?)
}
ETHTOOL_A_RINGS_RX => {
Self::Rx(parse_u32(payload).context("Invalid ETHTOOL_A_RINGS_RX value")?)
}
ETHTOOL_A_RINGS_RX_MINI => {
Self::RxMini(parse_u32(payload).context("Invalid ETHTOOL_A_RINGS_RX_MINI value")?)
}
ETHTOOL_A_RINGS_RX_JUMBO => {
Self::RxJumbo(parse_u32(payload).context("Invalid ETHTOOL_A_RINGS_RX_JUMBO value")?)
}
ETHTOOL_A_RINGS_TX => {
Self::Tx(parse_u32(payload).context("Invalid ETHTOOL_A_RINGS_TX value")?)
}
_ => Self::Other(DefaultNla::parse(buf).context("invalid NLA (unknown kind)")?),
})
}
}
pub(crate) fn parse_ring_nlas(buffer: &[u8]) -> Result<Vec<EthtoolAttr>, DecodeError> {
let mut nlas = Vec::new();
for nla in NlasIterator::new(buffer) {
let error_msg = format!("Failed to parse ethtool ring message attribute {:?}", nla);
let nla = &nla.context(error_msg.clone())?;
let parsed = EthtoolRingAttr::parse(nla).context(error_msg)?;
nlas.push(EthtoolAttr::Ring(parsed));
}
Ok(nlas)
}
================================================
FILE: ethtool/src/ring/get.rs
================================================
// SPDX-License-Identifier: MIT
use futures::TryStream;
use netlink_packet_generic::GenlMessage;
use crate::{ethtool_execute, EthtoolError, EthtoolHandle, EthtoolMessage};
pub struct EthtoolRingGetRequest {
handle: EthtoolHandle,
iface_name: Option<String>,
}
impl EthtoolRingGetRequest {
pub(crate) fn new(handle: EthtoolHandle, iface_name: Option<&str>) -> Self {
EthtoolRingGetRequest {
handle,
iface_name: iface_name.map(|i| i.to_string()),
}
}
pub async fn execute(
self,
) -> impl TryStream<Ok = GenlMessage<EthtoolMessage>, Error = EthtoolError> {
let EthtoolRingGetRequest {
mut handle,
iface_name,
} = self;
let ethtool_msg = EthtoolMessage::new_ring_get(iface_name.as_deref());
ethtool_execute(&mut handle, iface_name.is_none(), ethtool_msg).await
}
}
================================================
FILE: ethtool/src/ring/handle.rs
================================================
// SPDX-License-Identifier: MIT
use crate::{EthtoolHandle, EthtoolRingGetRequest};
pub struct EthtoolRingHandle(EthtoolHandle);
impl EthtoolRingHandle {
pub fn new(handle: EthtoolHandle) -> Self {
EthtoolRingHandle(handle)
}
/// Retrieve the ethtool rings of a interface (equivalent to `ethtool -g eth1`)
pub fn get(&mut self, iface_name: Option<&str>) -> EthtoolRingGetRequest {
EthtoolRingGetRequest::new(self.0.clone(), iface_name)
}
}
================================================
FILE: ethtool/src/ring/mod.rs
================================================
// SPDX-License-Identifier: MIT
mod attr;
mod get;
mod handle;
pub(crate) use attr::parse_ring_nlas;
pub use attr::EthtoolRingAttr;
pub use get::EthtoolRingGetRequest;
pub use handle::EthtoolRingHandle;
================================================
FILE: ethtool/tests/dump_link_modes.rs
================================================
// SPDX-License-Identifier: MIT
use futures::stream::TryStreamExt;
#[test]
// CI container normally have a veth for external communication which support link modes of ethtool.
fn test_dump_link_modes() {
let rt = tokio::runtime::Builder::new_current_thread()
.enable_io()
.build()
.unwrap();
rt.block_on(dump_link_modes());
}
async fn dump_link_modes() {
let (connection, mut handle, _) = ethtool::new_connection().unwrap();
tokio::spawn(connection);
let mut link_modes_handle = handle.link_mode().get(None).execute().await;
let mut msgs = Vec::new();
while let Some(msg) = link_modes_handle.try_next().await.unwrap() {
msgs.push(msg);
}
assert!(!msgs.is_empty());
let ethtool_msg = &msgs[0].payload;
println!("ethtool_msg {:?}", ðtool_msg);
assert!(ethtool_msg.cmd == ethtool::EthtoolCmd::LinkModeGetReply);
assert!(ethtool_msg.nlas.len() > 1);
}
================================================
FILE: ethtool/tests/get_features_lo.rs
================================================
// SPDX-License-Identifier: MIT
use futures::stream::TryStreamExt;
#[test]
fn test_get_features_of_loopback() {
let rt = tokio::runtime::Builder::new_current_thread()
.enable_io()
.build()
.unwrap();
rt.block_on(get_feature(Some("lo")));
}
async fn get_feature(iface_name: Option<&str>) {
let (connection, mut handle, _) = ethtool::new_connection().unwrap();
tokio::spawn(connection);
let mut feature_handle = handle.feature().get(iface_name).execute().await;
let mut msgs = Vec::new();
while let Some(msg) = feature_handle.try_next().await.unwrap() {
msgs.push(msg);
}
assert!(msgs.len() == 1);
let ethtool_msg = &msgs[0].payload;
assert!(ethtool_msg.cmd == ethtool::EthtoolCmd::FeatureGetReply);
assert!(ethtool_msg.nlas.len() > 1);
assert!(
ethtool_msg.nlas[0]
== ethtool::EthtoolAttr::Feature(ethtool::EthtoolFeatureAttr::Header(vec![
ethtool::EthtoolHeader::DevIndex(1),
ethtool::EthtoolHeader::DevName("lo".into())
]))
);
}
================================================
FILE: genetlink/Cargo.toml
================================================
[package]
name = "genetlink"
version = "0.2.3"
authors = ["Leo <leo881003@gmail.com>"]
edition = "2018"
homepage = "https://github.com/little-dude/netlink"
repository = "https://github.com/little-dude/netlink"
keywords = ["netlink", "linux"]
license = "MIT"
readme = "../README.md"
description = "communicate with generic netlink"
[features]
default = ["tokio_socket"]
tokio_socket = ["netlink-proto/tokio_socket", "tokio"]
smol_socket = ["netlink-proto/smol_socket","async-std"]
[dependencies]
futures = "0.3.16"
netlink-proto = { default-features = false, version = "0.10" , path = "../netlink-proto" }
netlink-packet-generic = { version = "0.3.1", path = "../netlink-packet-generic" }
netlink-packet-utils = { version = "0.5.1", path = "../netlink-packet-utils" }
netlink-packet-core = { version = "0.4.2", path = "../netlink-packet-core" }
tokio = { version = "1.9.0", features = ["rt"], optional = true }
async-std = { version = "1.9.0", optional = true }
thiserror = "1.0.26"
[dev-dependencies]
anyhow = "1.0.42"
tokio = { version = "1.9.0", features = ["rt", "rt-multi-thread", "macros"] }
[[example]]
name = "list_genetlink_family"
required-features = ["tokio_socket"]
[[example]]
name = "dump_family_policy"
required-features = ["tokio_socket"]
================================================
FILE: genetlink/examples/dump_family_policy.rs
================================================
// SPDX-License-Identifier: MIT
use std::env::args;
use anyhow::{bail, Error};
use futures::StreamExt;
use genetlink::new_connection;
use netlink_packet_core::{
NetlinkHeader,
NetlinkMessage,
NetlinkPayload,
NLM_F_DUMP,
NLM_F_REQUEST,
};
use netlink_packet_generic::{
ctrl::{nlas::GenlCtrlAttrs, GenlCtrl, GenlCtrlCmd},
GenlMessage,
};
#[tokio::main]
async fn main() -> Result<(), Error> {
let argv: Vec<_> = args().collect();
if argv.len() < 2 {
eprintln!("Usage: dump_family_policy <family name>");
bail!("Required arguments not given");
}
let nlmsg = NetlinkMessage {
header: NetlinkHeader {
flags: NLM_F_REQUEST | NLM_F_DUMP,
..Default::default()
},
payload: GenlMessage::from_payload(GenlCtrl {
cmd: GenlCtrlCmd::GetPolicy,
nlas: vec![GenlCtrlAttrs::FamilyName(argv[1].to_owned())],
})
.into(),
};
let (conn, mut handle, _) = new_connection()?;
tokio::spawn(conn);
let mut responses = handle.request(nlmsg).await?;
while let Some(result) = responses.next().await {
let resp = result?;
match resp.payload {
NetlinkPayload::InnerMessage(genlmsg) => {
if genlmsg.payload.cmd == GenlCtrlCmd::GetPolicy {
println!("<<< {:?}", genlmsg);
}
}
NetlinkPayload::Error(err) => {
eprintln!("Received a netlink error message: {:?}", err);
bail!(err);
}
_ => {}
}
}
Ok(())
}
================================================
FILE: genetlink/examples/list_genetlink_family.rs
================================================
// SPDX-License-Identifier: MIT
//! Example of listing generic families based on `netlink_proto`
//!
//! This example's functionality is same as the identical name example in `netlink_packet_generic`.
//! But this example shows you the usage of this crate to run generic netlink protocol asynchronously.
use anyhow::{bail, Error};
use futures::StreamExt;
use genetlink::new_connection;
use netlink_packet_core::{
NetlinkHeader,
NetlinkMessage,
NetlinkPayload,
NLM_F_DUMP,
NLM_F_REQUEST,
};
use netlink_packet_generic::{
ctrl::{nlas::GenlCtrlAttrs, GenlCtrl, GenlCtrlCmd},
GenlMessage,
};
#[tokio::main]
async fn main() -> Result<(), Error> {
let nlmsg = NetlinkMessage {
header: NetlinkHeader {
flags: NLM_F_REQUEST | NLM_F_DUMP,
..Default::default()
},
payload: GenlMessage::from_payload(GenlCtrl {
cmd: GenlCtrlCmd::GetFamily,
nlas: vec![],
})
.into(),
};
let (conn, mut handle, _) = new_connection()?;
tokio::spawn(conn);
let mut responses = handle.request(nlmsg).await?;
while let Some(result) = responses.next().await {
let resp = result?;
match resp.payload {
NetlinkPayload::InnerMessage(genlmsg) => {
if genlmsg.payload.cmd == GenlCtrlCmd::NewFamily {
print_entry(genlmsg.payload.nlas);
}
}
NetlinkPayload::Error(err) => {
eprintln!("Received a netlink error message: {:?}", err);
bail!(err);
}
_ => {}
}
}
Ok(())
}
fn print_entry(entry: Vec<GenlCtrlAttrs>) {
let family_id = entry
.iter()
.find_map(|nla| {
if let GenlCtrlAttrs::FamilyId(id) = nla {
Some(*id)
} else {
None
}
})
.expect("Cannot find FamilyId attribute");
let family_name = entry
.iter()
.find_map(|nla| {
if let GenlCtrlAttrs::FamilyName(name) = nla {
Some(name.as_str())
} else {
None
}
})
.expect("Cannot find FamilyName attribute");
let version = entry
.iter()
.find_map(|nla| {
if let GenlCtrlAttrs::Version(ver) = nla {
Some(*ver)
} else {
None
}
})
.expect("Cannot find Version attribute");
let hdrsize = entry
.iter()
.find_map(|nla| {
if let GenlCtrlAttrs::HdrSize(hdr) = nla {
Some(*hdr)
} else {
None
}
})
.expect("Cannot find HdrSize attribute");
if hdrsize == 0 {
println!("0x{:04x} {} [Version {}]", family_id, family_name, version);
} else {
println!(
"0x{:04x} {} [Version {}] [Header {} bytes]",
family_id, family_name, version, hdrsize
);
}
}
================================================
FILE: genetlink/src/connection.rs
================================================
// SPDX-License-Identifier: MIT
use crate::{message::RawGenlMessage, GenetlinkHandle};
use futures::channel::mpsc::UnboundedReceiver;
use netlink_packet_core::NetlinkMessage;
use netlink_proto::{
self,
sys::{protocols::NETLINK_GENERIC, AsyncSocket, SocketAddr},
Connection,
};
use std::io;
/// Construct a generic netlink connection
///
/// The function would return a tuple containing three objects.
/// - an async netlink connection
/// - a connection handle to interact with the connection
/// - a receiver of the unsolicited messages
///
/// The connection object is also a event loop which implements [`std::future::Future`].
/// In most cases, users spawn it on an async runtime and use the handle to send
/// messages. For detailed documentation, please refer to [`netlink_proto::new_connection`].
///
/// The [`GenetlinkHandle`] can send and receive any type of generic netlink message.
/// And it can automatic resolve the generic family id before sending.
#[cfg(feature = "tokio_socket")]
#[allow(clippy::type_complexity)]
pub fn new_connection() -> io::Result<(
Connection<RawGenlMessage>,
GenetlinkHandle,
UnboundedReceiver<(NetlinkMessage<RawGenlMessage>, SocketAddr)>,
)> {
new_connection_with_socket()
}
/// Variant of [`new_connection`] that allows specifying a socket type to use for async handling
#[allow(clippy::type_complexity)]
pub fn new_connection_with_socket<S>() -> io::Result<(
Connection<RawGenlMessage, S>,
GenetlinkHandle,
UnboundedReceiver<(NetlinkMessage<RawGenlMessage>, SocketAddr)>,
)>
where
S: AsyncSocket,
{
let (conn, handle, messages) = netlink_proto::new_connection_with_socket(NETLINK_GENERIC)?;
Ok((conn, GenetlinkHandle::new(handle), messages))
}
================================================
FILE: genetlink/src/error.rs
================================================
// SPDX-License-Identifier: MIT
use crate::message::RawGenlMessage;
/// Error type of genetlink
#[derive(Debug, Error)]
pub enum GenetlinkError {
#[error("Failed to send netlink request")]
ProtocolError(#[from] netlink_proto::Error<RawGenlMessage>),
#[error("Failed to decode generic packet")]
DecodeError(#[from] netlink_packet_utils::DecodeError),
#[error("Netlink error message: {0}")]
NetlinkError(std::io::Error),
#[error("Cannot find specified netlink attribute: {0}")]
AttributeNotFound(String),
#[error("Desire netlink message type not received")]
NoMessageReceived,
}
// Since `netlink_packet_core::error::ErrorMessage` doesn't impl `Error` trait,
// it need to convert to `std::io::Error` here
impl From<netlink_packet_core::error::ErrorMessage> for GenetlinkError {
fn from(err_msg: netlink_packet_core::error::ErrorMessage) -> Self {
Self::NetlinkError(err_msg.to_io())
}
}
================================================
FILE: genetlink/src/handle.rs
================================================
// SPDX-License-Identifier: MIT
use crate::{
error::GenetlinkError,
message::{map_from_rawgenlmsg, map_to_rawgenlmsg, RawGenlMessage},
resolver::Resolver,
};
use futures::{lock::Mutex, Stream, StreamExt};
use netlink_packet_core::{DecodeError, NetlinkMessage, NetlinkPayload};
use netlink_packet_generic::{GenlFamily, GenlHeader, GenlMessage};
use netlink_packet_utils::{Emitable, ParseableParametrized};
use netlink_proto::{sys::SocketAddr, ConnectionHandle};
use std::{fmt::Debug, sync::Arc};
/// The generic netlink connection handle
///
/// The handle is used to send messages to the connection. It also resolves
/// the family id automatically before sending messages.
///
/// # Family id resolving
/// There is a resolver with cache inside each connection. When you send generic
/// netlink message, the handle resolves and fills the family id into the message.
///
/// Since the resolver is created in [`new_connection()`](crate::new_connection),
/// the cache state wouldn't share between different connections.
///
/// P.s. The cloned handles use the same connection with the original handle. So,
/// they share the same cache state.
///
/// # Detailed process of sending generic messages
/// 1. Check if the message's family id is resolved. If yes, jump to step 6.
/// 2. Query the family id using the builtin resolver.
/// 3. If the id is in the cache, returning the id in the cache and skip step 4.
/// 4. The resolver sends `CTRL_CMD_GETFAMILY` request to get the id and records it in the cache.
/// 5. fill the family id using [`GenlMessage::set_resolved_family_id()`].
/// 6. Serialize the payload to [`RawGenlMessage`].
/// 7. Send it through the connection.
/// - The family id filled into `message_type` field in [`NetlinkMessage::finalize()`].
/// 8. In the response stream, deserialize the payload back to [`GenlMessage<F>`].
#[derive(Clone, Debug)]
pub struct GenetlinkHandle {
handle: ConnectionHandle<RawGenlMessage>,
resolver: Arc<Mutex<Resolver>>,
}
impl GenetlinkHandle {
pub(crate) fn new(handle: ConnectionHandle<RawGenlMessage>) -> Self {
Self {
handle,
resolver: Arc::new(Mutex::new(Resolver::new())),
}
}
/// Resolve the family id of the given [`GenlFamily`].
pub async fn resolve_family_id<F>(&self) -> Result<u16, GenetlinkError>
where
F: GenlFamily,
{
self.resolver
.lock()
.await
.query_family_id(self, F::family_name())
.await
}
/// Clear the resolver's fanily id cache
pub async fn clear_family_id_cache(&self) {
self.resolver.lock().await.clear_cache();
}
/// Send the generic netlink message and get the response stream
///
/// The function resolves the family id before sending the request. If the
/// resolving process is failed, the function would return an error.
pub async fn request<F>(
&mut self,
mut message: NetlinkMessage<GenlMessage<F>>,
) -> Result<
impl Stream<Item = Result<NetlinkMessage<GenlMessage<F>>, DecodeError>>,
GenetlinkError,
>
where
F: GenlFamily + Emitable + ParseableParametrized<[u8], GenlHeader> + Debug,
{
self.resolve_message_family_id(&mut message).await?;
self.send_request(message)
}
/// Send the request without resolving family id
///
/// This function is identical to [`request()`](Self::request) but it doesn't
/// resolve the family id for you.
pub fn send_request<F>(
&mut self,
message: NetlinkMessage<GenlMessage<F>>,
) -> Result<
impl Stream<Item = Result<NetlinkMessage<GenlMessage<F>>, DecodeError>>,
GenetlinkError,
>
where
F: GenlFamily + Emitable + ParseableParametrized<[u8], GenlHeader> + Debug,
{
let raw_msg = map_to_rawgenlmsg(message);
let stream = self.handle.request(raw_msg, SocketAddr::new(0, 0))?;
Ok(stream.map(map_from_rawgenlmsg))
}
/// Send the generic netlink message without returning the response stream
pub async fn notify<F>(
&mut self,
mut message: NetlinkMessage<GenlMessage<F>>,
) -> Result<(), GenetlinkError>
where
F: GenlFamily + Emitable + ParseableParametrized<[u8], GenlHeader> + Debug,
{
self.resolve_message_family_id(&mut message).await?;
self.send_notify(message)
}
/// Send the notify without resolving family id
pub fn send_notify<F>(
&mut self,
message: NetlinkMessage<GenlMessage<F>>,
) -> Result<(), GenetlinkError>
where
F: GenlFamily + Emitable + ParseableParametrized<[u8], GenlHeader> + Debug,
{
let raw_msg = map_to_rawgenlmsg(message);
self.handle.notify(raw_msg, SocketAddr::new(0, 0))?;
Ok(())
}
async fn resolve_message_family_id<F>(
&mut self,
message: &mut NetlinkMessage<GenlMessage<F>>,
) -> Result<(), GenetlinkError>
where
F: GenlFamily + Debug,
{
if let NetlinkPayload::InnerMessage(genlmsg) = &mut message.payload {
if genlmsg.family_id() == 0 {
// The family id is not resolved
// Resolve it before send it
let id = self.resolve_family_id::<F>().await?;
genlmsg.set_resolved_family_id(id);
}
}
Ok(())
}
}
================================================
FILE: genetlink/src/lib.rs
================================================
// SPDX-License-Identifier: MIT
#[macro_use]
extern crate thiserror;
mod connection;
mod error;
mod handle;
pub mod message;
mod resolver;
#[cfg(feature = "tokio_socket")]
pub use connection::new_connection;
pub use connection::new_connection_with_socket;
pub use error::GenetlinkError;
pub use handle::GenetlinkHandle;
================================================
FILE: genetlink/src/message.rs
================================================
// SPDX-License-Identifier: MIT
//! Raw generic netlink payload message
//!
//! # Design
//! Since we use generic type to represent different generic family's message type,
//! and it is not easy to create a underlying [`netlink_proto::new_connection()`]
//! with trait object to multiplex different generic netlink family's message.
//!
//! Therefore, I decided to serialize the generic type payload into bytes before
//! sending to the underlying connection. The [`RawGenlMessage`] is meant for this.
//!
//! This special message doesn't use generic type and its payload is `Vec<u8>`.
//! Therefore, its type is easier to use.
//!
//! Another advantage is that it can let users know when the generic netlink payload
//! fails to decode instead of just dropping the messages.
//! (`netlink_proto` would drop messages if they fails to decode.)
//! I think this can help developers debug their deserializing implementation.
use netlink_packet_core::{
DecodeError,
NetlinkDeserializable,
NetlinkHeader,
NetlinkMessage,
NetlinkPayload,
NetlinkSerializable,
};
use netlink_packet_generic::{GenlBuffer, GenlFamily, GenlHeader, GenlMessage};
use netlink_packet_utils::{Emitable, Parseable, ParseableParametrized};
use std::fmt::Debug;
/// Message type to hold serialized generic netlink payload
///
/// **Note** This message type is not intend to be used by normal users, unless
/// you need to use the `UnboundedReceiver<(NetlinkMessage<RawGenlMessage>, SocketAddr)>`
/// return by [`new_connection()`](crate::new_connection)
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RawGenlMessage {
pub header: GenlHeader,
pub payload: Vec<u8>,
pub family_id: u16,
}
impl RawGenlMessage {
/// Construct the message
pub fn new(header: GenlHeader, payload: Vec<u8>, family_id: u16) -> Self {
Self {
header,
payload,
family_id,
}
}
/// Consume this message and return its header and payload
pub fn into_parts(self) -> (GenlHeader, Vec<u8>) {
(self.header, self.payload)
}
/// Serialize the generic netlink payload into raw bytes
pub fn from_genlmsg<F>(genlmsg: GenlMessage<F>) -> Self
where
F: GenlFamily + Emitable + Debug,
{
let mut payload_buf = vec![0u8; genlmsg.payload.buffer_len()];
genlmsg.payload.emit(&mut payload_buf);
Self {
header: genlmsg.header,
payload: payload_buf,
family_id: genlmsg.family_id(),
}
}
/// Try to deserialize the generic netlink payload from raw bytes
pub fn parse_into_genlmsg<F>(&self) -> Result<GenlMessage<F>, DecodeError>
where
F: GenlFamily + ParseableParametrized<[u8], GenlHeader> + Debug,
{
let inner = F::parse_with_param(&self.payload, self.header)?;
Ok(GenlMessage::new(self.header, inner, self.family_id))
}
}
impl Emitable for RawGenlMessage {
fn buffer_len(&self) -> usize {
self.header.buffer_len() + self.payload.len()
}
fn emit(&self, buffer: &mut [u8]) {
self.header.emit(buffer);
let buffer = &mut buffer[self.header.buffer_len()..];
buffer.copy_from_slice(&self.payload);
}
}
impl<'a, T> ParseableParametrized<GenlBuffer<&'a T>, u16> for RawGenlMessage
where
T: AsRef<[u8]> + ?Sized,
{
fn parse_with_param(buf: &GenlBuffer<&'a T>, message_type: u16) -> Result<Self, DecodeError> {
let header = GenlHeader::parse(buf)?;
let payload_buf = buf.payload();
Ok(RawGenlMessage::new(
header,
payload_buf.to_vec(),
message_type,
))
}
}
impl NetlinkSerializable for RawGenlMessage {
fn message_type(&self) -> u16 {
self.family_id
}
fn buffer_len(&self) -> usize {
<Self as Emitable>::buffer_len(self)
}
fn serialize(&self, buffer: &mut [u8]) {
self.emit(buffer)
}
}
impl NetlinkDeserializable for RawGenlMessage {
type Error = DecodeError;
fn deserialize(header: &NetlinkHeader, payload: &[u8]) -> Result<Self, Self::Error> {
let buffer = GenlBuffer::new_checked(payload)?;
RawGenlMessage::parse_with_param(&buffer, header.message_type)
}
}
impl From<RawGenlMessage> for NetlinkPayload<RawGenlMessage> {
fn from(message: RawGenlMessage) -> Self {
NetlinkPayload::InnerMessage(message)
}
}
/// Helper function to map the [`NetlinkPayload`] types in [`NetlinkMessage`]
/// and serialize the generic netlink payload into raw bytes.
pub fn map_to_rawgenlmsg<F>(
message: NetlinkMessage<GenlMessage<F>>,
) -> NetlinkMessage<RawGenlMessage>
where
F: GenlFamily + Emitable + Debug,
{
let raw_payload = match message.payload {
NetlinkPayload::InnerMessage(genlmsg) => {
NetlinkPayload::InnerMessage(RawGenlMessage::from_genlmsg(genlmsg))
}
NetlinkPayload::Done => NetlinkPayload::Done,
NetlinkPayload::Error(i) => NetlinkPayload::Error(i),
NetlinkPayload::Ack(i) => NetlinkPayload::Ack(i),
NetlinkPayload::Noop => NetlinkPayload::Noop,
NetlinkPayload::Overrun(i) => NetlinkPayload::Overrun(i),
};
NetlinkMessage::new(message.header, raw_payload)
}
/// Helper function to map the [`NetlinkPayload`] types in [`NetlinkMessage`]
/// and try to deserialize the generic netlink payload from raw bytes.
pub fn map_from_rawgenlmsg<F>(
raw_msg: NetlinkMessage<RawGenlMessage>,
) -> Result<NetlinkMessage<GenlMessage<F>>, DecodeError>
where
F: GenlFamily + ParseableParametrized<[u8], GenlHeader> + Debug,
{
let payload = match raw_msg.payload {
NetlinkPayload::InnerMessage(raw_genlmsg) => {
NetlinkPayload::InnerMessage(raw_genlmsg.parse_into_genlmsg()?)
}
NetlinkPayload::Done => NetlinkPayload::Done,
NetlinkPayload::Error(i) => NetlinkPayload::Error(i),
NetlinkPayload::Ack(i) => NetlinkPayload::Ack(i),
NetlinkPayload::Noop => NetlinkPayload::Noop,
NetlinkPayload::Overrun(i) => NetlinkPayload::Overrun(i),
};
Ok(NetlinkMessage::new(raw_msg.header, payload))
}
================================================
FILE: genetlink/src/resolver.rs
================================================
// SPDX-License-Identifier: MIT
use crate::{error::GenetlinkError, GenetlinkHandle};
use futures::{future::Either, StreamExt};
use netlink_packet_core::{NetlinkMessage, NetlinkPayload, NLM_F_REQUEST};
use netlink_packet_generic::{
ctrl::{nlas::GenlCtrlAttrs, GenlCtrl, GenlCtrlCmd},
GenlMessage,
};
use std::{collections::HashMap, future::Future};
#[derive(Clone, Debug, Default)]
pub struct Resolver {
cache: HashMap<&'static str, u16>,
}
impl Resolver {
pub fn new() -> Self {
Self {
cache: HashMap::new(),
}
}
pub fn get_cache_by_name(&self, family_name: &str) -> Option<u16> {
self.cache.get(family_name).copied()
}
pub fn query_family_id(
&mut self,
handle: &GenetlinkHandle,
family_name: &'static str,
) -> impl Future<Output = Result<u16, GenetlinkError>> + '_ {
if let Some(id) = self.get_cache_by_name(family_name) {
Either::Left(futures::future::ready(Ok(id)))
} else {
let mut handle = handle.clone();
Either::Right(async move {
let mut genlmsg: GenlMessage<GenlCtrl> = GenlMessage::from_payload(GenlCtrl {
cmd: GenlCtrlCmd::GetFamily,
nlas: vec![GenlCtrlAttrs::FamilyName(family_name.to_owned())],
});
genlmsg.finalize();
// We don't have to set family id here, since nlctrl has static family id (0x10)
let mut nlmsg = NetlinkMessage::from(genlmsg);
nlmsg.header.flags = NLM_F_REQUEST;
nlmsg.finalize();
let mut res = handle.send_request(nlmsg)?;
while let Some(result) = res.next().await {
let rx_packet = result?;
match rx_packet.payload {
NetlinkPayload::InnerMessage(genlmsg) => {
let family_id = genlmsg
.payload
.nlas
.iter()
.find_map(|nla| {
if let GenlCtrlAttrs::FamilyId(id) = nla {
Some(*id)
} else {
None
}
})
.ok_or_else(|| {
GenetlinkError::AttributeNotFound(
"CTRL_ATTR_FAMILY_ID".to_owned(),
)
})?;
self.cache.insert(family_name, family_id);
return Ok(family_id);
}
NetlinkPayload::Error(e) => return Err(e.into()),
_ => (),
}
}
Err(GenetlinkError::NoMessageReceived)
})
}
}
pub fn clear_cache(&mut self) {
self.cache.clear();
}
}
#[cfg(test)]
mod test {
use super::*;
use crate::new_connection;
use std::io::ErrorKind;
#[tokio::test]
async fn test_resolver_nlctrl() {
let (conn, handle, _) = new_connection().unwrap();
tokio::spawn(conn);
let mut resolver = Resolver::new();
// nlctrl should always be 0x10
let nlctrl_fid = resolver.query_family_id(&handle, "nlctrl").await.unwrap();
assert_eq!(nlctrl_fid, 0x10);
}
const TEST_FAMILIES: &[&str] = &[
"devlink",
"ethtool",
"acpi_event",
"tcp_metrics",
"TASKSTATS",
"nl80211",
];
#[tokio::test]
async fn test_resolver_cache() {
let (conn, handle, _) = new_connection().unwrap();
tokio::spawn(conn);
let mut resolver = Resolver::new();
// Test if family id cached
for name in TEST_FAMILIES.iter().copied() {
let id = resolver
.query_family_id(&handle, name)
.await
.or_else(|e| {
if let GenetlinkError::NetlinkError(io_err) = &e {
if io_err.kind() == ErrorKind::NotFound {
// Ignore non exist entries
Ok(0)
} else {
Err(e)
}
} else {
Err(e)
}
})
.unwrap();
if id == 0 {
eprintln!(
"Generic family \"{}\" not exist or not loaded in this environment. Ignored.",
name
);
continue;
}
let cache = resolver.get_cache_by_name(name).unwrap();
assert_eq!(id, cache);
eprintln!("{:?}", (name, cache));
}
}
}
================================================
FILE: mptcp-pm/Cargo.toml
================================================
[package]
name = "mptcp-pm"
version = "0.1.1"
authors = ["Gris Ge <fge@redhat.com>"]
license = "MIT"
edition = "2018"
description = "Linux kernel MPTCP path manager netlink Library"
keywords = ["network"]
categories = ["network-programming", "os"]
readme = "../README.md"
[lib]
name = "mptcp_pm"
path = "src/lib.rs"
crate-type = ["lib"]
[features]
default = ["tokio_socket"]
tokio_socket = ["netlink-proto/tokio_socket", "tokio"]
smol_socket = ["netlink-proto/smol_socket", "async-std"]
[dependencies]
anyhow = "1.0.44"
async-std = { version = "1.9.0", optional = true}
byteorder = "1.4.3"
futures = "0.3.17"
log = "0.4.14"
thiserror = "1.0.29"
tokio = { version = "1.0.1", features = ["rt"], optional = true}
genetlink = { default-features = false, version = "0.2.1", path = "../genetlink" }
netlink-packet-core = { version = "0.4.2", path = "../netlink-packet-core" }
netlink-packet-generic = { version = "0.3.1", path = "../netlink-packet-generic" }
netlink-packet-utils = { version = "0.5.1", path = "../netlink-packet-utils" }
netlink-proto = { default-features = false, version = "0.10", path = "../netlink-proto" }
netlink-sys = { version = "0.8.3", path = "../netlink-sys" }
[dev-dependencies]
tokio = { version = "1.11.0", features = ["macros", "rt", "rt-multi-thread"] }
env_logger = "0.9.0"
================================================
FILE: mptcp-pm/examples/dump_mptcp.rs
================================================
// SPDX-License-Identifier: MIT
use futures::stream::TryStreamExt;
fn main() {
let rt = tokio::runtime::Builder::new_current_thread()
.enable_io()
.build()
.unwrap();
rt.block_on(get_addresses());
}
async fn get_addresses() {
let (connection, handle, _) = mptcp_pm::new_connection().unwrap();
tokio::spawn(connection);
let mut address_handle = handle.address().get().execute().await;
let mut msgs = Vec::new();
while let Some(msg) = address_handle.try_next().await.unwrap() {
msgs.push(msg);
}
assert!(!msgs.is_empty());
for msg in msgs {
println!("{:?}", msg);
}
let mut limits_handle = handle.limits().get().execute().await;
let mut msgs = Vec::new();
while let Some(msg) = limits_handle.try_next().await.unwrap() {
msgs.push(msg);
}
assert!(!msgs.is_empty());
for msg in msgs {
println!("{:?}", msg);
}
}
================================================
FILE: mptcp-pm/src/address/attr.rs
================================================
// SPDX-License-Identifier: MIT
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
use anyhow::Context;
use byteorder::{ByteOrder, NativeEndian};
use netlink_packet_utils::{
nla::{DefaultNla, Nla, NlaBuffer},
parsers::{parse_i32, parse_ip, parse_u16, parse_u32, parse_u8},
DecodeError,
Emitable,
Parseable,
};
const MPTCP_PM_ADDR_ATTR_FAMILY: u16 = 1;
const MPTCP_PM_ADDR_ATTR_ID: u16 = 2;
const MPTCP_PM_ADDR_ATTR_ADDR4: u16 = 3;
const MPTCP_PM_ADDR_ATTR_ADDR6: u16 = 4;
const MPTCP_PM_ADDR_ATTR_PORT: u16 = 5;
const MPTCP_PM_ADDR_ATTR_FLAGS: u16 = 6;
const MPTCP_PM_ADDR_ATTR_IF_IDX: u16 = 7;
const MPTCP_PM_ADDR_FLAG_SIGNAL: u32 = 1 << 0;
const MPTCP_PM_ADDR_FLAG_SUBFLOW: u32 = 1 << 1;
const MPTCP_PM_ADDR_FLAG_BACKUP: u32 = 1 << 2;
const MPTCP_PM_ADDR_FLAG_FULLMESH: u32 = 1 << 3;
const MPTCP_PM_ADDR_FLAG_IMPLICIT: u32 = 1 << 4;
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum MptcpPathManagerAddressAttrFlag {
Signal,
Subflow,
Backup,
Fullmesh,
Implicit,
Other(u32),
}
fn u32_to_vec_flags(value: u32) -> Vec<MptcpPathManagerAddressAttrFlag> {
let mut ret = Vec::new();
let mut found = 0u32;
if (value & MPTCP_PM_ADDR_FLAG_SIGNAL) > 0 {
found += MPTCP_PM_ADDR_FLAG_SIGNAL;
ret.push(MptcpPathManagerAddressAttrFlag::Signal);
}
if (value & MPTCP_PM_ADDR_FLAG_SUBFLOW) > 0 {
found += MPTCP_PM_ADDR_FLAG_SUBFLOW;
ret.push(MptcpPathManagerAddressAttrFlag::Subflow);
}
if (value & MPTCP_PM_ADDR_FLAG_BACKUP) > 0 {
found += MPTCP_PM_ADDR_FLAG_BACKUP;
ret.push(MptcpPathManagerAddressAttrFlag::Backup);
}
if (value & MPTCP_PM_ADDR_FLAG_FULLMESH) > 0 {
found += MPTCP_PM_ADDR_FLAG_FULLMESH;
ret.push(MptcpPathManagerAddressAttrFlag::Fullmesh);
}
if (value & MPTCP_PM_ADDR_FLAG_IMPLICIT) > 0 {
found += MPTCP_PM_ADDR_FLAG_IMPLICIT;
ret.push(MptcpPathManagerAddressAttrFlag::Implicit);
}
if (value - found) > 0 {
ret.push(MptcpPathManagerAddressAttrFlag::Other(value - found));
}
ret
}
impl From<&MptcpPathManagerAddressAttrFlag> for u32 {
fn from(v: &MptcpPathManagerAddressAttrFlag) -> u32 {
match v {
MptcpPathManagerAddressAttrFlag::Signal => MPTCP_PM_ADDR_FLAG_SIGNAL,
MptcpPathManagerAddressAttrFlag::Subflow => MPTCP_PM_ADDR_FLAG_SUBFLOW,
MptcpPathManagerAddressAttrFlag::Backup => MPTCP_PM_ADDR_FLAG_BACKUP,
MptcpPathManagerAddressAttrFlag::Fullmesh => MPTCP_PM_ADDR_FLAG_FULLMESH,
MptcpPathManagerAddressAttrFlag::Implicit => MPTCP_PM_ADDR_FLAG_IMPLICIT,
MptcpPathManagerAddressAttrFlag::Other(d) => *d,
}
}
}
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum MptcpPathManagerAddressAttr {
Family(u16),
Id(u8),
Addr4(Ipv4Addr),
Addr6(Ipv6Addr),
Port(u16),
Flags(Vec<MptcpPathManagerAddressAttrFlag>),
IfIndex(i32),
Other(DefaultNla),
}
impl Nla for MptcpPathManagerAddressAttr {
fn value_len(&self) -> usize {
match self {
Self::Family(_) | Self::Port(_) => 2,
Self::Addr4(_) | Self::Flags(_) | Self::IfIndex(_) => 4,
Self::Id(_) => 1,
Self::Addr6(_) => 16,
Self::Other(attr) => attr.value_len(),
}
}
fn kind(&self) -> u16 {
match self {
Self::Family(_) => MPTCP_PM_ADDR_ATTR_FAMILY,
Self::Id(_) => MPTCP_PM_ADDR_ATTR_ID,
Self::Addr4(_) => MPTCP_PM_ADDR_ATTR_ADDR4,
Self::Addr6(_) => MPTCP_PM_ADDR_ATTR_ADDR6,
Self::Port(_) => MPTCP_PM_ADDR_ATTR_PORT,
Self::Flags(_) => MPTCP_PM_ADDR_ATTR_FLAGS,
Self::IfIndex(_) => MPTCP_PM_ADDR_ATTR_IF_IDX,
Self::Other(attr) => attr.kind(),
}
}
fn emit_value(&self, buffer: &mut [u8]) {
match self {
Self::Family(d) | Self::Port(d) => NativeEndian::write_u16(buffer, *d),
Self::Addr4(i) => buffer.copy_from_slice(&i.octets()),
Self::Addr6(i) => buffer.copy_from_slice(&i.octets()),
Self::Id(d) => buffer[0] = *d,
Self::Flags(flags) => {
let mut value = 0u32;
for flag in flags {
value += u32::from(flag);
}
NativeEndian::write_u32(buffer, value)
}
Self::IfIndex(d) => NativeEndian::write_i32(buffer, *d),
Self::Other(ref attr) => attr.emit(buffer),
}
}
}
impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>> for MptcpPathManagerAddressAttr {
fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
let payload = buf.value();
Ok(match buf.kind() {
MPTCP_PM_ADDR_ATTR_FAMILY => {
let err_msg = format!("Invalid MPTCP_PM_ADDR_ATTR_FAMILY value {:?}", payload);
Self::Family(parse_u16(payload).context(err_msg)?)
}
MPTCP_PM_ADDR_ATTR_ID => {
Self::Id(parse_u8(payload).context("Invalid MPTCP_PM_ADDR_ATTR_ID value")?)
}
MPTCP_PM_ADDR_ATTR_ADDR4 | MPTCP_PM_ADDR_ATTR_ADDR6 => {
match parse_ip(payload)
.context("Invalid MPTCP_PM_ADDR_ATTR_ADDR4/MPTCP_PM_ADDR_ATTR_ADDR6 value")?
{
IpAddr::V4(i) => Self::Addr4(i),
IpAddr::V6(i) => Self::Addr6(i),
}
}
MPTCP_PM_ADDR_ATTR_PORT => {
Self::Port(parse_u16(payload).context("Invalid MPTCP_PM_ADDR_ATTR_PORT value")?)
}
MPTCP_PM_ADDR_ATTR_FLAGS => Self::Flags(u32_to_vec_flags(
parse_u32(payload).context("Invalid MPTCP_PM_ADDR_ATTR_FLAGS value")?,
)),
MPTCP_PM_ADDR_ATTR_IF_IDX => Self::IfIndex(
parse_i32(payload).context("Invalid MPTCP_PM_ADDR_ATTR_IF_IDX value")?,
),
_ => Self::Other(DefaultNla::parse(buf).context("invalid NLA (unknown kind)")?),
})
}
}
================================================
FILE: mptcp-pm/src/address/get.rs
================================================
// SPDX-License-Identifier: MIT
use futures::TryStream;
use netlink_packet_generic::GenlMessage;
use crate::{
mptcp_execute,
MptcpPathManagerError,
MptcpPathManagerHandle,
MptcpPathManagerMessage,
};
pub struct MptcpPathManagerAddressGetRequest {
handle: MptcpPathManagerHandle,
}
impl MptcpPathManagerAddressGetRequest {
pub(crate) fn new(handle: MptcpPathManagerHandle) -> Self {
MptcpPathManagerAddressGetRequest { handle }
}
pub async fn execute(
self,
) -> impl TryStream<Ok = GenlMessage<MptcpPathManagerMessage>, Error = MptcpPathManagerError>
{
let MptcpPathManagerAddressGetRequest { mut handle } = self;
let mptcp_msg = MptcpPathManagerMessage::new_address_get();
mptcp_execute(&mut handle, mptcp_msg).await
}
}
================================================
FILE: mptcp-pm/src/address/handle.rs
================================================
// SPDX-License-Identifier: MIT
use crate::{MptcpPathManagerAddressGetRequest, MptcpPathManagerHandle};
pub struct MptcpPathManagerAddressHandle(MptcpPathManagerHandle);
impl MptcpPathManagerAddressHandle {
pub fn new(handle: MptcpPathManagerHandle) -> Self {
MptcpPathManagerAddressHandle(handle)
}
/// Retrieve the multipath-TCP addresses
/// (equivalent to `ip mptcp endpoint show`)
pub fn get(&mut self) -> MptcpPathManagerAddressGetRequest {
MptcpPathManagerAddressGetRequest::new(self.0.clone())
}
}
================================================
FILE: mptcp-pm/src/address/mod.rs
================================================
// SPDX-License-Identifier: MIT
mod attr;
mod get;
mod handle;
pub use attr::{MptcpPathManagerAddressAttr, MptcpPathManagerAddressAttrFlag};
pub use get::MptcpPathManagerAddressGetRequest;
pub use handle::MptcpPathManagerAddressHandle;
================================================
FILE: mptcp-pm/src/connection.rs
================================================
// SPDX-License-Identifier: MIT
use std::io;
use futures::channel::mpsc::UnboundedReceiver;
use genetlink::message::RawGenlMessage;
use netlink_packet_core::NetlinkMessage;
use netlink_proto::Connection;
use netlink_sys::{AsyncSocket, SocketAddr};
use crate::MptcpPathManagerHandle;
#[cfg(feature = "tokio_socket")]
#[allow(clippy::type_complexity)]
pub fn new_connection() -> io::Result<(
Connection<RawGenlMessage>,
MptcpPathManagerHandle,
UnboundedReceiver<(NetlinkMessage<RawGenlMessage>, SocketAddr)>,
)> {
new_connection_with_socket()
}
#[allow(clippy::type_complexity)]
pub fn new_connection_with_socket<S>() -> io::Result<(
Connection<RawGenlMessage, S>,
MptcpPathManagerHandle,
UnboundedReceiver<(NetlinkMessage<RawGenlMessage>, SocketAddr)>,
)>
where
S: AsyncSocket,
{
let (conn, handle, messages) = genetlink::new_connection_with_socket()?;
Ok((conn, MptcpPathManagerHandle::new(handle), messages))
}
================================================
FILE: mptcp-pm/src/error.rs
================================================
// SPDX-License-Identifier: MIT
use thiserror::Error;
use netlink_packet_core::{ErrorMessage, NetlinkMessage};
use netlink_packet_generic::GenlMessage;
use crate::MptcpPathManagerMessage;
#[derive(Clone, Eq, PartialEq, Debug, Error)]
pub enum MptcpPathManagerError {
#[error("Received an unexpected message {0:?}")]
UnexpectedMessage(NetlinkMessage<GenlMessage<MptcpPathManagerMessage>>),
#[error("Received a netlink error message {0}")]
NetlinkError(ErrorMessage),
#[error("A netlink request failed")]
RequestFailed(String),
#[error("A bug in this crate")]
Bug(String),
}
================================================
FILE: mptcp-pm/src/handle.rs
================================================
// SPDX-License-Identifier: MIT
use futures::{future::Either, FutureExt, Stream, StreamExt, TryStream};
use genetlink::GenetlinkHandle;
use netlink_packet_core::{NetlinkMessage, NLM_F_DUMP, NLM_F_REQUEST};
use netlink_packet_generic::GenlMessage;
use netlink_packet_utils::DecodeError;
use crate::{
try_mptcp,
MptcpPathManagerAddressHandle,
MptcpPathManagerCmd,
MptcpPathManagerError,
MptcpPathManagerLimitsHandle,
MptcpPathManagerMessage,
};
#[derive(Clone, Debug)]
pub struct MptcpPathManagerHandle {
pub handle: GenetlinkHandle,
}
impl MptcpPathManagerHandle {
pub(crate) fn new(handle: GenetlinkHandle) -> Self {
MptcpPathManagerHandle { handle }
}
// equivalent to `ip mptcp endpoint` command
// Instead of using `endpoint`, we are aligning with kernel netlink name
// `address` here.
pub fn address(&self) -> MptcpPathManagerAddressHandle {
MptcpPathManagerAddressHandle::new(self.clone())
}
// equivalent to `ip mptcp limits` command
pub fn limits(&self) -> MptcpPathManagerLimitsHandle {
MptcpPathManagerLimitsHandle::new(self.clone())
}
pub async fn request(
&mut self,
message: NetlinkMessage<GenlMessage<MptcpPathManagerMessage>>,
) -> Result<
impl Stream<Item = Result<NetlinkMessage<GenlMessage<MptcpPathManagerMessage>>, DecodeError>>,
MptcpPathManagerError,
> {
self.handle.request(message).await.map_err(|e| {
MptcpPathManagerError::RequestFailed(format!("BUG: Request failed with {}", e))
})
}
}
pub(crate) async fn mptcp_execute(
handle: &mut MptcpPathManagerHandle,
mptcp_msg: MptcpPathManagerMessage,
) -> impl TryStream<Ok = GenlMessage<MptcpPathManagerMessage>, Error = MptcpPathManagerError> {
let nl_header_flags = match mptcp_msg.cmd {
MptcpPathManagerCmd::AddressGet => NLM_F_REQUEST | NLM_F_DUMP,
MptcpPathManagerCmd::LimitsGet => NLM_F_REQUEST,
};
let mut nl_msg = NetlinkMessage::from(GenlMessage::from_payload(mptcp_msg));
nl_msg.header.flags = nl_header_flags;
match handle.request(nl_msg).await {
Ok(response) => Either::Left(response.map(move |msg| Ok(try_mptcp!(msg)))),
Err(e) => Either::Right(
futures::future::err::<GenlMessage<MptcpPathManagerMessage>, MptcpPathManagerError>(e)
.into_stream(),
),
}
}
================================================
FILE: mptcp-pm/src/lib.rs
================================================
// SPDX-License-Identifier: MIT
mod address;
mod connection;
mod error;
mod handle;
mod limits;
mod macros;
mod message;
pub use address::{
MptcpPathManagerAddressAttr,
MptcpPathManagerAddressAttrFlag,
MptcpPathManagerAddressGetRequest,
MptcpPathManagerAddressHandle,
};
#[cfg(feature = "tokio_socket")]
pub use connection::new_connection;
pub use connection::new_connection_with_socket;
pub use error::MptcpPathManagerError;
pub use handle::MptcpPathManagerHandle;
pub use limits::{
MptcpPathManagerLimitsAttr,
MptcpPathManagerLimitsGetRequest,
MptcpPathManagerLimitsHandle,
};
pub use message::{MptcpPathManagerAttr, MptcpPathManagerCmd, MptcpPathManagerMessage};
pub(crate) use handle::mptcp_execute;
================================================
FILE: mptcp-pm/src/limits/attr.rs
================================================
// SPDX-License-Identifier: MIT
use anyhow::Context;
use byteorder::{ByteOrder, NativeEndian};
use netlink_packet_utils::{
nla::{DefaultNla, Nla, NlaBuffer},
parsers::parse_u32,
DecodeError,
Emitable,
Parseable,
};
const MPTCP_PM_ATTR_RCV_ADD_ADDRS: u16 = 2;
const MPTCP_PM_ATTR_SUBFLOWS: u16 = 3;
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum MptcpPathManagerLimitsAttr {
RcvAddAddrs(u32),
Subflows(u32),
Other(DefaultNla),
}
impl Nla for MptcpPathManagerLimitsAttr {
fn value_len(&self) -> usize {
match self {
Self::Other(attr) => attr.value_len(),
_ => 4,
}
}
fn kind(&self) -> u16 {
match self {
Self::RcvAddAddrs(_) => MPTCP_PM_ATTR_RCV_ADD_ADDRS,
Self::Subflows(_) => MPTCP_PM_ATTR_SUBFLOWS,
Self::Other(attr) => attr.kind(),
}
}
fn emit_value(&self, buffer: &mut [u8]) {
match self {
Self::RcvAddAddrs(d) | Self::Subflows(d) => NativeEndian::write_u32(buffer, *d),
Self::Other(ref attr) => attr.emit(buffer),
}
}
}
impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>> for MptcpPathManagerLimitsAttr {
fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
let payload = buf.value();
Ok(match buf.kind() {
MPTCP_PM_ATTR_RCV_ADD_ADDRS => Self::RcvAddAddrs(
parse_u32(payload).context("Invalid MPTCP_PM_ATTR_RCV_ADD_ADDRS value")?,
),
MPTCP_PM_ATTR_SUBFLOWS => {
Self::Subflows(parse_u32(payload).context("Invalid MPTCP_PM_ATTR_SUBFLOWS value")?)
}
_ => Self::Other(DefaultNla::parse(buf).context("invalid NLA (unknown kind)")?),
})
}
}
================================================
FILE: mptcp-pm/src/limits/get.rs
================================================
// SPDX-License-Identifier: MIT
use futures::TryStream;
use netlink_packet_generic::GenlMessage;
use crate::{
mptcp_execute,
MptcpPathManagerError,
MptcpPathManagerHandle,
MptcpPathManagerMessage,
};
pub struct MptcpPathManagerLimitsGetRequest {
handle: MptcpPathManagerHandle,
}
impl MptcpPathManagerLimitsGetRequest {
pub(crate) fn new(handle: MptcpPathManagerHandle) -> Self {
MptcpPathManagerLimitsGetRequest { handle }
}
pub async fn execute(
self,
) -> impl TryStream<Ok = GenlMessage<MptcpPathManagerMessage>, Error = MptcpPathManagerError>
{
let MptcpPathManagerLimitsGetRequest { mut handle } = self;
let mptcp_msg = MptcpPathManagerMessage::new_limits_get();
mptcp_execute(&mut handle, mptcp_msg).await
}
}
================================================
FILE: mptcp-pm/src/limits/handle.rs
================================================
// SPDX-License-Identifier: MIT
use crate::{MptcpPathManagerHandle, MptcpPathManagerLimitsGetRequest};
pub struct MptcpPathManagerLimitsHandle(MptcpPathManagerHandle);
impl MptcpPathManagerLimitsHandle {
pub fn new(handle: MptcpPathManagerHandle) -> Self {
MptcpPathManagerLimitsHandle(handle)
}
/// Retrieve the multipath-TCP addresses
/// (equivalent to `ip mptcp endpoint show`)
pub fn get(&mut self) -> MptcpPathManagerLimitsGetRequest {
MptcpPathManagerLimitsGetRequest::new(self.0.clone())
}
}
================================================
FILE: mptcp-pm/src/limits/mod.rs
================================================
// SPDX-License-Identifier: MIT
mod attr;
mod get;
mod handle;
pub use attr::MptcpPathManagerLimitsAttr;
pub use get::MptcpPathManagerLimitsGetRequest;
pub use handle::MptcpPathManagerLimitsHandle;
================================================
FILE: mptcp-pm/src/macros.rs
================================================
// SPDX-License-Identifier: MIT
#[macro_export]
macro_rules! try_mptcp {
($msg: expr) => {{
use netlink_packet_core::{NetlinkMessage, NetlinkPayload};
use $crate::MptcpPathManagerError;
match $msg {
Ok(msg) => {
let (header, payload) = msg.into_parts();
match payload {
NetlinkPayload::InnerMessage(msg) => msg,
NetlinkPayload::Error(err) => {
return Err(MptcpPathManagerError::NetlinkError(err))
}
_ => {
return Err(MptcpPathManagerError::UnexpectedMessage(
NetlinkMessage::new(header, payload),
))
}
}
}
Err(e) => {
return Err(MptcpPathManagerError::Bug(format!(
"BUG: decode error {:?}",
e
)))
}
}
}};
}
================================================
FILE: mptcp-pm/src/message.rs
================================================
// SPDX-License-Identifier: MIT
use anyhow::Context;
use netlink_packet_core::DecodeError;
use netlink_packet_generic::{GenlFamily, GenlHeader};
use netlink_packet_utils::{
nla::{DefaultNla, Nla, NlasIterator},
Emitable,
Parseable,
ParseableParametrized,
};
use crate::{address::MptcpPathManagerAddressAttr, limits::MptcpPathManagerLimitsAttr};
const MPTCP_PM_CMD_GET_ADDR: u8 = 3;
const MPTCP_PM_CMD_GET_LIMITS: u8 = 6;
const MPTCP_PM_ATTR_ADDR: u16 = 1;
const MPTCP_PM_ATTR_RCV_ADD_ADDRS: u16 = 2;
const MPTCP_PM_ATTR_SUBFLOWS: u16 = 3;
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum MptcpPathManagerCmd {
AddressGet,
LimitsGet,
}
impl From<MptcpPathManagerCmd> for u8 {
fn from(cmd: MptcpPathManagerCmd) -> Self {
match cmd {
MptcpPathManagerCmd::AddressGet => MPTCP_PM_CMD_GET_ADDR,
MptcpPathManagerCmd::LimitsGet => MPTCP_PM_CMD_GET_LIMITS,
}
}
}
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum MptcpPathManagerAttr {
Address(MptcpPathManagerAddressAttr),
Limits(MptcpPathManagerLimitsAttr),
Other(DefaultNla),
}
impl Nla for MptcpPathManagerAttr {
fn value_len(&self) -> usize {
match self {
Self::Address(attr) => attr.value_len(),
Self::Limits(attr) => attr.value_len(),
Self::Other(attr) => attr.value_len(),
}
}
fn kind(&self) -> u16 {
match self {
Self::Address(attr) => attr.kind(),
Self::Limits(attr) => attr.kind(),
Self::Other(attr) => attr.kind(),
}
}
fn emit_value(&self, buffer: &mut [u8]) {
match self {
Self::Address(attr) => attr.emit_value(buffer),
Self::Limits(attr) => attr.emit_value(buffer),
Self::Other(ref attr) => attr.emit(buffer),
}
}
}
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct MptcpPathManagerMessage {
pub cmd: MptcpPathManagerCmd,
pub nlas: Vec<MptcpPathManagerAttr>,
}
impl GenlFamily for MptcpPathManagerMessage {
fn family_name() -> &'static str {
"mptcp_pm"
}
fn version(&self) -> u8 {
1
}
fn command(&self) -> u8 {
self.cmd.into()
}
}
impl MptcpPathManagerMessage {
pub fn new_address_get() -> Self {
MptcpPathManagerMessage {
cmd: MptcpPathManagerCmd::AddressGet,
nlas: vec![],
}
}
pub fn new_limits_get() -> Self {
MptcpPathManagerMessage {
cmd: MptcpPathManagerCmd::LimitsGet,
nlas: vec![],
}
}
}
impl Emitable for MptcpPathManagerMessage {
fn buffer_len(&self) -> usize {
self.nlas.as_slice().buffer_len()
}
fn emit(&self, buffer: &mut [u8]) {
self.nlas.as_slice().emit(buffer)
}
}
fn parse_nlas(buffer: &[u8]) -> Result<Vec<MptcpPathManagerAttr>, DecodeError> {
let mut nlas = Vec::new();
for nla in NlasIterator::new(buffer) {
let error_msg = format!("Failed to parse mptcp address message attribute {:?}", nla);
let nla = &nla.context(error_msg)?;
match nla.kind() {
MPTCP_PM_ATTR_ADDR => {
for addr_nla in NlasIterator::new(nla.value()) {
let error_msg = format!("Failed to parse MPTCP_PM_ATTR_ADDR {:?}", addr_nla);
let addr_nla = &addr_nla.context(error_msg)?;
nlas.push(MptcpPathManagerAttr::Address(
MptcpPathManagerAddressAttr::parse(addr_nla)
.context("Failed to parse MPTCP_PM_ATTR_ADDR")?,
))
}
}
MPTCP_PM_ATTR_RCV_ADD_ADDRS => nlas.push(MptcpPathManagerAttr::Limits(
MptcpPathManagerLimitsAttr::parse(nla)
.context("Failed to parse MPTCP_PM_ATTR_RCV_ADD_ADDRS")?,
)),
MPTCP_PM_ATTR_SUBFLOWS => nlas.push(MptcpPathManagerAttr::Limits(
MptcpPathManagerLimitsAttr::parse(nla)
.context("Failed to parse MPTCP_PM_ATTR_RCV_ADD_ADDRS")?,
)),
_ => nlas.push(MptcpPathManagerAttr::Other(
DefaultNla::parse(nla).context("invalid NLA (unknown kind)")?,
)),
}
}
Ok(nlas)
}
impl ParseableParametrized<[u8], GenlHeader> for MptcpPathManagerMessage {
fn parse_with_param(buffer: &[u8], header: GenlHeader) -> Result<Self, DecodeError> {
Ok(match header.cmd {
MPTCP_PM_CMD_GET_ADDR => Self {
cmd: MptcpPathManagerCmd::AddressGet,
nlas: parse_nlas(buffer)?,
},
MPTCP_PM_CMD_GET_LIMITS => Self {
cmd: MptcpPathManagerCmd::LimitsGet,
nlas: parse_nlas(buffer)?,
},
cmd => {
return Err(DecodeError::from(format!(
"Unsupported mptcp reply command: {}",
cmd
)))
}
})
}
}
================================================
FILE: mptcp-pm/tests/dump_mptcp.rs
================================================
// SPDX-License-Identifier: MIT
use futures::stream::TryStreamExt;
use std::process::Command;
use mptcp_pm::{MptcpPathManagerAttr, MptcpPathManagerLimitsAttr};
#[test]
fn test_mptcp_empty_addresses_and_limits() {
Command::new("sysctl")
.arg("-w")
.arg("net.mptcp.enabled=1")
.spawn()
.unwrap();
// OK to fail as Github CI has no ip-mptcp
Command::new("ip")
.arg("mptcp")
.arg("endpoint")
.arg("flush")
.spawn()
.ok();
// OK to fail as Github CI has no ip-mptcp
Command::new("ip")
.arg("mptcp")
.arg("limits")
.arg("set")
.arg("subflows")
.arg("0")
.arg("add_addr_accepted")
.arg("0")
.spawn()
.ok();
let rt = tokio::runtime::Builder::new_current_thread()
.enable_io()
.build()
.unwrap();
rt.block_on(assert_empty_addresses_and_limits());
}
async fn assert_empty_addresses_and_limits() {
let (connection, handle, _) = mptcp_pm::new_connection().unwrap();
tokio::spawn(connection);
let mut address_handle = handle.address().get().execute().await;
let mut msgs = Vec::new();
while let Some(msg) = address_handle.try_next().await.unwrap() {
msgs.push(msg);
}
assert!(msgs.is_empty());
let mut limits_handle = handle.limits().get().execute().await;
let mut msgs = Vec::new();
while let Some(msg) = limits_handle.try_next().await.unwrap() {
msgs.push(msg);
}
assert_eq!(msgs.len(), 1);
let mptcp_nlas = &msgs[0].payload.nlas;
assert_eq!(
mptcp_nlas[0],
MptcpPathManagerAttr::Limits(MptcpPathManagerLimitsAttr::RcvAddAddrs(0))
);
assert_eq!(
mptcp_nlas[1],
MptcpPathManagerAttr::Limits(MptcpPathManagerLimitsAttr::Subflows(0))
);
}
================================================
FILE: netlink-packet-audit/Cargo.toml
================================================
[package]
authors = ["Corentin Henry <corentinhenry@gmail.com>"]
name = "netlink-packet-audit"
version = "0.4.2"
edition = "2018"
homepage = "https://github.com/little-dude/netlink"
keywords = ["netlink", "linux"]
license = "MIT"
readme = "../README.md"
repository = "https://github.com/little-dude/netlink"
description = "netlink packet types"
[dependencies]
anyhow = "1.0.31"
bytes = "1.0"
byteorder = "1.3.2"
log = "0.4.8"
netlink-packet-core = { version = "0.4.2", path = "../netlink-packet-core" }
netlink-packet-utils = { version = "0.5.1", path = "../netlink-packet-utils" }
netlink-proto = { default-features = false, version = "0.10", path = "../netlink-proto" }
[dev-dependencies]
lazy_static = "1.4.0"
================================================
FILE: netlink-packet-audit/fuzz/.gitignore
================================================
target
corpus
artifacts
================================================
FILE: netlink-packet-audit/fuzz/Cargo.toml
================================================
[package]
name = "netlink-packet-audit-fuzz"
version = "0.0.1"
authors = ["Automatically generated"]
publish = false
edition = "2018"
[package.metadata]
cargo-fuzz = true
[dependencies]
netlink-packet-audit = { version = "0.4.1", path = "../../netlink-packet-audit" }
netlink-packet-core = { version = "0.4.2", path = "../../netlink-packet-core" }
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" }
[[bin]]
name = "netlink-audit"
path = "fuzz_targets/netlink.rs"
================================================
FILE: netlink-packet-audit/fuzz/fuzz_targets/netlink.rs
================================================
// SPDX-License-Identifier: MIT
#![no_main]
use libfuzzer_sys::fuzz_target;
use netlink_packet_audit::{AuditMessage, NetlinkMessage};
fuzz_target!(|data: &[u8]| {
let _ = NetlinkMessage::<AuditMessage>::deserialize(data);
});
================================================
FILE: netlink-packet-audit/src/buffer.rs
================================================
// SPDX-License-Identifier: MIT
use crate::{
constants::*,
rules::{RuleBuffer, RuleMessage},
traits::{Parseable, ParseableParametrized},
AuditMessage,
DecodeError,
StatusMessage,
StatusMessageBuffer,
};
use anyhow::Context;
pub struct AuditBuffer<T> {
buffer: T,
}
impl<T: AsRef<[u8]>> AuditBuffer<T> {
pub fn new(buffer: T) -> AuditBuffer<T> {
AuditBuffer { buffer }
}
pub fn length(&self) -> usize {
self.buffer.as_ref().len()
}
pub fn new_checked(buffer: T) -> Result<AuditBuffer<T>, DecodeError> {
Ok(Self::new(buffer))
}
}
impl<'a, T: AsRef<[u8]> + ?Sized> AuditBuffer<&'a T> {
pub fn inner(&self) -> &'a [u8] {
self.buffer.as_ref()
}
}
impl<'a, T: AsRef<[u8]> + AsMut<[u8]> + ?Sized> AuditBuffer<&'a mut T> {
pub fn inner_mut(&mut self) -> &mut [u8] {
self.buffer.as_mut()
}
}
impl<'a, T: AsRef<[u8]> + ?Sized> ParseableParametrized<AuditBuffer<&'a T>, u16> for AuditMessage {
fn parse_with_param(buf: &AuditBuffer<&'a T>, message_type: u16) -> Result<Self, DecodeError> {
use self::AuditMessage::*;
let message = match message_type {
AUDIT_GET if buf.length() == 0 => GetStatus(None),
AUDIT_GET => {
let err = "failed to parse AUDIT_GET message";
let buf = StatusMessageBuffer::new(buf.inner());
GetStatus(Some(StatusMessage::parse(&buf).context(err)?))
}
AUDIT_SET => {
let err = "failed to parse AUDIT_SET message";
let buf = StatusMessageBuffer::new(buf.inner());
SetStatus(StatusMessage::parse(&buf).context(err)?)
}
AUDIT_ADD_RULE => {
let err = "failed to parse AUDIT_ADD_RULE message";
let buf = RuleBuffer::new_checked(buf.inner()).context(err)?;
AddRule(RuleMessage::parse(&buf).context(err)?)
}
AUDIT_DEL_RULE => {
let err = "failed to parse AUDIT_DEL_RULE message";
let buf = RuleBuffer::new_checked(buf.inner()).context(err)?;
DelRule(RuleMessage::parse(&buf).context(err)?)
}
AUDIT_LIST_RULES if buf.length() == 0 => ListRules(None),
AUDIT_LIST_RULES => {
let err = "failed to parse AUDIT_LIST_RULES message";
let buf = RuleBuffer::new_checked(buf.inner()).context(err)?;
ListRules(Some(RuleMessage::parse(&buf).context(err)?))
}
i if (AUDIT_EVENT_MESSAGE_MIN..AUDIT_EVENT_MESSAGE_MAX).contains(&i) => {
let data = String::from_utf8(buf.inner().to_vec())
.context("failed to parse audit event data as a valid string")?;
Event((i, data))
}
i => {
let data = String::from_utf8(buf.inner().to_vec())
.context("failed to parse audit event data as a valid string")?;
Other((i, data))
}
};
Ok(message)
}
}
================================================
FILE: netlink-packet-audit/src/codec.rs
================================================
// SPDX-License-Identifier: MIT
use std::{fmt::Debug, io};
use bytes::BytesMut;
use netlink_packet_core::{
NetlinkBuffer,
NetlinkDeserializable,
NetlinkMessage,
NetlinkSerializable,
};
pub(crate) use netlink_proto::{NetlinkCodec, NetlinkMessageCodec};
/// audit specific implementation of [`NetlinkMessageCodec`] due to the
/// protocol violations in messages generated by kernal audit.
///
/// Among the known bugs in kernel audit messages:
/// - `nlmsg_len` sometimes contains the padding too (it shouldn't)
/// - `nlmsg_len` sometimes doesn't contain the header (it really should)
///
/// See also:
/// - https://blog.des.no/2020/08/netlink-auditing-and-counting-bytes/
/// - https://github.com/torvalds/linux/blob/b5013d084e03e82ceeab4db8ae8ceeaebe76b0eb/kernel/audit.c#L2386
/// - https://github.com/mozilla/libaudit-go/issues/24
/// - https://github.com/linux-audit/audit-userspace/issues/78
pub struct NetlinkAuditCodec {
// we don't need an instance of this, just the type
_private: (),
}
impl NetlinkMessageCodec for NetlinkAuditCodec {
fn decode<T>(src: &mut BytesMut) -> io::Result<Option<NetlinkMessage<T>>>
where
T: NetlinkDeserializable + Debug,
{
debug!("NetlinkAuditCodec: decoding next message");
loop {
// If there's nothing to read, return Ok(None)
if src.is_empty() {
trace!("buffer is empty");
return Ok(None);
}
// This is a bit hacky because we don't want to keep `src`
// borrowed, since we need to mutate it later.
let src_len = src.len();
let len = match NetlinkBuffer::new_checked(src.as_mut()) {
Ok(mut buf) => {
if (src_len as isize - buf.length() as isize) <= 16 {
// The audit messages are sometimes truncated,
// because the length specified in the header,
// does not take the header itself into
// account. To workaround this, we tweak the
// length. We've noticed two occurences of
// truncated packets:
//
// - the length of the header is not included (see also:
// https://github.com/mozilla/libaudit-go/issues/24)
// - some rule message have some padding for alignment (see
// https://github.com/linux-audit/audit-userspace/issues/78) which is not
// taken into account in the buffer length.
//
// How do we know that's the right length? Due to an implementation detail and to
// the fact that netlink is a datagram protocol.
//
// - our implementation of Stream always calls the codec with at most 1 message in
// the buffer, so we know the extra bytes do not belong to another message.
// - because netlink is a datagram protocol, we receive entire messages, so we know
// that if those extra bytes do not belong to another message, they belong to
// this one.
warn!("found what looks like a truncated audit packet");
// also write correct length to buffer so parsing does not fail:
warn!(
"setting packet length to {} instead of {}",
src_len,
buf.length()
);
buf.set_length(src_len as u32);
src_len
} else {
buf.length() as usize
}
}
Err(e) => {
// We either received a truncated packet, or the
// packet if malformed (invalid length field). In
// both case, we can't decode the datagram, and we
// cannot find the start of the next one (if
// any). The only solution is to clear the buffer
// and potentially lose some datagrams.
error!(
"failed to decode datagram, clearing buffer: {:?}: {:#x?}.",
e,
src.as_ref()
);
src.clear();
return Ok(None);
}
};
let bytes = src.split_to(len);
let parsed = NetlinkMessage::<T>::deserialize(&bytes);
match parsed {
Ok(packet) => {
trace!("<<< {:?}", packet);
return Ok(Some(packet));
}
Err(e) => {
error!("failed to decode packet {:#x?}: {}", &bytes, e);
// continue looping, there may be more datagrams in the buffer
}
}
}
}
fn encode<T>(msg: NetlinkMessage<T>, buf: &mut BytesMut) -> io::Result<()>
where
T: Debug + NetlinkSerializable,
{
NetlinkCodec::encode(msg, buf)
}
}
================================================
FILE: netlink-packet-audit/src/constants.rs
================================================
// SPDX-License-Identifier: MIT
pub use netlink_packet_core::constants::*;
// ==========================================
// 1000 - 1099 are for commanding the audit system
// ==========================================
/// Get status
pub const AUDIT_GET: u16 = 1000;
/// Set status (enable/disable/auditd)
pub const AUDIT_SET: u16 = 1001;
/// List syscall rules -- deprecated
pub const AUDIT_LIST: u16 = 1002;
/// Add syscall rule -- deprecated
pub const AUDIT_ADD: u16 = 1003;
/// Delete syscall rule -- deprecated
pub const AUDIT_DEL: u16 = 1004;
/// Message from userspace -- deprecated
pub const AUDIT_USER: u16 = 1005;
/// Define the login id and information
pub const AUDIT_LOGIN: u16 = 1006;
/// Insert file/dir watch entry
pub const AUDIT_WATCH_INS: u16 = 1007;
/// Remove file/dir watch entry
pub const AUDIT_WATCH_REM: u16 = 1008;
/// List all file/dir watches
pub const AUDIT_WATCH_LIST: u16 = 1009;
/// Get info about sender of signal to auditd
pub const AUDIT_SIGNAL_INFO: u16 = 1010;
/// Add syscall filtering rule
pub const AUDIT_ADD_RULE: u16 = 1011;
/// Delete syscall filtering rule
pub const AUDIT_DEL_RULE: u16 = 1012;
/// List syscall filtering rules
pub const AUDIT_LIST_RULES: u16 = 1013;
/// Trim junk from watched tree
pub const AUDIT_TRIM: u16 = 1014;
/// Append to watched tree
pub const AUDIT_MAKE_EQUIV: u16 = 1015;
/// Get TTY auditing status
pub const AUDIT_TTY_GET: u16 = 1016;
/// Set TTY auditing status
pub const AUDIT_TTY_SET: u16 = 1017;
/// Turn an audit feature on or off
pub const AUDIT_SET_FEATURE: u16 = 1018;
/// Get which features are enabled
pub const AUDIT_GET_FEATURE: u16 = 1019;
// ==========================================
// 1100 - 1199 user space trusted application messages
// ==========================================
/// Userspace messages mostly uninteresting to kernel
pub const AUDIT_FIRST_USER_MSG: u16 = 1100;
/// We filter this differently
pub const AUDIT_USER_AVC: u16 = 1107;
/// Non-ICANON TTY input meaning
pub const AUDIT_USER_TTY: u16 = 1124;
pub const AUDIT_LAST_USER_MSG: u16 = 1199;
/// More user space messages;
pub const AUDIT_FIRST_USER_MSG2: u16 = 2100;
pub const AUDIT_LAST_USER_MSG2: u16 = 2999;
// ==========================================
// 1200 - 1299 messages internal to the audit daemon
// ==========================================
/// Daemon startup record
pub const AUDIT_DAEMON_START: u16 = 1200;
/// Daemon normal stop record
pub const AUDIT_DAEMON_END: u16 = 1201;
/// Daemon error stop record
pub const AUDIT_DAEMON_ABORT: u16 = 1202;
/// Daemon config change
pub const AUDIT_DAEMON_CONFIG: u16 = 1203;
// ==========================================
// 1300 - 1399 audit event messages
// ==========================================
pub const AUDIT_EVENT_MESSAGE_MIN: u16 = 1300;
pub const AUDIT_EVENT_MESSAGE_MAX: u16 = 1399;
/// Syscall event
pub const AUDIT_SYSCALL: u16 = 1300;
/// Filename path information
pub const AUDIT_PATH: u16 = 1302;
/// IPC record
pub const AUDIT_IPC: u16 = 1303;
/// sys_socketcall arguments
pub const AUDIT_SOCKETCALL: u16 = 1304;
/// Audit system configuration change
pub const AUDIT_CONFIG_CHANGE: u16 = 1305;
/// sockaddr copied as syscall arg
pub const AUDIT_SOCKADDR: u16 = 1306;
/// Current working directory
pub const AUDIT_CWD: u16 = 1307;
/// execve arguments
pub const AUDIT_EXECVE: u16 = 1309;
/// IPC new permissions record type
pub const AUDIT_IPC_SET_PERM: u16 = 1311;
/// POSIX MQ open record type
pub const AUDIT_MQ_OPEN: u16 = 1312;
/// POSIX MQ send/receive record type
pub const AUDIT_MQ_SENDRECV: u16 = 1313;
/// POSIX MQ notify record type
pub const AUDIT_MQ_NOTIFY: u16 = 1314;
/// POSIX MQ get/set attribute record type
pub const AUDIT_MQ_GETSETATTR: u16 = 1315;
/// For use by 3rd party modules
pub const AUDIT_KERNEL_OTHER: u16 = 1316;
/// audit record for pipe/socketpair
pub const AUDIT_FD_PAIR: u16 = 1317;
/// ptrace target
pub const AUDIT_OBJ_PID: u16 = 1318;
/// Input on an administrative TTY
pub const AUDIT_TTY: u16 = 1319;
/// End of multi-record event
pub const AUDIT_EOE: u16 = 1320;
/// Information about fcaps increasing perms
pub const AUDIT_BPRM_FCAPS: u16 = 1321;
/// Record showing argument to sys_capset
pub const AUDIT_CAPSET: u16 = 1322;
/// Record showing descriptor and flags in mmap
pub const AUDIT_MMAP: u16 = 1323;
/// Packets traversing netfilter chains
pub const AUDIT_NETFILTER_PKT: u16 = 1324;
/// Netfilter chain modifications
pub const AUDIT_NETFILTER_CFG: u16 = 1325;
/// Secure Computing event
pub const AUDIT_SECCOMP: u16 = 1326;
/// Proctitle emit event
pub const AUDIT_PROCTITLE: u16 = 1327;
/// audit log listing feature changes
pub const AUDIT_FEATURE_CHANGE: u16 = 1328;
/// Replace auditd if this packet unanswerd
pub const AUDIT_REPLACE: u16 = 1329;
/// Kernel Module events
pub const AUDIT_KERN_MODULE: u16 = 1330;
/// Fanotify access decision
pub const AUDIT_FANOTIFY: u16 = 1331;
// ==========================================
// 1400 - 1499 SE Linux use
// ==========================================
/// SE Linux avc denial or grant
pub const AUDIT_AVC: u16 = 1400;
/// Internal SE Linux Errors
pub const AUDIT_SELINUX_ERR: u16 = 1401;
/// dentry, vfsmount pair from avc
pub const AUDIT_AVC_PATH: u16 = 1402;
/// Policy file load
pub const AUDIT_MAC_POLICY_LOAD: u16 = 1403;
/// Changed enforcing,permissive,off
pub const AUDIT_MAC_STATUS: u16 = 1404;
/// Changes to booleans
pub const AUDIT_MAC_CONFIG_CHANGE: u16 = 1405;
/// NetLabel: allow unlabeled traffic
pub const AUDIT_MAC_UNLBL_ALLOW: u16 = 1406;
/// NetLabel: add CIPSOv4 DOI entry
pub const AUDIT_MAC_CIPSOV4_ADD: u16 = 1407;
/// NetLabel: del CIPSOv4 DOI entry
pub const AUDIT_MAC_CIPSOV4_DEL: u16 = 1408;
/// NetLabel: add LSM domain mapping
pub const AUDIT_MAC_MAP_ADD: u16 = 1409;
/// NetLabel: del LSM domain mapping
pub const AUDIT_MAC_MAP_DEL: u16 = 1410;
/// Not used
pub const AUDIT_MAC_IPSEC_ADDSA: u16 = 1411;
/// Not used
pub const AUDIT_MAC_IPSEC_DELSA: u16 = 1412;
/// Not used
pub const AUDIT_MAC_IPSEC_ADDSPD: u16 = 1413;
/// Not used
pub const AUDIT_MAC_IPSEC_DELSPD: u16 = 1414;
/// Audit an IPSec event
pub const AUDIT_MAC_IPSEC_EVENT: u16 = 1415;
/// NetLabel: add a static label
pub const AUDIT_MAC_UNLBL_STCADD: u16 = 1416;
/// NetLabel: del a static label
pub const AUDIT_MAC_UNLBL_STCDEL: u16 = 1417;
/// NetLabel: add CALIPSO DOI entry
pub const AUDIT_MAC_CALIPSO_ADD: u16 = 1418;
/// NetLabel: del CALIPSO DOI entry
pub const AUDIT_MAC_CALIPSO_DEL: u16 = 1419;
// ==========================================
// 1700 - 1799 kernel anomaly records
// ==========================================
pub const AUDIT_FIRST_KERN_ANOM_MSG: u16 = 1700;
pub const AUDIT_LAST_KERN_ANOM_MSG: u16 = 1799;
/// Device changed promiscuous mode
pub const AUDIT_ANOM_PROMISCUOUS: u16 = 1700;
/// Process ended abnormally
pub const AUDIT_ANOM_ABEND: u16 = 1701;
/// Suspicious use of file links
pub const AUDIT_ANOM_LINK: u16 = 1702;
// ==========================================
// 1800 - 1899 kernel integrity events
// ==========================================
/// Data integrity verification
pub const AUDIT_INTEGRITY_DATA: u16 = 1800;
/// Metadata integrity verification
pub const AUDIT_INTEGRITY_METADATA: u16 = 1801;
/// Integrity enable status
pub const AUDIT_INTEGRITY_STATUS: u16 = 1802;
/// Integrity HASH type
pub const AUDIT_INTEGRITY_HASH: u16 = 1803;
/// PCR invalidation msgs
pub const AUDIT_INTEGRITY_PCR: u16 = 1804;
/// policy rule
pub const AUDIT_INTEGRITY_RULE: u16 = 1805;
// 2000 is for otherwise unclassified kernel audit messages (legacy)
pub const AUDIT_KERNEL: u16 = 2000;
// rule flags
/// Apply rule to user-generated messages
pub const AUDIT_FILTER_USER: u32 = 0;
/// Apply rule at task creation (not syscall)
pub const AUDIT_FILTER_TASK: u32 = 1;
/// Apply rule at syscall entry
pub const AUDIT_FILTER_ENTRY: u32 = 2;
/// Apply rule to file system watches
pub const AUDIT_FILTER_WATCH: u32 = 3;
/// Apply rule at syscall exit
pub const AUDIT_FILTER_EXIT: u32 = 4;
/// Apply rule at audit_log_start
pub const AUDIT_FILTER_TYPE: u32 = 5;
pub const AUDIT_FILTER_FS: u32 = 6;
/// Mask to get actual filter
pub const AUDIT_NR_FILTERS: u32 = 7;
pub const AUDIT_FILTER_PREPEND: u32 = 16;
/// Filter is unset
pub const AUDIT_FILTER_UNSET: u32 = 128;
// Rule actions
/// Do not build context if rule matches
pub const AUDIT_NEVER: u32 = 0;
/// Build context if rule matches
pub const AUDIT_POSSIBLE: u32 = 1;
/// Generate audit record if rule matches
pub const AUDIT_ALWAYS: u32 = 2;
pub const AUDIT_MAX_FIELDS: usize = 64;
pub const AUDIT_MAX_KEY_LEN: usize = 256;
pub const AUDIT_BITMASK_SIZE: usize = 64;
pub const AUDIT_SYSCALL_CLASSES: u32 = 16;
pub const AUDIT_CLASS_DIR_WRITE: u32 = 0;
pub const AUDIT_CLASS_DIR_WRITE_32: u32 = 1;
pub const AUDIT_CLASS_CHATTR: u32 = 2;
pub const AUDIT_CLASS_CHATTR_32: u32 = 3;
pub const AUDIT_CLASS_READ: u32 = 4;
pub const AUDIT_CLASS_READ_32: u32 = 5;
pub const AUDIT_CLASS_WRITE: u32 = 6;
pub const AUDIT_CLASS_WRITE_32: u32 = 7;
pub const AUDIT_CLASS_SIGNAL: u32 = 8;
pub const AUDIT_CLASS_SIGNAL_32: u32 = 9;
pub const AUDIT_UNUSED_BITS: u32 = 134216704;
// Field Comparing Constants
pub const AUDIT_COMPARE_UID_TO_OBJ_UID: u32 = 1;
pub const AUDIT_COMPARE_GID_TO_OBJ_GID: u32 = 2;
pub const AUDIT_COMPARE_EUID_TO_OBJ_UID: u32 = 3;
pub const AUDIT_COMPARE_EGID_TO_OBJ_GID: u32 = 4;
pub const AUDIT_COMPARE_AUID_TO_OBJ_UID: u32 = 5;
pub const AUDIT_COMPARE_SUID_TO_OBJ_UID: u32 = 6;
pub const AUDIT_COMPARE_SGID_TO_OBJ_GID: u32 = 7;
pub const AUDIT_COMPARE_FSUID_TO_OBJ_UID: u32 = 8;
pub const AUDIT_COMPARE_FSGID_TO_OBJ_GID: u32 = 9;
pub const AUDIT_COMPARE_UID_TO_AUID: u32 = 10;
pub const AUDIT_COMPARE_UID_TO_EUID: u32 = 11;
pub const AUDIT_COMPARE_UID_TO_FSUID: u32 = 12;
pub const AUDIT_COMPARE_UID_TO_SUID: u32 = 13;
pub const AUDIT_COMPARE_AUID_TO_FSUID: u32 = 14;
pub const AUDIT_COMPARE_AUID_TO_SUID: u32 = 15;
pub const AUDIT_COMPARE_AUID_TO_EUID: u32 = 16;
pub const AUDIT_COMPARE_EUID_TO_SUID: u32 = 17;
pub const AUDIT_COMPARE_EUID_TO_FSUID: u32 = 18;
pub const AUDIT_COMPARE_SUID_TO_FSUID: u32 = 19;
pub const AUDIT_COMPARE_GID_TO_EGID: u32 = 20;
pub const AUDIT_COMPARE_GID_TO_FSGID: u32 = 21;
pub const AUDIT_COMPARE_GID_TO_SGID: u32 = 22;
pub const AUDIT_COMPARE_EGID_TO_FSGID: u32 = 23;
pub const AUDIT_COMPARE_EGID_TO_SGID: u32 = 24;
pub const AUDIT_COMPARE_SGID_TO_FSGID: u32 = 25;
pub const AUDIT_MAX_FIELD_COMPARE: u32 = 25;
// =======================================================================
// rule fields
// =======================================================================
pub const AUDIT_PID: u32 = 0;
pub const AUDIT_UID: u32 = 1;
pub const AUDIT_EUID: u32 = 2;
pub const AUDIT_SUID: u32 = 3;
pub const AUDIT_FSUID: u32 = 4;
pub const AUDIT_GID: u32 = 5;
pub const AUDIT_EGID: u32 = 6;
pub const AUDIT_SGID: u32 = 7;
pub const AUDIT_FSGID: u32 = 8;
pub const AUDIT_LOGINUID: u32 = 9;
pub const AUDIT_PERS: u32 = 10;
pub const AUDIT_ARCH: u32 = 11;
pub const AUDIT_MSGTYPE: u32 = 12;
pub const AUDIT_SUBJ_USER: u32 = 13;
pub const AUDIT_SUBJ_ROLE: u32 = 14;
pub const AUDIT_SUBJ_TYPE: u32 = 15;
pub const AUDIT_SUBJ_SEN: u32 = 16;
pub const AUDIT_SUBJ_CLR: u32 = 17;
pub const AUDIT_PPID: u32 = 18;
pub const AUDIT_OBJ_USER: u32 = 19;
pub const AUDIT_OBJ_ROLE: u32 = 20;
pub const AUDIT_OBJ_TYPE: u32 = 21;
pub const AUDIT_OBJ_LEV_LOW: u32 = 22;
pub const AUDIT_OBJ_LEV_HIGH: u32 = 23;
pub const AUDIT_LOGINUID_SET: u32 = 24;
pub const AUDIT_SESSIONID: u32 = 25;
pub const AUDIT_FSTYPE: u32 = 26;
pub const AUDIT_DEVMAJOR: u32 = 100;
pub const AUDIT_DEVMINOR: u32 = 101;
pub const AUDIT_INODE: u32 = 102;
pub const AUDIT_EXIT: u32 = 103;
pub const AUDIT_SUCCESS: u32 = 104;
pub const AUDIT_WATCH: u32 = 105;
pub const AUDIT_PERM: u32 = 106;
pub const AUDIT_DIR: u32 = 107;
pub const AUDIT_FILETYPE: u32 = 108;
pub const AUDIT_OBJ_UID: u32 = 109;
pub const AUDIT_OBJ_GID: u32 = 110;
pub const AUDIT_FIELD_COMPARE: u32 = 111;
pub const AUDIT_EXE: u32 = 112;
pub const AUDIT_ARG0: u32 = 200;
pub const AUDIT_ARG1: u32 = 201;
pub const AUDIT_ARG2: u32 = 202;
pub const AUDIT_ARG3: u32 = 203;
pub const AUDIT_FILTERKEY: u32 = 210;
pub const AUDIT_BIT_MASK: u32 = 0x0800_0000;
pub const AUDIT_LESS_THAN: u32 = 0x1000_0000;
pub const AUDIT_GREATER_THAN: u32 = 0x2000_0000;
pub const AUDIT_NOT_EQUAL: u32 = 0x3000_0000;
pub const AUDIT_EQUAL: u32 = 0x4000_0000;
pub const AUDIT_BIT_TEST: u32 = AUDIT_BIT_MASK | AUDIT_EQUAL;
pub const AUDIT_LESS_THAN_OR_EQUAL: u32 = AUDIT_LESS_THAN | AUDIT_EQUAL;
pub const AUDIT_GREATER_THAN_OR_EQUAL: u32 = AUDIT_GREATER_THAN | AUDIT_EQUAL;
pub const AUDIT_OPERATORS: u32 = AUDIT_EQUAL | AUDIT_NOT_EQUAL | AUDIT_BIT_MASK;
// ============================================
// failure to log actions
// ============================================
pub const AUDIT_FAIL_SILENT: u32 = 0;
pub const AUDIT_FAIL_PRINTK: u32 = 1;
pub const AUDIT_FAIL_PANIC: u32 = 2;
pub const AUDIT_PERM_EXEC: u32 = 1;
pub const AUDIT_PERM_WRITE: u32 = 2;
pub const AUDIT_PERM_READ: u32 = 4;
pub const AUDIT_PERM_ATTR: u32 = 8;
pub const AUDIT_MESSAGE_TEXT_MAX: u32 = 8560;
pub const AUDIT_FEATURE_VERSION: u32 = 1;
pub const AUDIT_FEATURE_ONLY_UNSET_LOGINUID: u32 = 0;
pub const AUDIT_FEATURE_LOGINUID_IMMUTABLE: u32 = 1;
pub const AUDIT_LAST_FEATURE: u32 = 1;
/// Unused multicast group for audit
pub const AUDIT_NLGRP_NONE: u32 = 0;
/// Multicast group to listen for audit events
pub const AUDIT_NLGRP_READLOG: u32 = 1;
pub const __AUDIT_ARCH_CONVENTION_MASK: u32 = 0x3000_0000;
pub const __AUDIT_ARCH_CONVENTION_MIPS64_N32: u32 = 0x2000_0000;
pub const __AUDIT_ARCH_64BIT: u32 = 0x0800_0000;
pub const __AUDIT_ARCH_LE: u32 = 0x4000_0000;
pub const AUDIT_ARCH_AARCH64: u32 = 0xC000_00B7;
pub const AUDIT_ARCH_ALPHA: u32 = 0xC000_9026;
pub const AUDIT_ARCH_ARM: u32 = 0x4000_0028;
pub const AUDIT_ARCH_ARMEB: u32 = 0x28;
pub const AUDIT_ARCH_CRIS: u32 = 0x4000_004C;
pub const AUDIT_ARCH_FRV: u32 = 0x5441;
pub const AUDIT_ARCH_I386: u32 = 0x4000_0003;
pub const AUDIT_ARCH_IA64: u32 = 0xC000_0032;
pub const AUDIT_ARCH_M32R: u32 = 0x58;
pub const AUDIT_ARCH_M68K: u32 = 0x04;
pub const AUDIT_ARCH_MICROBLAZE: u32 = 0xBD;
pub const AUDIT_ARCH_MIPS: u32 = 0x08;
pub const AUDIT_ARCH_MIPSEL: u32 = 0x4000_0008;
pub const AUDIT_ARCH_MIPS64: u32 = 0x8000_0008;
pub const AUDIT_ARCH_MIPS64N32: u32 = 0xA000_0008;
pub const AUDIT_ARCH_MIPSEL64: u32 = 0xC000_0008;
pub const AUDIT_ARCH_MIPSEL64N32: u32 = 0xE000_0008;
pub const AUDIT_ARCH_OPENRISC: u32 = 92;
pub const AUDIT_ARCH_PARISC: u32 = 15;
pub const AUDIT_ARCH_PARISC64: u32 = 0x8000_000F;
pub const AUDIT_ARCH_PPC: u32 = 20;
pub const AUDIT_ARCH_PPC64: u32 = 0x8000_0015;
pub const AUDIT_ARCH_PPC64LE: u32 = 0xC000_0015;
pub const AUDIT_ARCH_S390: u32 = 22;
pub const AUDIT_ARCH_S390X: u32 = 0x8000_0016;
pub const AUDIT_ARCH_SH: u32 = 42;
pub const AUDIT_ARCH_SHEL: u32 = 0x4000_002A;
pub const AUDIT_ARCH_SH64: u32 = 0x8000_002A;
pub const AUDIT_ARCH_SHEL64: u32 = 0xC000_002A;
pub const AUDIT_ARCH_SPARC: u32 = 2;
pub const AUDIT_ARCH_SPARC64: u32 = 0x8000_002B;
pub const AUDIT_ARCH_TILEGX: u32 = 0xC000_00BF;
pub const AUDIT_ARCH_TILEGX32: u32 = 0x4000_00BF;
pub const AUDIT_ARCH_TILEPRO: u32 = 0x4000_00BC;
pub const AUDIT_ARCH_X86_64: u32 = 0xC000_003E;
================================================
FILE: netlink-packet-audit/src/lib.rs
================================================
// SPDX-License-Identifier: MIT
#[macro_use]
extern crate log;
pub(crate) extern crate netlink_packet_utils as utils;
pub use self::utils::{traits, DecodeError};
pub use netlink_packet_core::{
ErrorMessage,
NetlinkBuffer,
NetlinkHeader,
NetlinkMessage,
NetlinkPayload,
};
pub(crate) use netlink_packet_core::{NetlinkDeserializable, NetlinkSerializable};
use core::ops::Range;
/// Represent a multi-bytes field with a fixed size in a packet
pub(crate) type Field = Range<usize>;
mod codec;
pub use codec::NetlinkAuditCodec;
pub mod status;
pub use self::status::*;
pub mod rules;
pub use self::rules::*;
mod message;
pub use self::message::*;
mod buffer;
pub use self::buffer::*;
pub mod constants;
pub use self::constants::*;
#[cfg(test)]
#[macro_use]
extern crate lazy_static;
================================================
FILE: netlink-packet-audit/src/message.rs
================================================
// SPDX-License-Identifier: MIT
use crate::{
constants::*,
rules::RuleMessage,
traits::{Emitable, ParseableParametrized},
AuditBuffer,
DecodeError,
NetlinkDeserializable,
NetlinkHeader,
NetlinkPayload,
NetlinkSerializable,
StatusMessage,
};
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum AuditMessage {
GetStatus(Option<StatusMessage>),
SetStatus(StatusMessage),
AddRule(RuleMessage),
DelRule(RuleMessage),
ListRules(Option<RuleMessage>),
/// Event message (message types 1300 through 1399). This includes the following message types
/// (this list is non-exhaustive, and not really kept up to date): `AUDIT_SYSCALL`,
/// `AUDIT_PATH`, `AUDIT_IPC`, `AUDIT_SOCKETCALL`, `AUDIT_CONFIG_CHANGE`, `AUDIT_SOCKADDR`,
/// `AUDIT_CWD`, `AUDIT_EXECVE`, `AUDIT_IPC_SET_PERM`, `AUDIT_MQ_OPEN`, `AUDIT_MQ_SENDRECV`,
/// `AUDIT_MQ_NOTIFY`, `AUDIT_MQ_GETSETATTR`, `AUDIT_KERNEL_OTHER`, `AUDIT_FD_PAIR`,
/// `AUDIT_OBJ_PID`, `AUDIT_TTY`, `AUDIT_EOE`, `AUDIT_BPRM_FCAPS`, `AUDIT_CAPSET`,
/// `AUDIT_MMAP`, `AUDIT_NETFILTER_PKT`, `AUDIT_NETFILTER_CFG`, `AUDIT_SECCOMP`,
/// `AUDIT_PROCTITLE`, `AUDIT_FEATURE_CHANGE`, `AUDIT_REPLACE`, `AUDIT_KERN_MODULE`,
/// `AUDIT_FANOTIFY`.
///
/// The first element of the tuple is the message type, and the second is the event data.
Event((u16, String)),
/// All the other events are parsed as such as they can be parsed also.
Other((u16, String)),
}
impl AuditMessage {
pub fn is_event(&self) -> bool {
matches!(self, AuditMessage::Event(_))
}
pub fn is_get_status(&self) -> bool {
matches!(self, AuditMessage::GetStatus(_))
}
pub fn is_set_status(&self) -> bool {
matches!(self, AuditMessage::GetStatus(_))
}
pub fn is_add_rule(&self) -> bool {
matches!(self, AuditMessage::AddRule(_))
}
pub fn is_del_rule(&self) -> bool {
matches!(self, AuditMessage::DelRule(_))
}
pub fn is_list_rules(&self) -> bool {
matches!(self, AuditMessage::ListRules(_))
}
pub fn message_type(&self) -> u16 {
use self::AuditMessage::*;
match self {
GetStatus(_) => AUDIT_GET,
SetStatus(_) => AUDIT_SET,
ListRules(_) => AUDIT_LIST_RULES,
AddRule(_) => AUDIT_ADD_RULE,
DelRule(_) => AUDIT_DEL_RULE,
Event((message_type, _)) => *message_type,
Other((message_type, _)) => *message_type,
}
}
}
impl Emitable for AuditMessage {
fn buffer_len(&self) -> usize {
use self::AuditMessage::*;
match self {
GetStatus(Some(ref msg)) => msg.buffer_len(),
SetStatus(ref msg) => msg.buffer_len(),
AddRule(ref msg) => msg.buffer_len(),
DelRule(ref msg) => msg.buffer_len(),
ListRules(Some(ref msg)) => msg.buffer_len(),
GetStatus(None) | ListRules(None) => 0,
Event((_, ref data)) => data.len(),
Other((_, ref data)) => data.len(),
}
}
fn emit(&self, buffer: &mut [u8]) {
use self::AuditMessage::*;
match self {
GetStatus(Some(ref msg)) => msg.emit(buffer),
SetStatus(ref msg) => msg.emit(buffer),
AddRule(ref msg) => msg.emit(buffer),
DelRule(ref msg) => msg.emit(buffer),
ListRules(Some(ref msg)) => msg.emit(buffer),
ListRules(None) | GetStatus(None) => {}
Event((_, ref data)) => buffer.copy_from_slice(data.as_bytes()),
Other((_, ref data)) => buffer.copy_from_slice(data.as_bytes()),
}
}
}
impl NetlinkSerializable for AuditMessage {
fn message_type(&self) -> u16 {
self.message_type()
}
fn buffer_len(&self) -> usize {
<Self as Emitable>::buffer_len(self)
}
fn serialize(&self, buffer: &mut [u8]) {
self.emit(buffer)
}
}
impl NetlinkDeserializable for AuditMessage {
type Error = DecodeError;
fn deserialize(header: &NetlinkHeader, payload: &[u8]) -> Result<Self, Self::Error> {
match AuditBuffer::new_checked(payload) {
Err(e) => Err(e),
Ok(buffer) => match AuditMessage::parse_with_param(&buffer, header.message_type) {
Err(e) => Err(e),
Ok(message) => Ok(message),
},
}
}
}
impl From<AuditMessage> for NetlinkPayload<AuditMessage> {
fn from(message: AuditMessage) -> Self {
NetlinkPayload::InnerMessage(message)
}
}
================================================
FILE: netlink-packet-audit/src/rules/action.rs
================================================
// SPDX-License-Identifier: MIT
use crate::constants::*;
#[derive(Copy, Debug, PartialEq, Eq, Clone)]
pub enum RuleAction {
Never,
Possible,
Always,
Unknown(u32),
}
impl From<u32> for RuleAction {
fn from(value: u32) -> Self {
use self::RuleAction::*;
match value {
AUDIT_NEVER => Never,
AUDIT_POSSIBLE => Possible,
AUDIT_ALWAYS => Always,
_ => Unknown(value),
}
}
}
impl From<RuleAction> for u32 {
fn from(value: RuleAction) -> Self {
use self::RuleAction::*;
match value {
Never => AUDIT_NEVER,
Possible => AUDIT_POSSIBLE,
Always => AUDIT_ALWAYS,
Unknown(value) => value,
}
}
}
================================================
FILE: netlink-packet-audit/src/rules/buffer.r
gitextract_sbpvo7hy/ ├── .github/ │ └── workflows/ │ ├── clippy-rustfmt.yml │ ├── license.yml │ └── main.yml ├── .gitignore ├── .licenserc.yaml ├── CHANGELOG ├── Cargo.toml ├── LICENSE-MIT ├── README.md ├── RELEASE_PROCESS.md ├── audit/ │ ├── Cargo.toml │ ├── examples/ │ │ ├── add_rules.rs │ │ ├── dump_audit_rules.rs │ │ ├── events.rs │ │ └── events_async.rs │ └── src/ │ ├── errors.rs │ ├── handle.rs │ └── lib.rs ├── ethtool/ │ ├── Cargo.toml │ ├── examples/ │ │ ├── dump_coalesce.rs │ │ ├── dump_features.rs │ │ ├── dump_link_mode.rs │ │ ├── dump_pause.rs │ │ └── dump_rings.rs │ ├── src/ │ │ ├── coalesce/ │ │ │ ├── attr.rs │ │ │ ├── get.rs │ │ │ ├── handle.rs │ │ │ └── mod.rs │ │ ├── connection.rs │ │ ├── error.rs │ │ ├── feature/ │ │ │ ├── attr.rs │ │ │ ├── get.rs │ │ │ ├── handle.rs │ │ │ └── mod.rs │ │ ├── handle.rs │ │ ├── header.rs │ │ ├── lib.rs │ │ ├── link_mode/ │ │ │ ├── attr.rs │ │ │ ├── get.rs │ │ │ ├── handle.rs │ │ │ └── mod.rs │ │ ├── macros.rs │ │ ├── message.rs │ │ ├── pause/ │ │ │ ├── attr.rs │ │ │ ├── get.rs │ │ │ ├── handle.rs │ │ │ └── mod.rs │ │ └── ring/ │ │ ├── attr.rs │ │ ├── get.rs │ │ ├── handle.rs │ │ └── mod.rs │ └── tests/ │ ├── dump_link_modes.rs │ └── get_features_lo.rs ├── genetlink/ │ ├── Cargo.toml │ ├── examples/ │ │ ├── dump_family_policy.rs │ │ └── list_genetlink_family.rs │ └── src/ │ ├── connection.rs │ ├── error.rs │ ├── handle.rs │ ├── lib.rs │ ├── message.rs │ └── resolver.rs ├── mptcp-pm/ │ ├── Cargo.toml │ ├── examples/ │ │ └── dump_mptcp.rs │ ├── src/ │ │ ├── address/ │ │ │ ├── attr.rs │ │ │ ├── get.rs │ │ │ ├── handle.rs │ │ │ └── mod.rs │ │ ├── connection.rs │ │ ├── error.rs │ │ ├── handle.rs │ │ ├── lib.rs │ │ ├── limits/ │ │ │ ├── attr.rs │ │ │ ├── get.rs │ │ │ ├── handle.rs │ │ │ └── mod.rs │ │ ├── macros.rs │ │ └── message.rs │ └── tests/ │ └── dump_mptcp.rs ├── netlink-packet-audit/ │ ├── Cargo.toml │ ├── fuzz/ │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ └── fuzz_targets/ │ │ └── netlink.rs │ └── src/ │ ├── buffer.rs │ ├── codec.rs │ ├── constants.rs │ ├── lib.rs │ ├── message.rs │ ├── rules/ │ │ ├── action.rs │ │ ├── buffer.rs │ │ ├── field.rs │ │ ├── flags.rs │ │ ├── mod.rs │ │ ├── rule.rs │ │ ├── syscalls.rs │ │ └── tests.rs │ └── status.rs ├── netlink-packet-core/ │ ├── Cargo.toml │ ├── examples/ │ │ ├── protocol.rs │ │ └── rtnetlink.rs │ └── src/ │ ├── buffer.rs │ ├── constants.rs │ ├── error.rs │ ├── header.rs │ ├── lib.rs │ ├── message.rs │ ├── payload.rs │ └── traits.rs ├── netlink-packet-generic/ │ ├── Cargo.toml │ ├── examples/ │ │ └── list_generic_family.rs │ ├── src/ │ │ ├── buffer.rs │ │ ├── constants.rs │ │ ├── ctrl/ │ │ │ ├── mod.rs │ │ │ └── nlas/ │ │ │ ├── mcast.rs │ │ │ ├── mod.rs │ │ │ ├── oppolicy.rs │ │ │ ├── ops.rs │ │ │ └── policy.rs │ │ ├── header.rs │ │ ├── lib.rs │ │ ├── message.rs │ │ └── traits.rs │ └── tests/ │ └── query_family_id.rs ├── netlink-packet-netfilter/ │ ├── Cargo.toml │ ├── examples/ │ │ └── nflog.rs │ └── src/ │ ├── buffer.rs │ ├── constants.rs │ ├── lib.rs │ ├── message.rs │ └── nflog/ │ ├── message.rs │ ├── mod.rs │ └── nlas/ │ ├── config/ │ │ ├── config_cmd.rs │ │ ├── config_flags.rs │ │ ├── config_mode.rs │ │ ├── mod.rs │ │ ├── nla.rs │ │ └── timeout.rs │ ├── mod.rs │ └── packet/ │ ├── hw_addr.rs │ ├── mod.rs │ ├── nla.rs │ ├── packet_hdr.rs │ └── timestamp.rs ├── netlink-packet-route/ │ ├── Cargo.toml │ ├── benches/ │ │ ├── link_message.rs │ │ └── rtnetlink_dump.rs │ ├── data/ │ │ ├── README.md │ │ └── rtnetlink.pcap │ ├── examples/ │ │ ├── dump_neighbours.rs │ │ ├── dump_packet_link_bridge_vlan.rs │ │ ├── dump_packet_links.rs │ │ ├── dump_rules.rs │ │ └── new_rule.rs │ ├── fuzz/ │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ └── fuzz_targets/ │ │ └── netlink.rs │ └── src/ │ ├── lib.rs │ └── rtnl/ │ ├── address/ │ │ ├── buffer.rs │ │ ├── message.rs │ │ ├── mod.rs │ │ └── nlas/ │ │ ├── cache_info.rs │ │ └── mod.rs │ ├── buffer.rs │ ├── constants.rs │ ├── link/ │ │ ├── buffer.rs │ │ ├── header.rs │ │ ├── message.rs │ │ ├── mod.rs │ │ └── nlas/ │ │ ├── af_spec_bridge.rs │ │ ├── af_spec_inet.rs │ │ ├── bond.rs │ │ ├── inet/ │ │ │ ├── dev_conf.rs │ │ │ └── mod.rs │ │ ├── inet6/ │ │ │ ├── cache.rs │ │ │ ├── dev_conf.rs │ │ │ ├── icmp6_stats.rs │ │ │ ├── mod.rs │ │ │ └── stats.rs │ │ ├── link_infos.rs │ │ ├── link_state.rs │ │ ├── map.rs │ │ ├── mod.rs │ │ ├── prop_list.rs │ │ ├── stats.rs │ │ ├── stats64.rs │ │ └── tests.rs │ ├── message.rs │ ├── mod.rs │ ├── neighbour/ │ │ ├── buffer.rs │ │ ├── header.rs │ │ ├── message.rs │ │ ├── mod.rs │ │ └── nlas/ │ │ ├── cache_info.rs │ │ └── mod.rs │ ├── neighbour_table/ │ │ ├── buffer.rs │ │ ├── header.rs │ │ ├── message.rs │ │ ├── mod.rs │ │ └── nlas/ │ │ ├── config.rs │ │ ├── mod.rs │ │ └── stats.rs │ ├── nsid/ │ │ ├── buffer.rs │ │ ├── header.rs │ │ ├── message.rs │ │ ├── mod.rs │ │ └── nlas.rs │ ├── route/ │ │ ├── buffer.rs │ │ ├── header.rs │ │ ├── message.rs │ │ ├── mod.rs │ │ ├── nlas/ │ │ │ ├── cache_info.rs │ │ │ ├── metrics.rs │ │ │ ├── mfc_stats.rs │ │ │ ├── mod.rs │ │ │ ├── mpls_ip_tunnel.rs │ │ │ └── next_hops.rs │ │ └── test.rs │ ├── rule/ │ │ ├── buffer.rs │ │ ├── header.rs │ │ ├── message.rs │ │ ├── mod.rs │ │ └── nlas/ │ │ └── mod.rs │ ├── tc/ │ │ ├── buffer.rs │ │ ├── constants.rs │ │ ├── message.rs │ │ ├── mod.rs │ │ ├── nlas/ │ │ │ ├── action/ │ │ │ │ ├── mirred.rs │ │ │ │ └── mod.rs │ │ │ ├── filter/ │ │ │ │ ├── mod.rs │ │ │ │ └── u32.rs │ │ │ ├── mod.rs │ │ │ ├── options.rs │ │ │ ├── qdisc/ │ │ │ │ └── mod.rs │ │ │ ├── stats.rs │ │ │ ├── stats_basic.rs │ │ │ ├── stats_queue.rs │ │ │ └── test.rs │ │ └── test.rs │ └── test.rs ├── netlink-packet-sock-diag/ │ ├── Cargo.toml │ ├── examples/ │ │ └── dump_ipv4.rs │ └── src/ │ ├── buffer.rs │ ├── constants.rs │ ├── inet/ │ │ ├── mod.rs │ │ ├── nlas.rs │ │ ├── request.rs │ │ ├── response.rs │ │ ├── socket_id.rs │ │ └── tests.rs │ ├── lib.rs │ ├── message.rs │ └── unix/ │ ├── mod.rs │ ├── nlas.rs │ ├── request.rs │ ├── response.rs │ └── tests.rs ├── netlink-packet-utils/ │ ├── Cargo.toml │ └── src/ │ ├── errors.rs │ ├── lib.rs │ ├── macros.rs │ ├── nla.rs │ ├── parsers.rs │ └── traits.rs ├── netlink-packet-wireguard/ │ ├── Cargo.toml │ ├── examples/ │ │ └── get_wireguard_info.rs │ └── src/ │ ├── constants.rs │ ├── lib.rs │ ├── nlas/ │ │ ├── allowedip.rs │ │ ├── device.rs │ │ ├── mod.rs │ │ └── peer.rs │ └── raw.rs ├── netlink-proto/ │ ├── Cargo.toml │ ├── examples/ │ │ ├── audit_netlink_events.rs │ │ ├── dump_links.rs │ │ └── dump_links_async.rs │ └── src/ │ ├── codecs.rs │ ├── connection.rs │ ├── errors.rs │ ├── framed.rs │ ├── handle.rs │ ├── lib.rs │ └── protocol/ │ ├── mod.rs │ ├── protocol.rs │ └── request.rs ├── netlink-sys/ │ ├── Cargo.toml │ ├── examples/ │ │ ├── audit_events.rs │ │ ├── audit_events_async_std.rs │ │ ├── audit_events_tokio.rs │ │ └── audit_events_tokio_manual_thread_builder.rs │ └── src/ │ ├── addr.rs │ ├── async_socket.rs │ ├── async_socket_ext.rs │ ├── constants.rs │ ├── lib.rs │ ├── mio.rs │ ├── smol.rs │ ├── socket.rs │ └── tokio.rs ├── rtnetlink/ │ ├── Cargo.toml │ ├── examples/ │ │ ├── add_address.rs │ │ ├── add_neighbour.rs │ │ ├── add_netns.rs │ │ ├── add_netns_async.rs │ │ ├── add_route.rs │ │ ├── add_route_pref_src.rs │ │ ├── add_rule.rs │ │ ├── add_tc_qdisc_ingress.rs │ │ ├── create_bond.rs │ │ ├── create_bridge.rs │ │ ├── create_macvlan.rs │ │ ├── create_macvtap.rs │ │ ├── create_veth.rs │ │ ├── create_vxlan.rs │ │ ├── del_link.rs │ │ ├── del_netns.rs │ │ ├── del_netns_async.rs │ │ ├── flush_addresses.rs │ │ ├── get_address.rs │ │ ├── get_links.rs │ │ ├── get_links_async.rs │ │ ├── get_links_thread_builder.rs │ │ ├── get_neighbours.rs │ │ ├── get_route.rs │ │ ├── get_rule.rs │ │ ├── ip_monitor.rs │ │ ├── listen.rs │ │ ├── property_altname.rs │ │ └── set_link_down.rs │ └── src/ │ ├── addr/ │ │ ├── add.rs │ │ ├── del.rs │ │ ├── get.rs │ │ ├── handle.rs │ │ └── mod.rs │ ├── connection.rs │ ├── constants.rs │ ├── errors.rs │ ├── handle.rs │ ├── lib.rs │ ├── link/ │ │ ├── add.rs │ │ ├── del.rs │ │ ├── get.rs │ │ ├── handle.rs │ │ ├── mod.rs │ │ ├── property_add.rs │ │ ├── property_del.rs │ │ ├── set.rs │ │ └── test.rs │ ├── macros.rs │ ├── neighbour/ │ │ ├── add.rs │ │ ├── del.rs │ │ ├── get.rs │ │ ├── handle.rs │ │ └── mod.rs │ ├── ns.rs │ ├── route/ │ │ ├── add.rs │ │ ├── del.rs │ │ ├── get.rs │ │ ├── handle.rs │ │ └── mod.rs │ ├── rule/ │ │ ├── add.rs │ │ ├── del.rs │ │ ├── get.rs │ │ ├── handle.rs │ │ └── mod.rs │ └── traffic_control/ │ ├── add_filter.rs │ ├── add_qdisc.rs │ ├── del_qdisc.rs │ ├── get.rs │ ├── handle.rs │ ├── mod.rs │ └── test.rs └── rustfmt.toml
Showing preview only (299K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3686 symbols across 294 files)
FILE: audit/examples/add_rules.rs
function main (line 24) | async fn main() -> Result<(), String> {
function add_rules (line 30) | async fn add_rules(mut handle: Handle) -> Result<(), Error> {
FILE: audit/examples/dump_audit_rules.rs
function main (line 9) | async fn main() -> Result<(), String> {
function list_rules (line 15) | async fn list_rules(mut handle: Handle) -> Result<(), Error> {
FILE: audit/examples/events.rs
function main (line 10) | async fn main() -> Result<(), String> {
FILE: audit/examples/events_async.rs
function main (line 10) | async fn main() -> Result<(), String> {
FILE: audit/src/errors.rs
type Error (line 8) | pub enum Error {
FILE: audit/src/handle.rs
constant AUDIT_STATUS_ENABLED (line 29) | pub const AUDIT_STATUS_ENABLED: u32 = 1;
constant AUDIT_STATUS_FAILURE (line 30) | pub const AUDIT_STATUS_FAILURE: u32 = 2;
constant AUDIT_STATUS_PID (line 31) | pub const AUDIT_STATUS_PID: u32 = 4;
constant AUDIT_STATUS_RATE_LIMIT (line 32) | pub const AUDIT_STATUS_RATE_LIMIT: u32 = 8;
constant AUDIT_STATUS_BACKLOG_LIMIT (line 33) | pub const AUDIT_STATUS_BACKLOG_LIMIT: u32 = 16;
constant AUDIT_STATUS_BACKLOG_WAIT_TIME (line 34) | pub const AUDIT_STATUS_BACKLOG_WAIT_TIME: u32 = 32;
constant AUDIT_STATUS_LOST (line 35) | pub const AUDIT_STATUS_LOST: u32 = 64;
constant AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT (line 36) | pub const AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT: u32 = 1;
constant AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME (line 37) | pub const AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME: u32 = 2;
constant AUDIT_FEATURE_BITMAP_EXECUTABLE_PATH (line 38) | pub const AUDIT_FEATURE_BITMAP_EXECUTABLE_PATH: u32 = 4;
constant AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND (line 39) | pub const AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND: u32 = 8;
constant AUDIT_FEATURE_BITMAP_SESSIONID_FILTER (line 40) | pub const AUDIT_FEATURE_BITMAP_SESSIONID_FILTER: u32 = 16;
constant AUDIT_FEATURE_BITMAP_LOST_RESET (line 41) | pub const AUDIT_FEATURE_BITMAP_LOST_RESET: u32 = 32;
constant AUDIT_FEATURE_BITMAP_FILTER_FS (line 42) | pub const AUDIT_FEATURE_BITMAP_FILTER_FS: u32 = 64;
constant AUDIT_FEATURE_BITMAP_ALL (line 43) | pub const AUDIT_FEATURE_BITMAP_ALL: u32 = 127;
constant AUDIT_VERSION_LATEST (line 44) | pub const AUDIT_VERSION_LATEST: u32 = 127;
constant AUDIT_VERSION_BACKLOG_LIMIT (line 45) | pub const AUDIT_VERSION_BACKLOG_LIMIT: u32 = 1;
constant AUDIT_VERSION_BACKLOG_WAIT_TIME (line 46) | pub const AUDIT_VERSION_BACKLOG_WAIT_TIME: u32 = 2;
type Handle (line 52) | pub struct Handle(ConnectionHandle<AuditMessage>);
method new (line 55) | pub(crate) fn new(conn: ConnectionHandle<AuditMessage>) -> Self {
method request (line 60) | pub fn request(
method acked_request (line 71) | async fn acked_request(&mut self, message: NetlinkMessage<AuditMessage...
method add_rule (line 90) | pub async fn add_rule(&mut self, rule: RuleMessage) -> Result<(), Erro...
method del_rule (line 97) | pub async fn del_rule(&mut self, rule: RuleMessage) -> Result<(), Erro...
method list_rules (line 104) | pub fn list_rules(&mut self) -> impl TryStream<Ok = RuleMessage, Error...
method enable_events (line 126) | pub async fn enable_events(&mut self) -> Result<(), Error> {
method get_status (line 137) | pub async fn get_status(&mut self) -> Result<StatusMessage, Error> {
FILE: audit/src/lib.rs
function new_connection (line 21) | pub fn new_connection() -> io::Result<(
function new_connection_with_socket (line 33) | pub fn new_connection_with_socket<S>() -> io::Result<(
FILE: ethtool/examples/dump_coalesce.rs
function main (line 7) | fn main() {
function get_coalesce (line 15) | async fn get_coalesce(iface_name: Option<&str>) {
FILE: ethtool/examples/dump_features.rs
function main (line 7) | fn main() {
function get_feature (line 15) | async fn get_feature(iface_name: Option<&str>) {
FILE: ethtool/examples/dump_link_mode.rs
function main (line 7) | fn main() {
function get_link_mode (line 15) | async fn get_link_mode(iface_name: Option<&str>) {
FILE: ethtool/examples/dump_pause.rs
function main (line 7) | fn main() {
function get_pause (line 16) | async fn get_pause(iface_name: Option<&str>) {
FILE: ethtool/examples/dump_rings.rs
function main (line 7) | fn main() {
function get_ring (line 15) | async fn get_ring(iface_name: Option<&str>) {
FILE: ethtool/src/coalesce/attr.rs
constant ETHTOOL_A_COALESCE_HEADER (line 15) | const ETHTOOL_A_COALESCE_HEADER: u16 = 1;
constant ETHTOOL_A_COALESCE_RX_USECS (line 16) | const ETHTOOL_A_COALESCE_RX_USECS: u16 = 2;
constant ETHTOOL_A_COALESCE_RX_MAX_FRAMES (line 17) | const ETHTOOL_A_COALESCE_RX_MAX_FRAMES: u16 = 3;
constant ETHTOOL_A_COALESCE_RX_USECS_IRQ (line 18) | const ETHTOOL_A_COALESCE_RX_USECS_IRQ: u16 = 4;
constant ETHTOOL_A_COALESCE_RX_MAX_FRAMES_IRQ (line 19) | const ETHTOOL_A_COALESCE_RX_MAX_FRAMES_IRQ: u16 = 5;
constant ETHTOOL_A_COALESCE_TX_USECS (line 20) | const ETHTOOL_A_COALESCE_TX_USECS: u16 = 6;
constant ETHTOOL_A_COALESCE_TX_MAX_FRAMES (line 21) | const ETHTOOL_A_COALESCE_TX_MAX_FRAMES: u16 = 7;
constant ETHTOOL_A_COALESCE_TX_USECS_IRQ (line 22) | const ETHTOOL_A_COALESCE_TX_USECS_IRQ: u16 = 8;
constant ETHTOOL_A_COALESCE_TX_MAX_FRAMES_IRQ (line 23) | const ETHTOOL_A_COALESCE_TX_MAX_FRAMES_IRQ: u16 = 9;
constant ETHTOOL_A_COALESCE_STATS_BLOCK_USECS (line 24) | const ETHTOOL_A_COALESCE_STATS_BLOCK_USECS: u16 = 10;
constant ETHTOOL_A_COALESCE_USE_ADAPTIVE_RX (line 25) | const ETHTOOL_A_COALESCE_USE_ADAPTIVE_RX: u16 = 11;
constant ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX (line 26) | const ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX: u16 = 12;
constant ETHTOOL_A_COALESCE_PKT_RATE_LOW (line 27) | const ETHTOOL_A_COALESCE_PKT_RATE_LOW: u16 = 13;
constant ETHTOOL_A_COALESCE_RX_USECS_LOW (line 28) | const ETHTOOL_A_COALESCE_RX_USECS_LOW: u16 = 14;
constant ETHTOOL_A_COALESCE_RX_MAX_FRAMES_LOW (line 29) | const ETHTOOL_A_COALESCE_RX_MAX_FRAMES_LOW: u16 = 15;
constant ETHTOOL_A_COALESCE_TX_USECS_LOW (line 30) | const ETHTOOL_A_COALESCE_TX_USECS_LOW: u16 = 16;
constant ETHTOOL_A_COALESCE_TX_MAX_FRAMES_LOW (line 31) | const ETHTOOL_A_COALESCE_TX_MAX_FRAMES_LOW: u16 = 17;
constant ETHTOOL_A_COALESCE_PKT_RATE_HIGH (line 32) | const ETHTOOL_A_COALESCE_PKT_RATE_HIGH: u16 = 18;
constant ETHTOOL_A_COALESCE_RX_USECS_HIGH (line 33) | const ETHTOOL_A_COALESCE_RX_USECS_HIGH: u16 = 19;
constant ETHTOOL_A_COALESCE_RX_MAX_FRAMES_HIGH (line 34) | const ETHTOOL_A_COALESCE_RX_MAX_FRAMES_HIGH: u16 = 20;
constant ETHTOOL_A_COALESCE_TX_USECS_HIGH (line 35) | const ETHTOOL_A_COALESCE_TX_USECS_HIGH: u16 = 21;
constant ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH (line 36) | const ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH: u16 = 22;
constant ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL (line 37) | const ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL: u16 = 23;
type EthtoolCoalesceAttr (line 40) | pub enum EthtoolCoalesceAttr {
method parse (line 155) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 68) | fn value_len(&self) -> usize {
method kind (line 96) | fn kind(&self) -> u16 {
method emit_value (line 125) | fn emit_value(&self, buffer: &mut [u8]) {
function parse_coalesce_nlas (line 263) | pub(crate) fn parse_coalesce_nlas(buffer: &[u8]) -> Result<Vec<EthtoolAt...
FILE: ethtool/src/coalesce/get.rs
type EthtoolCoalesceGetRequest (line 8) | pub struct EthtoolCoalesceGetRequest {
method new (line 14) | pub(crate) fn new(handle: EthtoolHandle, iface_name: Option<&str>) -> ...
method execute (line 21) | pub async fn execute(
FILE: ethtool/src/coalesce/handle.rs
type EthtoolCoalesceHandle (line 5) | pub struct EthtoolCoalesceHandle(EthtoolHandle);
method new (line 8) | pub fn new(handle: EthtoolHandle) -> Self {
method get (line 13) | pub fn get(&mut self, iface_name: Option<&str>) -> EthtoolCoalesceGetR...
FILE: ethtool/src/connection.rs
function new_connection (line 15) | pub fn new_connection() -> io::Result<(
function new_connection_with_socket (line 24) | pub fn new_connection_with_socket<S>() -> io::Result<(
FILE: ethtool/src/error.rs
type EthtoolError (line 11) | pub enum EthtoolError {
FILE: ethtool/src/feature/attr.rs
constant ETHTOOL_A_FEATURES_HEADER (line 15) | const ETHTOOL_A_FEATURES_HEADER: u16 = 1;
constant ETHTOOL_A_FEATURES_HW (line 16) | const ETHTOOL_A_FEATURES_HW: u16 = 2;
constant ETHTOOL_A_FEATURES_WANTED (line 17) | const ETHTOOL_A_FEATURES_WANTED: u16 = 3;
constant ETHTOOL_A_FEATURES_ACTIVE (line 18) | const ETHTOOL_A_FEATURES_ACTIVE: u16 = 4;
constant ETHTOOL_A_FEATURES_NOCHANGE (line 19) | const ETHTOOL_A_FEATURES_NOCHANGE: u16 = 5;
constant ETHTOOL_A_BITSET_BITS (line 21) | const ETHTOOL_A_BITSET_BITS: u16 = 3;
constant ETHTOOL_A_BITSET_BITS_BIT (line 23) | const ETHTOOL_A_BITSET_BITS_BIT: u16 = 1;
constant ETHTOOL_A_BITSET_BIT_INDEX (line 25) | const ETHTOOL_A_BITSET_BIT_INDEX: u16 = 1;
constant ETHTOOL_A_BITSET_BIT_NAME (line 26) | const ETHTOOL_A_BITSET_BIT_NAME: u16 = 2;
constant ETHTOOL_A_BITSET_BIT_VALUE (line 27) | const ETHTOOL_A_BITSET_BIT_VALUE: u16 = 3;
type EthtoolFeatureBit (line 30) | pub struct EthtoolFeatureBit {
method new (line 37) | fn new(has_mask: bool) -> Self {
function feature_bits_len (line 46) | fn feature_bits_len(_feature_bits: &[EthtoolFeatureBit]) -> usize {
function feature_bits_emit (line 50) | fn feature_bits_emit(_feature_bits: &[EthtoolFeatureBit], _buffer: &mut ...
type EthtoolFeatureAttr (line 55) | pub enum EthtoolFeatureAttr {
method parse (line 100) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 65) | fn value_len(&self) -> usize {
method kind (line 76) | fn kind(&self) -> u16 {
method emit_value (line 87) | fn emit_value(&self, buffer: &mut [u8]) {
function parse_bitset_bits_nlas (line 138) | fn parse_bitset_bits_nlas(
function parse_bitset_bits_nla (line 152) | fn parse_bitset_bits_nla(
function parse_feature_nlas (line 209) | pub(crate) fn parse_feature_nlas(buffer: &[u8]) -> Result<Vec<EthtoolAtt...
FILE: ethtool/src/feature/get.rs
type EthtoolFeatureGetRequest (line 8) | pub struct EthtoolFeatureGetRequest {
method new (line 14) | pub(crate) fn new(handle: EthtoolHandle, iface_name: Option<&str>) -> ...
method execute (line 21) | pub async fn execute(
FILE: ethtool/src/feature/handle.rs
type EthtoolFeatureHandle (line 5) | pub struct EthtoolFeatureHandle(EthtoolHandle);
method new (line 8) | pub fn new(handle: EthtoolHandle) -> Self {
method get (line 13) | pub fn get(&mut self, iface_name: Option<&str>) -> EthtoolFeatureGetRe...
FILE: ethtool/src/handle.rs
type EthtoolHandle (line 21) | pub struct EthtoolHandle {
method new (line 26) | pub(crate) fn new(handle: GenetlinkHandle) -> Self {
method pause (line 30) | pub fn pause(&mut self) -> EthtoolPauseHandle {
method feature (line 34) | pub fn feature(&mut self) -> EthtoolFeatureHandle {
method link_mode (line 38) | pub fn link_mode(&mut self) -> EthtoolLinkModeHandle {
method ring (line 42) | pub fn ring(&mut self) -> EthtoolRingHandle {
method coalesce (line 46) | pub fn coalesce(&mut self) -> EthtoolCoalesceHandle {
method request (line 50) | pub async fn request(
function ethtool_execute (line 64) | pub(crate) async fn ethtool_execute(
FILE: ethtool/src/header.rs
constant ALTIFNAMSIZ (line 14) | const ALTIFNAMSIZ: usize = 128;
constant ETHTOOL_A_HEADER_DEV_INDEX (line 15) | const ETHTOOL_A_HEADER_DEV_INDEX: u16 = 1;
constant ETHTOOL_A_HEADER_DEV_NAME (line 16) | const ETHTOOL_A_HEADER_DEV_NAME: u16 = 2;
constant ETHTOOL_A_HEADER_FLAGS (line 17) | const ETHTOOL_A_HEADER_FLAGS: u16 = 3;
type EthtoolHeader (line 20) | pub enum EthtoolHeader {
method parse (line 61) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 28) | fn value_len(&self) -> usize {
method kind (line 42) | fn kind(&self) -> u16 {
method emit_value (line 51) | fn emit_value(&self, buffer: &mut [u8]) {
function str_to_zero_ended_u8_array (line 78) | fn str_to_zero_ended_u8_array(src_str: &str, buffer: &mut [u8], max_size...
FILE: ethtool/src/link_mode/attr.rs
constant ETHTOOL_A_LINKMODES_HEADER (line 15) | const ETHTOOL_A_LINKMODES_HEADER: u16 = 1;
constant ETHTOOL_A_LINKMODES_AUTONEG (line 16) | const ETHTOOL_A_LINKMODES_AUTONEG: u16 = 2;
constant ETHTOOL_A_LINKMODES_OURS (line 17) | const ETHTOOL_A_LINKMODES_OURS: u16 = 3;
constant ETHTOOL_A_LINKMODES_PEER (line 18) | const ETHTOOL_A_LINKMODES_PEER: u16 = 4;
constant ETHTOOL_A_LINKMODES_SPEED (line 19) | const ETHTOOL_A_LINKMODES_SPEED: u16 = 5;
constant ETHTOOL_A_LINKMODES_DUPLEX (line 20) | const ETHTOOL_A_LINKMODES_DUPLEX: u16 = 6;
constant ETHTOOL_A_LINKMODES_SUBORDINATE_CFG (line 21) | const ETHTOOL_A_LINKMODES_SUBORDINATE_CFG: u16 = 7;
constant ETHTOOL_A_LINKMODES_SUBORDINATE_STATE (line 22) | const ETHTOOL_A_LINKMODES_SUBORDINATE_STATE: u16 = 8;
constant ETHTOOL_A_LINKMODES_LANES (line 23) | const ETHTOOL_A_LINKMODES_LANES: u16 = 9;
constant ETHTOOL_A_BITSET_BITS (line 25) | const ETHTOOL_A_BITSET_BITS: u16 = 3;
constant ETHTOOL_A_BITSET_BITS_BIT (line 27) | const ETHTOOL_A_BITSET_BITS_BIT: u16 = 1;
constant ETHTOOL_A_BITSET_BIT_INDEX (line 29) | const ETHTOOL_A_BITSET_BIT_INDEX: u16 = 1;
constant ETHTOOL_A_BITSET_BIT_NAME (line 30) | const ETHTOOL_A_BITSET_BIT_NAME: u16 = 2;
constant ETHTOOL_A_BITSET_BIT_VALUE (line 31) | const ETHTOOL_A_BITSET_BIT_VALUE: u16 = 3;
constant DUPLEX_HALF (line 33) | const DUPLEX_HALF: u8 = 0x00;
constant DUPLEX_FULL (line 34) | const DUPLEX_FULL: u8 = 0x01;
constant DUPLEX_UNKNOWN (line 35) | const DUPLEX_UNKNOWN: u8 = 0xff;
type EthtoolLinkModeDuplex (line 38) | pub enum EthtoolLinkModeDuplex {
method from (line 46) | fn from(d: u8) -> Self {
type EthtoolLinkModeAttr (line 57) | pub enum EthtoolLinkModeAttr {
method parse (line 114) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 71) | fn value_len(&self) -> usize {
method kind (line 89) | fn kind(&self) -> u16 {
method emit_value (line 104) | fn emit_value(&self, buffer: &mut [u8]) {
function parse_bitset_bits_nlas (line 155) | fn parse_bitset_bits_nlas(raw: &[u8]) -> Result<Vec<String>, DecodeError> {
function parse_bitset_bits_nla (line 166) | fn parse_bitset_bits_nla(raw: &[u8]) -> Result<Vec<String>, DecodeError> {
function parse_link_mode_nlas (line 210) | pub(crate) fn parse_link_mode_nlas(buffer: &[u8]) -> Result<Vec<EthtoolA...
FILE: ethtool/src/link_mode/get.rs
type EthtoolLinkModeGetRequest (line 8) | pub struct EthtoolLinkModeGetRequest {
method new (line 14) | pub(crate) fn new(handle: EthtoolHandle, iface_name: Option<&str>) -> ...
method execute (line 21) | pub async fn execute(
FILE: ethtool/src/link_mode/handle.rs
type EthtoolLinkModeHandle (line 5) | pub struct EthtoolLinkModeHandle(EthtoolHandle);
method new (line 8) | pub fn new(handle: EthtoolHandle) -> Self {
method get (line 13) | pub fn get(&mut self, iface_name: Option<&str>) -> EthtoolLinkModeGetR...
FILE: ethtool/src/message.rs
constant ETHTOOL_MSG_PAUSE_GET (line 16) | const ETHTOOL_MSG_PAUSE_GET: u8 = 21;
constant ETHTOOL_MSG_PAUSE_GET_REPLY (line 17) | const ETHTOOL_MSG_PAUSE_GET_REPLY: u8 = 22;
constant ETHTOOL_MSG_FEATURES_GET (line 18) | const ETHTOOL_MSG_FEATURES_GET: u8 = 11;
constant ETHTOOL_MSG_FEATURES_GET_REPLY (line 19) | const ETHTOOL_MSG_FEATURES_GET_REPLY: u8 = 11;
constant ETHTOOL_MSG_LINKMODES_GET (line 20) | const ETHTOOL_MSG_LINKMODES_GET: u8 = 4;
constant ETHTOOL_MSG_LINKMODES_GET_REPLY (line 21) | const ETHTOOL_MSG_LINKMODES_GET_REPLY: u8 = 4;
constant ETHTOOL_MSG_RINGS_GET (line 22) | const ETHTOOL_MSG_RINGS_GET: u8 = 15;
constant ETHTOOL_MSG_RINGS_GET_REPLY (line 23) | const ETHTOOL_MSG_RINGS_GET_REPLY: u8 = 16;
constant ETHTOOL_MSG_COALESCE_GET (line 24) | const ETHTOOL_MSG_COALESCE_GET: u8 = 19;
constant ETHTOOL_MSG_COALESCE_GET_REPLY (line 25) | const ETHTOOL_MSG_COALESCE_GET_REPLY: u8 = 20;
type EthtoolCmd (line 28) | pub enum EthtoolCmd {
function from (line 42) | fn from(cmd: EthtoolCmd) -> Self {
type EthtoolAttr (line 59) | pub enum EthtoolAttr {
method value_len (line 68) | fn value_len(&self) -> usize {
method kind (line 78) | fn kind(&self) -> u16 {
method emit_value (line 88) | fn emit_value(&self, buffer: &mut [u8]) {
type EthtoolMessage (line 100) | pub struct EthtoolMessage {
method new_pause_get (line 120) | pub fn new_pause_get(iface_name: Option<&str>) -> Self {
method new_feature_get (line 133) | pub fn new_feature_get(iface_name: Option<&str>) -> Self {
method new_link_mode_get (line 146) | pub fn new_link_mode_get(iface_name: Option<&str>) -> Self {
method new_ring_get (line 159) | pub fn new_ring_get(iface_name: Option<&str>) -> Self {
method new_coalesce_get (line 172) | pub fn new_coalesce_get(iface_name: Option<&str>) -> Self {
method parse_with_param (line 197) | fn parse_with_param(buffer: &[u8], header: GenlHeader) -> Result<Self,...
method family_name (line 106) | fn family_name() -> &'static str {
method version (line 110) | fn version(&self) -> u8 {
method command (line 114) | fn command(&self) -> u8 {
method buffer_len (line 187) | fn buffer_len(&self) -> usize {
method emit (line 191) | fn emit(&self, buffer: &mut [u8]) {
FILE: ethtool/src/pause/attr.rs
constant ETHTOOL_A_PAUSE_HEADER (line 15) | const ETHTOOL_A_PAUSE_HEADER: u16 = 1;
constant ETHTOOL_A_PAUSE_AUTONEG (line 16) | const ETHTOOL_A_PAUSE_AUTONEG: u16 = 2;
constant ETHTOOL_A_PAUSE_RX (line 17) | const ETHTOOL_A_PAUSE_RX: u16 = 3;
constant ETHTOOL_A_PAUSE_TX (line 18) | const ETHTOOL_A_PAUSE_TX: u16 = 4;
constant ETHTOOL_A_PAUSE_STATS (line 19) | const ETHTOOL_A_PAUSE_STATS: u16 = 5;
constant ETHTOOL_A_PAUSE_STAT_TX_FRAMES (line 21) | const ETHTOOL_A_PAUSE_STAT_TX_FRAMES: u16 = 2;
constant ETHTOOL_A_PAUSE_STAT_RX_FRAMES (line 22) | const ETHTOOL_A_PAUSE_STAT_RX_FRAMES: u16 = 3;
type EthtoolPauseStatAttr (line 25) | pub enum EthtoolPauseStatAttr {
method parse (line 56) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 32) | fn value_len(&self) -> usize {
method kind (line 39) | fn kind(&self) -> u16 {
method emit_value (line 47) | fn emit_value(&self, buffer: &mut [u8]) {
type EthtoolPauseAttr (line 71) | pub enum EthtoolPauseAttr {
method parse (line 112) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 81) | fn value_len(&self) -> usize {
method kind (line 90) | fn kind(&self) -> u16 {
method emit_value (line 101) | fn emit_value(&self, buffer: &mut [u8]) {
function parse_pause_nlas (line 149) | pub(crate) fn parse_pause_nlas(buffer: &[u8]) -> Result<Vec<EthtoolAttr>...
FILE: ethtool/src/pause/get.rs
type EthtoolPauseGetRequest (line 8) | pub struct EthtoolPauseGetRequest {
method new (line 14) | pub(crate) fn new(handle: EthtoolHandle, iface_name: Option<&str>) -> ...
method execute (line 21) | pub async fn execute(
FILE: ethtool/src/pause/handle.rs
type EthtoolPauseHandle (line 5) | pub struct EthtoolPauseHandle(EthtoolHandle);
method new (line 8) | pub fn new(handle: EthtoolHandle) -> Self {
method get (line 13) | pub fn get(&mut self, iface_name: Option<&str>) -> EthtoolPauseGetRequ...
FILE: ethtool/src/ring/attr.rs
constant ETHTOOL_A_RINGS_HEADER (line 15) | const ETHTOOL_A_RINGS_HEADER: u16 = 1;
constant ETHTOOL_A_RINGS_RX_MAX (line 16) | const ETHTOOL_A_RINGS_RX_MAX: u16 = 2;
constant ETHTOOL_A_RINGS_RX_MINI_MAX (line 17) | const ETHTOOL_A_RINGS_RX_MINI_MAX: u16 = 3;
constant ETHTOOL_A_RINGS_RX_JUMBO_MAX (line 18) | const ETHTOOL_A_RINGS_RX_JUMBO_MAX: u16 = 4;
constant ETHTOOL_A_RINGS_TX_MAX (line 19) | const ETHTOOL_A_RINGS_TX_MAX: u16 = 5;
constant ETHTOOL_A_RINGS_RX (line 20) | const ETHTOOL_A_RINGS_RX: u16 = 6;
constant ETHTOOL_A_RINGS_RX_MINI (line 21) | const ETHTOOL_A_RINGS_RX_MINI: u16 = 7;
constant ETHTOOL_A_RINGS_RX_JUMBO (line 22) | const ETHTOOL_A_RINGS_RX_JUMBO: u16 = 8;
constant ETHTOOL_A_RINGS_TX (line 23) | const ETHTOOL_A_RINGS_TX: u16 = 9;
type EthtoolRingAttr (line 26) | pub enum EthtoolRingAttr {
method parse (line 87) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 40) | fn value_len(&self) -> usize {
method kind (line 55) | fn kind(&self) -> u16 {
method emit_value (line 70) | fn emit_value(&self, buffer: &mut [u8]) {
function parse_ring_nlas (line 130) | pub(crate) fn parse_ring_nlas(buffer: &[u8]) -> Result<Vec<EthtoolAttr>,...
FILE: ethtool/src/ring/get.rs
type EthtoolRingGetRequest (line 8) | pub struct EthtoolRingGetRequest {
method new (line 14) | pub(crate) fn new(handle: EthtoolHandle, iface_name: Option<&str>) -> ...
method execute (line 21) | pub async fn execute(
FILE: ethtool/src/ring/handle.rs
type EthtoolRingHandle (line 5) | pub struct EthtoolRingHandle(EthtoolHandle);
method new (line 8) | pub fn new(handle: EthtoolHandle) -> Self {
method get (line 13) | pub fn get(&mut self, iface_name: Option<&str>) -> EthtoolRingGetReque...
FILE: ethtool/tests/dump_link_modes.rs
function test_dump_link_modes (line 7) | fn test_dump_link_modes() {
function dump_link_modes (line 15) | async fn dump_link_modes() {
FILE: ethtool/tests/get_features_lo.rs
function test_get_features_of_loopback (line 6) | fn test_get_features_of_loopback() {
function get_feature (line 14) | async fn get_feature(iface_name: Option<&str>) {
FILE: genetlink/examples/dump_family_policy.rs
function main (line 21) | async fn main() -> Result<(), Error> {
FILE: genetlink/examples/list_genetlink_family.rs
function main (line 24) | async fn main() -> Result<(), Error> {
function print_entry (line 60) | fn print_entry(entry: Vec<GenlCtrlAttrs>) {
FILE: genetlink/src/connection.rs
function new_connection (line 28) | pub fn new_connection() -> io::Result<(
function new_connection_with_socket (line 38) | pub fn new_connection_with_socket<S>() -> io::Result<(
FILE: genetlink/src/error.rs
type GenetlinkError (line 7) | pub enum GenetlinkError {
method from (line 23) | fn from(err_msg: netlink_packet_core::error::ErrorMessage) -> Self {
FILE: genetlink/src/handle.rs
type GenetlinkHandle (line 41) | pub struct GenetlinkHandle {
method new (line 47) | pub(crate) fn new(handle: ConnectionHandle<RawGenlMessage>) -> Self {
method resolve_family_id (line 55) | pub async fn resolve_family_id<F>(&self) -> Result<u16, GenetlinkError>
method clear_family_id_cache (line 67) | pub async fn clear_family_id_cache(&self) {
method request (line 75) | pub async fn request<F>(
method send_request (line 93) | pub fn send_request<F>(
method notify (line 110) | pub async fn notify<F>(
method send_notify (line 122) | pub fn send_notify<F>(
method resolve_message_family_id (line 135) | async fn resolve_message_family_id<F>(
FILE: genetlink/src/message.rs
type RawGenlMessage (line 38) | pub struct RawGenlMessage {
method new (line 46) | pub fn new(header: GenlHeader, payload: Vec<u8>, family_id: u16) -> Se...
method into_parts (line 55) | pub fn into_parts(self) -> (GenlHeader, Vec<u8>) {
method from_genlmsg (line 60) | pub fn from_genlmsg<F>(genlmsg: GenlMessage<F>) -> Self
method parse_into_genlmsg (line 75) | pub fn parse_into_genlmsg<F>(&self) -> Result<GenlMessage<F>, DecodeEr...
method parse_with_param (line 101) | fn parse_with_param(buf: &GenlBuffer<&'a T>, message_type: u16) -> Res...
method buffer_len (line 85) | fn buffer_len(&self) -> usize {
method emit (line 89) | fn emit(&self, buffer: &mut [u8]) {
method message_type (line 113) | fn message_type(&self) -> u16 {
method buffer_len (line 117) | fn buffer_len(&self) -> usize {
method serialize (line 121) | fn serialize(&self, buffer: &mut [u8]) {
type Error (line 127) | type Error = DecodeError;
method deserialize (line 128) | fn deserialize(header: &NetlinkHeader, payload: &[u8]) -> Result<Self, S...
function from (line 135) | fn from(message: RawGenlMessage) -> Self {
function map_to_rawgenlmsg (line 142) | pub fn map_to_rawgenlmsg<F>(
function map_from_rawgenlmsg (line 163) | pub fn map_from_rawgenlmsg<F>(
FILE: genetlink/src/resolver.rs
type Resolver (line 13) | pub struct Resolver {
method new (line 18) | pub fn new() -> Self {
method get_cache_by_name (line 24) | pub fn get_cache_by_name(&self, family_name: &str) -> Option<u16> {
method query_family_id (line 28) | pub fn query_family_id(
method clear_cache (line 84) | pub fn clear_cache(&mut self) {
function test_resolver_nlctrl (line 96) | async fn test_resolver_nlctrl() {
constant TEST_FAMILIES (line 106) | const TEST_FAMILIES: &[&str] = &[
function test_resolver_cache (line 116) | async fn test_resolver_cache() {
FILE: mptcp-pm/examples/dump_mptcp.rs
function main (line 5) | fn main() {
function get_addresses (line 13) | async fn get_addresses() {
FILE: mptcp-pm/src/address/attr.rs
constant MPTCP_PM_ADDR_ATTR_FAMILY (line 15) | const MPTCP_PM_ADDR_ATTR_FAMILY: u16 = 1;
constant MPTCP_PM_ADDR_ATTR_ID (line 16) | const MPTCP_PM_ADDR_ATTR_ID: u16 = 2;
constant MPTCP_PM_ADDR_ATTR_ADDR4 (line 17) | const MPTCP_PM_ADDR_ATTR_ADDR4: u16 = 3;
constant MPTCP_PM_ADDR_ATTR_ADDR6 (line 18) | const MPTCP_PM_ADDR_ATTR_ADDR6: u16 = 4;
constant MPTCP_PM_ADDR_ATTR_PORT (line 19) | const MPTCP_PM_ADDR_ATTR_PORT: u16 = 5;
constant MPTCP_PM_ADDR_ATTR_FLAGS (line 20) | const MPTCP_PM_ADDR_ATTR_FLAGS: u16 = 6;
constant MPTCP_PM_ADDR_ATTR_IF_IDX (line 21) | const MPTCP_PM_ADDR_ATTR_IF_IDX: u16 = 7;
constant MPTCP_PM_ADDR_FLAG_SIGNAL (line 23) | const MPTCP_PM_ADDR_FLAG_SIGNAL: u32 = 1 << 0;
constant MPTCP_PM_ADDR_FLAG_SUBFLOW (line 24) | const MPTCP_PM_ADDR_FLAG_SUBFLOW: u32 = 1 << 1;
constant MPTCP_PM_ADDR_FLAG_BACKUP (line 25) | const MPTCP_PM_ADDR_FLAG_BACKUP: u32 = 1 << 2;
constant MPTCP_PM_ADDR_FLAG_FULLMESH (line 26) | const MPTCP_PM_ADDR_FLAG_FULLMESH: u32 = 1 << 3;
constant MPTCP_PM_ADDR_FLAG_IMPLICIT (line 27) | const MPTCP_PM_ADDR_FLAG_IMPLICIT: u32 = 1 << 4;
type MptcpPathManagerAddressAttrFlag (line 30) | pub enum MptcpPathManagerAddressAttrFlag {
function u32_to_vec_flags (line 39) | fn u32_to_vec_flags(value: u32) -> Vec<MptcpPathManagerAddressAttrFlag> {
function from (line 69) | fn from(v: &MptcpPathManagerAddressAttrFlag) -> u32 {
type MptcpPathManagerAddressAttr (line 82) | pub enum MptcpPathManagerAddressAttr {
method parse (line 137) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 94) | fn value_len(&self) -> usize {
method kind (line 104) | fn kind(&self) -> u16 {
method emit_value (line 117) | fn emit_value(&self, buffer: &mut [u8]) {
FILE: mptcp-pm/src/address/get.rs
type MptcpPathManagerAddressGetRequest (line 13) | pub struct MptcpPathManagerAddressGetRequest {
method new (line 18) | pub(crate) fn new(handle: MptcpPathManagerHandle) -> Self {
method execute (line 22) | pub async fn execute(
FILE: mptcp-pm/src/address/handle.rs
type MptcpPathManagerAddressHandle (line 5) | pub struct MptcpPathManagerAddressHandle(MptcpPathManagerHandle);
method new (line 8) | pub fn new(handle: MptcpPathManagerHandle) -> Self {
method get (line 14) | pub fn get(&mut self) -> MptcpPathManagerAddressGetRequest {
FILE: mptcp-pm/src/connection.rs
function new_connection (line 15) | pub fn new_connection() -> io::Result<(
function new_connection_with_socket (line 24) | pub fn new_connection_with_socket<S>() -> io::Result<(
FILE: mptcp-pm/src/error.rs
type MptcpPathManagerError (line 11) | pub enum MptcpPathManagerError {
FILE: mptcp-pm/src/handle.rs
type MptcpPathManagerHandle (line 19) | pub struct MptcpPathManagerHandle {
method new (line 24) | pub(crate) fn new(handle: GenetlinkHandle) -> Self {
method address (line 31) | pub fn address(&self) -> MptcpPathManagerAddressHandle {
method limits (line 36) | pub fn limits(&self) -> MptcpPathManagerLimitsHandle {
method request (line 40) | pub async fn request(
function mptcp_execute (line 53) | pub(crate) async fn mptcp_execute(
FILE: mptcp-pm/src/limits/attr.rs
constant MPTCP_PM_ATTR_RCV_ADD_ADDRS (line 13) | const MPTCP_PM_ATTR_RCV_ADD_ADDRS: u16 = 2;
constant MPTCP_PM_ATTR_SUBFLOWS (line 14) | const MPTCP_PM_ATTR_SUBFLOWS: u16 = 3;
type MptcpPathManagerLimitsAttr (line 17) | pub enum MptcpPathManagerLimitsAttr {
method parse (line 48) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 24) | fn value_len(&self) -> usize {
method kind (line 31) | fn kind(&self) -> u16 {
method emit_value (line 39) | fn emit_value(&self, buffer: &mut [u8]) {
FILE: mptcp-pm/src/limits/get.rs
type MptcpPathManagerLimitsGetRequest (line 13) | pub struct MptcpPathManagerLimitsGetRequest {
method new (line 18) | pub(crate) fn new(handle: MptcpPathManagerHandle) -> Self {
method execute (line 22) | pub async fn execute(
FILE: mptcp-pm/src/limits/handle.rs
type MptcpPathManagerLimitsHandle (line 5) | pub struct MptcpPathManagerLimitsHandle(MptcpPathManagerHandle);
method new (line 8) | pub fn new(handle: MptcpPathManagerHandle) -> Self {
method get (line 14) | pub fn get(&mut self) -> MptcpPathManagerLimitsGetRequest {
FILE: mptcp-pm/src/message.rs
constant MPTCP_PM_CMD_GET_ADDR (line 15) | const MPTCP_PM_CMD_GET_ADDR: u8 = 3;
constant MPTCP_PM_CMD_GET_LIMITS (line 16) | const MPTCP_PM_CMD_GET_LIMITS: u8 = 6;
constant MPTCP_PM_ATTR_ADDR (line 18) | const MPTCP_PM_ATTR_ADDR: u16 = 1;
constant MPTCP_PM_ATTR_RCV_ADD_ADDRS (line 19) | const MPTCP_PM_ATTR_RCV_ADD_ADDRS: u16 = 2;
constant MPTCP_PM_ATTR_SUBFLOWS (line 20) | const MPTCP_PM_ATTR_SUBFLOWS: u16 = 3;
type MptcpPathManagerCmd (line 23) | pub enum MptcpPathManagerCmd {
function from (line 29) | fn from(cmd: MptcpPathManagerCmd) -> Self {
type MptcpPathManagerAttr (line 38) | pub enum MptcpPathManagerAttr {
method value_len (line 45) | fn value_len(&self) -> usize {
method kind (line 53) | fn kind(&self) -> u16 {
method emit_value (line 61) | fn emit_value(&self, buffer: &mut [u8]) {
type MptcpPathManagerMessage (line 71) | pub struct MptcpPathManagerMessage {
method new_address_get (line 91) | pub fn new_address_get() -> Self {
method new_limits_get (line 98) | pub fn new_limits_get() -> Self {
method parse_with_param (line 150) | fn parse_with_param(buffer: &[u8], header: GenlHeader) -> Result<Self,...
method family_name (line 77) | fn family_name() -> &'static str {
method version (line 81) | fn version(&self) -> u8 {
method command (line 85) | fn command(&self) -> u8 {
method buffer_len (line 107) | fn buffer_len(&self) -> usize {
method emit (line 111) | fn emit(&self, buffer: &mut [u8]) {
function parse_nlas (line 116) | fn parse_nlas(buffer: &[u8]) -> Result<Vec<MptcpPathManagerAttr>, Decode...
FILE: mptcp-pm/tests/dump_mptcp.rs
function test_mptcp_empty_addresses_and_limits (line 9) | fn test_mptcp_empty_addresses_and_limits() {
function assert_empty_addresses_and_limits (line 41) | async fn assert_empty_addresses_and_limits() {
FILE: netlink-packet-audit/src/buffer.rs
type AuditBuffer (line 14) | pub struct AuditBuffer<T> {
function new (line 19) | pub fn new(buffer: T) -> AuditBuffer<T> {
function length (line 23) | pub fn length(&self) -> usize {
function new_checked (line 27) | pub fn new_checked(buffer: T) -> Result<AuditBuffer<T>, DecodeError> {
function inner (line 33) | pub fn inner(&self) -> &'a [u8] {
function inner_mut (line 39) | pub fn inner_mut(&mut self) -> &mut [u8] {
method parse_with_param (line 45) | fn parse_with_param(buf: &AuditBuffer<&'a T>, message_type: u16) -> Resu...
FILE: netlink-packet-audit/src/codec.rs
type NetlinkAuditCodec (line 26) | pub struct NetlinkAuditCodec {
method decode (line 32) | fn decode<T>(src: &mut BytesMut) -> io::Result<Option<NetlinkMessage<T>>>
method encode (line 118) | fn encode<T>(msg: NetlinkMessage<T>, buf: &mut BytesMut) -> io::Result<()>
FILE: netlink-packet-audit/src/constants.rs
constant AUDIT_GET (line 10) | pub const AUDIT_GET: u16 = 1000;
constant AUDIT_SET (line 12) | pub const AUDIT_SET: u16 = 1001;
constant AUDIT_LIST (line 14) | pub const AUDIT_LIST: u16 = 1002;
constant AUDIT_ADD (line 16) | pub const AUDIT_ADD: u16 = 1003;
constant AUDIT_DEL (line 18) | pub const AUDIT_DEL: u16 = 1004;
constant AUDIT_USER (line 20) | pub const AUDIT_USER: u16 = 1005;
constant AUDIT_LOGIN (line 22) | pub const AUDIT_LOGIN: u16 = 1006;
constant AUDIT_WATCH_INS (line 24) | pub const AUDIT_WATCH_INS: u16 = 1007;
constant AUDIT_WATCH_REM (line 26) | pub const AUDIT_WATCH_REM: u16 = 1008;
constant AUDIT_WATCH_LIST (line 28) | pub const AUDIT_WATCH_LIST: u16 = 1009;
constant AUDIT_SIGNAL_INFO (line 30) | pub const AUDIT_SIGNAL_INFO: u16 = 1010;
constant AUDIT_ADD_RULE (line 32) | pub const AUDIT_ADD_RULE: u16 = 1011;
constant AUDIT_DEL_RULE (line 34) | pub const AUDIT_DEL_RULE: u16 = 1012;
constant AUDIT_LIST_RULES (line 36) | pub const AUDIT_LIST_RULES: u16 = 1013;
constant AUDIT_TRIM (line 38) | pub const AUDIT_TRIM: u16 = 1014;
constant AUDIT_MAKE_EQUIV (line 40) | pub const AUDIT_MAKE_EQUIV: u16 = 1015;
constant AUDIT_TTY_GET (line 42) | pub const AUDIT_TTY_GET: u16 = 1016;
constant AUDIT_TTY_SET (line 44) | pub const AUDIT_TTY_SET: u16 = 1017;
constant AUDIT_SET_FEATURE (line 46) | pub const AUDIT_SET_FEATURE: u16 = 1018;
constant AUDIT_GET_FEATURE (line 48) | pub const AUDIT_GET_FEATURE: u16 = 1019;
constant AUDIT_FIRST_USER_MSG (line 55) | pub const AUDIT_FIRST_USER_MSG: u16 = 1100;
constant AUDIT_USER_AVC (line 57) | pub const AUDIT_USER_AVC: u16 = 1107;
constant AUDIT_USER_TTY (line 59) | pub const AUDIT_USER_TTY: u16 = 1124;
constant AUDIT_LAST_USER_MSG (line 60) | pub const AUDIT_LAST_USER_MSG: u16 = 1199;
constant AUDIT_FIRST_USER_MSG2 (line 63) | pub const AUDIT_FIRST_USER_MSG2: u16 = 2100;
constant AUDIT_LAST_USER_MSG2 (line 64) | pub const AUDIT_LAST_USER_MSG2: u16 = 2999;
constant AUDIT_DAEMON_START (line 71) | pub const AUDIT_DAEMON_START: u16 = 1200;
constant AUDIT_DAEMON_END (line 73) | pub const AUDIT_DAEMON_END: u16 = 1201;
constant AUDIT_DAEMON_ABORT (line 75) | pub const AUDIT_DAEMON_ABORT: u16 = 1202;
constant AUDIT_DAEMON_CONFIG (line 77) | pub const AUDIT_DAEMON_CONFIG: u16 = 1203;
constant AUDIT_EVENT_MESSAGE_MIN (line 83) | pub const AUDIT_EVENT_MESSAGE_MIN: u16 = 1300;
constant AUDIT_EVENT_MESSAGE_MAX (line 84) | pub const AUDIT_EVENT_MESSAGE_MAX: u16 = 1399;
constant AUDIT_SYSCALL (line 86) | pub const AUDIT_SYSCALL: u16 = 1300;
constant AUDIT_PATH (line 88) | pub const AUDIT_PATH: u16 = 1302;
constant AUDIT_IPC (line 90) | pub const AUDIT_IPC: u16 = 1303;
constant AUDIT_SOCKETCALL (line 92) | pub const AUDIT_SOCKETCALL: u16 = 1304;
constant AUDIT_CONFIG_CHANGE (line 94) | pub const AUDIT_CONFIG_CHANGE: u16 = 1305;
constant AUDIT_SOCKADDR (line 96) | pub const AUDIT_SOCKADDR: u16 = 1306;
constant AUDIT_CWD (line 98) | pub const AUDIT_CWD: u16 = 1307;
constant AUDIT_EXECVE (line 100) | pub const AUDIT_EXECVE: u16 = 1309;
constant AUDIT_IPC_SET_PERM (line 102) | pub const AUDIT_IPC_SET_PERM: u16 = 1311;
constant AUDIT_MQ_OPEN (line 104) | pub const AUDIT_MQ_OPEN: u16 = 1312;
constant AUDIT_MQ_SENDRECV (line 106) | pub const AUDIT_MQ_SENDRECV: u16 = 1313;
constant AUDIT_MQ_NOTIFY (line 108) | pub const AUDIT_MQ_NOTIFY: u16 = 1314;
constant AUDIT_MQ_GETSETATTR (line 110) | pub const AUDIT_MQ_GETSETATTR: u16 = 1315;
constant AUDIT_KERNEL_OTHER (line 112) | pub const AUDIT_KERNEL_OTHER: u16 = 1316;
constant AUDIT_FD_PAIR (line 114) | pub const AUDIT_FD_PAIR: u16 = 1317;
constant AUDIT_OBJ_PID (line 116) | pub const AUDIT_OBJ_PID: u16 = 1318;
constant AUDIT_TTY (line 118) | pub const AUDIT_TTY: u16 = 1319;
constant AUDIT_EOE (line 120) | pub const AUDIT_EOE: u16 = 1320;
constant AUDIT_BPRM_FCAPS (line 122) | pub const AUDIT_BPRM_FCAPS: u16 = 1321;
constant AUDIT_CAPSET (line 124) | pub const AUDIT_CAPSET: u16 = 1322;
constant AUDIT_MMAP (line 126) | pub const AUDIT_MMAP: u16 = 1323;
constant AUDIT_NETFILTER_PKT (line 128) | pub const AUDIT_NETFILTER_PKT: u16 = 1324;
constant AUDIT_NETFILTER_CFG (line 130) | pub const AUDIT_NETFILTER_CFG: u16 = 1325;
constant AUDIT_SECCOMP (line 132) | pub const AUDIT_SECCOMP: u16 = 1326;
constant AUDIT_PROCTITLE (line 134) | pub const AUDIT_PROCTITLE: u16 = 1327;
constant AUDIT_FEATURE_CHANGE (line 136) | pub const AUDIT_FEATURE_CHANGE: u16 = 1328;
constant AUDIT_REPLACE (line 138) | pub const AUDIT_REPLACE: u16 = 1329;
constant AUDIT_KERN_MODULE (line 140) | pub const AUDIT_KERN_MODULE: u16 = 1330;
constant AUDIT_FANOTIFY (line 142) | pub const AUDIT_FANOTIFY: u16 = 1331;
constant AUDIT_AVC (line 149) | pub const AUDIT_AVC: u16 = 1400;
constant AUDIT_SELINUX_ERR (line 151) | pub const AUDIT_SELINUX_ERR: u16 = 1401;
constant AUDIT_AVC_PATH (line 153) | pub const AUDIT_AVC_PATH: u16 = 1402;
constant AUDIT_MAC_POLICY_LOAD (line 155) | pub const AUDIT_MAC_POLICY_LOAD: u16 = 1403;
constant AUDIT_MAC_STATUS (line 157) | pub const AUDIT_MAC_STATUS: u16 = 1404;
constant AUDIT_MAC_CONFIG_CHANGE (line 159) | pub const AUDIT_MAC_CONFIG_CHANGE: u16 = 1405;
constant AUDIT_MAC_UNLBL_ALLOW (line 161) | pub const AUDIT_MAC_UNLBL_ALLOW: u16 = 1406;
constant AUDIT_MAC_CIPSOV4_ADD (line 163) | pub const AUDIT_MAC_CIPSOV4_ADD: u16 = 1407;
constant AUDIT_MAC_CIPSOV4_DEL (line 165) | pub const AUDIT_MAC_CIPSOV4_DEL: u16 = 1408;
constant AUDIT_MAC_MAP_ADD (line 167) | pub const AUDIT_MAC_MAP_ADD: u16 = 1409;
constant AUDIT_MAC_MAP_DEL (line 169) | pub const AUDIT_MAC_MAP_DEL: u16 = 1410;
constant AUDIT_MAC_IPSEC_ADDSA (line 171) | pub const AUDIT_MAC_IPSEC_ADDSA: u16 = 1411;
constant AUDIT_MAC_IPSEC_DELSA (line 173) | pub const AUDIT_MAC_IPSEC_DELSA: u16 = 1412;
constant AUDIT_MAC_IPSEC_ADDSPD (line 175) | pub const AUDIT_MAC_IPSEC_ADDSPD: u16 = 1413;
constant AUDIT_MAC_IPSEC_DELSPD (line 177) | pub const AUDIT_MAC_IPSEC_DELSPD: u16 = 1414;
constant AUDIT_MAC_IPSEC_EVENT (line 179) | pub const AUDIT_MAC_IPSEC_EVENT: u16 = 1415;
constant AUDIT_MAC_UNLBL_STCADD (line 181) | pub const AUDIT_MAC_UNLBL_STCADD: u16 = 1416;
constant AUDIT_MAC_UNLBL_STCDEL (line 183) | pub const AUDIT_MAC_UNLBL_STCDEL: u16 = 1417;
constant AUDIT_MAC_CALIPSO_ADD (line 185) | pub const AUDIT_MAC_CALIPSO_ADD: u16 = 1418;
constant AUDIT_MAC_CALIPSO_DEL (line 187) | pub const AUDIT_MAC_CALIPSO_DEL: u16 = 1419;
constant AUDIT_FIRST_KERN_ANOM_MSG (line 193) | pub const AUDIT_FIRST_KERN_ANOM_MSG: u16 = 1700;
constant AUDIT_LAST_KERN_ANOM_MSG (line 194) | pub const AUDIT_LAST_KERN_ANOM_MSG: u16 = 1799;
constant AUDIT_ANOM_PROMISCUOUS (line 196) | pub const AUDIT_ANOM_PROMISCUOUS: u16 = 1700;
constant AUDIT_ANOM_ABEND (line 198) | pub const AUDIT_ANOM_ABEND: u16 = 1701;
constant AUDIT_ANOM_LINK (line 200) | pub const AUDIT_ANOM_LINK: u16 = 1702;
constant AUDIT_INTEGRITY_DATA (line 207) | pub const AUDIT_INTEGRITY_DATA: u16 = 1800;
constant AUDIT_INTEGRITY_METADATA (line 209) | pub const AUDIT_INTEGRITY_METADATA: u16 = 1801;
constant AUDIT_INTEGRITY_STATUS (line 211) | pub const AUDIT_INTEGRITY_STATUS: u16 = 1802;
constant AUDIT_INTEGRITY_HASH (line 213) | pub const AUDIT_INTEGRITY_HASH: u16 = 1803;
constant AUDIT_INTEGRITY_PCR (line 215) | pub const AUDIT_INTEGRITY_PCR: u16 = 1804;
constant AUDIT_INTEGRITY_RULE (line 217) | pub const AUDIT_INTEGRITY_RULE: u16 = 1805;
constant AUDIT_KERNEL (line 220) | pub const AUDIT_KERNEL: u16 = 2000;
constant AUDIT_FILTER_USER (line 225) | pub const AUDIT_FILTER_USER: u32 = 0;
constant AUDIT_FILTER_TASK (line 227) | pub const AUDIT_FILTER_TASK: u32 = 1;
constant AUDIT_FILTER_ENTRY (line 229) | pub const AUDIT_FILTER_ENTRY: u32 = 2;
constant AUDIT_FILTER_WATCH (line 231) | pub const AUDIT_FILTER_WATCH: u32 = 3;
constant AUDIT_FILTER_EXIT (line 233) | pub const AUDIT_FILTER_EXIT: u32 = 4;
constant AUDIT_FILTER_TYPE (line 235) | pub const AUDIT_FILTER_TYPE: u32 = 5;
constant AUDIT_FILTER_FS (line 237) | pub const AUDIT_FILTER_FS: u32 = 6;
constant AUDIT_NR_FILTERS (line 240) | pub const AUDIT_NR_FILTERS: u32 = 7;
constant AUDIT_FILTER_PREPEND (line 241) | pub const AUDIT_FILTER_PREPEND: u32 = 16;
constant AUDIT_FILTER_UNSET (line 243) | pub const AUDIT_FILTER_UNSET: u32 = 128;
constant AUDIT_NEVER (line 248) | pub const AUDIT_NEVER: u32 = 0;
constant AUDIT_POSSIBLE (line 250) | pub const AUDIT_POSSIBLE: u32 = 1;
constant AUDIT_ALWAYS (line 252) | pub const AUDIT_ALWAYS: u32 = 2;
constant AUDIT_MAX_FIELDS (line 254) | pub const AUDIT_MAX_FIELDS: usize = 64;
constant AUDIT_MAX_KEY_LEN (line 255) | pub const AUDIT_MAX_KEY_LEN: usize = 256;
constant AUDIT_BITMASK_SIZE (line 256) | pub const AUDIT_BITMASK_SIZE: usize = 64;
constant AUDIT_SYSCALL_CLASSES (line 258) | pub const AUDIT_SYSCALL_CLASSES: u32 = 16;
constant AUDIT_CLASS_DIR_WRITE (line 259) | pub const AUDIT_CLASS_DIR_WRITE: u32 = 0;
constant AUDIT_CLASS_DIR_WRITE_32 (line 260) | pub const AUDIT_CLASS_DIR_WRITE_32: u32 = 1;
constant AUDIT_CLASS_CHATTR (line 261) | pub const AUDIT_CLASS_CHATTR: u32 = 2;
constant AUDIT_CLASS_CHATTR_32 (line 262) | pub const AUDIT_CLASS_CHATTR_32: u32 = 3;
constant AUDIT_CLASS_READ (line 263) | pub const AUDIT_CLASS_READ: u32 = 4;
constant AUDIT_CLASS_READ_32 (line 264) | pub const AUDIT_CLASS_READ_32: u32 = 5;
constant AUDIT_CLASS_WRITE (line 265) | pub const AUDIT_CLASS_WRITE: u32 = 6;
constant AUDIT_CLASS_WRITE_32 (line 266) | pub const AUDIT_CLASS_WRITE_32: u32 = 7;
constant AUDIT_CLASS_SIGNAL (line 267) | pub const AUDIT_CLASS_SIGNAL: u32 = 8;
constant AUDIT_CLASS_SIGNAL_32 (line 268) | pub const AUDIT_CLASS_SIGNAL_32: u32 = 9;
constant AUDIT_UNUSED_BITS (line 269) | pub const AUDIT_UNUSED_BITS: u32 = 134216704;
constant AUDIT_COMPARE_UID_TO_OBJ_UID (line 272) | pub const AUDIT_COMPARE_UID_TO_OBJ_UID: u32 = 1;
constant AUDIT_COMPARE_GID_TO_OBJ_GID (line 273) | pub const AUDIT_COMPARE_GID_TO_OBJ_GID: u32 = 2;
constant AUDIT_COMPARE_EUID_TO_OBJ_UID (line 274) | pub const AUDIT_COMPARE_EUID_TO_OBJ_UID: u32 = 3;
constant AUDIT_COMPARE_EGID_TO_OBJ_GID (line 275) | pub const AUDIT_COMPARE_EGID_TO_OBJ_GID: u32 = 4;
constant AUDIT_COMPARE_AUID_TO_OBJ_UID (line 276) | pub const AUDIT_COMPARE_AUID_TO_OBJ_UID: u32 = 5;
constant AUDIT_COMPARE_SUID_TO_OBJ_UID (line 277) | pub const AUDIT_COMPARE_SUID_TO_OBJ_UID: u32 = 6;
constant AUDIT_COMPARE_SGID_TO_OBJ_GID (line 278) | pub const AUDIT_COMPARE_SGID_TO_OBJ_GID: u32 = 7;
constant AUDIT_COMPARE_FSUID_TO_OBJ_UID (line 279) | pub const AUDIT_COMPARE_FSUID_TO_OBJ_UID: u32 = 8;
constant AUDIT_COMPARE_FSGID_TO_OBJ_GID (line 280) | pub const AUDIT_COMPARE_FSGID_TO_OBJ_GID: u32 = 9;
constant AUDIT_COMPARE_UID_TO_AUID (line 281) | pub const AUDIT_COMPARE_UID_TO_AUID: u32 = 10;
constant AUDIT_COMPARE_UID_TO_EUID (line 282) | pub const AUDIT_COMPARE_UID_TO_EUID: u32 = 11;
constant AUDIT_COMPARE_UID_TO_FSUID (line 283) | pub const AUDIT_COMPARE_UID_TO_FSUID: u32 = 12;
constant AUDIT_COMPARE_UID_TO_SUID (line 284) | pub const AUDIT_COMPARE_UID_TO_SUID: u32 = 13;
constant AUDIT_COMPARE_AUID_TO_FSUID (line 285) | pub const AUDIT_COMPARE_AUID_TO_FSUID: u32 = 14;
constant AUDIT_COMPARE_AUID_TO_SUID (line 286) | pub const AUDIT_COMPARE_AUID_TO_SUID: u32 = 15;
constant AUDIT_COMPARE_AUID_TO_EUID (line 287) | pub const AUDIT_COMPARE_AUID_TO_EUID: u32 = 16;
constant AUDIT_COMPARE_EUID_TO_SUID (line 288) | pub const AUDIT_COMPARE_EUID_TO_SUID: u32 = 17;
constant AUDIT_COMPARE_EUID_TO_FSUID (line 289) | pub const AUDIT_COMPARE_EUID_TO_FSUID: u32 = 18;
constant AUDIT_COMPARE_SUID_TO_FSUID (line 290) | pub const AUDIT_COMPARE_SUID_TO_FSUID: u32 = 19;
constant AUDIT_COMPARE_GID_TO_EGID (line 291) | pub const AUDIT_COMPARE_GID_TO_EGID: u32 = 20;
constant AUDIT_COMPARE_GID_TO_FSGID (line 292) | pub const AUDIT_COMPARE_GID_TO_FSGID: u32 = 21;
constant AUDIT_COMPARE_GID_TO_SGID (line 293) | pub const AUDIT_COMPARE_GID_TO_SGID: u32 = 22;
constant AUDIT_COMPARE_EGID_TO_FSGID (line 294) | pub const AUDIT_COMPARE_EGID_TO_FSGID: u32 = 23;
constant AUDIT_COMPARE_EGID_TO_SGID (line 295) | pub const AUDIT_COMPARE_EGID_TO_SGID: u32 = 24;
constant AUDIT_COMPARE_SGID_TO_FSGID (line 296) | pub const AUDIT_COMPARE_SGID_TO_FSGID: u32 = 25;
constant AUDIT_MAX_FIELD_COMPARE (line 297) | pub const AUDIT_MAX_FIELD_COMPARE: u32 = 25;
constant AUDIT_PID (line 302) | pub const AUDIT_PID: u32 = 0;
constant AUDIT_UID (line 303) | pub const AUDIT_UID: u32 = 1;
constant AUDIT_EUID (line 304) | pub const AUDIT_EUID: u32 = 2;
constant AUDIT_SUID (line 305) | pub const AUDIT_SUID: u32 = 3;
constant AUDIT_FSUID (line 306) | pub const AUDIT_FSUID: u32 = 4;
constant AUDIT_GID (line 307) | pub const AUDIT_GID: u32 = 5;
constant AUDIT_EGID (line 308) | pub const AUDIT_EGID: u32 = 6;
constant AUDIT_SGID (line 309) | pub const AUDIT_SGID: u32 = 7;
constant AUDIT_FSGID (line 310) | pub const AUDIT_FSGID: u32 = 8;
constant AUDIT_LOGINUID (line 311) | pub const AUDIT_LOGINUID: u32 = 9;
constant AUDIT_PERS (line 312) | pub const AUDIT_PERS: u32 = 10;
constant AUDIT_ARCH (line 313) | pub const AUDIT_ARCH: u32 = 11;
constant AUDIT_MSGTYPE (line 314) | pub const AUDIT_MSGTYPE: u32 = 12;
constant AUDIT_SUBJ_USER (line 315) | pub const AUDIT_SUBJ_USER: u32 = 13;
constant AUDIT_SUBJ_ROLE (line 316) | pub const AUDIT_SUBJ_ROLE: u32 = 14;
constant AUDIT_SUBJ_TYPE (line 317) | pub const AUDIT_SUBJ_TYPE: u32 = 15;
constant AUDIT_SUBJ_SEN (line 318) | pub const AUDIT_SUBJ_SEN: u32 = 16;
constant AUDIT_SUBJ_CLR (line 319) | pub const AUDIT_SUBJ_CLR: u32 = 17;
constant AUDIT_PPID (line 320) | pub const AUDIT_PPID: u32 = 18;
constant AUDIT_OBJ_USER (line 321) | pub const AUDIT_OBJ_USER: u32 = 19;
constant AUDIT_OBJ_ROLE (line 322) | pub const AUDIT_OBJ_ROLE: u32 = 20;
constant AUDIT_OBJ_TYPE (line 323) | pub const AUDIT_OBJ_TYPE: u32 = 21;
constant AUDIT_OBJ_LEV_LOW (line 324) | pub const AUDIT_OBJ_LEV_LOW: u32 = 22;
constant AUDIT_OBJ_LEV_HIGH (line 325) | pub const AUDIT_OBJ_LEV_HIGH: u32 = 23;
constant AUDIT_LOGINUID_SET (line 326) | pub const AUDIT_LOGINUID_SET: u32 = 24;
constant AUDIT_SESSIONID (line 327) | pub const AUDIT_SESSIONID: u32 = 25;
constant AUDIT_FSTYPE (line 328) | pub const AUDIT_FSTYPE: u32 = 26;
constant AUDIT_DEVMAJOR (line 329) | pub const AUDIT_DEVMAJOR: u32 = 100;
constant AUDIT_DEVMINOR (line 330) | pub const AUDIT_DEVMINOR: u32 = 101;
constant AUDIT_INODE (line 331) | pub const AUDIT_INODE: u32 = 102;
constant AUDIT_EXIT (line 332) | pub const AUDIT_EXIT: u32 = 103;
constant AUDIT_SUCCESS (line 333) | pub const AUDIT_SUCCESS: u32 = 104;
constant AUDIT_WATCH (line 334) | pub const AUDIT_WATCH: u32 = 105;
constant AUDIT_PERM (line 335) | pub const AUDIT_PERM: u32 = 106;
constant AUDIT_DIR (line 336) | pub const AUDIT_DIR: u32 = 107;
constant AUDIT_FILETYPE (line 337) | pub const AUDIT_FILETYPE: u32 = 108;
constant AUDIT_OBJ_UID (line 338) | pub const AUDIT_OBJ_UID: u32 = 109;
constant AUDIT_OBJ_GID (line 339) | pub const AUDIT_OBJ_GID: u32 = 110;
constant AUDIT_FIELD_COMPARE (line 340) | pub const AUDIT_FIELD_COMPARE: u32 = 111;
constant AUDIT_EXE (line 341) | pub const AUDIT_EXE: u32 = 112;
constant AUDIT_ARG0 (line 342) | pub const AUDIT_ARG0: u32 = 200;
constant AUDIT_ARG1 (line 343) | pub const AUDIT_ARG1: u32 = 201;
constant AUDIT_ARG2 (line 344) | pub const AUDIT_ARG2: u32 = 202;
constant AUDIT_ARG3 (line 345) | pub const AUDIT_ARG3: u32 = 203;
constant AUDIT_FILTERKEY (line 346) | pub const AUDIT_FILTERKEY: u32 = 210;
constant AUDIT_BIT_MASK (line 348) | pub const AUDIT_BIT_MASK: u32 = 0x0800_0000;
constant AUDIT_LESS_THAN (line 349) | pub const AUDIT_LESS_THAN: u32 = 0x1000_0000;
constant AUDIT_GREATER_THAN (line 350) | pub const AUDIT_GREATER_THAN: u32 = 0x2000_0000;
constant AUDIT_NOT_EQUAL (line 351) | pub const AUDIT_NOT_EQUAL: u32 = 0x3000_0000;
constant AUDIT_EQUAL (line 352) | pub const AUDIT_EQUAL: u32 = 0x4000_0000;
constant AUDIT_BIT_TEST (line 353) | pub const AUDIT_BIT_TEST: u32 = AUDIT_BIT_MASK | AUDIT_EQUAL;
constant AUDIT_LESS_THAN_OR_EQUAL (line 354) | pub const AUDIT_LESS_THAN_OR_EQUAL: u32 = AUDIT_LESS_THAN | AUDIT_EQUAL;
constant AUDIT_GREATER_THAN_OR_EQUAL (line 355) | pub const AUDIT_GREATER_THAN_OR_EQUAL: u32 = AUDIT_GREATER_THAN | AUDIT_...
constant AUDIT_OPERATORS (line 356) | pub const AUDIT_OPERATORS: u32 = AUDIT_EQUAL | AUDIT_NOT_EQUAL | AUDIT_B...
constant AUDIT_FAIL_SILENT (line 361) | pub const AUDIT_FAIL_SILENT: u32 = 0;
constant AUDIT_FAIL_PRINTK (line 362) | pub const AUDIT_FAIL_PRINTK: u32 = 1;
constant AUDIT_FAIL_PANIC (line 363) | pub const AUDIT_FAIL_PANIC: u32 = 2;
constant AUDIT_PERM_EXEC (line 365) | pub const AUDIT_PERM_EXEC: u32 = 1;
constant AUDIT_PERM_WRITE (line 366) | pub const AUDIT_PERM_WRITE: u32 = 2;
constant AUDIT_PERM_READ (line 367) | pub const AUDIT_PERM_READ: u32 = 4;
constant AUDIT_PERM_ATTR (line 368) | pub const AUDIT_PERM_ATTR: u32 = 8;
constant AUDIT_MESSAGE_TEXT_MAX (line 369) | pub const AUDIT_MESSAGE_TEXT_MAX: u32 = 8560;
constant AUDIT_FEATURE_VERSION (line 370) | pub const AUDIT_FEATURE_VERSION: u32 = 1;
constant AUDIT_FEATURE_ONLY_UNSET_LOGINUID (line 371) | pub const AUDIT_FEATURE_ONLY_UNSET_LOGINUID: u32 = 0;
constant AUDIT_FEATURE_LOGINUID_IMMUTABLE (line 372) | pub const AUDIT_FEATURE_LOGINUID_IMMUTABLE: u32 = 1;
constant AUDIT_LAST_FEATURE (line 373) | pub const AUDIT_LAST_FEATURE: u32 = 1;
constant AUDIT_NLGRP_NONE (line 376) | pub const AUDIT_NLGRP_NONE: u32 = 0;
constant AUDIT_NLGRP_READLOG (line 378) | pub const AUDIT_NLGRP_READLOG: u32 = 1;
constant __AUDIT_ARCH_CONVENTION_MASK (line 380) | pub const __AUDIT_ARCH_CONVENTION_MASK: u32 = 0x3000_0000;
constant __AUDIT_ARCH_CONVENTION_MIPS64_N32 (line 381) | pub const __AUDIT_ARCH_CONVENTION_MIPS64_N32: u32 = 0x2000_0000;
constant __AUDIT_ARCH_64BIT (line 382) | pub const __AUDIT_ARCH_64BIT: u32 = 0x0800_0000;
constant __AUDIT_ARCH_LE (line 383) | pub const __AUDIT_ARCH_LE: u32 = 0x4000_0000;
constant AUDIT_ARCH_AARCH64 (line 384) | pub const AUDIT_ARCH_AARCH64: u32 = 0xC000_00B7;
constant AUDIT_ARCH_ALPHA (line 385) | pub const AUDIT_ARCH_ALPHA: u32 = 0xC000_9026;
constant AUDIT_ARCH_ARM (line 386) | pub const AUDIT_ARCH_ARM: u32 = 0x4000_0028;
constant AUDIT_ARCH_ARMEB (line 387) | pub const AUDIT_ARCH_ARMEB: u32 = 0x28;
constant AUDIT_ARCH_CRIS (line 388) | pub const AUDIT_ARCH_CRIS: u32 = 0x4000_004C;
constant AUDIT_ARCH_FRV (line 389) | pub const AUDIT_ARCH_FRV: u32 = 0x5441;
constant AUDIT_ARCH_I386 (line 390) | pub const AUDIT_ARCH_I386: u32 = 0x4000_0003;
constant AUDIT_ARCH_IA64 (line 391) | pub const AUDIT_ARCH_IA64: u32 = 0xC000_0032;
constant AUDIT_ARCH_M32R (line 392) | pub const AUDIT_ARCH_M32R: u32 = 0x58;
constant AUDIT_ARCH_M68K (line 393) | pub const AUDIT_ARCH_M68K: u32 = 0x04;
constant AUDIT_ARCH_MICROBLAZE (line 394) | pub const AUDIT_ARCH_MICROBLAZE: u32 = 0xBD;
constant AUDIT_ARCH_MIPS (line 395) | pub const AUDIT_ARCH_MIPS: u32 = 0x08;
constant AUDIT_ARCH_MIPSEL (line 396) | pub const AUDIT_ARCH_MIPSEL: u32 = 0x4000_0008;
constant AUDIT_ARCH_MIPS64 (line 397) | pub const AUDIT_ARCH_MIPS64: u32 = 0x8000_0008;
constant AUDIT_ARCH_MIPS64N32 (line 398) | pub const AUDIT_ARCH_MIPS64N32: u32 = 0xA000_0008;
constant AUDIT_ARCH_MIPSEL64 (line 399) | pub const AUDIT_ARCH_MIPSEL64: u32 = 0xC000_0008;
constant AUDIT_ARCH_MIPSEL64N32 (line 400) | pub const AUDIT_ARCH_MIPSEL64N32: u32 = 0xE000_0008;
constant AUDIT_ARCH_OPENRISC (line 401) | pub const AUDIT_ARCH_OPENRISC: u32 = 92;
constant AUDIT_ARCH_PARISC (line 402) | pub const AUDIT_ARCH_PARISC: u32 = 15;
constant AUDIT_ARCH_PARISC64 (line 403) | pub const AUDIT_ARCH_PARISC64: u32 = 0x8000_000F;
constant AUDIT_ARCH_PPC (line 404) | pub const AUDIT_ARCH_PPC: u32 = 20;
constant AUDIT_ARCH_PPC64 (line 405) | pub const AUDIT_ARCH_PPC64: u32 = 0x8000_0015;
constant AUDIT_ARCH_PPC64LE (line 406) | pub const AUDIT_ARCH_PPC64LE: u32 = 0xC000_0015;
constant AUDIT_ARCH_S390 (line 407) | pub const AUDIT_ARCH_S390: u32 = 22;
constant AUDIT_ARCH_S390X (line 408) | pub const AUDIT_ARCH_S390X: u32 = 0x8000_0016;
constant AUDIT_ARCH_SH (line 409) | pub const AUDIT_ARCH_SH: u32 = 42;
constant AUDIT_ARCH_SHEL (line 410) | pub const AUDIT_ARCH_SHEL: u32 = 0x4000_002A;
constant AUDIT_ARCH_SH64 (line 411) | pub const AUDIT_ARCH_SH64: u32 = 0x8000_002A;
constant AUDIT_ARCH_SHEL64 (line 412) | pub const AUDIT_ARCH_SHEL64: u32 = 0xC000_002A;
constant AUDIT_ARCH_SPARC (line 413) | pub const AUDIT_ARCH_SPARC: u32 = 2;
constant AUDIT_ARCH_SPARC64 (line 414) | pub const AUDIT_ARCH_SPARC64: u32 = 0x8000_002B;
constant AUDIT_ARCH_TILEGX (line 415) | pub const AUDIT_ARCH_TILEGX: u32 = 0xC000_00BF;
constant AUDIT_ARCH_TILEGX32 (line 416) | pub const AUDIT_ARCH_TILEGX32: u32 = 0x4000_00BF;
constant AUDIT_ARCH_TILEPRO (line 417) | pub const AUDIT_ARCH_TILEPRO: u32 = 0x4000_00BC;
constant AUDIT_ARCH_X86_64 (line 418) | pub const AUDIT_ARCH_X86_64: u32 = 0xC000_003E;
FILE: netlink-packet-audit/src/lib.rs
type Field (line 19) | pub(crate) type Field = Range<usize>;
FILE: netlink-packet-audit/src/message.rs
type AuditMessage (line 17) | pub enum AuditMessage {
method is_event (line 40) | pub fn is_event(&self) -> bool {
method is_get_status (line 44) | pub fn is_get_status(&self) -> bool {
method is_set_status (line 48) | pub fn is_set_status(&self) -> bool {
method is_add_rule (line 52) | pub fn is_add_rule(&self) -> bool {
method is_del_rule (line 56) | pub fn is_del_rule(&self) -> bool {
method is_list_rules (line 60) | pub fn is_list_rules(&self) -> bool {
method message_type (line 64) | pub fn message_type(&self) -> u16 {
method buffer_len (line 80) | fn buffer_len(&self) -> usize {
method emit (line 95) | fn emit(&self, buffer: &mut [u8]) {
method message_type (line 112) | fn message_type(&self) -> u16 {
method buffer_len (line 116) | fn buffer_len(&self) -> usize {
method serialize (line 120) | fn serialize(&self, buffer: &mut [u8]) {
type Error (line 126) | type Error = DecodeError;
method deserialize (line 127) | fn deserialize(header: &NetlinkHeader, payload: &[u8]) -> Result<Self, S...
function from (line 139) | fn from(message: AuditMessage) -> Self {
FILE: netlink-packet-audit/src/rules/action.rs
type RuleAction (line 6) | pub enum RuleAction {
method from (line 14) | fn from(value: u32) -> Self {
function from (line 26) | fn from(value: RuleAction) -> Self {
FILE: netlink-packet-audit/src/rules/buffer.rs
constant FLAGS (line 18) | const FLAGS: Field = 0..4;
constant ACTION (line 19) | const ACTION: Field = 4..8;
constant FIELD_COUNT (line 20) | const FIELD_COUNT: Field = 8..12;
constant SYSCALLS (line 21) | const SYSCALLS: Field = u32_array!(FIELD_COUNT.end, AUDIT_BITMASK_SIZE);
constant FIELDS (line 22) | const FIELDS: Field = u32_array!(SYSCALLS.end, AUDIT_MAX_FIELDS);
constant VALUES (line 23) | const VALUES: Field = u32_array!(FIELDS.end, AUDIT_MAX_FIELDS);
constant FIELD_FLAGS (line 24) | const FIELD_FLAGS: Field = u32_array!(VALUES.end, AUDIT_MAX_FIELDS);
constant BUFLEN (line 25) | const BUFLEN: Field = FIELD_FLAGS.end..FIELD_FLAGS.end + 4;
constant RULE_BUF_MIN_LEN (line 27) | pub(crate) const RULE_BUF_MIN_LEN: usize = BUFLEN.end;
function BUF (line 30) | fn BUF(len: usize) -> Field {
type RuleBuffer (line 35) | pub struct RuleBuffer<T> {
function new (line 40) | pub fn new(buffer: T) -> RuleBuffer<T> {
function new_checked (line 44) | pub fn new_checked(buffer: T) -> Result<Self, DecodeError> {
function check_len (line 50) | pub(crate) fn check_len(&self) -> Result<(), DecodeError> {
function flags (line 71) | pub fn flags(&self) -> u32 {
function action (line 75) | pub fn action(&self) -> u32 {
function field_count (line 79) | pub fn field_count(&self) -> u32 {
function buflen (line 83) | pub fn buflen(&self) -> u32 {
function syscalls (line 89) | pub fn syscalls(&self) -> &'a [u8] {
function fields (line 93) | pub fn fields(&self) -> &'a [u8] {
function values (line 97) | pub fn values(&self) -> &'a [u8] {
function field_flags (line 101) | pub fn field_flags(&self) -> &'a [u8] {
function buf (line 105) | pub fn buf(&self) -> &'a [u8] {
function set_flags (line 112) | pub fn set_flags(&mut self, value: u32) {
function set_action (line 116) | pub fn set_action(&mut self, value: u32) {
function set_field_count (line 120) | pub fn set_field_count(&mut self, value: u32) {
function set_buflen (line 124) | pub fn set_buflen(&mut self, value: u32) {
function syscalls_mut (line 128) | pub fn syscalls_mut(&mut self) -> &mut [u8] {
function fields_mut (line 132) | pub fn fields_mut(&mut self) -> &mut [u8] {
function set_field (line 136) | pub fn set_field(&mut self, position: usize, value: u32) {
function values_mut (line 142) | pub fn values_mut(&mut self) -> &mut [u8] {
function set_value (line 146) | pub fn set_value(&mut self, position: usize, value: u32) {
function field_flags_mut (line 152) | pub fn field_flags_mut(&mut self) -> &mut [u8] {
function set_field_flags (line 156) | pub fn set_field_flags(&mut self, position: usize, value: u32) {
function buf_mut (line 162) | pub fn buf_mut(&mut self) -> &mut [u8] {
method parse (line 169) | fn parse(buf: &RuleBuffer<&'a T>) -> Result<Self, DecodeError> {
FILE: netlink-packet-audit/src/rules/field.rs
type RuleField (line 6) | pub enum RuleField {
type RuleFieldFlags (line 58) | pub enum RuleFieldFlags {
method from (line 72) | fn from(value: u32) -> Self {
function from (line 90) | fn from(value: RuleFieldFlags) -> Self {
FILE: netlink-packet-audit/src/rules/flags.rs
type RuleFlags (line 6) | pub enum RuleFlags {
method from (line 21) | fn from(value: u32) -> Self {
function from (line 40) | fn from(value: RuleFlags) -> Self {
FILE: netlink-packet-audit/src/rules/rule.rs
type RuleMessage (line 22) | pub struct RuleMessage {
method new (line 36) | pub fn new() -> Self {
method compute_string_values_length (line 46) | fn compute_string_values_length(&self) -> usize {
method default (line 30) | fn default() -> Self {
function set_str_field (line 72) | fn set_str_field<T>(rule_buffer: &mut RuleBuffer<T>, position: usize, bu...
method buffer_len (line 84) | fn buffer_len(&self) -> usize {
method emit (line 88) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-audit/src/rules/syscalls.rs
type RuleSyscalls (line 8) | pub struct RuleSyscalls(pub(crate) Vec<u32>);
method from_slice (line 16) | pub fn from_slice(slice: &[u8]) -> Result<Self, DecodeError> {
method new_zeroed (line 33) | pub fn new_zeroed() -> Self {
method new_maxed (line 37) | pub fn new_maxed() -> Self {
method unset_all (line 42) | pub fn unset_all(&mut self) -> &mut Self {
method is_all (line 48) | pub fn is_all(&self) -> bool {
method set_all (line 58) | pub fn set_all(&mut self) -> &mut Self {
method unset (line 64) | pub fn unset(&mut self, syscall: u32) -> &mut Self {
method set (line 71) | pub fn set(&mut self, syscall: u32) -> &mut Self {
method has (line 78) | pub fn has(&self, syscall: u32) -> bool {
method syscall_coordinates (line 83) | fn syscall_coordinates(syscall: u32) -> (usize, u32) {
constant BITMASK_BYTE_LEN (line 10) | const BITMASK_BYTE_LEN: usize = AUDIT_BITMASK_SIZE * 4;
constant BITMASK_BIT_LEN (line 11) | const BITMASK_BIT_LEN: u32 = AUDIT_BITMASK_SIZE as u32 * 32;
type RuleSyscallsIter (line 93) | pub struct RuleSyscallsIter<T> {
type Item (line 99) | type Item = u32;
type IntoIter (line 100) | type IntoIter = RuleSyscallsIter<RuleSyscalls>;
method into_iter (line 102) | fn into_iter(self) -> Self::IntoIter {
type Item (line 111) | type Item = u32;
method next (line 112) | fn next(&mut self) -> Option<Self::Item> {
type Item (line 125) | type Item = u32;
type IntoIter (line 126) | type IntoIter = RuleSyscallsIter<&'a RuleSyscalls>;
method into_iter (line 128) | fn into_iter(self) -> Self::IntoIter {
type Item (line 137) | type Item = u32;
method next (line 138) | fn next(&mut self) -> Option<Self::Item> {
type Item (line 151) | type Item = u32;
type IntoIter (line 152) | type IntoIter = RuleSyscallsIter<&'a mut RuleSyscalls>;
method into_iter (line 154) | fn into_iter(self) -> Self::IntoIter {
type Item (line 163) | type Item = u32;
method next (line 164) | fn next(&mut self) -> Option<Self::Item> {
function test_from_slice (line 180) | fn test_from_slice() {
function test_iter (line 191) | fn test_iter() {
function test_set_unset (line 207) | fn test_set_unset() {
FILE: netlink-packet-audit/src/rules/tests.rs
constant AUDIT_ARCH_X86_64 (line 16) | const AUDIT_ARCH_X86_64: u32 = 0xC000_003E;
function parse_rule_1 (line 19) | fn parse_rule_1() {
function emit_rule_1 (line 26) | fn emit_rule_1() {
function parse_rule_2 (line 34) | fn parse_rule_2() {
function emit_rule_2 (line 41) | fn emit_rule_2() {
function parse_rule_3 (line 49) | fn parse_rule_3() {
function emit_rule_3 (line 56) | fn emit_rule_3() {
FILE: netlink-packet-audit/src/status.rs
constant MASK (line 11) | const MASK: Field = 0..4;
constant ENABLED (line 12) | const ENABLED: Field = 4..8;
constant FAILURE (line 13) | const FAILURE: Field = 8..12;
constant PID (line 14) | const PID: Field = 12..16;
constant RATE_LIMITING (line 15) | const RATE_LIMITING: Field = 16..20;
constant BACKLOG_LIMIT (line 16) | const BACKLOG_LIMIT: Field = 20..24;
constant LOST (line 17) | const LOST: Field = 24..28;
constant BACKLOG (line 18) | const BACKLOG: Field = 28..32;
constant FEATURE_BITMAP (line 19) | const FEATURE_BITMAP: Field = 32..36;
constant BACKLOG_WAIT_TIME (line 20) | const BACKLOG_WAIT_TIME: Field = 36..40;
constant STATUS_MESSAGE_LEN (line 21) | pub const STATUS_MESSAGE_LEN: usize = BACKLOG_WAIT_TIME.end;
type StatusMessage (line 24) | pub struct StatusMessage {
method new (line 47) | pub fn new() -> Self {
method parse (line 168) | fn parse(buf: &StatusMessageBuffer<T>) -> Result<Self, DecodeError> {
type StatusMessageBuffer (line 53) | pub struct StatusMessageBuffer<T> {
function new (line 58) | pub fn new(buffer: T) -> StatusMessageBuffer<T> {
function new_checked (line 62) | pub fn new_checked(buffer: T) -> Result<StatusMessageBuffer<T>, DecodeEr...
function check_buffer_length (line 68) | fn check_buffer_length(&self) -> Result<(), DecodeError> {
function into_inner (line 80) | pub fn into_inner(self) -> T {
function mask (line 84) | pub fn mask(&self) -> u32 {
function enabled (line 88) | pub fn enabled(&self) -> u32 {
function failure (line 92) | pub fn failure(&self) -> u32 {
function pid (line 96) | pub fn pid(&self) -> u32 {
function rate_limiting (line 100) | pub fn rate_limiting(&self) -> u32 {
function backlog_limit (line 104) | pub fn backlog_limit(&self) -> u32 {
function lost (line 108) | pub fn lost(&self) -> u32 {
function backlog (line 112) | pub fn backlog(&self) -> u32 {
function feature_bitmap (line 116) | pub fn feature_bitmap(&self) -> u32 {
function backlog_wait_time (line 120) | pub fn backlog_wait_time(&self) -> u32 {
function set_mask (line 126) | pub fn set_mask(&mut self, value: u32) {
function set_enabled (line 130) | pub fn set_enabled(&mut self, value: u32) {
function set_failure (line 134) | pub fn set_failure(&mut self, value: u32) {
function set_pid (line 138) | pub fn set_pid(&mut self, value: u32) {
function set_rate_limiting (line 142) | pub fn set_rate_limiting(&mut self, value: u32) {
function set_backlog_limit (line 146) | pub fn set_backlog_limit(&mut self, value: u32) {
function set_lost (line 150) | pub fn set_lost(&mut self, value: u32) {
function set_backlog (line 154) | pub fn set_backlog(&mut self, value: u32) {
function set_feature_bitmap (line 158) | pub fn set_feature_bitmap(&mut self, value: u32) {
function set_backlog_wait_time (line 162) | pub fn set_backlog_wait_time(&mut self, value: u32) {
method buffer_len (line 186) | fn buffer_len(&self) -> usize {
method emit (line 190) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-core/examples/protocol.rs
type PingPongMessage (line 16) | pub enum PingPongMessage {
constant PING_MESSAGE (line 24) | pub const PING_MESSAGE: u16 = 18;
constant PONG_MESSAGE (line 25) | pub const PONG_MESSAGE: u16 = 20;
type DeserializeError (line 31) | pub struct DeserializeError(&'static str);
method fmt (line 43) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
method description (line 34) | fn description(&self) -> &str {
method source (line 37) | fn source(&self) -> Option<&(dyn Error + 'static)> {
type Error (line 50) | type Error = DeserializeError;
method deserialize (line 52) | fn deserialize(header: &NetlinkHeader, payload: &[u8]) -> Result<Self, S...
method message_type (line 65) | fn message_type(&self) -> u16 {
method buffer_len (line 72) | fn buffer_len(&self) -> usize {
method serialize (line 78) | fn serialize(&self, buffer: &mut [u8]) {
function from (line 92) | fn from(message: PingPongMessage) -> Self {
function main (line 97) | fn main() {
FILE: netlink-packet-core/examples/rtnetlink.rs
function main (line 6) | fn main() {
FILE: netlink-packet-core/src/buffer.rs
constant LENGTH (line 7) | const LENGTH: Field = 0..4;
constant MESSAGE_TYPE (line 8) | const MESSAGE_TYPE: Field = 4..6;
constant FLAGS (line 9) | const FLAGS: Field = 6..8;
constant SEQUENCE_NUMBER (line 10) | const SEQUENCE_NUMBER: Field = 8..12;
constant PORT_NUMBER (line 11) | const PORT_NUMBER: Field = 12..16;
constant PAYLOAD (line 12) | const PAYLOAD: Rest = 16..;
constant NETLINK_HEADER_LEN (line 15) | pub const NETLINK_HEADER_LEN: usize = PAYLOAD.start;
type NetlinkBuffer (line 105) | pub struct NetlinkBuffer<T> {
function new (line 117) | pub fn new(buffer: T) -> NetlinkBuffer<T> {
function new_checked (line 157) | pub fn new_checked(buffer: T) -> Result<NetlinkBuffer<T>, DecodeError> {
function check_buffer_length (line 163) | fn check_buffer_length(&self) -> Result<(), DecodeError> {
function payload_length (line 196) | pub fn payload_length(&self) -> usize {
function into_inner (line 204) | pub fn into_inner(self) -> T {
function length (line 213) | pub fn length(&self) -> u32 {
function message_type (line 223) | pub fn message_type(&self) -> u16 {
function flags (line 233) | pub fn flags(&self) -> u16 {
function sequence_number (line 243) | pub fn sequence_number(&self) -> u32 {
function port_number (line 253) | pub fn port_number(&self) -> u32 {
function set_length (line 265) | pub fn set_length(&mut self, value: u32) {
function set_message_type (line 275) | pub fn set_message_type(&mut self, value: u16) {
function set_flags (line 285) | pub fn set_flags(&mut self, value: u16) {
function set_sequence_number (line 295) | pub fn set_sequence_number(&mut self, value: u32) {
function set_port_number (line 305) | pub fn set_port_number(&mut self, value: u32) {
function payload (line 319) | pub fn payload(&self) -> &'a [u8] {
function payload_mut (line 334) | pub fn payload_mut(&mut self) -> &mut [u8] {
constant RTM_GETLINK (line 348) | const RTM_GETLINK: u16 = 18;
function packet_read (line 364) | fn packet_read() {
function packet_build (line 380) | fn packet_build() {
FILE: netlink-packet-core/src/constants.rs
constant NLM_F_REQUEST (line 4) | pub const NLM_F_REQUEST: u16 = 1;
constant NLM_F_MULTIPART (line 6) | pub const NLM_F_MULTIPART: u16 = 2;
constant NLM_F_ACK (line 9) | pub const NLM_F_ACK: u16 = 4;
constant NLM_F_ECHO (line 12) | pub const NLM_F_ECHO: u16 = 8;
constant NLM_F_DUMP_INTR (line 14) | pub const NLM_F_DUMP_INTR: u16 = 16;
constant NLM_F_DUMP_FILTERED (line 16) | pub const NLM_F_DUMP_FILTERED: u16 = 32;
constant NLM_F_ROOT (line 18) | pub const NLM_F_ROOT: u16 = 256;
constant NLM_F_MATCH (line 20) | pub const NLM_F_MATCH: u16 = 512;
constant NLM_F_ATOMIC (line 23) | pub const NLM_F_ATOMIC: u16 = 1024;
constant NLM_F_DUMP (line 24) | pub const NLM_F_DUMP: u16 = 768;
constant NLM_F_REPLACE (line 26) | pub const NLM_F_REPLACE: u16 = 256;
constant NLM_F_EXCL (line 28) | pub const NLM_F_EXCL: u16 = 512;
constant NLM_F_CREATE (line 30) | pub const NLM_F_CREATE: u16 = 1024;
constant NLM_F_APPEND (line 32) | pub const NLM_F_APPEND: u16 = 2048;
constant NLM_F_NONREC (line 35) | pub const NLM_F_NONREC: u16 = 256;
constant NLM_F_CAPPED (line 37) | pub const NLM_F_CAPPED: u16 = 256;
constant NLM_F_ACK_TLVS (line 39) | pub const NLM_F_ACK_TLVS: u16 = 512;
FILE: netlink-packet-core/src/error.rs
constant CODE (line 9) | const CODE: Field = 0..4;
constant PAYLOAD (line 10) | const PAYLOAD: Rest = 4..;
constant ERROR_HEADER_LEN (line 11) | const ERROR_HEADER_LEN: usize = PAYLOAD.start;
type ErrorBuffer (line 14) | pub struct ErrorBuffer<T> {
function new (line 19) | pub fn new(buffer: T) -> ErrorBuffer<T> {
function into_inner (line 24) | pub fn into_inner(self) -> T {
function new_checked (line 28) | pub fn new_checked(buffer: T) -> Result<Self, DecodeError> {
function check_buffer_length (line 34) | fn check_buffer_length(&self) -> Result<(), DecodeError> {
function code (line 48) | pub fn code(&self) -> i32 {
function payload (line 56) | pub fn payload(&self) -> &'a [u8] {
function payload_mut (line 64) | pub fn payload_mut(&mut self) -> &mut [u8] {
function set_code (line 72) | pub fn set_code(&mut self, value: i32) {
type ErrorMessage (line 79) | pub struct ErrorMessage {
method parse (line 98) | fn parse(buf: &ErrorBuffer<&'buffer T>) -> Result<ErrorMessage, Decode...
method to_io (line 120) | pub fn to_io(&self) -> io::Error {
method fmt (line 126) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type AckMessage (line 84) | pub type AckMessage = ErrorMessage;
method buffer_len (line 87) | fn buffer_len(&self) -> usize {
method emit (line 90) | fn emit(&self, buffer: &mut [u8]) {
function from (line 132) | fn from(e: ErrorMessage) -> io::Error {
function into_io_error (line 142) | fn into_io_error() {
FILE: netlink-packet-core/src/header.rs
type NetlinkHeader (line 20) | pub struct NetlinkHeader {
method parse (line 53) | fn parse(buf: &NetlinkBuffer<&'a T>) -> Result<NetlinkHeader, DecodeEr...
method buffer_len (line 38) | fn buffer_len(&self) -> usize {
method emit (line 42) | fn emit(&self, buffer: &mut [u8]) {
constant RTM_GETLINK (line 82) | const RTM_GETLINK: u16 = 18;
function repr_parse (line 85) | fn repr_parse() {
function repr_emit (line 97) | fn repr_emit() {
FILE: netlink-packet-core/src/lib.rs
type Field (line 242) | pub(crate) type Field = Range<usize>;
type Rest (line 244) | pub(crate) type Rest = RangeFrom<usize>;
FILE: netlink-packet-core/src/message.rs
type NetlinkMessage (line 23) | pub struct NetlinkMessage<I> {
function new (line 32) | pub fn new(header: NetlinkHeader, payload: NetlinkPayload<I>) -> Self {
function into_parts (line 37) | pub fn into_parts(self) -> (NetlinkHeader, NetlinkPayload<I>) {
function deserialize (line 47) | pub fn deserialize(buffer: &[u8]) -> Result<Self, DecodeError> {
function buffer_len (line 58) | pub fn buffer_len(&self) -> usize {
function serialize (line 70) | pub fn serialize(&self, buffer: &mut [u8]) {
function finalize (line 82) | pub fn finalize(&mut self) {
function parse (line 93) | fn parse(buf: &NetlinkBuffer<&'buffer B>) -> Result<Self, DecodeError> {
method buffer_len (line 130) | fn buffer_len(&self) -> usize {
method emit (line 144) | fn emit(&self, buffer: &mut [u8]) {
function from (line 164) | fn from(inner_message: T) -> Self {
FILE: netlink-packet-core/src/payload.rs
constant NLMSG_NOOP (line 8) | pub const NLMSG_NOOP: u16 = 1;
constant NLMSG_ERROR (line 11) | pub const NLMSG_ERROR: u16 = 2;
constant NLMSG_DONE (line 14) | pub const NLMSG_DONE: u16 = 3;
constant NLMSG_OVERRUN (line 15) | pub const NLMSG_OVERRUN: u16 = 4;
constant NLMSG_ALIGNTO (line 16) | pub const NLMSG_ALIGNTO: u16 = 4;
type NetlinkPayload (line 19) | pub enum NetlinkPayload<I> {
function message_type (line 32) | pub fn message_type(&self) -> u16 {
FILE: netlink-packet-core/src/traits.rs
type NetlinkDeserializable (line 7) | pub trait NetlinkDeserializable: Sized {
method deserialize (line 11) | fn deserialize(header: &NetlinkHeader, payload: &[u8]) -> Result<Self,...
type NetlinkSerializable (line 14) | pub trait NetlinkSerializable {
method message_type (line 15) | fn message_type(&self) -> u16;
method buffer_len (line 24) | fn buffer_len(&self) -> usize;
method serialize (line 37) | fn serialize(&self, buffer: &mut [u8]);
FILE: netlink-packet-generic/examples/list_generic_family.rs
function main (line 10) | fn main() {
function print_entry (line 63) | fn print_entry(entry: Vec<GenlCtrlAttrs>) {
FILE: netlink-packet-generic/src/buffer.rs
function parse_with_param (line 19) | fn parse_with_param(buf: &[u8], message_type: u16) -> Result<Self, Decod...
function parse_with_param (line 30) | fn parse_with_param(buf: &GenlBuffer<&'a T>, message_type: u16) -> Resul...
FILE: netlink-packet-generic/src/constants.rs
constant GENL_ID_CTRL (line 4) | pub const GENL_ID_CTRL: u16 = libc::GENL_ID_CTRL as u16;
constant GENL_HDRLEN (line 5) | pub const GENL_HDRLEN: usize = 4;
constant CTRL_CMD_UNSPEC (line 7) | pub const CTRL_CMD_UNSPEC: u8 = libc::CTRL_CMD_UNSPEC as u8;
constant CTRL_CMD_NEWFAMILY (line 8) | pub const CTRL_CMD_NEWFAMILY: u8 = libc::CTRL_CMD_NEWFAMILY as u8;
constant CTRL_CMD_DELFAMILY (line 9) | pub const CTRL_CMD_DELFAMILY: u8 = libc::CTRL_CMD_DELFAMILY as u8;
constant CTRL_CMD_GETFAMILY (line 10) | pub const CTRL_CMD_GETFAMILY: u8 = libc::CTRL_CMD_GETFAMILY as u8;
constant CTRL_CMD_NEWOPS (line 11) | pub const CTRL_CMD_NEWOPS: u8 = libc::CTRL_CMD_NEWOPS as u8;
constant CTRL_CMD_DELOPS (line 12) | pub const CTRL_CMD_DELOPS: u8 = libc::CTRL_CMD_DELOPS as u8;
constant CTRL_CMD_GETOPS (line 13) | pub const CTRL_CMD_GETOPS: u8 = libc::CTRL_CMD_GETOPS as u8;
constant CTRL_CMD_NEWMCAST_GRP (line 14) | pub const CTRL_CMD_NEWMCAST_GRP: u8 = libc::CTRL_CMD_NEWMCAST_GRP as u8;
constant CTRL_CMD_DELMCAST_GRP (line 15) | pub const CTRL_CMD_DELMCAST_GRP: u8 = libc::CTRL_CMD_DELMCAST_GRP as u8;
constant CTRL_CMD_GETMCAST_GRP (line 16) | pub const CTRL_CMD_GETMCAST_GRP: u8 = libc::CTRL_CMD_GETMCAST_GRP as u8;
constant CTRL_CMD_GETPOLICY (line 17) | pub const CTRL_CMD_GETPOLICY: u8 = 10;
constant CTRL_ATTR_UNSPEC (line 19) | pub const CTRL_ATTR_UNSPEC: u16 = libc::CTRL_ATTR_UNSPEC as u16;
constant CTRL_ATTR_FAMILY_ID (line 20) | pub const CTRL_ATTR_FAMILY_ID: u16 = libc::CTRL_ATTR_FAMILY_ID as u16;
constant CTRL_ATTR_FAMILY_NAME (line 21) | pub const CTRL_ATTR_FAMILY_NAME: u16 = libc::CTRL_ATTR_FAMILY_NAME as u16;
constant CTRL_ATTR_VERSION (line 22) | pub const CTRL_ATTR_VERSION: u16 = libc::CTRL_ATTR_VERSION as u16;
constant CTRL_ATTR_HDRSIZE (line 23) | pub const CTRL_ATTR_HDRSIZE: u16 = libc::CTRL_ATTR_HDRSIZE as u16;
constant CTRL_ATTR_MAXATTR (line 24) | pub const CTRL_ATTR_MAXATTR: u16 = libc::CTRL_ATTR_MAXATTR as u16;
constant CTRL_ATTR_OPS (line 25) | pub const CTRL_ATTR_OPS: u16 = libc::CTRL_ATTR_OPS as u16;
constant CTRL_ATTR_MCAST_GROUPS (line 26) | pub const CTRL_ATTR_MCAST_GROUPS: u16 = libc::CTRL_ATTR_MCAST_GROUPS as ...
constant CTRL_ATTR_POLICY (line 27) | pub const CTRL_ATTR_POLICY: u16 = 8;
constant CTRL_ATTR_OP_POLICY (line 28) | pub const CTRL_ATTR_OP_POLICY: u16 = 9;
constant CTRL_ATTR_OP (line 29) | pub const CTRL_ATTR_OP: u16 = 10;
constant CTRL_ATTR_OP_UNSPEC (line 31) | pub const CTRL_ATTR_OP_UNSPEC: u16 = libc::CTRL_ATTR_OP_UNSPEC as u16;
constant CTRL_ATTR_OP_ID (line 32) | pub const CTRL_ATTR_OP_ID: u16 = libc::CTRL_ATTR_OP_ID as u16;
constant CTRL_ATTR_OP_FLAGS (line 33) | pub const CTRL_ATTR_OP_FLAGS: u16 = libc::CTRL_ATTR_OP_FLAGS as u16;
constant CTRL_ATTR_MCAST_GRP_UNSPEC (line 35) | pub const CTRL_ATTR_MCAST_GRP_UNSPEC: u16 = libc::CTRL_ATTR_MCAST_GRP_UN...
constant CTRL_ATTR_MCAST_GRP_NAME (line 36) | pub const CTRL_ATTR_MCAST_GRP_NAME: u16 = libc::CTRL_ATTR_MCAST_GRP_NAME...
constant CTRL_ATTR_MCAST_GRP_ID (line 37) | pub const CTRL_ATTR_MCAST_GRP_ID: u16 = libc::CTRL_ATTR_MCAST_GRP_ID as ...
constant CTRL_ATTR_POLICY_UNSPEC (line 39) | pub const CTRL_ATTR_POLICY_UNSPEC: u16 = 0;
constant CTRL_ATTR_POLICY_DO (line 40) | pub const CTRL_ATTR_POLICY_DO: u16 = 1;
constant CTRL_ATTR_POLICY_DUMP (line 41) | pub const CTRL_ATTR_POLICY_DUMP: u16 = 2;
constant NL_ATTR_TYPE_INVALID (line 43) | pub const NL_ATTR_TYPE_INVALID: u32 = 0;
constant NL_ATTR_TYPE_FLAG (line 44) | pub const NL_ATTR_TYPE_FLAG: u32 = 1;
constant NL_ATTR_TYPE_U8 (line 45) | pub const NL_ATTR_TYPE_U8: u32 = 2;
constant NL_ATTR_TYPE_U16 (line 46) | pub const NL_ATTR_TYPE_U16: u32 = 3;
constant NL_ATTR_TYPE_U32 (line 47) | pub const NL_ATTR_TYPE_U32: u32 = 4;
constant NL_ATTR_TYPE_U64 (line 48) | pub const NL_ATTR_TYPE_U64: u32 = 5;
constant NL_ATTR_TYPE_S8 (line 49) | pub const NL_ATTR_TYPE_S8: u32 = 6;
constant NL_ATTR_TYPE_S16 (line 50) | pub const NL_ATTR_TYPE_S16: u32 = 7;
constant NL_ATTR_TYPE_S32 (line 51) | pub const NL_ATTR_TYPE_S32: u32 = 8;
constant NL_ATTR_TYPE_S64 (line 52) | pub const NL_ATTR_TYPE_S64: u32 = 9;
constant NL_ATTR_TYPE_BINARY (line 53) | pub const NL_ATTR_TYPE_BINARY: u32 = 10;
constant NL_ATTR_TYPE_STRING (line 54) | pub const NL_ATTR_TYPE_STRING: u32 = 11;
constant NL_ATTR_TYPE_NUL_STRING (line 55) | pub const NL_ATTR_TYPE_NUL_STRING: u32 = 12;
constant NL_ATTR_TYPE_NESTED (line 56) | pub const NL_ATTR_TYPE_NESTED: u32 = 13;
constant NL_ATTR_TYPE_NESTED_ARRAY (line 57) | pub const NL_ATTR_TYPE_NESTED_ARRAY: u32 = 14;
constant NL_ATTR_TYPE_BITFIELD32 (line 58) | pub const NL_ATTR_TYPE_BITFIELD32: u32 = 15;
constant NL_POLICY_TYPE_ATTR_UNSPEC (line 60) | pub const NL_POLICY_TYPE_ATTR_UNSPEC: u16 = 0;
constant NL_POLICY_TYPE_ATTR_TYPE (line 61) | pub const NL_POLICY_TYPE_ATTR_TYPE: u16 = 1;
constant NL_POLICY_TYPE_ATTR_MIN_VALUE_S (line 62) | pub const NL_POLICY_TYPE_ATTR_MIN_VALUE_S: u16 = 2;
constant NL_POLICY_TYPE_ATTR_MAX_VALUE_S (line 63) | pub const NL_POLICY_TYPE_ATTR_MAX_VALUE_S: u16 = 3;
constant NL_POLICY_TYPE_ATTR_MIN_VALUE_U (line 64) | pub const NL_POLICY_TYPE_ATTR_MIN_VALUE_U: u16 = 4;
constant NL_POLICY_TYPE_ATTR_MAX_VALUE_U (line 65) | pub const NL_POLICY_TYPE_ATTR_MAX_VALUE_U: u16 = 5;
constant NL_POLICY_TYPE_ATTR_MIN_LENGTH (line 66) | pub const NL_POLICY_TYPE_ATTR_MIN_LENGTH: u16 = 6;
constant NL_POLICY_TYPE_ATTR_MAX_LENGTH (line 67) | pub const NL_POLICY_TYPE_ATTR_MAX_LENGTH: u16 = 7;
constant NL_POLICY_TYPE_ATTR_POLICY_IDX (line 68) | pub const NL_POLICY_TYPE_ATTR_POLICY_IDX: u16 = 8;
constant NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE (line 69) | pub const NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE: u16 = 9;
constant NL_POLICY_TYPE_ATTR_BITFIELD32_MASK (line 70) | pub const NL_POLICY_TYPE_ATTR_BITFIELD32_MASK: u16 = 10;
constant NL_POLICY_TYPE_ATTR_PAD (line 71) | pub const NL_POLICY_TYPE_ATTR_PAD: u16 = 11;
constant NL_POLICY_TYPE_ATTR_MASK (line 72) | pub const NL_POLICY_TYPE_ATTR_MASK: u16 = 12;
FILE: netlink-packet-generic/src/ctrl/mod.rs
type GenlCtrlCmd (line 19) | pub enum GenlCtrlCmd {
type Error (line 61) | type Error = DecodeError;
method try_from (line 63) | fn try_from(value: u8) -> Result<Self, Self::Error> {
function from (line 43) | fn from(cmd: GenlCtrlCmd) -> u8 {
type GenlCtrl (line 88) | pub struct GenlCtrl {
method parse_with_param (line 124) | fn parse_with_param(buf: &[u8], header: GenlHeader) -> Result<Self, De...
method family_name (line 96) | fn family_name() -> &'static str {
method family_id (line 100) | fn family_id(&self) -> u16 {
method command (line 104) | fn command(&self) -> u8 {
method version (line 108) | fn version(&self) -> u8 {
method emit (line 114) | fn emit(&self, buffer: &mut [u8]) {
method buffer_len (line 118) | fn buffer_len(&self) -> usize {
function parse_ctrlnlas (line 132) | fn parse_ctrlnlas(buf: &[u8]) -> Result<Vec<GenlCtrlAttrs>, DecodeError> {
FILE: netlink-packet-generic/src/ctrl/nlas/mcast.rs
type McastGrpAttrs (line 15) | pub enum McastGrpAttrs {
method parse (line 50) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 21) | fn value_len(&self) -> usize {
method kind (line 29) | fn kind(&self) -> u16 {
method emit_value (line 37) | fn emit_value(&self, buffer: &mut [u8]) {
FILE: netlink-packet-generic/src/ctrl/nlas/mod.rs
type GenlCtrlAttrs (line 25) | pub enum GenlCtrlAttrs {
method parse (line 104) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 39) | fn value_len(&self) -> usize {
method kind (line 55) | fn kind(&self) -> u16 {
method emit_value (line 71) | fn emit_value(&self, buffer: &mut [u8]) {
FILE: netlink-packet-generic/src/ctrl/nlas/oppolicy.rs
type OppolicyAttr (line 15) | pub struct OppolicyAttr {
method parse (line 39) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 21) | fn value_len(&self) -> usize {
method kind (line 25) | fn kind(&self) -> u16 {
method emit_value (line 29) | fn emit_value(&self, buffer: &mut [u8]) {
method is_nested (line 33) | fn is_nested(&self) -> bool {
type OppolicyIndexAttr (line 54) | pub enum OppolicyIndexAttr {
method parse (line 86) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 60) | fn value_len(&self) -> usize {
method kind (line 68) | fn kind(&self) -> u16 {
method emit_value (line 76) | fn emit_value(&self, buffer: &mut [u8]) {
FILE: netlink-packet-generic/src/ctrl/nlas/ops.rs
type OpAttrs (line 15) | pub enum OpAttrs {
method parse (line 47) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 21) | fn value_len(&self) -> usize {
method kind (line 29) | fn kind(&self) -> u16 {
method emit_value (line 37) | fn emit_value(&self, buffer: &mut [u8]) {
FILE: netlink-packet-generic/src/ctrl/nlas/policy.rs
type PolicyAttr (line 20) | pub struct PolicyAttr {
method parse (line 44) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 26) | fn value_len(&self) -> usize {
method kind (line 30) | fn kind(&self) -> u16 {
method emit_value (line 34) | fn emit_value(&self, buffer: &mut [u8]) {
method is_nested (line 38) | fn is_nested(&self) -> bool {
type AttributePolicyAttr (line 58) | pub struct AttributePolicyAttr {
method parse (line 82) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 64) | fn value_len(&self) -> usize {
method kind (line 68) | fn kind(&self) -> u16 {
method emit_value (line 72) | fn emit_value(&self, buffer: &mut [u8]) {
method is_nested (line 76) | fn is_nested(&self) -> bool {
type NlPolicyTypeAttrs (line 99) | pub enum NlPolicyTypeAttrs {
method parse (line 167) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 114) | fn value_len(&self) -> usize {
method kind (line 131) | fn kind(&self) -> u16 {
method emit_value (line 148) | fn emit_value(&self, buffer: &mut [u8]) {
type NlaType (line 210) | pub enum NlaType {
type Error (line 251) | type Error = DecodeError;
method try_from (line 253) | fn try_from(value: u32) -> Result<Self, Self::Error> {
function from (line 229) | fn from(nlatype: NlaType) -> u32 {
function parse_i64 (line 276) | fn parse_i64(payload: &[u8]) -> Result<i64, DecodeError> {
FILE: netlink-packet-generic/src/header.rs
type GenlHeader (line 10) | pub struct GenlHeader {
method parse (line 28) | fn parse(buf: &GenlBuffer<T>) -> Result<Self, DecodeError> {
method buffer_len (line 16) | fn buffer_len(&self) -> usize {
method emit (line 20) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-generic/src/message.rs
type GenlMessage (line 25) | pub struct GenlMessage<F> {
function new (line 36) | pub fn new(header: GenlHeader, payload: F, family_id: u16) -> Self {
function from_parts (line 45) | pub fn from_parts(header: GenlHeader, payload: F) -> Self {
function into_parts (line 54) | pub fn into_parts(self) -> (GenlHeader, F) {
function resolved_family_id (line 62) | pub fn resolved_family_id(&self) -> u16 {
function set_resolved_family_id (line 80) | pub fn set_resolved_family_id(&mut self, family_id: u16) {
function from_payload (line 93) | pub fn from_payload(payload: F) -> Self {
function finalize (line 110) | pub fn finalize(&mut self) {
function family_id (line 122) | pub fn family_id(&self) -> u16 {
method buffer_len (line 136) | fn buffer_len(&self) -> usize {
method emit (line 140) | fn emit(&self, buffer: &mut [u8]) {
method message_type (line 152) | fn message_type(&self) -> u16 {
method buffer_len (line 156) | fn buffer_len(&self) -> usize {
method serialize (line 160) | fn serialize(&self, buffer: &mut [u8]) {
type Error (line 169) | type Error = DecodeError;
method deserialize (line 170) | fn deserialize(header: &NetlinkHeader, payload: &[u8]) -> Result<Self, S...
function from (line 180) | fn from(message: GenlMessage<F>) -> Self {
FILE: netlink-packet-generic/src/traits.rs
type GenlFamily (line 12) | pub trait GenlFamily {
method family_name (line 16) | fn family_name() -> &'static str;
method family_id (line 26) | fn family_id(&self) -> u16 {
method command (line 31) | fn command(&self) -> u8;
method version (line 34) | fn version(&self) -> u8;
FILE: netlink-packet-generic/tests/query_family_id.rs
function query_family_id (line 11) | fn query_family_id() {
FILE: netlink-packet-netfilter/examples/nflog.rs
function get_packet_nlas (line 30) | fn get_packet_nlas(message: &NetlinkMessage<NetfilterMessage>) -> &[Pack...
function main (line 42) | fn main() {
FILE: netlink-packet-netfilter/src/buffer.rs
function nlas (line 21) | pub fn nlas(&self) -> impl Iterator<Item = Result<NlaBuffer<&'a [u8]>, D...
function parse_all_nlas (line 25) | pub fn parse_all_nlas<F, U>(&self, f: F) -> Result<Vec<U>, DecodeError>
function default_nlas (line 36) | pub fn default_nlas(&self) -> Result<Vec<DefaultNla>, DecodeError> {
method parse_with_param (line 44) | fn parse_with_param(
FILE: netlink-packet-netfilter/src/constants.rs
constant AF_UNSPEC (line 5) | pub const AF_UNSPEC: u8 = libc::AF_UNSPEC as u8;
constant AF_UNIX (line 6) | pub const AF_UNIX: u8 = libc::AF_UNIX as u8;
constant AF_LOCAL (line 7) | pub const AF_LOCAL: u8 = libc::AF_LOCAL as u8;
constant AF_INET (line 8) | pub const AF_INET: u8 = libc::AF_INET as u8;
constant AF_AX25 (line 9) | pub const AF_AX25: u8 = libc::AF_AX25 as u8;
constant AF_IPX (line 10) | pub const AF_IPX: u8 = libc::AF_IPX as u8;
constant AF_APPLETALK (line 11) | pub const AF_APPLETALK: u8 = libc::AF_APPLETALK as u8;
constant AF_NETROM (line 12) | pub const AF_NETROM: u8 = libc::AF_NETROM as u8;
constant AF_BRIDGE (line 13) | pub const AF_BRIDGE: u8 = libc::AF_BRIDGE as u8;
constant AF_ATMPVC (line 14) | pub const AF_ATMPVC: u8 = libc::AF_ATMPVC as u8;
constant AF_X25 (line 15) | pub const AF_X25: u8 = libc::AF_X25 as u8;
constant AF_INET6 (line 16) | pub const AF_INET6: u8 = libc::AF_INET6 as u8;
constant AF_ROSE (line 17) | pub const AF_ROSE: u8 = libc::AF_ROSE as u8;
constant AF_DECNET (line 18) | pub const AF_DECNET: u8 = libc::AF_DECnet as u8;
constant AF_NETBEUI (line 19) | pub const AF_NETBEUI: u8 = libc::AF_NETBEUI as u8;
constant AF_SECURITY (line 20) | pub const AF_SECURITY: u8 = libc::AF_SECURITY as u8;
constant AF_KEY (line 21) | pub const AF_KEY: u8 = libc::AF_KEY as u8;
constant AF_NETLINK (line 22) | pub const AF_NETLINK: u8 = libc::AF_NETLINK as u8;
constant AF_ROUTE (line 23) | pub const AF_ROUTE: u8 = libc::AF_ROUTE as u8;
constant AF_PACKET (line 24) | pub const AF_PACKET: u8 = libc::AF_PACKET as u8;
constant AF_ASH (line 25) | pub const AF_ASH: u8 = libc::AF_ASH as u8;
constant AF_ECONET (line 26) | pub const AF_ECONET: u8 = libc::AF_ECONET as u8;
constant AF_ATMSVC (line 27) | pub const AF_ATMSVC: u8 = libc::AF_ATMSVC as u8;
constant AF_RDS (line 28) | pub const AF_RDS: u8 = libc::AF_RDS as u8;
constant AF_SNA (line 29) | pub const AF_SNA: u8 = libc::AF_SNA as u8;
constant AF_IRDA (line 30) | pub const AF_IRDA: u8 = libc::AF_IRDA as u8;
constant AF_PPPOX (line 31) | pub const AF_PPPOX: u8 = libc::AF_PPPOX as u8;
constant AF_WANPIPE (line 32) | pub const AF_WANPIPE: u8 = libc::AF_WANPIPE as u8;
constant AF_LLC (line 33) | pub const AF_LLC: u8 = libc::AF_LLC as u8;
constant AF_CAN (line 34) | pub const AF_CAN: u8 = libc::AF_CAN as u8;
constant AF_TIPC (line 35) | pub const AF_TIPC: u8 = libc::AF_TIPC as u8;
constant AF_BLUETOOTH (line 36) | pub const AF_BLUETOOTH: u8 = libc::AF_BLUETOOTH as u8;
constant AF_IUCV (line 37) | pub const AF_IUCV: u8 = libc::AF_IUCV as u8;
constant AF_RXRPC (line 38) | pub const AF_RXRPC: u8 = libc::AF_RXRPC as u8;
constant AF_ISDN (line 39) | pub const AF_ISDN: u8 = libc::AF_ISDN as u8;
constant AF_PHONET (line 40) | pub const AF_PHONET: u8 = libc::AF_PHONET as u8;
constant AF_IEEE802154 (line 41) | pub const AF_IEEE802154: u8 = libc::AF_IEEE802154 as u8;
constant AF_CAIF (line 42) | pub const AF_CAIF: u8 = libc::AF_CAIF as u8;
constant AF_ALG (line 43) | pub const AF_ALG: u8 = libc::AF_ALG as u8;
constant NFNETLINK_V0 (line 45) | pub const NFNETLINK_V0: u8 = libc::NFNETLINK_V0 as u8;
constant NFNL_SUBSYS_NONE (line 47) | pub const NFNL_SUBSYS_NONE: u8 = libc::NFNL_SUBSYS_NONE as u8;
constant NFNL_SUBSYS_CTNETLINK (line 48) | pub const NFNL_SUBSYS_CTNETLINK: u8 = libc::NFNL_SUBSYS_CTNETLINK as u8;
constant NFNL_SUBSYS_CTNETLINK_EXP (line 49) | pub const NFNL_SUBSYS_CTNETLINK_EXP: u8 = libc::NFNL_SUBSYS_CTNETLINK_EX...
constant NFNL_SUBSYS_QUEUE (line 50) | pub const NFNL_SUBSYS_QUEUE: u8 = libc::NFNL_SUBSYS_QUEUE as u8;
constant NFNL_SUBSYS_ULOG (line 51) | pub const NFNL_SUBSYS_ULOG: u8 = libc::NFNL_SUBSYS_ULOG as u8;
constant NFNL_SUBSYS_OSF (line 52) | pub const NFNL_SUBSYS_OSF: u8 = libc::NFNL_SUBSYS_OSF as u8;
constant NFNL_SUBSYS_IPSET (line 53) | pub const NFNL_SUBSYS_IPSET: u8 = libc::NFNL_SUBSYS_IPSET as u8;
constant NFNL_SUBSYS_ACCT (line 54) | pub const NFNL_SUBSYS_ACCT: u8 = libc::NFNL_SUBSYS_ACCT as u8;
constant NFNL_SUBSYS_CTNETLINK_TIMEOUT (line 55) | pub const NFNL_SUBSYS_CTNETLINK_TIMEOUT: u8 = libc::NFNL_SUBSYS_CTNETLIN...
constant NFNL_SUBSYS_CTHELPER (line 56) | pub const NFNL_SUBSYS_CTHELPER: u8 = libc::NFNL_SUBSYS_CTHELPER as u8;
constant NFNL_SUBSYS_NFTABLES (line 57) | pub const NFNL_SUBSYS_NFTABLES: u8 = libc::NFNL_SUBSYS_NFTABLES as u8;
constant NFNL_SUBSYS_NFT_COMPAT (line 58) | pub const NFNL_SUBSYS_NFT_COMPAT: u8 = libc::NFNL_SUBSYS_NFT_COMPAT as u8;
constant NFULA_CFG_CMD (line 60) | pub const NFULA_CFG_CMD: u16 = libc::NFULA_CFG_CMD as u16;
constant NFULA_CFG_MODE (line 61) | pub const NFULA_CFG_MODE: u16 = libc::NFULA_CFG_MODE as u16;
constant NFULA_CFG_NLBUFSIZ (line 62) | pub const NFULA_CFG_NLBUFSIZ: u16 = libc::NFULA_CFG_NLBUFSIZ as u16;
constant NFULA_CFG_TIMEOUT (line 63) | pub const NFULA_CFG_TIMEOUT: u16 = libc::NFULA_CFG_TIMEOUT as u16;
constant NFULA_CFG_QTHRESH (line 64) | pub const NFULA_CFG_QTHRESH: u16 = libc::NFULA_CFG_QTHRESH as u16;
constant NFULA_CFG_FLAGS (line 65) | pub const NFULA_CFG_FLAGS: u16 = libc::NFULA_CFG_FLAGS as u16;
constant NLBUFSIZ_MAX (line 66) | pub const NLBUFSIZ_MAX: u32 = 131072;
constant NFULA_PACKET_HDR (line 68) | pub const NFULA_PACKET_HDR: u16 = libc::NFULA_PACKET_HDR as u16;
constant NFULA_MARK (line 69) | pub const NFULA_MARK: u16 = libc::NFULA_MARK as u16;
constant NFULA_TIMESTAMP (line 70) | pub const NFULA_TIMESTAMP: u16 = libc::NFULA_TIMESTAMP as u16;
constant NFULA_IFINDEX_INDEV (line 71) | pub const NFULA_IFINDEX_INDEV: u16 = libc::NFULA_IFINDEX_INDEV as u16;
constant NFULA_IFINDEX_OUTDEV (line 72) | pub const NFULA_IFINDEX_OUTDEV: u16 = libc::NFULA_IFINDEX_OUTDEV as u16;
constant NFULA_IFINDEX_PHYSINDEV (line 73) | pub const NFULA_IFINDEX_PHYSINDEV: u16 = libc::NFULA_IFINDEX_PHYSINDEV a...
constant NFULA_IFINDEX_PHYSOUTDEV (line 74) | pub const NFULA_IFINDEX_PHYSOUTDEV: u16 = libc::NFULA_IFINDEX_PHYSOUTDEV...
constant NFULA_HWADDR (line 75) | pub const NFULA_HWADDR: u16 = libc::NFULA_HWADDR as u16;
constant NFULA_PAYLOAD (line 76) | pub const NFULA_PAYLOAD: u16 = libc::NFULA_PAYLOAD as u16;
constant NFULA_PREFIX (line 77) | pub const NFULA_PREFIX: u16 = libc::NFULA_PREFIX as u16;
constant NFULA_UID (line 78) | pub const NFULA_UID: u16 = libc::NFULA_UID as u16;
constant NFULA_SEQ (line 79) | pub const NFULA_SEQ: u16 = libc::NFULA_SEQ as u16;
constant NFULA_SEQ_GLOBAL (line 80) | pub const NFULA_SEQ_GLOBAL: u16 = libc::NFULA_SEQ_GLOBAL as u16;
constant NFULA_GID (line 81) | pub const NFULA_GID: u16 = libc::NFULA_GID as u16;
constant NFULA_HWTYPE (line 82) | pub const NFULA_HWTYPE: u16 = libc::NFULA_HWTYPE as u16;
constant NFULA_HWHEADER (line 83) | pub const NFULA_HWHEADER: u16 = libc::NFULA_HWHEADER as u16;
constant NFULA_HWLEN (line 84) | pub const NFULA_HWLEN: u16 = libc::NFULA_HWLEN as u16;
constant NFULA_CT (line 85) | pub const NFULA_CT: u16 = libc::NFULA_CT as u16;
constant NFULA_CT_INFO (line 86) | pub const NFULA_CT_INFO: u16 = libc::NFULA_CT_INFO as u16;
constant NFULNL_MSG_CONFIG (line 88) | pub const NFULNL_MSG_CONFIG: u8 = libc::NFULNL_MSG_CONFIG as u8;
constant NFULNL_MSG_PACKET (line 89) | pub const NFULNL_MSG_PACKET: u8 = libc::NFULNL_MSG_PACKET as u8;
FILE: netlink-packet-netfilter/src/message.rs
constant NETFILTER_HEADER_LEN (line 14) | pub const NETFILTER_HEADER_LEN: usize = 4;
type NetfilterHeader (line 23) | pub struct NetfilterHeader {
method new (line 30) | pub fn new(family: u8, version: u8, res_id: u16) -> Self {
method parse (line 53) | fn parse(buf: &NetfilterHeaderBuffer<T>) -> Result<Self, DecodeError> {
method buffer_len (line 40) | fn buffer_len(&self) -> usize {
method emit (line 44) | fn emit(&self, buf: &mut [u8]) {
type NetfilterMessageInner (line 64) | pub enum NetfilterMessageInner {
method from (line 74) | fn from(message: NfLogMessage) -> Self {
method buffer_len (line 80) | fn buffer_len(&self) -> usize {
method emit (line 87) | fn emit(&self, buffer: &mut [u8]) {
type NetfilterMessage (line 96) | pub struct NetfilterMessage {
method new (line 102) | pub fn new<T: Into<NetfilterMessageInner>>(header: NetfilterHeader, in...
method subsys (line 109) | pub fn subsys(&self) -> u8 {
method message_type (line 116) | pub fn message_type(&self) -> u8 {
method buffer_len (line 125) | fn buffer_len(&self) -> usize {
method emit (line 129) | fn emit(&self, buffer: &mut [u8]) {
method message_type (line 136) | fn message_type(&self) -> u16 {
method buffer_len (line 140) | fn buffer_len(&self) -> usize {
method serialize (line 144) | fn serialize(&self, buffer: &mut [u8]) {
type Error (line 150) | type Error = DecodeError;
method deserialize (line 151) | fn deserialize(header: &NetlinkHeader, payload: &[u8]) -> Result<Self, S...
function from (line 163) | fn from(message: NetfilterMessage) -> Self {
FILE: netlink-packet-netfilter/src/nflog/message.rs
type NfLogMessage (line 13) | pub enum NfLogMessage {
constant SUBSYS (line 23) | pub const SUBSYS: u8 = NFNL_SUBSYS_ULOG;
method message_type (line 25) | pub fn message_type(&self) -> u8 {
method parse_with_param (line 55) | fn parse_with_param(
method buffer_len (line 35) | fn buffer_len(&self) -> usize {
method emit (line 43) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-netfilter/src/nflog/mod.rs
function config_request (line 15) | pub fn config_request(
FILE: netlink-packet-netfilter/src/nflog/nlas/config/config_cmd.rs
constant NFULA_CFG_CMD (line 5) | const NFULA_CFG_CMD: u16 = libc::NFULA_CFG_CMD as u16;
constant NFULNL_CFG_CMD_NONE (line 6) | const NFULNL_CFG_CMD_NONE: u8 = libc::NFULNL_CFG_CMD_NONE as u8;
constant NFULNL_CFG_CMD_BIND (line 7) | const NFULNL_CFG_CMD_BIND: u8 = libc::NFULNL_CFG_CMD_BIND as u8;
constant NFULNL_CFG_CMD_UNBIND (line 8) | const NFULNL_CFG_CMD_UNBIND: u8 = libc::NFULNL_CFG_CMD_UNBIND as u8;
constant NFULNL_CFG_CMD_PF_BIND (line 9) | const NFULNL_CFG_CMD_PF_BIND: u8 = libc::NFULNL_CFG_CMD_PF_BIND as u8;
constant NFULNL_CFG_CMD_PF_UNBIND (line 10) | const NFULNL_CFG_CMD_PF_UNBIND: u8 = libc::NFULNL_CFG_CMD_PF_UNBIND as u8;
type ConfigCmd (line 13) | pub enum ConfigCmd {
method from (line 36) | fn from(cmd: u8) -> Self {
function from (line 23) | fn from(cmd: ConfigCmd) -> Self {
method value_len (line 49) | fn value_len(&self) -> usize {
method kind (line 53) | fn kind(&self) -> u16 {
method emit_value (line 57) | fn emit_value(&self, buffer: &mut [u8]) {
FILE: netlink-packet-netfilter/src/nflog/nlas/config/config_flags.rs
constant NFULA_CFG_FLAGS (line 9) | const NFULA_CFG_FLAGS: u16 = libc::NFULA_CFG_FLAGS as u16;
method from_bits_preserve (line 21) | pub fn from_bits_preserve(bits: u16) -> Self {
method value_len (line 27) | fn value_len(&self) -> usize {
method kind (line 31) | fn kind(&self) -> u16 {
method emit_value (line 35) | fn emit_value(&self, buffer: &mut [u8]) {
FILE: netlink-packet-netfilter/src/nflog/nlas/config/config_mode.rs
constant NFULA_CFG_MODE (line 5) | const NFULA_CFG_MODE: u16 = libc::NFULA_CFG_MODE as u16;
constant NFULNL_COPY_NONE (line 6) | const NFULNL_COPY_NONE: u8 = libc::NFULNL_COPY_NONE as u8;
constant NFULNL_COPY_META (line 7) | const NFULNL_COPY_META: u8 = libc::NFULNL_COPY_META as u8;
constant NFULNL_COPY_PACKET (line 8) | const NFULNL_COPY_PACKET: u8 = libc::NFULNL_COPY_PACKET as u8;
constant CONFIG_MODE_LEN (line 10) | const CONFIG_MODE_LEN: usize = 6;
type CopyMode (line 18) | pub enum CopyMode {
method from (line 37) | fn from(cmd: u8) -> Self {
function from (line 26) | fn from(cmd: CopyMode) -> Self {
type ConfigMode (line 48) | pub struct ConfigMode {
constant NONE (line 54) | pub const NONE: Self = Self {
constant META (line 59) | pub const META: Self = Self {
constant PACKET_MAX (line 64) | pub const PACKET_MAX: Self = Self {
method new (line 69) | pub fn new(copy_range: u32, copy_mode: CopyMode) -> Self {
method new_packet (line 76) | pub fn new_packet(copy_range: u32) -> Self {
method parse (line 98) | fn parse(buf: &ConfigModeBuffer<T>) -> Result<Self, DecodeError> {
method value_len (line 82) | fn value_len(&self) -> usize {
method kind (line 86) | fn kind(&self) -> u16 {
method emit_value (line 90) | fn emit_value(&self, buf: &mut [u8]) {
FILE: netlink-packet-netfilter/src/nflog/nlas/config/nla.rs
type ConfigNla (line 30) | pub enum ConfigNla {
method parse (line 81) | fn parse(buf: &NlaBuffer<&'buffer T>) -> Result<Self, DecodeError> {
method value_len (line 43) | fn value_len(&self) -> usize {
method kind (line 55) | fn kind(&self) -> u16 {
method emit_value (line 67) | fn emit_value(&self, buffer: &mut [u8]) {
FILE: netlink-packet-netfilter/src/nflog/nlas/config/timeout.rs
constant NFULA_CFG_TIMEOUT (line 8) | const NFULA_CFG_TIMEOUT: u16 = libc::NFULA_CFG_TIMEOUT as u16;
type Timeout (line 11) | pub struct Timeout {
method new (line 16) | pub fn new(hundredth: u32) -> Self {
method from (line 22) | fn from(duration: Duration) -> Self {
method value_len (line 29) | fn value_len(&self) -> usize {
method kind (line 33) | fn kind(&self) -> u16 {
method emit_value (line 37) | fn emit_value(&self, buffer: &mut [u8]) {
FILE: netlink-packet-netfilter/src/nflog/nlas/packet/hw_addr.rs
constant HW_ADDR_LEN (line 5) | const HW_ADDR_LEN: usize = 12;
type HwAddr (line 20) | pub struct HwAddr {
method parse (line 49) | fn parse(buf: &HwAddrBuffer<T>) -> Result<Self, DecodeError> {
method value_len (line 26) | fn value_len(&self) -> usize {
method kind (line 30) | fn kind(&self) -> u16 {
method emit_value (line 34) | fn emit_value(&self, buf: &mut [u8]) {
FILE: netlink-packet-netfilter/src/nflog/nlas/packet/nla.rs
type PacketNla (line 41) | pub enum PacketNla {
method parse (line 138) | fn parse(buf: &NlaBuffer<&'buffer T>) -> Result<Self, DecodeError> {
method value_len (line 67) | fn value_len(&self) -> usize {
method kind (line 90) | fn kind(&self) -> u16 {
method emit_value (line 113) | fn emit_value(&self, buffer: &mut [u8]) {
FILE: netlink-packet-netfilter/src/nflog/nlas/packet/packet_hdr.rs
constant PACKET_HDR_LEN (line 6) | const PACKET_HDR_LEN: usize = 4;
constant NFULA_PACKET_HDR (line 7) | pub const NFULA_PACKET_HDR: u16 = libc::NFULA_PACKET_HDR as u16;
type PacketHdr (line 16) | pub struct PacketHdr {
method parse (line 38) | fn parse(buf: &PacketHdrBuffer<T>) -> Result<Self, DecodeError> {
method value_len (line 22) | fn value_len(&self) -> usize {
method kind (line 26) | fn kind(&self) -> u16 {
method emit_value (line 30) | fn emit_value(&self, buf: &mut [u8]) {
FILE: netlink-packet-netfilter/src/nflog/nlas/packet/timestamp.rs
constant TIMESTAMP_LEN (line 8) | const TIMESTAMP_LEN: usize = 16;
type TimeStamp (line 16) | pub struct TimeStamp {
method parse (line 38) | fn parse(buf: &TimeStampBuffer<T>) -> Result<Self, DecodeError> {
method value_len (line 22) | fn value_len(&self) -> usize {
method kind (line 26) | fn kind(&self) -> u16 {
method emit_value (line 30) | fn emit_value(&self, buf: &mut [u8]) {
FILE: netlink-packet-route/benches/link_message.rs
constant LINKMSG1 (line 13) | const LINKMSG1: [u8; 96] = [
function b1 (line 39) | fn b1(c: &mut Criterion) {
FILE: netlink-packet-route/benches/rtnetlink_dump.rs
function bench (line 10) | fn bench(c: &mut Criterion) {
FILE: netlink-packet-route/examples/dump_neighbours.rs
function main (line 16) | fn main() {
function format_ip (line 74) | fn format_ip(buf: &[u8]) -> String {
function format_mac (line 84) | fn format_mac(buf: &[u8]) -> String {
function state_str (line 92) | fn state_str(value: u16) -> &'static str {
function print_entry (line 107) | fn print_entry(entry: NeighbourMessage) {
FILE: netlink-packet-route/examples/dump_packet_link_bridge_vlan.rs
function main (line 17) | fn main() {
FILE: netlink-packet-route/examples/dump_packet_links.rs
function main (line 14) | fn main() {
FILE: netlink-packet-route/examples/dump_rules.rs
function main (line 13) | fn main() {
FILE: netlink-packet-route/examples/new_rule.rs
function main (line 7) | fn main() {
FILE: netlink-packet-route/src/rtnl/address/buffer.rs
constant ADDRESS_HEADER_LEN (line 8) | pub const ADDRESS_HEADER_LEN: usize = 8;
function nlas (line 20) | pub fn nlas(&self) -> impl Iterator<Item = Result<NlaBuffer<&'a [u8]>, D...
FILE: netlink-packet-route/src/rtnl/address/message.rs
type AddressMessage (line 14) | pub struct AddressMessage {
method parse (line 69) | fn parse(buf: &AddressMessageBuffer<&'a T>) -> Result<Self, DecodeErro...
type AddressHeader (line 20) | pub struct AddressHeader {
method parse (line 57) | fn parse(buf: &AddressMessageBuffer<T>) -> Result<Self, DecodeError> {
method buffer_len (line 29) | fn buffer_len(&self) -> usize {
method emit (line 33) | fn emit(&self, buffer: &mut [u8]) {
method buffer_len (line 44) | fn buffer_len(&self) -> usize {
method emit (line 48) | fn emit(&self, buffer: &mut [u8]) {
function parse (line 78) | fn parse(buf: &AddressMessageBuffer<&'a T>) -> Result<Self, DecodeError> {
FILE: netlink-packet-route/src/rtnl/address/nlas/cache_info.rs
type CacheInfo (line 9) | pub struct CacheInfo {
method parse (line 25) | fn parse(buf: &CacheInfoBuffer<T>) -> Result<Self, DecodeError> {
constant ADDRESSS_CACHE_INFO_LEN (line 16) | pub const ADDRESSS_CACHE_INFO_LEN: usize = 16;
method buffer_len (line 36) | fn buffer_len(&self) -> usize {
method emit (line 40) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/address/nlas/mod.rs
type Nla (line 20) | pub enum Nla {
method value_len (line 35) | fn value_len(&self) -> usize {
method emit_value (line 61) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 88) | fn kind(&self) -> u16 {
method parse (line 106) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
FILE: netlink-packet-route/src/rtnl/buffer.rs
method parse_with_param (line 35) | fn parse_with_param(buf: &RtnlMessageBuffer<&'a T>, message_type: u16) -...
FILE: netlink-packet-route/src/rtnl/constants.rs
constant RTM_BASE (line 5) | pub const RTM_BASE: u16 = 16;
constant RTM_NEWLINK (line 6) | pub const RTM_NEWLINK: u16 = 16;
constant RTM_DELLINK (line 7) | pub const RTM_DELLINK: u16 = 17;
constant RTM_GETLINK (line 8) | pub const RTM_GETLINK: u16 = 18;
constant RTM_SETLINK (line 9) | pub const RTM_SETLINK: u16 = 19;
constant RTM_NEWADDR (line 10) | pub const RTM_NEWADDR: u16 = 20;
constant RTM_DELADDR (line 11) | pub const RTM_DELADDR: u16 = 21;
constant RTM_GETADDR (line 12) | pub const RTM_GETADDR: u16 = 22;
constant RTM_NEWROUTE (line 13) | pub const RTM_NEWROUTE: u16 = 24;
constant RTM_DELROUTE (line 14) | pub const RTM_DELROUTE: u16 = 25;
constant RTM_GETROUTE (line 15) | pub const RTM_GETROUTE: u16 = 26;
constant RTM_NEWNEIGH (line 16) | pub const RTM_NEWNEIGH: u16 = 28;
constant RTM_DELNEIGH (line 17) | pub const RTM_DELNEIGH: u16 = 29;
constant RTM_GETNEIGH (line 18) | pub const RTM_GETNEIGH: u16 = 30;
constant RTM_NEWRULE (line 19) | pub const RTM_NEWRULE: u16 = 32;
constant RTM_DELRULE (line 20) | pub const RTM_DELRULE: u16 = 33;
constant RTM_GETRULE (line 21) | pub const RTM_GETRULE: u16 = 34;
constant RTM_NEWQDISC (line 22) | pub const RTM_NEWQDISC: u16 = 36;
constant RTM_DELQDISC (line 23) | pub const RTM_DELQDISC: u16 = 37;
constant RTM_GETQDISC (line 24) | pub const RTM_GETQDISC: u16 = 38;
constant RTM_NEWTCLASS (line 25) | pub const RTM_NEWTCLASS: u16 = 40;
constant RTM_DELTCLASS (line 26) | pub const RTM_DELTCLASS: u16 = 41;
constant RTM_GETTCLASS (line 27) | pub const RTM_GETTCLASS: u16 = 42;
constant RTM_NEWTFILTER (line 28) | pub const RTM_NEWTFILTER: u16 = 44;
constant RTM_DELTFILTER (line 29) | pub const RTM_DELTFILTER: u16 = 45;
constant RTM_GETTFILTER (line 30) | pub const RTM_GETTFILTER: u16 = 46;
constant RTM_NEWACTION (line 31) | pub const RTM_NEWACTION: u16 = 48;
constant RTM_DELACTION (line 32) | pub const RTM_DELACTION: u16 = 49;
constant RTM_GETACTION (line 33) | pub const RTM_GETACTION: u16 = 50;
constant RTM_NEWPREFIX (line 34) | pub const RTM_NEWPREFIX: u16 = 52;
constant RTM_GETMULTICAST (line 35) | pub const RTM_GETMULTICAST: u16 = 58;
constant RTM_GETANYCAST (line 36) | pub const RTM_GETANYCAST: u16 = 62;
constant RTM_NEWNEIGHTBL (line 37) | pub const RTM_NEWNEIGHTBL: u16 = 64;
constant RTM_GETNEIGHTBL (line 38) | pub const RTM_GETNEIGHTBL: u16 = 66;
constant RTM_SETNEIGHTBL (line 39) | pub const RTM_SETNEIGHTBL: u16 = 67;
constant RTM_NEWNDUSEROPT (line 40) | pub const RTM_NEWNDUSEROPT: u16 = 68;
constant RTM_NEWADDRLABEL (line 41) | pub const RTM_NEWADDRLABEL: u16 = 72;
constant RTM_DELADDRLABEL (line 42) | pub const RTM_DELADDRLABEL: u16 = 73;
constant RTM_GETADDRLABEL (line 43) | pub const RTM_GETADDRLABEL: u16 = 74;
constant RTM_GETDCB (line 44) | pub const RTM_GETDCB: u16 = 78;
constant RTM_SETDCB (line 45) | pub const RTM_SETDCB: u16 = 79;
constant RTM_NEWNETCONF (line 46) | pub const RTM_NEWNETCONF: u16 = 80;
constant RTM_DELNETCONF (line 47) | pub const RTM_DELNETCONF: u16 = 81;
constant RTM_GETNETCONF (line 48) | pub const RTM_GETNETCONF: u16 = 82;
constant RTM_NEWMDB (line 49) | pub const RTM_NEWMDB: u16 = 84;
constant RTM_DELMDB (line 50) | pub const RTM_DELMDB: u16 = 85;
constant RTM_GETMDB (line 51) | pub const RTM_GETMDB: u16 = 86;
constant RTM_NEWNSID (line 52) | pub const RTM_NEWNSID: u16 = 88;
constant RTM_DELNSID (line 53) | pub const RTM_DELNSID: u16 = 89;
constant RTM_GETNSID (line 54) | pub const RTM_GETNSID: u16 = 90;
constant RTM_NEWSTATS (line 55) | pub const RTM_NEWSTATS: u16 = 92;
constant RTM_GETSTATS (line 56) | pub const RTM_GETSTATS: u16 = 94;
constant RTM_NEWCACHEREPORT (line 57) | pub const RTM_NEWCACHEREPORT: u16 = 96;
constant RTM_NEWCHAIN (line 58) | pub const RTM_NEWCHAIN: u16 = 100;
constant RTM_DELCHAIN (line 59) | pub const RTM_DELCHAIN: u16 = 101;
constant RTM_GETCHAIN (line 60) | pub const RTM_GETCHAIN: u16 = 102;
constant RTM_NEWLINKPROP (line 61) | pub const RTM_NEWLINKPROP: u16 = 108;
constant RTM_DELLINKPROP (line 62) | pub const RTM_DELLINKPROP: u16 = 109;
constant RTN_UNSPEC (line 65) | pub const RTN_UNSPEC: u8 = 0;
constant RTN_UNICAST (line 67) | pub const RTN_UNICAST: u8 = 1;
constant RTN_LOCAL (line 69) | pub const RTN_LOCAL: u8 = 2;
constant RTN_BROADCAST (line 71) | pub const RTN_BROADCAST: u8 = 3;
constant RTN_ANYCAST (line 73) | pub const RTN_ANYCAST: u8 = 4;
constant RTN_MULTICAST (line 75) | pub const RTN_MULTICAST: u8 = 5;
constant RTN_BLACKHOLE (line 77) | pub const RTN_BLACKHOLE: u8 = 6;
constant RTN_UNREACHABLE (line 79) | pub const RTN_UNREACHABLE: u8 = 7;
constant RTN_PROHIBIT (line 81) | pub const RTN_PROHIBIT: u8 = 8;
constant RTN_THROW (line 83) | pub const RTN_THROW: u8 = 9;
constant RTN_NAT (line 85) | pub const RTN_NAT: u8 = 10;
constant RTN_XRESOLVE (line 87) | pub const RTN_XRESOLVE: u8 = 11;
constant RTPROT_UNSPEC (line 90) | pub const RTPROT_UNSPEC: u8 = 0;
constant RTPROT_REDIRECT (line 92) | pub const RTPROT_REDIRECT: u8 = 1;
constant RTPROT_KERNEL (line 94) | pub const RTPROT_KERNEL: u8 = 2;
constant RTPROT_BOOT (line 96) | pub const RTPROT_BOOT: u8 = 3;
constant RTPROT_STATIC (line 98) | pub const RTPROT_STATIC: u8 = 4;
constant RTPROT_GATED (line 99) | pub const RTPROT_GATED: u8 = 8;
constant RTPROT_RA (line 100) | pub const RTPROT_RA: u8 = 9;
constant RTPROT_MRT (line 101) | pub const RTPROT_MRT: u8 = 10;
constant RTPROT_ZEBRA (line 102) | pub const RTPROT_ZEBRA: u8 = 11;
constant RTPROT_BIRD (line 103) | pub const RTPROT_BIRD: u8 = 12;
constant RTPROT_DNROUTED (line 104) | pub const RTPROT_DNROUTED: u8 = 13;
constant RTPROT_XORP (line 105) | pub const RTPROT_XORP: u8 = 14;
constant RTPROT_NTK (line 106) | pub const RTPROT_NTK: u8 = 15;
constant RTPROT_DHCP (line 107) | pub const RTPROT_DHCP: u8 = 16;
constant RTPROT_MROUTED (line 108) | pub const RTPROT_MROUTED: u8 = 17;
constant RTPROT_BABEL (line 109) | pub const RTPROT_BABEL: u8 = 42;
constant RT_SCOPE_UNIVERSE (line 112) | pub const RT_SCOPE_UNIVERSE: u8 = 0;
constant RT_SCOPE_SITE (line 115) | pub const RT_SCOPE_SITE: u8 = 200;
constant RT_SCOPE_LINK (line 117) | pub const RT_SCOPE_LINK: u8 = 253;
constant RT_SCOPE_HOST (line 119) | pub const RT_SCOPE_HOST: u8 = 254;
constant RT_SCOPE_NOWHERE (line 121) | pub const RT_SCOPE_NOWHERE: u8 = 255;
constant RT_TABLE_UNSPEC (line 124) | pub const RT_TABLE_UNSPEC: u8 = 0;
constant RT_TABLE_COMPAT (line 148) | pub const RT_TABLE_COMPAT: u8 = 252;
constant RT_TABLE_DEFAULT (line 159) | pub const RT_TABLE_DEFAULT: u8 = 253;
constant RT_TABLE_MAIN (line 165) | pub const RT_TABLE_MAIN: u8 = 254;
constant RT_TABLE_LOCAL (line 210) | pub const RT_TABLE_LOCAL: u8 = 255;
constant RTM_F_NOTIFY (line 213) | pub const RTM_F_NOTIFY: u32 = 256;
constant RTM_F_CLONED (line 219) | pub const RTM_F_CLONED: u32 = 512;
constant RTM_F_EQUALIZE (line 221) | pub const RTM_F_EQUALIZE: u32 = 1024;
constant RTM_F_PREFIX (line 223) | pub const RTM_F_PREFIX: u32 = 2048;
constant RTM_F_LOOKUP_TABLE (line 229) | pub const RTM_F_LOOKUP_TABLE: u32 = 4096;
constant RTM_F_FIB_MATCH (line 231) | pub const RTM_F_FIB_MATCH: u32 = 8192;
constant AF_UNSPEC (line 233) | pub const AF_UNSPEC: u16 = libc::AF_UNSPEC as u16;
constant AF_UNIX (line 234) | pub const AF_UNIX: u16 = libc::AF_UNIX as u16;
constant AF_INET (line 236) | pub const AF_INET: u16 = libc::AF_INET as u16;
constant AF_AX25 (line 237) | pub const AF_AX25: u16 = libc::AF_AX25 as u16;
constant AF_IPX (line 238) | pub const AF_IPX: u16 = libc::AF_IPX as u16;
constant AF_APPLETALK (line 239) | pub const AF_APPLETALK: u16 = libc::AF_APPLETALK as u16;
constant AF_NETROM (line 240) | pub const AF_NETROM: u16 = libc::AF_NETROM as u16;
constant AF_BRIDGE (line 241) | pub const AF_BRIDGE: u16 = libc::AF_BRIDGE as u16;
constant AF_ATMPVC (line 242) | pub const AF_ATMPVC: u16 = libc::AF_ATMPVC as u16;
constant AF_X25 (line 243) | pub const AF_X25: u16 = libc::AF_X25 as u16;
constant AF_INET6 (line 244) | pub const AF_INET6: u16 = libc::AF_INET6 as u16;
constant AF_ROSE (line 245) | pub const AF_ROSE: u16 = libc::AF_ROSE as u16;
constant AF_DECNET (line 246) | pub const AF_DECNET: u16 = libc::AF_DECnet as u16;
constant AF_NETBEUI (line 247) | pub const AF_NETBEUI: u16 = libc::AF_NETBEUI as u16;
constant AF_SECURITY (line 248) | pub const AF_SECURITY: u16 = libc::AF_SECURITY as u16;
constant AF_KEY (line 249) | pub const AF_KEY: u16 = libc::AF_KEY as u16;
constant AF_NETLINK (line 250) | pub const AF_NETLINK: u16 = libc::AF_NETLINK as u16;
constant AF_PACKET (line 252) | pub const AF_PACKET: u16 = libc::AF_PACKET as u16;
constant AF_ASH (line 253) | pub const AF_ASH: u16 = libc::AF_ASH as u16;
constant AF_ECONET (line 254) | pub const AF_ECONET: u16 = libc::AF_ECONET as u16;
constant AF_ATMSVC (line 255) | pub const AF_ATMSVC: u16 = libc::AF_ATMSVC as u16;
constant AF_RDS (line 256) | pub const AF_RDS: u16 = libc::AF_RDS as u16;
constant AF_SNA (line 257) | pub const AF_SNA: u16 = libc::AF_SNA as u16;
constant AF_IRDA (line 258) | pub const AF_IRDA: u16 = libc::AF_IRDA as u16;
constant AF_PPPOX (line 259) | pub const AF_PPPOX: u16 = libc::AF_PPPOX as u16;
constant AF_WANPIPE (line 260) | pub const AF_WANPIPE: u16 = libc::AF_WANPIPE as u16;
constant AF_LLC (line 261) | pub const AF_LLC: u16 = libc::AF_LLC as u16;
constant AF_CAN (line 262) | pub const AF_CAN: u16 = libc::AF_CAN as u16;
constant AF_TIPC (line 263) | pub const AF_TIPC: u16 = libc::AF_TIPC as u16;
constant AF_BLUETOOTH (line 264) | pub const AF_BLUETOOTH: u16 = libc::AF_BLUETOOTH as u16;
constant AF_IUCV (line 265) | pub const AF_IUCV: u16 = libc::AF_IUCV as u16;
constant AF_RXRPC (line 266) | pub const AF_RXRPC: u16 = libc::AF_RXRPC as u16;
constant AF_ISDN (line 267) | pub const AF_ISDN: u16 = libc::AF_ISDN as u16;
constant AF_PHONET (line 268) | pub const AF_PHONET: u16 = libc::AF_PHONET as u16;
constant AF_IEEE802154 (line 269) | pub const AF_IEEE802154: u16 = libc::AF_IEEE802154 as u16;
constant AF_CAIF (line 270) | pub const AF_CAIF: u16 = libc::AF_CAIF as u16;
constant AF_ALG (line 271) | pub const AF_ALG: u16 = libc::AF_ALG as u16;
constant NETNSA_NONE (line 273) | pub const NETNSA_NONE: u16 = 0;
constant NETNSA_NSID (line 274) | pub const NETNSA_NSID: u16 = 1;
constant NETNSA_PID (line 275) | pub const NETNSA_PID: u16 = 2;
constant NETNSA_FD (line 276) | pub const NETNSA_FD: u16 = 3;
constant NETNSA_NSID_NOT_ASSIGNED (line 277) | pub const NETNSA_NSID_NOT_ASSIGNED: i32 = -1;
constant NUD_INCOMPLETE (line 280) | pub const NUD_INCOMPLETE: u16 = 1;
constant NUD_REACHABLE (line 282) | pub const NUD_REACHABLE: u16 = 2;
constant NUD_STALE (line 284) | pub const NUD_STALE: u16 = 4;
constant NUD_DELAY (line 286) | pub const NUD_DELAY: u16 = 8;
constant NUD_PROBE (line 288) | pub const NUD_PROBE: u16 = 16;
constant NUD_FAILED (line 290) | pub const NUD_FAILED: u16 = 32;
constant NUD_NOARP (line 293) | pub const NUD_NOARP: u16 = 64;
constant NUD_PERMANENT (line 296) | pub const NUD_PERMANENT: u16 = 128;
constant NUD_NONE (line 298) | pub const NUD_NONE: u16 = 0;
constant NTF_USE (line 301) | pub const NTF_USE: u8 = 1;
constant NTF_SELF (line 302) | pub const NTF_SELF: u8 = 2;
constant NTF_MASTER (line 303) | pub const NTF_MASTER: u8 = 4;
constant NTF_PROXY (line 304) | pub const NTF_PROXY: u8 = 8;
constant NTF_EXT_LEARNED (line 305) | pub const NTF_EXT_LEARNED: u8 = 16;
constant NTF_OFFLOADED (line 306) | pub const NTF_OFFLOADED: u8 = 32;
constant NTF_ROUTER (line 307) | pub const NTF_ROUTER: u8 = 128;
constant TCA_UNSPEC (line 309) | pub const TCA_UNSPEC: u16 = 0;
constant TCA_KIND (line 310) | pub const TCA_KIND: u16 = 1;
constant TCA_OPTIONS (line 311) | pub const TCA_OPTIONS: u16 = 2;
constant TCA_STATS (line 312) | pub const TCA_STATS: u16 = 3;
constant TCA_XSTATS (line 313) | pub const TCA_XSTATS: u16 = 4;
constant TCA_RATE (line 314) | pub const TCA_RATE: u16 = 5;
constant TCA_FCNT (line 315) | pub const TCA_FCNT: u16 = 6;
constant TCA_STATS2 (line 316) | pub const TCA_STATS2: u16 = 7;
constant TCA_STAB (line 317) | pub const TCA_STAB: u16 = 8;
constant TCA_PAD (line 318) | pub const TCA_PAD: u16 = 9;
constant TCA_DUMP_INVISIBLE (line 319) | pub const TCA_DUMP_INVISIBLE: u16 = 10;
constant TCA_CHAIN (line 320) | pub const TCA_CHAIN: u16 = 11;
constant TCA_HW_OFFLOAD (line 321) | pub const TCA_HW_OFFLOAD: u16 = 12;
constant TCA_INGRESS_BLOCK (line 322) | pub const TCA_INGRESS_BLOCK: u16 = 13;
constant TCA_EGRESS_BLOCK (line 323) | pub const TCA_EGRESS_BLOCK: u16 = 14;
constant TCA_STATS_UNSPEC (line 324) | pub const TCA_STATS_UNSPEC: u16 = 0;
constant TCA_STATS_BASIC (line 325) | pub const TCA_STATS_BASIC: u16 = 1;
constant TCA_STATS_RATE_EST (line 326) | pub const TCA_STATS_RATE_EST: u16 = 2;
constant TCA_STATS_QUEUE (line 327) | pub const TCA_STATS_QUEUE: u16 = 3;
constant TCA_STATS_APP (line 328) | pub const TCA_STATS_APP: u16 = 4;
constant TCA_STATS_RATE_EST64 (line 329) | pub const TCA_STATS_RATE_EST64: u16 = 5;
constant TCA_STATS_PAD (line 330) | pub const TCA_STATS_PAD: u16 = 6;
constant TCA_STATS_BASIC_HW (line 331) | pub const TCA_STATS_BASIC_HW: u16 = 7;
constant NDTA_UNSPEC (line 333) | pub const NDTA_UNSPEC: u16 = 0;
constant NDTA_NAME (line 334) | pub const NDTA_NAME: u16 = 1;
constant NDTA_THRESH1 (line 335) | pub const NDTA_THRESH1: u16 = 2;
constant NDTA_THRESH2 (line 336) | pub const NDTA_THRESH2: u16 = 3;
constant NDTA_THRESH3 (line 337) | pub const NDTA_THRESH3: u16 = 4;
constant NDTA_CONFIG (line 338) | pub const NDTA_CONFIG: u16 = 5;
constant NDTA_PARMS (line 339) | pub const NDTA_PARMS: u16 = 6;
constant NDTA_STATS (line 340) | pub const NDTA_STATS: u16 = 7;
constant NDTA_GC_INTERVAL (line 341) | pub const NDTA_GC_INTERVAL: u16 = 8;
constant NDTA_PAD (line 342) | pub const NDTA_PAD: u16 = 9;
constant RTA_UNSPEC (line 344) | pub const RTA_UNSPEC: u16 = 0;
constant RTA_DST (line 345) | pub const RTA_DST: u16 = 1;
constant RTA_SRC (line 346) | pub const RTA_SRC: u16 = 2;
constant RTA_IIF (line 347) | pub const RTA_IIF: u16 = 3;
constant RTA_OIF (line 348) | pub const RTA_OIF: u16 = 4;
constant RTA_GATEWAY (line 349) | pub const RTA_GATEWAY: u16 = 5;
constant RTA_PRIORITY (line 350) | pub const RTA_PRIORITY: u16 = 6;
constant RTA_PREFSRC (line 351) | pub const RTA_PREFSRC: u16 = 7;
constant RTA_METRICS (line 352) | pub const RTA_METRICS: u16 = 8;
constant RTA_MULTIPATH (line 353) | pub const RTA_MULTIPATH: u16 = 9;
constant RTA_PROTOINFO (line 354) | pub const RTA_PROTOINFO: u16 = 10;
constant RTA_FLOW (line 355) | pub const RTA_FLOW: u16 = 11;
constant RTA_CACHEINFO (line 356) | pub const RTA_CACHEINFO: u16 = 12;
constant RTA_SESSION (line 357) | pub const RTA_SESSION: u16 = 13;
constant RTA_MP_ALGO (line 358) | pub const RTA_MP_ALGO: u16 = 14;
constant RTA_TABLE (line 359) | pub const RTA_TABLE: u16 = 15;
constant RTA_MARK (line 360) | pub const RTA_MARK: u16 = 16;
constant RTA_MFC_STATS (line 361) | pub const RTA_MFC_STATS: u16 = 17;
constant RTA_VIA (line 362) | pub const RTA_VIA: u16 = 18;
constant RTA_NEWDST (line 363) | pub const RTA_NEWDST: u16 = 19;
constant RTA_PREF (line 364) | pub const RTA_PREF: u16 = 20;
constant RTA_ENCAP_TYPE (line 365) | pub const RTA_ENCAP_TYPE: u16 = 21;
constant RTA_ENCAP (line 366) | pub const RTA_ENCAP: u16 = 22;
constant RTA_EXPIRES (line 367) | pub const RTA_EXPIRES: u16 = 23;
constant RTA_PAD (line 368) | pub const RTA_PAD: u16 = 24;
constant RTA_UID (line 369) | pub const RTA_UID: u16 = 25;
constant RTA_TTL_PROPAGATE (line 370) | pub const RTA_TTL_PROPAGATE: u16 = 26;
constant RTAX_UNSPEC (line 372) | pub const RTAX_UNSPEC: u16 = 0;
constant RTAX_LOCK (line 373) | pub const RTAX_LOCK: u16 = 1;
constant RTAX_MTU (line 374) | pub const RTAX_MTU: u16 = 2;
constant RTAX_WINDOW (line 375) | pub const RTAX_WINDOW: u16 = 3;
constant RTAX_RTT (line 376) | pub const RTAX_RTT: u16 = 4;
constant RTAX_RTTVAR (line 377) | pub const RTAX_RTTVAR: u16 = 5;
constant RTAX_SSTHRESH (line 378) | pub const RTAX_SSTHRESH: u16 = 6;
constant RTAX_CWND (line 379) | pub const RTAX_CWND: u16 = 7;
constant RTAX_ADVMSS (line 380) | pub const RTAX_ADVMSS: u16 = 8;
constant RTAX_REORDERING (line 381) | pub const RTAX_REORDERING: u16 = 9;
constant RTAX_HOPLIMIT (line 382) | pub const RTAX_HOPLIMIT: u16 = 10;
constant RTAX_INITCWND (line 383) | pub const RTAX_INITCWND: u16 = 11;
constant RTAX_FEATURES (line 384) | pub const RTAX_FEATURES: u16 = 12;
constant RTAX_RTO_MIN (line 385) | pub const RTAX_RTO_MIN: u16 = 13;
constant RTAX_INITRWND (line 386) | pub const RTAX_INITRWND: u16 = 14;
constant RTAX_QUICKACK (line 387) | pub const RTAX_QUICKACK: u16 = 15;
constant RTAX_CC_ALGO (line 388) | pub const RTAX_CC_ALGO: u16 = 16;
constant RTAX_FASTOPEN_NO_COOKIE (line 389) | pub const RTAX_FASTOPEN_NO_COOKIE: u16 = 17;
constant IFLA_INFO_UNSPEC (line 391) | pub const IFLA_INFO_UNSPEC: u16 = 0;
constant IFLA_INFO_KIND (line 392) | pub const IFLA_INFO_KIND: u16 = 1;
constant IFLA_INFO_DATA (line 393) | pub const IFLA_INFO_DATA: u16 = 2;
constant IFLA_INFO_XSTATS (line 394) | pub const IFLA_INFO_XSTATS: u16 = 3;
constant IFLA_INFO_SLAVE_KIND (line 395) | pub const IFLA_INFO_SLAVE_KIND: u16 = 4;
constant IFLA_INFO_SLAVE_DATA (line 396) | pub const IFLA_INFO_SLAVE_DATA: u16 = 5;
constant IFLA_BRIDGE_FLAGS (line 398) | pub const IFLA_BRIDGE_FLAGS: u16 = 0;
constant BRIDGE_FLAGS_MASTER (line 399) | pub const BRIDGE_FLAGS_MASTER: u16 = 1;
constant BRIDGE_FLAGS_SELF (line 400) | pub const BRIDGE_FLAGS_SELF: u16 = 2;
constant IFLA_BRIDGE_VLAN_INFO (line 402) | pub const IFLA_BRIDGE_VLAN_INFO: u16 = 2;
constant BRIDGE_VLAN_INFO_MASTER (line 403) | pub const BRIDGE_VLAN_INFO_MASTER: u16 = 1;
constant BRIDGE_VLAN_INFO_PVID (line 404) | pub const BRIDGE_VLAN_INFO_PVID: u16 = 4;
constant BRIDGE_VLAN_INFO_UNTAGGED (line 405) | pub const BRIDGE_VLAN_INFO_UNTAGGED: u16 = 8;
constant BRIDGE_VLAN_INFO_RANGE_BEGIN (line 406) | pub const BRIDGE_VLAN_INFO_RANGE_BEGIN: u16 = 16;
constant BRIDGE_VLAN_INFO_RANGE_END (line 407) | pub const BRIDGE_VLAN_INFO_RANGE_END: u16 = 32;
constant IFLA_BR_UNSPEC (line 409) | pub const IFLA_BR_UNSPEC: u16 = 0;
constant IFLA_BR_FORWARD_DELAY (line 410) | pub const IFLA_BR_FORWARD_DELAY: u16 = 1;
constant IFLA_BR_HELLO_TIME (line 411) | pub const IFLA_BR_HELLO_TIME: u16 = 2;
constant IFLA_BR_MAX_AGE (line 412) | pub const IFLA_BR_MAX_AGE: u16 = 3;
constant IFLA_BR_AGEING_TIME (line 413) | pub const IFLA_BR_AGEING_TIME: u16 = 4;
constant IFLA_BR_STP_STATE (line 414) | pub const IFLA_BR_STP_STATE: u16 = 5;
constant IFLA_BR_PRIORITY (line 415) | pub const IFLA_BR_PRIORITY: u16 = 6;
constant IFLA_BR_VLAN_FILTERING (line 416) | pub const IFLA_BR_VLAN_FILTERING: u16 = 7;
constant IFLA_BR_VLAN_PROTOCOL (line 417) | pub const IFLA_BR_VLAN_PROTOCOL: u16 = 8;
constant IFLA_BR_GROUP_FWD_MASK (line 418) | pub const IFLA_BR_GROUP_FWD_MASK: u16 = 9;
constant IFLA_BR_ROOT_ID (line 419) | pub const IFLA_BR_ROOT_ID: u16 = 10;
constant IFLA_BR_BRIDGE_ID (line 420) | pub const IFLA_BR_BRIDGE_ID: u16 = 11;
constant IFLA_BR_ROOT_PORT (line 421) | pub const IFLA_BR_ROOT_PORT: u16 = 12;
constant IFLA_BR_ROOT_PATH_COST (line 422) | pub const IFLA_BR_ROOT_PATH_COST: u16 = 13;
constant IFLA_BR_TOPOLOGY_CHANGE (line 423) | pub const IFLA_BR_TOPOLOGY_CHANGE: u16 = 14;
constant IFLA_BR_TOPOLOGY_CHANGE_DETECTED (line 424) | pub const IFLA_BR_TOPOLOGY_CHANGE_DETECTED: u16 = 15;
constant IFLA_BR_HELLO_TIMER (line 425) | pub const IFLA_BR_HELLO_TIMER: u16 = 16;
constant IFLA_BR_TCN_TIMER (line 426) | pub const IFLA_BR_TCN_TIMER: u16 = 17;
constant IFLA_BR_TOPOLOGY_CHANGE_TIMER (line 427) | pub const IFLA_BR_TOPOLOGY_CHANGE_TIMER: u16 = 18;
constant IFLA_BR_GC_TIMER (line 428) | pub const IFLA_BR_GC_TIMER: u16 = 19;
constant IFLA_BR_GROUP_ADDR (line 429) | pub const IFLA_BR_GROUP_ADDR: u16 = 20;
constant IFLA_BR_FDB_FLUSH (line 430) | pub const IFLA_BR_FDB_FLUSH: u16 = 21;
constant IFLA_BR_MCAST_ROUTER (line 431) | pub const IFLA_BR_MCAST_ROUTER: u16 = 22;
constant IFLA_BR_MCAST_SNOOPING (line 432) | pub const IFLA_BR_MCAST_SNOOPING: u16 = 23;
constant IFLA_BR_MCAST_QUERY_USE_IFADDR (line 433) | pub const IFLA_BR_MCAST_QUERY_USE_IFADDR: u16 = 24;
constant IFLA_BR_MCAST_QUERIER (line 434) | pub const IFLA_BR_MCAST_QUERIER: u16 = 25;
constant IFLA_BR_MCAST_HASH_ELASTICITY (line 435) | pub const IFLA_BR_MCAST_HASH_ELASTICITY: u16 = 26;
constant IFLA_BR_MCAST_HASH_MAX (line 436) | pub const IFLA_BR_MCAST_HASH_MAX: u16 = 27;
constant IFLA_BR_MCAST_LAST_MEMBER_CNT (line 437) | pub const IFLA_BR_MCAST_LAST_MEMBER_CNT: u16 = 28;
constant IFLA_BR_MCAST_STARTUP_QUERY_CNT (line 438) | pub const IFLA_BR_MCAST_STARTUP_QUERY_CNT: u16 = 29;
constant IFLA_BR_MCAST_LAST_MEMBER_INTVL (line 439) | pub const IFLA_BR_MCAST_LAST_MEMBER_INTVL: u16 = 30;
constant IFLA_BR_MCAST_MEMBERSHIP_INTVL (line 440) | pub const IFLA_BR_MCAST_MEMBERSHIP_INTVL: u16 = 31;
constant IFLA_BR_MCAST_QUERIER_INTVL (line 441) | pub const IFLA_BR_MCAST_QUERIER_INTVL: u16 = 32;
constant IFLA_BR_MCAST_QUERY_INTVL (line 442) | pub const IFLA_BR_MCAST_QUERY_INTVL: u16 = 33;
constant IFLA_BR_MCAST_QUERY_RESPONSE_INTVL (line 443) | pub const IFLA_BR_MCAST_QUERY_RESPONSE_INTVL: u16 = 34;
constant IFLA_BR_MCAST_STARTUP_QUERY_INTVL (line 444) | pub const IFLA_BR_MCAST_STARTUP_QUERY_INTVL: u16 = 35;
constant IFLA_BR_NF_CALL_IPTABLES (line 445) | pub const IFLA_BR_NF_CALL_IPTABLES: u16 = 36;
constant IFLA_BR_NF_CALL_IP6TABLES (line 446) | pub const IFLA_BR_NF_CALL_IP6TABLES: u16 = 37;
constant IFLA_BR_NF_CALL_ARPTABLES (line 447) | pub const IFLA_BR_NF_CALL_ARPTABLES: u16 = 38;
constant IFLA_BR_VLAN_DEFAULT_PVID (line 448) | pub const IFLA_BR_VLAN_DEFAULT_PVID: u16 = 39;
constant IFLA_BR_PAD (line 449) | pub const IFLA_BR_PAD: u16 = 40;
constant IFLA_BR_VLAN_STATS_ENABLED (line 450) | pub const IFLA_BR_VLAN_STATS_ENABLED: u16 = 41;
constant IFLA_BR_MCAST_STATS_ENABLED (line 451) | pub const IFLA_BR_MCAST_STATS_ENABLED: u16 = 42;
constant IFLA_BR_MCAST_IGMP_VERSION (line 452) | pub const IFLA_BR_MCAST_IGMP_VERSION: u16 = 43;
constant IFLA_BR_MCAST_MLD_VERSION (line 453) | pub const IFLA_BR_MCAST_MLD_VERSION: u16 = 44;
constant IFLA_BR_VLAN_STATS_PER_PORT (line 454) | pub const IFLA_BR_VLAN_STATS_PER_PORT: u16 = 45;
constant IFLA_BR_MULTI_BOOLOPT (line 455) | pub const IFLA_BR_MULTI_BOOLOPT: u16 = 46;
constant IFLA_MACVLAN_UNSPEC (line 456) | pub const IFLA_MACVLAN_UNSPEC: u16 = 0;
constant IFLA_MACVLAN_MODE (line 457) | pub const IFLA_MACVLAN_MODE: u16 = 1;
constant IFLA_MACVLAN_FLAGS (line 458) | pub const IFLA_MACVLAN_FLAGS: u16 = 2;
constant IFLA_MACVLAN_MACADDR_MODE (line 459) | pub const IFLA_MACVLAN_MACADDR_MODE: u16 = 3;
constant IFLA_MACVLAN_MACADDR (line 460) | pub const IFLA_MACVLAN_MACADDR: u16 = 4;
constant IFLA_MACVLAN_MACADDR_DATA (line 461) | pub const IFLA_MACVLAN_MACADDR_DATA: u16 = 5;
constant IFLA_MACVLAN_MACADDR_COUNT (line 462) | pub const IFLA_MACVLAN_MACADDR_COUNT: u16 = 6;
constant IFLA_VLAN_UNSPEC (line 463) | pub const IFLA_VLAN_UNSPEC: u16 = 0;
constant IFLA_VLAN_ID (line 464) | pub const IFLA_VLAN_ID: u16 = 1;
constant IFLA_VLAN_FLAGS (line 465) | pub const IFLA_VLAN_FLAGS: u16 = 2;
constant IFLA_VLAN_EGRESS_QOS (line 466) | pub const IFLA_VLAN_EGRESS_QOS: u16 = 3;
constant IFLA_VLAN_INGRESS_QOS (line 467) | pub const IFLA_VLAN_INGRESS_QOS: u16 = 4;
constant IFLA_VLAN_PROTOCOL (line 468) | pub const IFLA_VLAN_PROTOCOL: u16 = 5;
constant IFLA_VRF_UNSPEC (line 469) | pub const IFLA_VRF_UNSPEC: u16 = 0;
constant IFLA_VRF_TABLE (line 470) | pub const IFLA_VRF_TABLE: u16 = 1;
constant IFLA_IPVLAN_UNSPEC (line 471) | pub const IFLA_IPVLAN_UNSPEC: u16 = 0;
constant IFLA_IPVLAN_MODE (line 472) | pub const IFLA_IPVLAN_MODE: u16 = 1;
constant IFLA_IPVLAN_FLAGS (line 473) | pub const IFLA_IPVLAN_FLAGS: u16 = 2;
constant IFLA_IPOIB_UNSPEC (line 474) | pub const IFLA_IPOIB_UNSPEC: u16 = 0;
constant IFLA_IPOIB_PKEY (line 475) | pub const IFLA_IPOIB_PKEY: u16 = 1;
constant IFLA_IPOIB_MODE (line 476) | pub const IFLA_IPOIB_MODE: u16 = 2;
constant IFLA_IPOIB_UMCAST (line 477) | pub const IFLA_IPOIB_UMCAST: u16 = 3;
constant VETH_INFO_UNSPEC (line 478) | pub const VETH_INFO_UNSPEC: u16 = 0;
constant VETH_INFO_PEER (line 479) | pub const VETH_INFO_PEER: u16 = 1;
constant ARPHRD_NETROM (line 481) | pub const ARPHRD_NETROM: u16 = 0;
constant ARPHRD_ETHER (line 482) | pub const ARPHRD_ETHER: u16 = 1;
constant ARPHRD_EETHER (line 483) | pub const ARPHRD_EETHER: u16 = 2;
constant ARPHRD_AX25 (line 484) | pub const ARPHRD_AX25: u16 = 3;
constant ARPHRD_PRONET (line 485) | pub const ARPHRD_PRONET: u16 = 4;
constant ARPHRD_CHAOS (line 486) | pub const ARPHRD_CHAOS: u16 = 5;
constant ARPHRD_IEEE802 (line 487) | pub const ARPHRD_IEEE802: u16 = 6;
constant ARPHRD_ARCNET (line 488) | pub const ARPHRD_ARCNET: u16 = 7;
constant ARPHRD_APPLETLK (line 489) | pub const ARPHRD_APPLETLK: u16 = 8;
constant ARPHRD_DLCI (line 490) | pub const ARPHRD_DLCI: u16 = 15;
constant ARPHRD_ATM (line 491) | pub const ARPHRD_ATM: u16 = 19;
constant ARPHRD_METRICOM (line 492) | pub const ARPHRD_METRICOM: u16 = 23;
constant ARPHRD_IEEE1394 (line 493) | pub const ARPHRD_IEEE1394: u16 = 24;
constant ARPHRD_EUI64 (line 494) | pub const ARPHRD_EUI64: u16 = 27;
constant ARPHRD_INFINIBAND (line 495) | pub const ARPHRD_INFINIBAND: u16 = 32;
constant ARPHRD_SLIP (line 496) | pub const ARPHRD_SLIP: u16 = 256;
constant ARPHRD_CSLIP (line 497) | pub const ARPHRD_CSLIP: u16 = 257;
constant ARPHRD_SLIP6 (line 498) | pub const ARPHRD_SLIP6: u16 = 258;
constant ARPHRD_CSLIP6 (line 499) | pub const ARPHRD_CSLIP6: u16 = 259;
constant ARPHRD_RSRVD (line 500) | pub const ARPHRD_RSRVD: u16 = 260;
constant ARPHRD_ADAPT (line 501) | pub const ARPHRD_ADAPT: u16 = 264;
constant ARPHRD_ROSE (line 502) | pub const ARPHRD_ROSE: u16 = 270;
constant ARPHRD_X25 (line 503) | pub const ARPHRD_X25: u16 = 271;
constant ARPHRD_HWX25 (line 504) | pub const ARPHRD_HWX25: u16 = 272;
constant ARPHRD_CAN (line 505) | pub const ARPHRD_CAN: u16 = 280;
constant ARPHRD_PPP (line 506) | pub const ARPHRD_PPP: u16 = 512;
constant ARPHRD_CISCO (line 507) | pub const ARPHRD_CISCO: u16 = 513;
constant ARPHRD_HDLC (line 508) | pub const ARPHRD_HDLC: u16 = 513;
constant ARPHRD_LAPB (line 509) | pub const ARPHRD_LAPB: u16 = 516;
constant ARPHRD_DDCMP (line 510) | pub const ARPHRD_DDCMP: u16 = 517;
constant ARPHRD_RAWHDLC (line 511) | pub const ARPHRD_RAWHDLC: u16 = 518;
constant ARPHRD_RAWIP (line 512) | pub const ARPHRD_RAWIP: u16 = 519;
constant ARPHRD_TUNNEL (line 513) | pub const ARPHRD_TUNNEL: u16 = 768;
constant ARPHRD_TUNNEL6 (line 514) | pub const ARPHRD_TUNNEL6: u16 = 769;
constant ARPHRD_FRAD (line 515) | pub const ARPHRD_FRAD: u16 = 770;
constant ARPHRD_SKIP (line 516) | pub const ARPHRD_SKIP: u16 = 771;
constant ARPHRD_LOOPBACK (line 517) | pub const ARPHRD_LOOPBACK: u16 = 772;
constant ARPHRD_LOCALTLK (line 518) | pub const ARPHRD_LOCALTLK: u16 = 773;
constant ARPHRD_FDDI (line 519) | pub const ARPHRD_FDDI: u16 = 774;
constant ARPHRD_BIF (line 520) | pub const ARPHRD_BIF: u16 = 775;
constant ARPHRD_SIT (line 521) | pub const ARPHRD_SIT: u16 = 776;
constant ARPHRD_IPDDP (line 522) | pub const ARPHRD_IPDDP: u16 = 777;
constant ARPHRD_IPGRE (line 523) | pub const ARPHRD_IPGRE: u16 = 778;
constant ARPHRD_PIMREG (line 524) | pub const ARPHRD_PIMREG: u16 = 779;
constant ARPHRD_HIPPI (line 525) | pub const ARPHRD_HIPPI: u16 = 780;
constant ARPHRD_ASH (line 526) | pub const ARPHRD_ASH: u16 = 781;
constant ARPHRD_ECONET (line 527) | pub const ARPHRD_ECONET: u16 = 782;
constant ARPHRD_IRDA (line 528) | pub const ARPHRD_IRDA: u16 = 783;
constant ARPHRD_FCPP (line 529) | pub const ARPHRD_FCPP: u16 = 784;
constant ARPHRD_FCAL (line 530) | pub const ARPHRD_FCAL: u16 = 785;
constant ARPHRD_FCPL (line 531) | pub const ARPHRD_FCPL: u16 = 786;
constant ARPHRD_FCFABRIC (line 532) | pub const ARPHRD_FCFABRIC: u16 = 787;
constant ARPHRD_IEEE802_TR (line 533) | pub const ARPHRD_IEEE802_TR: u16 = 800;
constant ARPHRD_IEEE80211 (line 534) | pub const ARPHRD_IEEE80211: u16 = 801;
constant ARPHRD_IEEE80211_PRISM (line 535) | pub const ARPHRD_IEEE80211_PRISM: u16 = 802;
constant ARPHRD_IEEE80211_RADIOTAP (line 536) | pub const ARPHRD_IEEE80211_RADIOTAP: u16 = 803;
constant ARPHRD_IEEE802154 (line 537) | pub const ARPHRD_IEEE802154: u16 = 804;
constant ARPHRD_IEEE802154_MONITOR (line 538) | pub const ARPHRD_IEEE802154_MONITOR: u16 = 805;
constant ARPHRD_PHONET (line 539) | pub const ARPHRD_PHONET: u16 = 820;
constant ARPHRD_PHONET_PIPE (line 540) | pub const ARPHRD_PHONET_PIPE: u16 = 821;
constant ARPHRD_CAIF (line 541) | pub const ARPHRD_CAIF: u16 = 822;
constant ARPHRD_IP6GRE (line 542) | pub const ARPHRD_IP6GRE: u16 = 823;
constant ARPHRD_NETLINK (line 543) | pub const ARPHRD_NETLINK: u16 = 824;
constant ARPHRD_6LOWPAN (line 544) | pub const ARPHRD_6LOWPAN: u16 = 825;
constant ARPHRD_VSOCKMON (line 545) | pub const ARPHRD_VSOCKMON: u16 = 826;
constant ARPHRD_VOID (line 546) | pub const ARPHRD_VOID: u16 = 65535;
constant ARPHRD_NONE (line 547) | pub const ARPHRD_NONE: u16 = 65534;
constant IFA_UNSPEC (line 549) | pub const IFA_UNSPEC: u16 = 0;
constant IFA_ADDRESS (line 550) | pub const IFA_ADDRESS: u16 = 1;
constant IFA_LOCAL (line 551) | pub const IFA_LOCAL: u16 = 2;
constant IFA_LABEL (line 552) | pub const IFA_LABEL: u16 = 3;
constant IFA_BROADCAST (line 553) | pub const IFA_BROADCAST: u16 = 4;
constant IFA_ANYCAST (line 554) | pub const IFA_ANYCAST: u16 = 5;
constant IFA_CACHEINFO (line 555) | pub const IFA_CACHEINFO: u16 = 6;
constant IFA_MULTICAST (line 556) | pub const IFA_MULTICAST: u16 = 7;
constant IFA_FLAGS (line 557) | pub const IFA_FLAGS: u16 = 8;
constant IFLA_UNSPEC (line 559) | pub const IFLA_UNSPEC: u16 = 0;
constant IFLA_ADDRESS (line 560) | pub const IFLA_ADDRESS: u16 = 1;
constant IFLA_BROADCAST (line 561) | pub const IFLA_BROADCAST: u16 = 2;
constant IFLA_IFNAME (line 562) | pub const IFLA_IFNAME: u16 = 3;
constant IFLA_MTU (line 563) | pub const IFLA_MTU: u16 = 4;
constant IFLA_LINK (line 564) | pub const IFLA_LINK: u16 = 5;
constant IFLA_QDISC (line 565) | pub const IFLA_QDISC: u16 = 6;
constant IFLA_STATS (line 566) | pub const IFLA_STATS: u16 = 7;
constant IFLA_COST (line 567) | pub const IFLA_COST: u16 = 8;
constant IFLA_PRIORITY (line 568) | pub const IFLA_PRIORITY: u16 = 9;
constant IFLA_MASTER (line 569) | pub const IFLA_MASTER: u16 = 10;
constant IFLA_WIRELESS (line 570) | pub const IFLA_WIRELESS: u16 = 11;
constant IFLA_PROTINFO (line 571) | pub const IFLA_PROTINFO: u16 = 12;
constant IFLA_TXQLEN (line 572) | pub const IFLA_TXQLEN: u16 = 13;
constant IFLA_MAP (line 573) | pub const IFLA_MAP: u16 = 14;
constant IFLA_WEIGHT (line 574) | pub const IFLA_WEIGHT: u16 = 15;
constant IFLA_OPERSTATE (line 575) | pub const IFLA_OPERSTATE: u16 = 16;
constant IFLA_LINKMODE (line 576) | pub const IFLA_LINKMODE: u16 = 17;
constant IFLA_LINKINFO (line 577) | pub const IFLA_LINKINFO: u16 = 18;
constant IFLA_NET_NS_PID (line 578) | pub const IFLA_NET_NS_PID: u16 = 19;
constant IFLA_IFALIAS (line 579) | pub const IFLA_IFALIAS: u16 = 20;
constant IFLA_NUM_VF (line 580) | pub const IFLA_NUM_VF: u16 = 21;
constant IFLA_VFINFO_LIST (line 581) | pub const IFLA_VFINFO_LIST: u16 = 22;
constant IFLA_STATS64 (line 582) | pub const IFLA_STATS64: u16 = 23;
constant IFLA_VF_PORTS (line 583) | pub const IFLA_VF_PORTS: u16 = 24;
constant IFLA_PORT_SELF (line 584) | pub const IFLA_PORT_SELF: u16 = 25;
constant IFLA_AF_SPEC (line 585) | pub const IFLA_AF_SPEC: u16 = 26;
constant IFLA_GROUP (line 586) | pub const IFLA_GROUP: u16 = 27;
constant IFLA_NET_NS_FD (line 587) | pub const IFLA_NET_NS_FD: u16 = 28;
constant IFLA_EXT_MASK (line 588) | pub const IFLA_EXT_MASK: u16 = 29;
constant IFLA_PROMISCUITY (line 589) | pub const IFLA_PROMISCUITY: u16 = 30;
constant IFLA_NUM_TX_QUEUES (line 590) | pub const IFLA_NUM_TX_QUEUES: u16 = 31;
constant IFLA_NUM_RX_QUEUES (line 591) | pub const IFLA_NUM_RX_QUEUES: u16 = 32;
constant IFLA_CARRIER (line 592) | pub const IFLA_CARRIER: u16 = 33;
constant IFLA_PHYS_PORT_ID (line 593) | pub const IFLA_PHYS_PORT_ID: u16 = 34;
constant IFLA_CARRIER_CHANGES (line 594) | pub const IFLA_CARRIER_CHANGES: u16 = 35;
constant IFLA_PHYS_SWITCH_ID (line 595) | pub const IFLA_PHYS_SWITCH_ID: u16 = 36;
constant IFLA_LINK_NETNSID (line 596) | pub const IFLA_LINK_NETNSID: u16 = 37;
constant IFLA_PHYS_PORT_NAME (line 597) | pub const IFLA_PHYS_PORT_NAME: u16 = 38;
constant IFLA_PROTO_DOWN (line 598) | pub const IFLA_PROTO_DOWN: u16 = 39;
constant IFLA_GSO_MAX_SEGS (line 599) | pub const IFLA_GSO_MAX_SEGS: u16 = 40;
constant IFLA_GSO_MAX_SIZE (line 600) | pub const IFLA_GSO_MAX_SIZE: u16 = 41;
constant IFLA_PAD (line 601) | pub const IFLA_PAD: u16 = 42;
constant IFLA_XDP (line 602) | pub const IFLA_XDP: u16 = 43;
constant IFLA_EVENT (line 603) | pub const IFLA_EVENT: u16 = 44;
constant IFLA_NEW_NETNSID (line 604) | pub const IFLA_NEW_NETNSID: u16 = 45;
constant IFLA_IF_NETNSID (line 605) | pub const IFLA_IF_NETNSID: u16 = 46;
constant IFLA_CARRIER_UP_COUNT (line 606) | pub const IFLA_CARRIER_UP_COUNT: u16 = 47;
constant IFLA_CARRIER_DOWN_COUNT (line 607) | pub const IFLA_CARRIER_DOWN_COUNT: u16 = 48;
constant IFLA_NEW_IFINDEX (line 608) | pub const IFLA_NEW_IFINDEX: u16 = 49;
constant IFLA_MIN_MTU (line 609) | pub const IFLA_MIN_MTU: u16 = 50;
constant IFLA_MAX_MTU (line 610) | pub const IFLA_MAX_MTU: u16 = 51;
constant IFLA_PROP_LIST (line 611) | pub const IFLA_PROP_LIST: u16 = 52;
constant IFLA_ALT_IFNAME (line 612) | pub const IFLA_ALT_IFNAME: u16 = 53;
constant IFLA_PERM_ADDRESS (line 613) | pub const IFLA_PERM_ADDRESS: u16 = 54;
constant IFLA_PROTO_DOWN_REASON (line 614) | pub const IFLA_PROTO_DOWN_REASON: u16 = 55;
constant IFLA_INET_UNSPEC (line 615) | pub const IFLA_INET_UNSPEC: u16 = 0;
constant IFLA_INET_CONF (line 616) | pub const IFLA_INET_CONF: u16 = 1;
constant IFLA_INET6_UNSPEC (line 617) | pub const IFLA_INET6_UNSPEC: u16 = 0;
constant IFLA_INET6_FLAGS (line 618) | pub const IFLA_INET6_FLAGS: u16 = 1;
constant IFLA_INET6_CONF (line 619) | pub const IFLA_INET6_CONF: u16 = 2;
constant IFLA_INET6_STATS (line 620) | pub const IFLA_INET6_STATS: u16 = 3;
constant IFLA_INET6_CACHEINFO (line 622) | pub const IFLA_INET6_CACHEINFO: u16 = 5;
constant IFLA_INET6_ICMP6STATS (line 623) | pub const IFLA_INET6_ICMP6STATS: u16 = 6;
constant IFLA_INET6_TOKEN (line 624) | pub const IFLA_INET6_TOKEN: u16 = 7;
constant IFLA_INET6_ADDR_GEN_MODE (line 625) | pub const IFLA_INET6_ADDR_GEN_MODE: u16 = 8;
constant IFF_UP (line 628) | pub const IFF_UP: u32 = libc::IFF_UP as u32;
constant IFF_RUNNING (line 630) | pub const IFF_RUNNING: u32 = libc::IFF_RUNNING as u32;
constant IFF_LOWER_UP (line 632) | pub const IFF_LOWER_UP: u32 = libc::IFF_LOWER_UP as u32;
constant IFF_DORMANT (line 634) | pub const IFF_DORMANT: u32 = libc::IFF_DORMANT as u32;
constant IFF_BROADCAST (line 636) | pub const IFF_BROADCAST: u32 = libc::IFF_BROADCAST as u32;
constant IFF_MULTICAST (line 638) | pub const IFF_MULTICAST: u32 = libc::IFF_MULTICAST as u32;
constant IFF_ALLMULTI (line 640) | pub const IFF_ALLMULTI: u32 = libc::IFF_ALLMULTI as u32;
constant IFF_DEBUG (line 642) | pub const IFF_DEBUG: u32 = libc::IFF_DEBUG as u32;
constant IFF_LOOPBACK (line 644) | pub const IFF_LOOPBACK: u32 = libc::IFF_LOOPBACK as u32;
constant IFF_POINTOPOINT (line 646) | pub const IFF_POINTOPOINT: u32 = libc::IFF_POINTOPOINT as u32;
constant IFF_NOARP (line 648) | pub const IFF_NOARP: u32 = libc::IFF_NOARP as u32;
constant IFF_PROMISC (line 650) | pub const IFF_PROMISC: u32 = libc::IFF_PROMISC as u32;
constant IFF_MASTER (line 652) | pub const IFF_MASTER: u32 = libc::IFF_MASTER as u32;
constant IFF_SLAVE (line 654) | pub const IFF_SLAVE: u32 = libc::IFF_SLAVE as u32;
constant IFF_PORTSEL (line 656) | pub const IFF_PORTSEL: u32 = libc::IFF_PORTSEL as u32;
constant IFF_AUTOMEDIA (line 658) | pub const IFF_AUTOMEDIA: u32 = libc::IFF_AUTOMEDIA as u32;
constant IF_OPER_UNKNOWN (line 666) | pub const IF_OPER_UNKNOWN: u8 = 0;
constant IF_OPER_NOTPRESENT (line 667) | pub const IF_OPER_NOTPRESENT: u8 = 1;
constant IF_OPER_DOWN (line 668) | pub const IF_OPER_DOWN: u8 = 2;
constant IF_OPER_LOWERLAYERDOWN (line 669) | pub const IF_OPER_LOWERLAYERDOWN: u8 = 3;
constant IF_OPER_TESTING (line 670) | pub const IF_OPER_TESTING: u8 = 4;
constant IF_OPER_DORMANT (line 671) | pub const IF_OPER_DORMANT: u8 = 5;
constant IF_OPER_UP (line 672) | pub const IF_OPER_UP: u8 = 6;
constant NDA_UNSPEC (line 675) | pub const NDA_UNSPEC: u16 = 0;
constant NDA_DST (line 678) | pub const NDA_DST: u16 = 1;
constant NDA_LLADDR (line 681) | pub const NDA_LLADDR: u16 = 2;
constant NDA_CACHEINFO (line 683) | pub const NDA_CACHEINFO: u16 = 3;
constant NDA_PROBES (line 684) | pub const NDA_PROBES: u16 = 4;
constant NDA_VLAN (line 685) | pub const NDA_VLAN: u16 = 5;
constant NDA_PORT (line 686) | pub const NDA_PORT: u16 = 6;
constant NDA_VNI (line 687) | pub const NDA_VNI: u16 = 7;
constant NDA_IFINDEX (line 688) | pub const NDA_IFINDEX: u16 = 8;
constant NDA_MASTER (line 689) | pub const NDA_MASTER: u16 = 9;
constant NDA_LINK_NETNSID (line 690) | pub const NDA_LINK_NETNSID: u16 = 10;
constant NDA_SRC_VNI (line 691) | pub const NDA_SRC_VNI: u16 = 11;
constant FR_ACT_UNSPEC (line 695) | pub const FR_ACT_UNSPEC: u8 = 0;
constant FR_ACT_TO_TBL (line 697) | pub const FR_ACT_TO_TBL: u8 = 1;
constant FR_ACT_GOTO (line 699) | pub const FR_ACT_GOTO: u8 = 2;
constant FR_ACT_NOP (line 701) | pub const FR_ACT_NOP: u8 = 3;
constant FR_ACT_RES3 (line 702) | pub const FR_ACT_RES3: u8 = 4;
constant FR_ACT_RES4 (line 703) | pub const FR_ACT_RES4: u8 = 5;
constant FR_ACT_BLACKHOLE (line 705) | pub const FR_ACT_BLACKHOLE: u8 = 6;
constant FR_ACT_UNREACHABLE (line 707) | pub const FR_ACT_UNREACHABLE: u8 = 7;
constant FR_ACT_PROHIBIT (line 709) | pub const FR_ACT_PROHIBIT: u8 = 8;
constant FRA_UNSPEC (line 711) | pub const FRA_UNSPEC: u16 = 0;
constant FRA_DST (line 713) | pub const FRA_DST: u16 = 1;
constant FRA_SRC (line 715) | pub const FRA_SRC: u16 = 2;
constant FRA_IIFNAME (line 717) | pub const FRA_IIFNAME: u16 = 3;
constant FRA_GOTO (line 719) | pub const FRA_GOTO: u16 = 4;
constant FRA_UNUSED2 (line 721) | pub const FRA_UNUSED2: u16 = 5;
constant FRA_PRIORITY (line 724) | pub const FRA_PRIORITY: u16 = 6;
constant FRA_UNUSED3 (line 726) | pub const FRA_UNUSED3: u16 = 7;
constant FRA_UNUSED4 (line 727) | pub const FRA_UNUSED4: u16 = 8;
constant FRA_UNUSED5 (line 728) | pub const FRA_UNUSED5: u16 = 9;
constant FRA_FWMARK (line 731) | pub const FRA_FWMARK: u16 = 10;
constant FRA_FLOW (line 733) | pub const FRA_FLOW: u16 = 11;
constant FRA_TUN_ID (line 734) | pub const FRA_TUN_ID: u16 = 12;
constant FRA_SUPPRESS_IFGROUP (line 735) | pub const FRA_SUPPRESS_IFGROUP: u16 = 13;
constant FRA_SUPPRESS_PREFIXLEN (line 736) | pub const FRA_SUPPRESS_PREFIXLEN: u16 = 14;
constant FRA_TABLE (line 738) | pub const FRA_TABLE: u16 = 15;
constant FRA_FWMASK (line 740) | pub const FRA_FWMASK: u16 = 16;
constant FRA_OIFNAME (line 741) | pub const FRA_OIFNAME: u16 = 17;
constant FRA_PAD (line 742) | pub const FRA_PAD: u16 = 18;
constant FRA_L3MDEV (line 744) | pub const FRA_L3MDEV: u16 = 19;
constant FRA_UID_RANGE (line 746) | pub const FRA_UID_RANGE: u16 = 20;
constant FRA_PROTOCOL (line 748) | pub const FRA_PROTOCOL: u16 = 21;
constant FRA_IP_PROTO (line 750) | pub const FRA_IP_PROTO: u16 = 22;
constant FRA_SPORT_RANGE (line 752) | pub const FRA_SPORT_RANGE: u16 = 23;
constant FRA_DPORT_RANGE (line 754) | pub const FRA_DPORT_RANGE: u16 = 24;
constant FIB_RULE_PERMANENT (line 756) | pub const FIB_RULE_PERMANENT: u32 = 1;
constant FIB_RULE_INVERT (line 757) | pub const FIB_RULE_INVERT: u32 = 2;
constant FIB_RULE_UNRESOLVED (line 758) | pub const FIB_RULE_UNRESOLVED: u32 = 4;
constant FIB_RULE_IIF_DETACHED (line 759) | pub const FIB_RULE_IIF_DETACHED: u32 = 8;
constant FIB_RULE_DEV_DETACHED (line 760) | pub const FIB_RULE_DEV_DETACHED: u32 = FIB_RULE_IIF_DETACHED;
constant FIB_RULE_OIF_DETACHED (line 761) | pub const FIB_RULE_OIF_DETACHED: u32 = 10;
constant FIB_RULE_FIND_SADDR (line 763) | pub const FIB_RULE_FIND_SADDR: u32 = 10000;
constant IFA_F_SECONDARY (line 779) | pub const IFA_F_SECONDARY: u32 = 1;
constant IFA_F_TEMPORARY (line 780) | pub const IFA_F_TEMPORARY: u32 = 1;
constant IFA_F_NODAD (line 781) | pub const IFA_F_NODAD: u32 = 2;
constant IFA_F_OPTIMISTIC (line 782) | pub const IFA_F_OPTIMISTIC: u32 = 4;
constant IFA_F_DADFAILED (line 783) | pub const IFA_F_DADFAILED: u32 = 8;
constant IFA_F_HOMEADDRESS (line 784) | pub const IFA_F_HOMEADDRESS: u32 = 16;
constant IFA_F_DEPRECATED (line 785) | pub const IFA_F_DEPRECATED: u32 = 32;
constant IFA_F_TENTATIVE (line 786) | pub const IFA_F_TENTATIVE: u32 = 64;
constant IFA_F_PERMANENT (line 787) | pub const IFA_F_PERMANENT: u32 = 128;
constant IFA_F_MANAGETEMPADDR (line 788) | pub const IFA_F_MANAGETEMPADDR: u32 = 256;
constant IFA_F_NOPREFIXROUTE (line 789) | pub const IFA_F_NOPREFIXROUTE: u32 = 512;
constant IFA_F_MCAUTOJOIN (line 790) | pub const IFA_F_MCAUTOJOIN: u32 = 1024;
constant IFA_F_STABLE_PRIVACY (line 791) | pub const IFA_F_STABLE_PRIVACY: u32 = 2048;
constant RTNH_F_DEAD (line 798) | pub const RTNH_F_DEAD: u8 = 1;
constant RTNH_F_PERVASIVE (line 799) | pub const RTNH_F_PERVASIVE: u8 = 2;
constant RTNH_F_ONLINK (line 800) | pub const RTNH_F_ONLINK: u8 = 4;
constant RTNH_F_OFFLOAD (line 801) | pub const RTNH_F_OFFLOAD: u8 = 8;
constant RTNH_F_LINKDOWN (line 802) | pub const RTNH_F_LINKDOWN: u8 = 16;
constant RTNH_F_UNRESOLVED (line 803) | pub const RTNH_F_UNRESOLVED: u8 = 32;
constant TCM_IFINDEX_MAGIC_BLOCK (line 812) | pub const TCM_IFINDEX_MAGIC_BLOCK: u32 = 0xffff_ffff;
constant RTEXT_FILTER_VF (line 815) | pub const RTEXT_FILTER_VF: u32 = 1;
constant RTEXT_FILTER_BRVLAN (line 816) | pub const RTEXT_FILTER_BRVLAN: u32 = 2;
constant RTEXT_FILTER_BRVLAN_COMPRESSED (line 817) | pub const RTEXT_FILTER_BRVLAN_COMPRESSED: u32 = 4;
constant RTEXT_FILTER_SKIP_STATS (line 818) | pub const RTEXT_FILTER_SKIP_STATS: u32 = 8;
constant MACVLAN_MODE_PRIVATE (line 877) | pub const MACVLAN_MODE_PRIVATE: u32 = 1;
constant MACVLAN_MODE_VEPA (line 878) | pub const MACVLAN_MODE_VEPA: u32 = 2;
constant MACVLAN_MODE_BRIDGE (line 879) | pub const MACVLAN_MODE_BRIDGE: u32 = 4;
constant MACVLAN_MODE_PASSTHRU (line 880) | pub const MACVLAN_MODE_PASSTHRU: u32 = 8;
constant MACVLAN_MODE_SOURCE (line 881) | pub const MACVLAN_MODE_SOURCE: u32 = 16;
constant IFLA_VXLAN_UNSPEC (line 925) | pub const IFLA_VXLAN_UNSPEC: u16 = 0;
constant IFLA_VXLAN_ID (line 926) | pub const IFLA_VXLAN_ID: u16 = 1;
constant IFLA_VXLAN_GROUP (line 927) | pub const IFLA_VXLAN_GROUP: u16 = 2;
constant IFLA_VXLAN_LINK (line 928) | pub const IFLA_VXLAN_LINK: u16 = 3;
constant IFLA_VXLAN_LOCAL (line 929) | pub const IFLA_VXLAN_LOCAL: u16 = 4;
constant IFLA_VXLAN_TTL (line 930) | pub const IFLA_VXLAN_TTL: u16 = 5;
constant IFLA_VXLAN_TOS (line 931) | pub const IFLA_VXLAN_TOS: u16 = 6;
constant IFLA_VXLAN_LEARNING (line 932) | pub const IFLA_VXLAN_LEARNING: u16 = 7;
constant IFLA_VXLAN_AGEING (line 933) | pub const IFLA_VXLAN_AGEING: u16 = 8;
constant IFLA_VXLAN_LIMIT (line 934) | pub const IFLA_VXLAN_LIMIT: u16 = 9;
constant IFLA_VXLAN_PORT_RANGE (line 935) | pub const IFLA_VXLAN_PORT_RANGE: u16 = 10;
constant IFLA_VXLAN_PROXY (line 936) | pub const IFLA_VXLAN_PROXY: u16 = 11;
constant IFLA_VXLAN_RSC (line 937) | pub const IFLA_VXLAN_RSC: u16 = 12;
constant IFLA_VXLAN_L2MISS (line 938) | pub const IFLA_VXLAN_L2MISS: u16 = 13;
constant IFLA_VXLAN_L3MISS (line 939) | pub const IFLA_VXLAN_L3MISS: u16 = 14;
constant IFLA_VXLAN_PORT (line 940) | pub const IFLA_VXLAN_PORT: u16 = 15;
constant IFLA_VXLAN_GROUP6 (line 941) | pub const IFLA_VXLAN_GROUP6: u16 = 16;
constant IFLA_VXLAN_LOCAL6 (line 942) | pub const IFLA_VXLAN_LOCAL6: u16 = 17;
constant IFLA_VXLAN_UDP_CSUM (line 943) | pub const IFLA_VXLAN_UDP_CSUM: u16 = 18;
constant IFLA_VXLAN_UDP_ZERO_CSUM6_TX (line 944) | pub const IFLA_VXLAN_UDP_ZERO_CSUM6_TX: u16 = 19;
constant IFLA_VXLAN_UDP_ZERO_CSUM6_RX (line 945) | pub const IFLA_VXLAN_UDP_ZERO_CSUM6_RX: u16 = 20;
constant IFLA_VXLAN_REMCSUM_TX (line 946) | pub const IFLA_VXLAN_REMCSUM_TX: u16 = 21;
constant IFLA_VXLAN_REMCSUM_RX (line 947) | pub const IFLA_VXLAN_REMCSUM_RX: u16 = 22;
constant IFLA_VXLAN_GBP (line 948) | pub const IFLA_VXLAN_GBP: u16 = 23;
constant IFLA_VXLAN_REMCSUM_NOPARTIAL (line 949) | pub const IFLA_VXLAN_REMCSUM_NOPARTIAL: u16 = 24;
constant IFLA_VXLAN_COLLECT_METADATA (line 950) | pub const IFLA_VXLAN_COLLECT_METADATA: u16 = 25;
constant IFLA_VXLAN_LABEL (line 951) | pub const IFLA_VXLAN_LABEL: u16 = 26;
constant IFLA_VXLAN_GPE (line 952) | pub const IFLA_VXLAN_GPE: u16 = 27;
constant IFLA_VXLAN_TTL_INHERIT (line 953) | pub const IFLA_VXLAN_TTL_INHERIT: u16 = 28;
constant IFLA_VXLAN_DF (line 954) | pub const IFLA_VXLAN_DF: u16 = 29;
constant __IFLA_VXLAN_MAX (line 955) | pub const __IFLA_VXLAN_MAX: u16 = 30;
constant IFLA_BOND_UNSPEC (line 982) | pub const IFLA_BOND_UNSPEC: u16 = 0;
constant IFLA_BOND_MODE (line 983) | pub const IFLA_BOND_MODE: u16 = 1;
constant IFLA_BOND_ACTIVE_SLAVE (line 984) | pub const IFLA_BOND_ACTIVE_SLAVE: u16 = 2;
constant IFLA_BOND_MIIMON (line 985) | pub const IFLA_BOND_MIIMON: u16 = 3;
constant IFLA_BOND_UPDELAY (line 986) | pub const IFLA_BOND_UPDELAY: u16 = 4;
constant IFLA_BOND_DOWNDELAY (line 987) | pub const IFLA_BOND_DOWNDELAY: u16 = 5;
constant IFLA_BOND_USE_CARRIER (line 988) | pub const IFLA_BOND_USE_CARRIER: u16 = 6;
constant IFLA_BOND_ARP_INTERVAL (line 989) | pub const IFLA_BOND_ARP_INTERVAL: u16 = 7;
constant IFLA_BOND_ARP_IP_TARGET (line 990) | pub const IFLA_BOND_ARP_IP_TARGET: u16 = 8;
constant IFLA_BOND_ARP_VALIDATE (line 991) | pub const IFLA_BOND_ARP_VALIDATE: u16 = 9;
constant IFLA_BOND_ARP_ALL_TARGETS (line 992) | pub const IFLA_BOND_ARP_ALL_TARGETS: u16 = 10;
constant IFLA_BOND_PRIMARY (line 993) | pub const IFLA_BOND_PRIMARY: u16 = 11;
constant IFLA_BOND_PRIMARY_RESELECT (line 994) | pub const IFLA_BOND_PRIMARY_RESELECT: u16 = 12;
constant IFLA_BOND_FAIL_OVER_MAC (line 995) | pub const IFLA_BOND_FAIL_OVER_MAC: u16 = 13;
constant IFLA_BOND_XMIT_HASH_POLICY (line 996) | pub const IFLA_BOND_XMIT_HASH_POLICY: u16 = 14;
constant IFLA_BOND_RESEND_IGMP (line 997) | pub const IFLA_BOND_RESEND_IGMP: u16 = 15;
constant IFLA_BOND_NUM_PEER_NOTIF (line 998) | pub const IFLA_BOND_NUM_PEER_NOTIF: u16 = 16;
constant IFLA_BOND_ALL_SLAVES_ACTIVE (line 999) | pub const IFLA_BOND_ALL_SLAVES_ACTIVE: u16 = 17;
constant IFLA_BOND_MIN_LINKS (line 1000) | pub const IFLA_BOND_MIN_LINKS: u16 = 18;
constant IFLA_BOND_LP_INTERVAL (line 1001) | pub const IFLA_BOND_LP_INTERVAL: u16 = 19;
constant IFLA_BOND_PACKETS_PER_SLAVE (line 1002) | pub const IFLA_BOND_PACKETS_PER_SLAVE: u16 = 20;
constant IFLA_BOND_AD_LACP_RATE (line 1003) | pub const IFLA_BOND_AD_LACP_RATE: u16 = 21;
constant IFLA_BOND_AD_SELECT (line 1004) | pub const IFLA_BOND_AD_SELECT: u16 = 22;
constant IFLA_BOND_AD_INFO (line 1005) | pub const IFLA_BOND_AD_INFO: u16 = 23;
constant IFLA_BOND_AD_ACTOR_SYS_PRIO (line 1006) | pub const IFLA_BOND_AD_ACTOR_SYS_PRIO: u16 = 24;
constant IFLA_BOND_AD_USER_PORT_KEY (line 1007) | pub const IFLA_BOND_AD_USER_PORT_KEY: u16 = 25;
constant IFLA_BOND_AD_ACTOR_SYSTEM (line 1008) | pub const IFLA_BOND_AD_ACTOR_SYSTEM: u16 = 26;
constant IFLA_BOND_TLB_DYNAMIC_LB (line 1009) | pub const IFLA_BOND_TLB_DYNAMIC_LB: u16 = 27;
constant IFLA_BOND_PEER_NOTIF_DELAY (line 1010) | pub const IFLA_BOND_PEER_NOTIF_DELAY: u16 = 28;
constant IFLA_BOND_AD_LACP_ACTIVE (line 1011) | pub const IFLA_BOND_AD_LACP_ACTIVE: u16 = 29;
constant IFLA_BOND_MISSED_MAX (line 1012) | pub const IFLA_BOND_MISSED_MAX: u16 = 30;
constant IFLA_BOND_NS_IP6_TARGET (line 1013) | pub const IFLA_BOND_NS_IP6_TARGET: u16 = 31;
constant IFLA_BOND_AD_INFO_UNSPEC (line 1015) | pub const IFLA_BOND_AD_INFO_UNSPEC: u16 = 0;
constant IFLA_BOND_AD_INFO_AGGREGATOR (line 1016) | pub const IFLA_BOND_AD_INFO_AGGREGATOR: u16 = 1;
constant IFLA_BOND_AD_INFO_NUM_PORTS (line 1017) | pub const IFLA_BOND_AD_INFO_NUM_PORTS: u16 = 2;
constant IFLA_BOND_AD_INFO_ACTOR_KEY (line 1018) | pub const IFLA_BOND_AD_INFO_ACTOR_KEY: u16 = 3;
constant IFLA_BOND_AD_INFO_PARTNER_KEY (line 1019) | pub const IFLA_BOND_AD_INFO_PARTNER_KEY: u16 = 4;
constant IFLA_BOND_AD_INFO_PARTNER_MAC (line 1020) | pub const IFLA_BOND_AD_INFO_PARTNER_MAC: u16 = 5;
constant RTNLGRP_NONE (line 1055) | pub const RTNLGRP_NONE: u32 = 0;
constant RTNLGRP_LINK (line 1056) | pub const RTNLGRP_LINK: u32 = 1;
constant RTNLGRP_NOTIFY (line 1057) | pub const RTNLGRP_NOTIFY: u32 = 2;
constant RTNLGRP_NEIGH (line 1058) | pub const RTNLGRP_NEIGH: u32 = 3;
constant RTNLGRP_TC (line 1059) | pub const RTNLGRP_TC: u32 = 4;
constant RTNLGRP_IPV4_IFADDR (line 1060) | pub const RTNLGRP_IPV4_IFADDR: u32 = 5;
constant RTNLGRP_IPV4_MROUTE (line 1061) | pub const RTNLGRP_IPV4_MROUTE: u32 = 6;
constant RTNLGRP_IPV4_ROUTE (line 1062) | pub const RTNLGRP_IPV4_ROUTE: u32 = 7;
constant RTNLGRP_IPV4_RULE (line 1063) | pub const RTNLGRP_IPV4_RULE: u32 = 8;
constant RTNLGRP_IPV6_IFADDR (line 1064) | pub const RTNLGRP_IPV6_IFADDR: u32 = 9;
constant RTNLGRP_IPV6_MROUTE (line 1065) | pub const RTNLGRP_IPV6_MROUTE: u32 = 10;
constant RTNLGRP_IPV6_ROUTE (line 1066) | pub const RTNLGRP_IPV6_ROUTE: u32 = 11;
constant RTNLGRP_IPV6_IFINFO (line 1067) | pub const RTNLGRP_IPV6_IFINFO: u32 = 12;
constant RTNLGRP_DECNET_IFADDR (line 1068) | pub const RTNLGRP_DECNET_IFADDR: u32 = 13;
constant RTNLGRP_NOP2 (line 1069) | pub const RTNLGRP_NOP2: u32 = 14;
constant RTNLGRP_DECNET_ROUTE (line 1070) | pub const RTNLGRP_DECNET_ROUTE: u32 = 15;
constant RTNLGRP_DECNET_RULE (line 1071) | pub const RTNLGRP_DECNET_RULE: u32 = 16;
constant RTNLGRP_NOP4 (line 1072) | pub const RTNLGRP_NOP4: u32 = 17;
constant RTNLGRP_IPV6_PREFIX (line 1073) | pub const RTNLGRP_IPV6_PREFIX: u32 = 18;
constant RTNLGRP_IPV6_RULE (line 1074) | pub const RTNLGRP_IPV6_RULE: u32 = 19;
constant RTNLGRP_ND_USEROPT (line 1075) | pub const RTNLGRP_ND_USEROPT: u32 = 20;
constant RTNLGRP_PHONET_IFADDR (line 1076) | pub const RTNLGRP_PHONET_IFADDR: u32 = 21;
constant RTNLGRP_PHONET_ROUTE (line 1077) | pub const RTNLGRP_PHONET_ROUTE: u32 = 22;
constant RTNLGRP_DCB (line 1078) | pub const RTNLGRP_DCB: u32 = 23;
constant RTNLGRP_IPV4_NETCONF (line 1079) | pub const RTNLGRP_IPV4_NETCONF: u32 = 24;
constant RTNLGRP_IPV6_NETCONF (line 1080) | pub const RTNLGRP_IPV6_NETCONF: u32 = 25;
constant RTNLGRP_MDB (line 1081) | pub const RTNLGRP_MDB: u32 = 26;
constant RTNLGRP_MPLS_ROUTE (line 1082) | pub const RTNLGRP_MPLS_ROUTE: u32 = 27;
constant RTNLGRP_NSID (line 1083) | pub const RTNLGRP_NSID: u32 = 28;
constant RTNLGRP_MPLS_NETCONF (line 1084) | pub const RTNLGRP_MPLS_NETCONF: u32 = 29;
constant RTNLGRP_IPV4_MROUTE_R (line 1085) | pub const RTNLGRP_IPV4_MROUTE_R: u32 = 30;
constant RTNLGRP_IPV6_MROUTE_R (line 1086) | pub const RTNLGRP_IPV6_MROUTE_R: u32 = 31;
constant IFLA_XDP_UNSPEC (line 1167) | pub const IFLA_XDP_UNSPEC: u32 = 0;
constant IFLA_XDP_FD (line 1168) | pub const IFLA_XDP_FD: u32 = 1;
constant IFLA_XDP_ATTACHED (line 1169) | pub const IFLA_XDP_ATTACHED: u32 = 2;
constant IFLA_XDP_FLAGS (line 1170) | pub const IFLA_XDP_FLAGS: u32 = 3;
constant IFLA_XDP_PROG_ID (line 1171) | pub const IFLA_XDP_PROG_ID: u32 = 4;
constant LWTUNNEL_ENCAP_NONE (line 1208) | pub const LWTUNNEL_ENCAP_NONE: u16 = 0;
constant LWTUNNEL_ENCAP_MPLS (line 1209) | pub const LWTUNNEL_ENCAP_MPLS: u16 = 1;
constant LWTUNNEL_ENCAP_IP (line 1210) | pub const LWTUNNEL_ENCAP_IP: u16 = 2;
constant LWTUNNEL_ENCAP_ILA (line 1211) | pub const LWTUNNEL_ENCAP_ILA: u16 = 3;
constant LWTUNNEL_ENCAP_IP6 (line 1212) | pub const LWTUNNEL_ENCAP_IP6: u16 = 4;
constant LWTUNNEL_ENCAP_SEG6 (line 1213) | pub const LWTUNNEL_ENCAP_SEG6: u16 = 5;
constant LWTUNNEL_ENCAP_BPF (line 1214) | pub const LWTUNNEL_ENCAP_BPF: u16 = 6;
constant LWTUNNEL_ENCAP_SEG6_LOCAL (line 1215) | pub const LWTUNNEL_ENCAP_SEG6_LOCAL: u16 = 7;
constant LWTUNNEL_ENCAP_RPL (line 1216) | pub const LWTUNNEL_ENCAP_RPL: u16 = 8;
constant MPLS_IPTUNNEL_UNSPEC (line 1218) | pub const MPLS_IPTUNNEL_UNSPEC: u16 = 0;
constant MPLS_IPTUNNEL_DST (line 1219) | pub const MPLS_IPTUNNEL_DST: u16 = 1;
constant MPLS_IPTUNNEL_TTL (line 1220) | pub const MPLS_IPTUNNEL_TTL: u16 = 2;
constant MACVTAP_MODE_PRIVATE (line 1223) | pub const MACVTAP_MODE_PRIVATE: u32 = 1;
constant MACVTAP_MODE_VEPA (line 1224) | pub const MACVTAP_MODE_VEPA: u32 = 2;
constant MACVTAP_MODE_BRIDGE (line 1225) | pub const MACVTAP_MODE_BRIDGE: u32 = 4;
constant MACVTAP_MODE_PASSTHRU (line 1226) | pub const MACVTAP_MODE_PASSTHRU: u32 = 8;
constant MACVTAP_MODE_SOURCE (line 1227) | pub const MACVTAP_MODE_SOURCE: u32 = 16;
FILE: netlink-packet-route/src/rtnl/link/buffer.rs
constant LINK_HEADER_LEN (line 8) | pub const LINK_HEADER_LEN: usize = 16;
function nlas (line 21) | pub fn nlas(&self) -> impl Iterator<Item = Result<NlaBuffer<&'a [u8]>, D...
FILE: netlink-packet-route/src/rtnl/link/header.rs
type LinkHeader (line 30) | pub struct LinkHeader {
method parse (line 63) | fn parse(buf: &LinkMessageBuffer<T>) -> Result<Self, DecodeError> {
method buffer_len (line 48) | fn buffer_len(&self) -> usize {
method emit (line 52) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/link/message.rs
type LinkMessage (line 14) | pub struct LinkMessage {
method parse (line 33) | fn parse(buf: &LinkMessageBuffer<&'a T>) -> Result<Self, DecodeError> {
method buffer_len (line 20) | fn buffer_len(&self) -> usize {
method emit (line 24) | fn emit(&self, buffer: &mut [u8]) {
function parse_with_param (line 43) | fn parse_with_param(buf: &LinkMessageBuffer<&'a T>, family: u16) -> Resu...
function parse_with_param (line 53) | fn parse_with_param(buf: &LinkMessageBuffer<&'a T>, family: u8) -> Resul...
function packet_header_read (line 97) | fn packet_header_read() {
function packet_header_build (line 108) | fn packet_header_build() {
function packet_nlas_read (line 123) | fn packet_nlas_read() {
function emit (line 204) | fn emit() {
FILE: netlink-packet-route/src/rtnl/link/nlas/af_spec_bridge.rs
type AfSpecBridge (line 18) | pub enum AfSpecBridge {
method value_len (line 25) | fn value_len(&self) -> usize {
method emit_value (line 34) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 45) | fn kind(&self) -> u16 {
method parse (line 56) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
type BridgeVlanInfo (line 73) | pub struct BridgeVlanInfo {
type Error (line 88) | type Error = DecodeError;
method try_from (line 89) | fn try_from(raw: &[u8]) -> Result<Self, DecodeError> {
function from (line 79) | fn from(d: &BridgeVlanInfo) -> Self {
FILE: netlink-packet-route/src/rtnl/link/nlas/af_spec_inet.rs
type AfSpecInet (line 14) | pub enum AfSpecInet {
method value_len (line 57) | fn value_len(&self) -> usize {
method emit_value (line 103) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 148) | fn kind(&self) -> u16 {
method parse (line 194) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
FILE: netlink-packet-route/src/rtnl/link/nlas/bond.rs
type BondAdInfo (line 19) | pub enum BondAdInfo {
method parse (line 59) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 28) | fn value_len(&self) -> usize {
method kind (line 36) | fn kind(&self) -> u16 {
method emit_value (line 47) | fn emit_value(&self, buffer: &mut [u8]) {
type BondIpAddrNla (line 87) | struct BondIpAddrNla {
type BondIpAddrNlaList (line 92) | struct BondIpAddrNlaList(Vec<BondIpAddrNla>);
method from (line 103) | fn from(addrs: &Vec<Ipv4Addr>) -> Self {
method from (line 117) | fn from(addrs: &Vec<Ipv6Addr>) -> Self {
type Target (line 95) | type Target = Vec<BondIpAddrNla>;
method deref (line 97) | fn deref(&self) -> &Self::Target {
method value_len (line 131) | fn value_len(&self) -> usize {
method emit_value (line 138) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 144) | fn kind(&self) -> u16 {
type InfoBond (line 150) | pub enum InfoBond {
method parse (line 318) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 186) | fn value_len(&self) -> usize {
method emit_value (line 234) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 278) | fn kind(&self) -> u16 {
FILE: netlink-packet-route/src/rtnl/link/nlas/inet/dev_conf.rs
constant DEV_CONF_LEN (line 8) | pub const DEV_CONF_LEN: usize = 124;
type InetDevConf (line 45) | pub struct InetDevConf {
method parse (line 80) | fn parse(buf: &InetDevConfBuffer<T>) -> Result<Self, DecodeError> {
method buffer_len (line 118) | fn buffer_len(&self) -> usize {
method emit (line 122) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/link/nlas/inet/mod.rs
type Inet (line 16) | pub enum Inet {
method parse (line 52) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 23) | fn value_len(&self) -> usize {
method emit_value (line 32) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 41) | fn kind(&self) -> u16 {
FILE: netlink-packet-route/src/rtnl/link/nlas/inet6/cache.rs
type Inet6CacheInfo (line 9) | pub struct Inet6CacheInfo {
method parse (line 25) | fn parse(buf: &Inet6CacheInfoBuffer<T>) -> Result<Self, DecodeError> {
constant LINK_INET6_CACHE_INFO_LEN (line 16) | pub const LINK_INET6_CACHE_INFO_LEN: usize = 16;
method buffer_len (line 36) | fn buffer_len(&self) -> usize {
method emit (line 40) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/link/nlas/inet6/dev_conf.rs
constant LINK_INET6_DEV_CONF_LEN (line 8) | pub const LINK_INET6_DEV_CONF_LEN: usize = 204;
method buffer_len (line 122) | fn buffer_len(&self) -> usize {
method emit (line 126) | fn emit(&self, buffer: &mut [u8]) {
type Inet6DevConf (line 183) | pub struct Inet6DevConf {
method parse (line 64) | fn parse(buf: &Inet6DevConfBuffer<T>) -> Result<Self, DecodeError> {
FILE: netlink-packet-route/src/rtnl/link/nlas/inet6/icmp6_stats.rs
type Icmp6Stats (line 9) | pub struct Icmp6Stats {
method parse (line 29) | fn parse(buf: &Icmp6StatsBuffer<T>) -> Result<Self, DecodeError> {
constant ICMP6_STATS_LEN (line 18) | pub const ICMP6_STATS_LEN: usize = 48;
method buffer_len (line 42) | fn buffer_len(&self) -> usize {
method emit (line 46) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/link/nlas/inet6/mod.rs
type Inet6 (line 24) | pub enum Inet6 {
method parse (line 84) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 37) | fn value_len(&self) -> usize {
method emit_value (line 52) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 67) | fn kind(&self) -> u16 {
FILE: netlink-packet-route/src/rtnl/link/nlas/inet6/stats.rs
constant INET6_STATS_LEN (line 8) | pub const INET6_STATS_LEN: usize = 288;
type Inet6Stats (line 49) | pub struct Inet6Stats {
method parse (line 89) | fn parse(buf: &Inet6StatsBuffer<T>) -> Result<Self, DecodeError> {
method buffer_len (line 132) | fn buffer_len(&self) -> usize {
method emit (line 136) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/link/nlas/link_infos.rs
constant DUMMY (line 17) | const DUMMY: &str = "dummy";
constant IFB (line 18) | const IFB: &str = "ifb";
constant BRIDGE (line 19) | const BRIDGE: &str = "bridge";
constant TUN (line 20) | const TUN: &str = "tun";
constant NLMON (line 21) | const NLMON: &str = "nlmon";
constant VLAN (line 22) | const VLAN: &str = "vlan";
constant VETH (line 23) | const VETH: &str = "veth";
constant VXLAN (line 24) | const VXLAN: &str = "vxlan";
constant BOND (line 25) | const BOND: &str = "bond";
constant IPVLAN (line 26) | const IPVLAN: &str = "ipvlan";
constant MACVLAN (line 27) | const MACVLAN: &str = "macvlan";
constant MACVTAP (line 28) | const MACVTAP: &str = "macvtap";
constant GRETAP (line 29) | const GRETAP: &str = "gretap";
constant IP6GRETAP (line 30) | const IP6GRETAP: &str = "ip6gretap";
constant IPIP (line 31) | const IPIP: &str = "ipip";
constant SIT (line 32) | const SIT: &str = "sit";
constant GRE (line 33) | const GRE: &str = "gre";
constant IP6GRE (line 34) | const IP6GRE: &str = "ip6gre";
constant VTI (line 35) | const VTI: &str = "vti";
constant VRF (line 36) | const VRF: &str = "vrf";
constant GTP (line 37) | const GTP: &str = "gtp";
constant IPOIB (line 38) | const IPOIB: &str = "ipoib";
constant WIREGUARD (line 39) | const WIREGUARD: &str = "wireguard";
type Info (line 42) | pub enum Info {
method value_len (line 53) | fn value_len(&self) -> usize {
method emit_value (line 67) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 80) | fn kind(&self) -> u16 {
type VecInfo (line 93) | pub(crate) struct VecInfo(pub(crate) Vec<Info>);
method parse (line 106) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
type InfoData (line 261) | pub enum InfoData {
method value_len (line 290) | fn value_len(&self) -> usize {
method emit_value (line 322) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 353) | fn kind(&self) -> u16 {
type InfoKind (line 359) | pub enum InfoKind {
method parse (line 456) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<InfoKind, DecodeError> {
method value_len (line 387) | fn value_len(&self) -> usize {
method emit_value (line 418) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 450) | fn kind(&self) -> u16 {
type InfoVxlan (line 495) | pub enum InfoVxlan {
method parse (line 651) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 530) | fn value_len(&self) -> usize {
method emit_value (line 570) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 612) | fn kind(&self) -> u16 {
type InfoVlan (line 731) | pub enum InfoVlan {
method parse (line 788) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 742) | fn value_len(&self) -> usize {
method emit_value (line 755) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 774) | fn kind(&self) -> u16 {
type InfoBridge (line 814) | pub enum InfoBridge {
method parse (line 1063) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 869) | fn value_len(&self) -> usize {
method emit_value (line 934) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 1007) | fn kind(&self) -> u16 {
type InfoIpoib (line 1218) | pub enum InfoIpoib {
method parse (line 1260) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 1227) | fn value_len(&self) -> usize {
method emit_value (line 1236) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 1247) | fn kind(&self) -> u16 {
type VethInfo (line 1276) | pub enum VethInfo {
method parse (line 1312) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 1283) | fn value_len(&self) -> usize {
method emit_value (line 1292) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 1301) | fn kind(&self) -> u16 {
type InfoIpVlan (line 1328) | pub enum InfoIpVlan {
method parse (line 1367) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 1336) | fn value_len(&self) -> usize {
method emit_value (line 1345) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 1355) | fn kind(&self) -> u16 {
type InfoVrf (line 1382) | pub enum InfoVrf {
method parse (line 1414) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 1388) | fn value_len(&self) -> usize {
method emit_value (line 1396) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 1404) | fn kind(&self) -> u16 {
type InfoMacVlan (line 1425) | pub enum InfoMacVlan {
method parse (line 1481) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 1437) | fn value_len(&self) -> usize {
method emit_value (line 1451) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 1465) | fn kind(&self) -> u16 {
type InfoMacVtap (line 1517) | pub enum InfoMacVtap {
method parse (line 1573) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 1529) | fn value_len(&self) -> usize {
method emit_value (line 1543) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 1557) | fn kind(&self) -> u16 {
function parse_info_kind (line 1880) | fn parse_info_kind() {
function parse_info_bridge (line 1887) | fn parse_info_bridge() {
function parse_veth_info (line 1896) | fn parse_veth_info() {
function parse_info_bond (line 1946) | fn parse_info_bond() {
function parse_info_ipvlan (line 2062) | fn parse_info_ipvlan() {
function emit_info_ipvlan (line 2073) | fn emit_info_ipvlan() {
function parse_info_macvlan (line 2105) | fn parse_info_macvlan() {
function emit_info_macvlan (line 2116) | fn emit_info_macvlan() {
function parse_info_macvlan_source_set (line 2180) | fn parse_info_macvlan_source_set() {
function emit_info_macvlan_source_set (line 2191) | fn emit_info_macvlan_source_set() {
function parse (line 2205) | fn parse() {
function emit (line 2224) | fn emit() {
FILE: netlink-packet-route/src/rtnl/link/nlas/link_state.rs
type State (line 6) | pub enum State {
method from (line 27) | fn from(value: u8) -> Self {
function from (line 43) | fn from(value: State) -> Self {
FILE: netlink-packet-route/src/rtnl/link/nlas/map.rs
constant LINK_MAP_LEN (line 8) | pub const LINK_MAP_LEN: usize = 28;
type Map (line 19) | pub struct Map {
method parse (line 29) | fn parse(buf: &MapBuffer<T>) -> Result<Self, DecodeError> {
method buffer_len (line 42) | fn buffer_len(&self) -> usize {
method emit (line 46) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/link/nlas/mod.rs
type Nla (line 53) | pub enum Nla {
method value_len (line 159) | fn value_len(&self) -> usize {
method emit_value (line 237) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 322) | fn kind(&self) -> u16 {
method parse_with_param (line 394) | fn parse_with_param(
FILE: netlink-packet-route/src/rtnl/link/nlas/prop_list.rs
type Prop (line 14) | pub enum Prop {
method parse (line 51) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 21) | fn value_len(&self) -> usize {
method emit_value (line 30) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 41) | fn kind(&self) -> u16 {
FILE: netlink-packet-route/src/rtnl/link/nlas/stats.rs
type Stats (line 9) | pub struct Stats {
method parse (line 88) | fn parse(buf: &StatsBuffer<T>) -> Result<Self, DecodeError> {
constant LINK_STATS_LEN (line 58) | pub const LINK_STATS_LEN: usize = 96;
method buffer_len (line 119) | fn buffer_len(&self) -> usize {
method emit (line 123) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/link/nlas/stats64.rs
constant LINK_STATS64_LEN (line 8) | pub const LINK_STATS64_LEN: usize = 192;
type Stats64 (line 37) | pub struct Stats64 {
method parse (line 87) | fn parse(buf: &Stats64Buffer<T>) -> Result<Self, DecodeError> {
method buffer_len (line 118) | fn buffer_len(&self) -> usize {
method emit (line 122) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/link/nlas/tests.rs
function get_nlas (line 175) | fn get_nlas() -> impl Iterator<Item = Result<NlaBuffer<&'static [u8]>, D...
function get_byte_buffer (line 179) | fn get_byte_buffer(nla: &dyn Emitable) -> Vec<u8> {
function af_spec_header (line 336) | fn af_spec_header() {
function parse_af_inet (line 342) | fn parse_af_inet() {
function emit_af_inet (line 358) | fn emit_af_inet() {
function emit_af_inet6 (line 378) | fn emit_af_inet6() {
function parse_af_inet6 (line 398) | fn parse_af_inet6() {
FILE: netlink-packet-route/src/rtnl/message.rs
type RtnlMessage (line 23) | pub enum RtnlMessage {
method is_new_link (line 63) | pub fn is_new_link(&self) -> bool {
method is_del_link (line 67) | pub fn is_del_link(&self) -> bool {
method is_get_link (line 71) | pub fn is_get_link(&self) -> bool {
method is_set_link (line 75) | pub fn is_set_link(&self) -> bool {
method is_new_address (line 79) | pub fn is_new_address(&self) -> bool {
method is_del_address (line 83) | pub fn is_del_address(&self) -> bool {
method is_get_address (line 87) | pub fn is_get_address(&self) -> bool {
method is_get_neighbour (line 91) | pub fn is_get_neighbour(&self) -> bool {
method is_new_route (line 95) | pub fn is_new_route(&self) -> bool {
method is_new_neighbour (line 99) | pub fn is_new_neighbour(&self) -> bool {
method is_get_route (line 103) | pub fn is_get_route(&self) -> bool {
method is_del_neighbour (line 107) | pub fn is_del_neighbour(&self) -> bool {
method is_new_neighbour_table (line 111) | pub fn is_new_neighbour_table(&self) -> bool {
method is_get_neighbour_table (line 115) | pub fn is_get_neighbour_table(&self) -> bool {
method is_set_neighbour_table (line 119) | pub fn is_set_neighbour_table(&self) -> bool {
method is_del_route (line 123) | pub fn is_del_route(&self) -> bool {
method is_new_qdisc (line 127) | pub fn is_new_qdisc(&self) -> bool {
method is_del_qdisc (line 131) | pub fn is_del_qdisc(&self) -> bool {
method is_get_qdisc (line 135) | pub fn is_get_qdisc(&self) -> bool {
method is_new_class (line 139) | pub fn is_new_class(&self) -> bool {
method is_del_class (line 143) | pub fn is_del_class(&self) -> bool {
method is_get_class (line 147) | pub fn is_get_class(&self) -> bool {
method is_new_filter (line 151) | pub fn is_new_filter(&self) -> bool {
method is_del_filter (line 155) | pub fn is_del_filter(&self) -> bool {
method is_get_filter (line 159) | pub fn is_get_filter(&self) -> bool {
method is_new_chain (line 163) | pub fn is_new_chain(&self) -> bool {
method is_del_chain (line 167) | pub fn is_del_chain(&self) -> bool {
method is_get_chain (line 171) | pub fn is_get_chain(&self) -> bool {
method is_new_nsid (line 175) | pub fn is_new_nsid(&self) -> bool {
method is_get_nsid (line 179) | pub fn is_get_nsid(&self) -> bool {
method is_del_nsid (line 183) | pub fn is_del_nsid(&self) -> bool {
method is_get_rule (line 187) | pub fn is_get_rule(&self) -> bool {
method is_new_rule (line 191) | pub fn is_new_rule(&self) -> bool {
method is_del_rule (line 195) | pub fn is_del_rule(&self) -> bool {
method message_type (line 199) | pub fn message_type(&self) -> u16 {
method buffer_len (line 245) | fn buffer_len(&self) -> usize {
method emit (line 303) | fn emit(&self, buffer: &mut [u8]) {
method message_type (line 362) | fn message_type(&self) -> u16 {
method buffer_len (line 366) | fn buffer_len(&self) -> usize {
method serialize (line 370) | fn serialize(&self, buffer: &mut [u8]) {
type Error (line 376) | type Error = DecodeError;
method deserialize (line 377) | fn deserialize(header: &NetlinkHeader, payload: &[u8]) -> Result<Self, S...
function from (line 387) | fn from(message: RtnlMessage) -> Self {
FILE: netlink-packet-route/src/rtnl/neighbour/buffer.rs
constant NEIGHBOUR_HEADER_LEN (line 8) | pub const NEIGHBOUR_HEADER_LEN: usize = 12;
function nlas (line 19) | pub fn nlas(&self) -> impl Iterator<Item = Result<NlaBuffer<&'a [u8]>, D...
FILE: netlink-packet-route/src/rtnl/neighbour/header.rs
type NeighbourHeader (line 25) | pub struct NeighbourHeader {
method parse (line 40) | fn parse(buf: &NeighbourMessageBuffer<T>) -> Result<Self, DecodeError> {
method buffer_len (line 52) | fn buffer_len(&self) -> usize {
method emit (line 56) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/neighbour/message.rs
type NeighbourMessage (line 14) | pub struct NeighbourMessage {
method parse (line 33) | fn parse(buf: &NeighbourMessageBuffer<&'a T>) -> Result<Self, DecodeEr...
method buffer_len (line 20) | fn buffer_len(&self) -> usize {
method emit (line 24) | fn emit(&self, buffer: &mut [u8]) {
function parse (line 43) | fn parse(buf: &NeighbourMessageBuffer<&'a T>) -> Result<Self, DecodeErro...
function packet_header_read (line 82) | fn packet_header_read() {
function packet_header_build (line 92) | fn packet_header_build() {
function emit (line 106) | fn emit() {
FILE: netlink-packet-route/src/rtnl/neighbour/nlas/cache_info.rs
type CacheInfo (line 9) | pub struct CacheInfo {
method parse (line 26) | fn parse(buf: &CacheInfoBuffer<T>) -> Result<Self, DecodeError> {
constant NEIGHBOUR_CACHE_INFO_LEN (line 16) | pub const NEIGHBOUR_CACHE_INFO_LEN: usize = 16;
method buffer_len (line 37) | fn buffer_len(&self) -> usize {
method emit (line 41) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/neighbour/nlas/mod.rs
type Nla (line 18) | pub enum Nla {
method value_len (line 36) | fn value_len(&self) -> usize {
method emit_value (line 56) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 75) | fn kind(&self) -> u16 {
method parse (line 96) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
FILE: netlink-packet-route/src/rtnl/neighbour_table/buffer.rs
constant NEIGHBOUR_TABLE_HEADER_LEN (line 8) | pub const NEIGHBOUR_TABLE_HEADER_LEN: usize = 4;
function nlas (line 16) | pub fn nlas(&self) -> impl Iterator<Item = Result<NlaBuffer<&'a [u8]>, D...
FILE: netlink-packet-route/src/rtnl/neighbour_table/header.rs
type NeighbourTableHeader (line 11) | pub struct NeighbourTableHeader {
method parse (line 16) | fn parse(buf: &NeighbourTableMessageBuffer<T>) -> Result<Self, DecodeE...
method buffer_len (line 24) | fn buffer_len(&self) -> usize {
method emit (line 28) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/neighbour_table/message.rs
type NeighbourTableMessage (line 13) | pub struct NeighbourTableMessage {
method parse (line 32) | fn parse(buf: &NeighbourTableMessageBuffer<&'a T>) -> Result<Self, Dec...
method buffer_len (line 19) | fn buffer_len(&self) -> usize {
method emit (line 23) | fn emit(&self, buffer: &mut [u8]) {
function parse (line 42) | fn parse(buf: &NeighbourTableMessageBuffer<&'a T>) -> Result<Self, Decod...
FILE: netlink-packet-route/src/rtnl/neighbour_table/nlas/config.rs
type Config (line 9) | pub struct Config {
method parse (line 36) | fn parse(buf: &ConfigBuffer<T>) -> Result<Self, DecodeError> {
constant CONFIG_LEN (line 21) | pub const CONFIG_LEN: usize = 32;
method buffer_len (line 52) | fn buffer_len(&self) -> usize {
method emit (line 56) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/neighbour_table/nlas/mod.rs
type Nla (line 21) | pub enum Nla {
method value_len (line 37) | fn value_len(&self) -> usize {
method emit_value (line 49) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 67) | fn kind(&self) -> u16 {
method parse (line 85) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
FILE: netlink-packet-route/src/rtnl/neighbour_table/nlas/stats.rs
type Stats (line 9) | pub struct Stats {
method parse (line 37) | fn parse(buf: &StatsBuffer<T>) -> Result<Self, DecodeError> {
constant STATS_LEN (line 22) | pub const STATS_LEN: usize = 80;
method buffer_len (line 54) | fn buffer_len(&self) -> usize {
method emit (line 58) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/nsid/buffer.rs
constant NSID_HEADER_LEN (line 8) | pub const NSID_HEADER_LEN: usize = 4;
function nlas (line 16) | pub fn nlas(&self) -> impl Iterator<Item = Result<NlaBuffer<&'a [u8]>, D...
FILE: netlink-packet-route/src/rtnl/nsid/header.rs
type NsidHeader (line 10) | pub struct NsidHeader {
method parse (line 26) | fn parse(buf: &NsidMessageBuffer<T>) -> Result<Self, DecodeError> {
method buffer_len (line 15) | fn buffer_len(&self) -> usize {
method emit (line 19) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/nsid/message.rs
type NsidMessage (line 14) | pub struct NsidMessage {
method parse (line 20) | fn parse(buf: &NsidMessageBuffer<&'a T>) -> Result<Self, DecodeError> {
function parse (line 29) | fn parse(buf: &NsidMessageBuffer<&'a T>) -> Result<Self, DecodeError> {
method buffer_len (line 39) | fn buffer_len(&self) -> usize {
method emit (line 43) | fn emit(&self, buffer: &mut [u8]) {
function get_ns_id_request (line 68) | fn get_ns_id_request() {
function get_ns_id_response (line 94) | fn get_ns_id_response() {
FILE: netlink-packet-route/src/rtnl/nsid/nlas.rs
type Nla (line 15) | pub enum Nla {
method value_len (line 24) | fn value_len(&self) -> usize {
method emit_value (line 33) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 43) | fn kind(&self) -> u16 {
method parse (line 56) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
FILE: netlink-packet-route/src/rtnl/route/buffer.rs
constant ROUTE_HEADER_LEN (line 8) | pub const ROUTE_HEADER_LEN: usize = 12;
function nlas (line 24) | pub fn nlas(&self) -> impl Iterator<Item = Result<NlaBuffer<&'a [u8]>, D...
FILE: netlink-packet-route/src/rtnl/route/header.rs
method default (line 38) | fn default() -> Self {
type RouteHeader (line 87) | pub struct RouteHeader {
method parse (line 135) | fn parse(buf: &RouteMessageBuffer<&'a T>) -> Result<Self, DecodeError> {
method buffer_len (line 151) | fn buffer_len(&self) -> usize {
method emit (line 155) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/route/message.rs
type RouteMessage (line 14) | pub struct RouteMessage {
method parse (line 33) | fn parse(buf: &RouteMessageBuffer<&'a T>) -> Result<Self, DecodeError> {
method input_interface (line 67) | pub fn input_interface(&self) -> Option<u32> {
method output_interface (line 78) | pub fn output_interface(&self) -> Option<u32> {
method source_prefix (line 89) | pub fn source_prefix(&self) -> Option<(IpAddr, u8)> {
method destination_prefix (line 102) | pub fn destination_prefix(&self) -> Option<(IpAddr, u8)> {
method gateway (line 115) | pub fn gateway(&self) -> Option<IpAddr> {
method buffer_len (line 20) | fn buffer_len(&self) -> usize {
method emit (line 24) | fn emit(&self, buffer: &mut [u8]) {
function parse (line 42) | fn parse(buf: &RouteMessageBuffer<&'a T>) -> Result<Self, DecodeError> {
function octets_to_addr (line 51) | fn octets_to_addr(octets: &[u8]) -> Result<IpAddr, DecodeError> {
FILE: netlink-packet-route/src/rtnl/route/nlas/cache_info.rs
type CacheInfo (line 9) | pub struct CacheInfo {
method parse (line 34) | fn parse(buf: &CacheInfoBuffer<T>) -> Result<Self, DecodeError> {
constant CACHE_INFO_LEN (line 20) | pub const CACHE_INFO_LEN: usize = 32;
method buffer_len (line 49) | fn buffer_len(&self) -> usize {
method emit (line 53) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/route/nlas/metrics.rs
type Metrics (line 16) | pub enum Metrics {
method parse (line 122) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 40) | fn value_len(&self) -> usize {
method emit_value (line 67) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 95) | fn kind(&self) -> u16 {
FILE: netlink-packet-route/src/rtnl/route/nlas/mfc_stats.rs
type MfcStats (line 9) | pub struct MfcStats {
method parse (line 24) | fn parse(buf: &MfcStatsBuffer<T>) -> Result<MfcStats, DecodeError> {
constant MFC_STATS_LEN (line 15) | pub const MFC_STATS_LEN: usize = 24;
method buffer_len (line 34) | fn buffer_len(&self) -> usize {
method emit (line 38) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/route/nlas/mod.rs
type Nla (line 35) | pub enum Nla {
method value_len (line 81) | fn value_len(&self) -> usize {
method emit_value (line 132) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 188) | fn kind(&self) -> u16 {
method parse (line 224) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
FILE: netlink-packet-route/src/rtnl/route/nlas/mpls_ip_tunnel.rs
type MplsIpTunnel (line 14) | pub enum MplsIpTunnel {
method parse (line 50) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method value_len (line 21) | fn value_len(&self) -> usize {
method kind (line 30) | fn kind(&self) -> u16 {
method emit_value (line 39) | fn emit_value(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/route/nlas/next_hops.rs
constant PAYLOAD_OFFSET (line 27) | const PAYLOAD_OFFSET: usize = 8;
function new_checked (line 38) | pub fn new_checked(buffer: T) -> Result<Self, DecodeError> {
function check_buffer_length (line 44) | fn check_buffer_length(&self) -> Result<(), DecodeError> {
function nlas (line 64) | pub fn nlas(&self) -> impl Iterator<Item = Result<NlaBuffer<&'a [u8]>, D...
type NextHop (line 70) | pub struct NextHop {
method parse (line 82) | fn parse(buf: &NextHopBuffer<&T>) -> Result<NextHop, DecodeError> {
method gateway (line 125) | pub fn gateway(&self) -> Option<IpAddr> {
function parse (line 98) | fn parse(buf: &NextHopBuffer<&'a T>) -> Result<Self, DecodeError> {
method buffer_len (line 108) | fn buffer_len(&self) -> usize {
method emit (line 113) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/route/test.rs
function route_message (line 67) | fn route_message() -> RouteMessage {
function parse_message_with_multipath_nla (line 109) | fn parse_message_with_multipath_nla() {
function emit_message_with_multipath_nla (line 118) | fn emit_message_with_multipath_nla() {
FILE: netlink-packet-route/src/rtnl/rule/buffer.rs
constant RULE_HEADER_LEN (line 8) | pub const RULE_HEADER_LEN: usize = 12;
function nlas (line 24) | pub fn nlas(&self) -> impl Iterator<Item = Result<NlaBuffer<&'a [u8]>, D...
FILE: netlink-packet-route/src/rtnl/rule/header.rs
method default (line 23) | fn default() -> Self {
type RuleHeader (line 31) | pub struct RuleHeader {
method parse (line 63) | fn parse(buf: &RuleMessageBuffer<&'a T>) -> Result<Self, DecodeError> {
method buffer_len (line 46) | fn buffer_len(&self) -> usize {
method emit (line 50) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/rule/message.rs
type RuleMessage (line 11) | pub struct RuleMessage {
method parse (line 30) | fn parse(buf: &RuleMessageBuffer<&'a T>) -> Result<Self, DecodeError> {
method buffer_len (line 17) | fn buffer_len(&self) -> usize {
method emit (line 21) | fn emit(&self, buffer: &mut [u8]) {
function parse (line 38) | fn parse(buf: &RuleMessageBuffer<&'a T>) -> Result<Self, DecodeError> {
FILE: netlink-packet-route/src/rtnl/rule/nlas/mod.rs
type Nla (line 38) | pub enum Nla {
method value_len (line 73) | fn value_len(&self) -> usize {
method kind (line 91) | fn kind(&self) -> u16 {
method emit_value (line 119) | fn emit_value(&self, buffer: &mut [u8]) {
method parse (line 147) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
FILE: netlink-packet-route/src/rtnl/tc/buffer.rs
constant TC_HEADER_LEN (line 8) | pub const TC_HEADER_LEN: usize = 20;
function nlas (line 22) | pub fn nlas(&self) -> impl Iterator<Item = Result<NlaBuffer<&'a [u8]>, D...
FILE: netlink-packet-route/src/rtnl/tc/constants.rs
constant TC_H_MAJ_MASK (line 4) | pub const TC_H_MAJ_MASK: u32 = 0xFFFF0000;
constant TC_H_MIN_MASK (line 5) | pub const TC_H_MIN_MASK: u32 = 0x0000FFFF;
constant TC_H_UNSPEC (line 14) | pub const TC_H_UNSPEC: u32 = 0;
constant TC_H_ROOT (line 15) | pub const TC_H_ROOT: u32 = 0xFFFFFFFF;
constant TC_H_INGRESS (line 16) | pub const TC_H_INGRESS: u32 = 0xFFFFFFF1;
constant TC_H_CLSACT (line 17) | pub const TC_H_CLSACT: u32 = TC_H_INGRESS;
constant TC_H_MIN_PRIORITY (line 19) | pub const TC_H_MIN_PRIORITY: u32 = 0xFFE0;
constant TC_H_MIN_INGRESS (line 20) | pub const TC_H_MIN_INGRESS: u32 = 0xFFF2;
constant TC_H_MIN_EGRESS (line 21) | pub const TC_H_MIN_EGRESS: u32 = 0xFFF3;
constant TCA_U32_UNSPEC (line 24) | pub const TCA_U32_UNSPEC: u16 = 0;
constant TCA_U32_CLASSID (line 25) | pub const TCA_U32_CLASSID: u16 = 1;
constant TCA_U32_HASH (line 26) | pub const TCA_U32_HASH: u16 = 2;
constant TCA_U32_LINK (line 27) | pub const TCA_U32_LINK: u16 = 3;
constant TCA_U32_DIVISOR (line 28) | pub const TCA_U32_DIVISOR: u16 = 4;
constant TCA_U32_SEL (line 29) | pub const TCA_U32_SEL: u16 = 5;
constant TCA_U32_POLICE (line 30) | pub const TCA_U32_POLICE: u16 = 6;
constant TCA_U32_ACT (line 31) | pub const TCA_U32_ACT: u16 = 7;
constant TCA_U32_INDEV (line 32) | pub const TCA_U32_INDEV: u16 = 8;
constant TCA_U32_PCNT (line 33) | pub const TCA_U32_PCNT: u16 = 9;
constant TCA_U32_MARK (line 34) | pub const TCA_U32_MARK: u16 = 10;
constant TCA_U32_FLAGS (line 35) | pub const TCA_U32_FLAGS: u16 = 11;
constant TCA_U32_PAD (line 36) | pub const TCA_U32_PAD: u16 = 12;
constant TCA_U32_MAX (line 37) | pub const TCA_U32_MAX: u16 = TCA_U32_PAD;
constant TC_U32_TERMINAL (line 40) | pub const TC_U32_TERMINAL: u8 = 1;
constant TC_U32_OFFSET (line 41) | pub const TC_U32_OFFSET: u8 = 2;
constant TC_U32_VAROFFSET (line 42) | pub const TC_U32_VAROFFSET: u8 = 4;
constant TC_U32_EAT (line 43) | pub const TC_U32_EAT: u8 = 8;
constant TC_U32_MAXDEPTH (line 44) | pub const TC_U32_MAXDEPTH: u8 = 8;
constant TCA_ACT_UNSPEC (line 47) | pub const TCA_ACT_UNSPEC: u16 = 0;
constant TCA_ACT_KIND (line 48) | pub const TCA_ACT_KIND: u16 = 1;
constant TCA_ACT_OPTIONS (line 49) | pub const TCA_ACT_OPTIONS: u16 = 2;
constant TCA_ACT_INDEX (line 50) | pub const TCA_ACT_INDEX: u16 = 3;
constant TCA_ACT_STATS (line 51) | pub const TCA_ACT_STATS: u16 = 4;
constant TCA_ACT_PAD (line 52) | pub const TCA_ACT_PAD: u16 = 5;
constant TCA_ACT_COOKIE (line 53) | pub const TCA_ACT_COOKIE: u16 = 6;
constant TCA_ACT_MAX (line 56) | pub const TCA_ACT_MAX: u16 = 7;
constant TCA_OLD_COMPAT (line 57) | pub const TCA_OLD_COMPAT: u16 = TCA_ACT_MAX + 1;
constant TCA_ACT_MAX_PRIO (line 58) | pub const TCA_ACT_MAX_PRIO: u16 = 32;
constant TCA_ACT_BIND (line 59) | pub const TCA_ACT_BIND: u16 = 1;
constant TCA_ACT_NOBIND (line 60) | pub const TCA_ACT_NOBIND: u16 = 0;
constant TCA_ACT_UNBIND (line 61) | pub const TCA_ACT_UNBIND: u16 = 1;
constant TCA_ACT_NOUNBIND (line 62) | pub const TCA_ACT_NOUNBIND: u16 = 0;
constant TCA_ACT_REPLACE (line 63) | pub const TCA_ACT_REPLACE: u16 = 1;
constant TCA_ACT_NOREPLACE (line 64) | pub const TCA_ACT_NOREPLACE: u16 = 0;
constant TC_ACT_UNSPEC (line 66) | pub const TC_ACT_UNSPEC: i32 = -1;
constant TC_ACT_OK (line 67) | pub const TC_ACT_OK: i32 = 0;
constant TC_ACT_RECLASSIFY (line 68) | pub const TC_ACT_RECLASSIFY: i32 = 1;
constant TC_ACT_SHOT (line 69) | pub const TC_ACT_SHOT: i32 = 2;
constant TC_ACT_PIPE (line 70) | pub const TC_ACT_PIPE: i32 = 3;
constant TC_ACT_STOLEN (line 71) | pub const TC_ACT_STOLEN: i32 = 4;
constant TC_ACT_QUEUED (line 72) | pub const TC_ACT_QUEUED: i32 = 5;
constant TC_ACT_REPEAT (line 73) | pub const TC_ACT_REPEAT: i32 = 6;
constant TC_ACT_REDIRECT (line 74) | pub const TC_ACT_REDIRECT: i32 = 7;
constant TC_ACT_TRAP (line 75) | pub const TC_ACT_TRAP: i32 = 8;
constant TC_ACT_VALUE_MAX (line 77) | pub const TC_ACT_VALUE_MAX: i32 = TC_ACT_TRAP;
constant TC_ACT_JUMP (line 79) | pub const TC_ACT_JUMP: i32 = 0x10000000;
constant TCA_ACT_TAB (line 81) | pub const TCA_ACT_TAB: u16 = 1;
constant TCAA_MAX (line 82) | pub const TCAA_MAX: u16 = 1;
constant TCA_MIRRED_UNSPEC (line 85) | pub const TCA_MIRRED_UNSPEC: u16 = 0;
constant TCA_MIRRED_TM (line 86) | pub const TCA_MIRRED_TM: u16 = 1;
constant TCA_MIRRED_PARMS (line 87) | pub const TCA_MIRRED_PARMS: u16 = 2;
constant TCA_MIRRED_PAD (line 88) | pub const TCA_MIRRED_PAD: u16 = 3;
constant TCA_MIRRED_MAX (line 89) | pub const TCA_MIRRED_MAX: u16 = TCA_MIRRED_PAD;
constant TCA_EGRESS_REDIR (line 91) | pub const TCA_EGRESS_REDIR: i32 = 1;
constant TCA_EGRESS_MIRROR (line 92) | pub const TCA_EGRESS_MIRROR: i32 = 2;
constant TCA_INGRESS_REDIR (line 93) | pub const TCA_INGRESS_REDIR: i32 = 3;
constant TCA_INGRESS_MIRROR (line 94) | pub const TCA_INGRESS_MIRROR: i32 = 4;
FILE: netlink-packet-route/src/rtnl/tc/message.rs
type TcMessage (line 20) | pub struct TcMessage {
method into_parts (line 26) | pub fn into_parts(self) -> (TcHeader, Vec<Nla>) {
method from_parts (line 30) | pub fn from_parts(header: TcHeader, nlas: Vec<Nla>) -> Self {
method with_index (line 35) | pub fn with_index(index: i32) -> Self {
method parse (line 99) | fn parse(buf: &TcMessageBuffer<&'a T>) -> Result<Self, DecodeError> {
type TcHeader (line 47) | pub struct TcHeader {
method parse (line 87) | fn parse(buf: &TcMessageBuffer<T>) -> Result<Self, DecodeError> {
method buffer_len (line 59) | fn buffer_len(&self) -> usize {
method emit (line 63) | fn emit(&self, buffer: &mut [u8]) {
method buffer_len (line 74) | fn buffer_len(&self) -> usize {
method emit (line 78) | fn emit(&self, buffer: &mut [u8]) {
function parse (line 108) | fn parse(buf: &TcMessageBuffer<&'a T>) -> Result<Self, DecodeError> {
FILE: netlink-packet-route/src/rtnl/tc/nlas/action/mirred.rs
constant KIND (line 16) | pub const KIND: &str = "mirred";
constant TC_MIRRED_BUF_LEN (line 17) | pub const TC_MIRRED_BUF_LEN: usize = TC_GEN_BUF_LEN + 8;
type Nla (line 20) | pub enum Nla {
method value_len (line 28) | fn value_len(&self) -> usize {
method emit_value (line 37) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 45) | fn kind(&self) -> u16 {
method parse (line 57) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
type TcMirred (line 70) | pub struct TcMirred {
method parse (line 110) | fn parse(buf: &TcMirredBuffer<T>) -> Result<Self, DecodeError> {
method buffer_len (line 92) | fn buffer_len(&self) -> usize {
method emit (line 96) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/tc/nlas/action/mod.rs
constant TC_GEN_BUF_LEN (line 16) | pub const TC_GEN_BUF_LEN: usize = 20;
type Action (line 19) | pub struct Action {
method value_len (line 34) | fn value_len(&self) -> usize {
method emit_value (line 38) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 42) | fn kind(&self) -> u16 {
method parse (line 48) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
method default (line 25) | fn default() -> Self {
type ActNla (line 95) | pub enum ActNla {
method value_len (line 106) | fn value_len(&self) -> usize {
method emit_value (line 117) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 131) | fn kind(&self) -> u16 {
type ActOpt (line 146) | pub enum ActOpt {
method value_len (line 153) | fn value_len(&self) -> usize {
method emit_value (line 161) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 169) | fn kind(&self) -> u16 {
method parse_with_param (line 183) | fn parse_with_param(buf: &NlaBuffer<&'a T>, kind: S) -> Result<Self, D...
type TcGen (line 194) | pub struct TcGen {
method parse (line 226) | fn parse(buf: &TcGenBuffer<T>) -> Result<Self, DecodeError> {
method buffer_len (line 211) | fn buffer_len(&self) -> usize {
method emit (line 215) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/tc/nlas/filter/u32.rs
constant KIND (line 20) | pub const KIND: &str = "u32";
constant U32_SEL_BUF_LEN (line 22) | const U32_SEL_BUF_LEN: usize = 16;
constant U32_KEY_BUF_LEN (line 23) | const U32_KEY_BUF_LEN: usize = 16;
type Nla (line 26) | pub enum Nla {
method value_len (line 43) | fn value_len(&self) -> usize {
method emit_value (line 54) | fn emit_value(&self, buffer: &mut [u8]) {
method kind (line 69) | fn kind(&self) -> u16 {
method parse (line 90) | fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
type Sel (line 126) | pub struct Sel {
method parse (line 176) | fn parse(buf: &SelBuffer<&T>) -> Result<Self, DecodeError> {
method buffer_len (line 152) | fn buffer_len(&self) -> usize {
method emit (line 156) | fn emit(&self, buffer: &mut [u8]) {
type Key (line 204) | pub struct Key {
method parse (line 232) | fn parse(buf: &KeyBuffer<T>) -> Result<Self, DecodeError> {
method buffer_len (line 219) | fn buffer_len(&self) -> usize {
method emit (line 222) | fn emit(&self, buffer: &mut [u8]) {
FILE: netlink-packet-route/src/rtnl/tc/nlas/mod.rs
type Nla (line 35) | pub enum Nla {
method value_len (line 58) | fn value_len(&self) -> usize {
method
Condensed preview — 373 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,321K chars).
[
{
"path": ".github/workflows/clippy-rustfmt.yml",
"chars": 741,
"preview": "name: Rustfmt and clippy check\n\non:\n pull_request:\n types: [opened, synchronize, reopened]\n push:\n branches:\n "
},
{
"path": ".github/workflows/license.yml",
"chars": 338,
"preview": "name: license\n\non:\n pull_request:\n types: [opened, synchronize, reopened]\n push:\n branches:\n - master\n\njobs"
},
{
"path": ".github/workflows/main.yml",
"chars": 2055,
"preview": "name: CI\n\non:\n pull_request:\n types: [opened, synchronize, reopened]\n push:\n branches:\n - master\n\njobs:\n c"
},
{
"path": ".gitignore",
"chars": 37,
"preview": "**/target\n**/*.rs.bk\nCargo.lock\n.idea"
},
{
"path": ".licenserc.yaml",
"chars": 249,
"preview": "header:\n license:\n content: |\n SPDX-License-Identifier: MIT\n paths-ignore:\n - 'target'\n - '**/*.toml'\n "
},
{
"path": "CHANGELOG",
"chars": 8409,
"preview": "# Changelog\n## On-going\n### Versioning\n### Breaking Changes\n### New Features\n### Bug fixes\n\n## [20220715] 2022-07-15\n###"
},
{
"path": "Cargo.toml",
"chars": 847,
"preview": "[workspace]\n\nmembers = [\n \"netlink-sys\",\n \"netlink-packet-core\",\n \"netlink-packet-utils\",\n \"netlink-packet-g"
},
{
"path": "LICENSE-MIT",
"chars": 1532,
"preview": "Permission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentati"
},
{
"path": "README.md",
"chars": 4390,
"preview": "[](https://travis-ci.org/little-dude/netlink"
},
{
"path": "RELEASE_PROCESS.md",
"chars": 5300,
"preview": "# Release process\n\n## Summary\n\n- bump the versions in the Cargo.toml using `git blame` and `git log`,\n starting from th"
},
{
"path": "audit/Cargo.toml",
"chars": 971,
"preview": "[package]\nname = \"audit\"\nversion = \"0.7.1\"\nauthors = [\"Corentin Henry <corentinhenry@gmail.com>\"]\nedition = \"2018\"\n\nhome"
},
{
"path": "audit/examples/add_rules.rs",
"chars": 1750,
"preview": "// SPDX-License-Identifier: MIT\n\n//! In this example, we create two rules which is equivalent to the following commands:"
},
{
"path": "audit/examples/dump_audit_rules.rs",
"chars": 732,
"preview": "// SPDX-License-Identifier: MIT\n\n//! In this example, we create a netlink connection, and send a request to retrieve the"
},
{
"path": "audit/examples/events.rs",
"chars": 587,
"preview": "// SPDX-License-Identifier: MIT\n\n//! This example opens a netlink socket, enables audit events, and prints the events th"
},
{
"path": "audit/examples/events_async.rs",
"chars": 602,
"preview": "// SPDX-License-Identifier: MIT\n\n//! This example opens a netlink socket, enables audit events, and prints the events th"
},
{
"path": "audit/src/errors.rs",
"chars": 432,
"preview": "// SPDX-License-Identifier: MIT\n\nuse thiserror::Error;\n\nuse crate::packet::{AuditMessage, ErrorMessage, NetlinkMessage};"
},
{
"path": "audit/src/handle.rs",
"chars": 5657,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::process;\n\nuse futures::{\n future::{self, Either},\n stream::{Stream, Stre"
},
{
"path": "audit/src/lib.rs",
"chars": 1175,
"preview": "// SPDX-License-Identifier: MIT\n\nmod handle;\npub use crate::handle::*;\n\nmod errors;\npub use crate::errors::*;\n\npub use n"
},
{
"path": "ethtool/Cargo.toml",
"chars": 1362,
"preview": "[package]\nname = \"ethtool\"\nversion = \"0.2.3\"\nauthors = [\"Gris Ge <fge@redhat.com>\"]\nlicense = \"MIT\"\nedition = \"2018\"\ndes"
},
{
"path": "ethtool/examples/dump_coalesce.rs",
"chars": 791,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::stream::TryStreamExt;\n\n// Once we find a way to load netsimdev kernel modu"
},
{
"path": "ethtool/examples/dump_features.rs",
"chars": 786,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::stream::TryStreamExt;\n\n// Once we find a way to load netsimdev kernel modu"
},
{
"path": "ethtool/examples/dump_link_mode.rs",
"chars": 796,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::stream::TryStreamExt;\n\n// Once we find a way to load netsimdev kernel modu"
},
{
"path": "ethtool/examples/dump_pause.rs",
"chars": 769,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::stream::TryStreamExt;\n\n// Once we find a way to load netsimdev kernel modu"
},
{
"path": "ethtool/examples/dump_rings.rs",
"chars": 771,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::stream::TryStreamExt;\n\n// Once we find a way to load netsimdev kernel modu"
},
{
"path": "ethtool/src/coalesce/attr.rs",
"chars": 11315,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\nuse byteorder::{ByteOrder, NativeEndian};\nuse netlink_packet_utils"
},
{
"path": "ethtool/src/coalesce/get.rs",
"chars": 920,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::TryStream;\nuse netlink_packet_generic::GenlMessage;\n\nuse crate::{ethtool_e"
},
{
"path": "ethtool/src/coalesce/handle.rs",
"chars": 507,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{EthtoolCoalesceGetRequest, EthtoolHandle};\n\npub struct EthtoolCoalesceHandl"
},
{
"path": "ethtool/src/coalesce/mod.rs",
"chars": 222,
"preview": "// SPDX-License-Identifier: MIT\n\nmod attr;\nmod get;\nmod handle;\n\npub(crate) use attr::parse_coalesce_nlas;\n\npub use attr"
},
{
"path": "ethtool/src/connection.rs",
"chars": 921,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::io;\n\nuse futures::channel::mpsc::UnboundedReceiver;\nuse genetlink::message::Ra"
},
{
"path": "ethtool/src/error.rs",
"chars": 585,
"preview": "// SPDX-License-Identifier: MIT\n\nuse thiserror::Error;\n\nuse netlink_packet_core::{ErrorMessage, NetlinkMessage};\nuse net"
},
{
"path": "ethtool/src/feature/attr.rs",
"chars": 7963,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\nuse log::warn;\nuse netlink_packet_utils::{\n nla::{DefaultNla, N"
},
{
"path": "ethtool/src/feature/get.rs",
"chars": 915,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::TryStream;\nuse netlink_packet_generic::GenlMessage;\n\nuse crate::{ethtool_e"
},
{
"path": "ethtool/src/feature/handle.rs",
"chars": 500,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{EthtoolFeatureGetRequest, EthtoolHandle};\n\npub struct EthtoolFeatureHandle("
},
{
"path": "ethtool/src/feature/mod.rs",
"chars": 238,
"preview": "// SPDX-License-Identifier: MIT\n\nmod attr;\nmod get;\nmod handle;\n\npub(crate) use attr::parse_feature_nlas;\npub use attr::"
},
{
"path": "ethtool/src/handle.rs",
"chars": 2747,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::{future::Either, FutureExt, Stream, StreamExt, TryStream};\nuse genetlink::"
},
{
"path": "ethtool/src/header.rs",
"chars": 2859,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::ffi::CString;\n\nuse anyhow::Context;\nuse byteorder::{ByteOrder, NativeEndian};\n"
},
{
"path": "ethtool/src/lib.rs",
"chars": 1027,
"preview": "// SPDX-License-Identifier: MIT\n\nmod coalesce;\nmod connection;\nmod error;\nmod feature;\nmod handle;\nmod header;\nmod link_"
},
{
"path": "ethtool/src/link_mode/attr.rs",
"chars": 8047,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\nuse log::warn;\nuse netlink_packet_utils::{\n nla::{DefaultNla, N"
},
{
"path": "ethtool/src/link_mode/get.rs",
"chars": 921,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::TryStream;\nuse netlink_packet_generic::GenlMessage;\n\nuse crate::{ethtool_e"
},
{
"path": "ethtool/src/link_mode/handle.rs",
"chars": 502,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{EthtoolHandle, EthtoolLinkModeGetRequest};\n\npub struct EthtoolLinkModeHandl"
},
{
"path": "ethtool/src/link_mode/mod.rs",
"chars": 247,
"preview": "// SPDX-License-Identifier: MIT\n\nmod attr;\nmod get;\nmod handle;\n\npub(crate) use attr::parse_link_mode_nlas;\npub use attr"
},
{
"path": "ethtool/src/macros.rs",
"chars": 847,
"preview": "// SPDX-License-Identifier: MIT\n\n#[macro_export]\nmacro_rules! try_ethtool {\n ($msg: expr) => {{\n use netlink_p"
},
{
"path": "ethtool/src/message.rs",
"chars": 7289,
"preview": "// SPDX-License-Identifier: MIT\n\nuse netlink_packet_core::DecodeError;\nuse netlink_packet_generic::{GenlFamily, GenlHead"
},
{
"path": "ethtool/src/pause/attr.rs",
"chars": 5538,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\nuse byteorder::{ByteOrder, NativeEndian};\nuse netlink_packet_utils"
},
{
"path": "ethtool/src/pause/get.rs",
"chars": 905,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::TryStream;\nuse netlink_packet_generic::GenlMessage;\n\nuse crate::{ethtool_e"
},
{
"path": "ethtool/src/pause/handle.rs",
"chars": 485,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{EthtoolHandle, EthtoolPauseGetRequest};\n\npub struct EthtoolPauseHandle(Etht"
},
{
"path": "ethtool/src/pause/mod.rs",
"chars": 233,
"preview": "// SPDX-License-Identifier: MIT\n\nmod attr;\nmod get;\nmod handle;\n\npub(crate) use attr::parse_pause_nlas;\npub use attr::{E"
},
{
"path": "ethtool/src/ring/attr.rs",
"chars": 4952,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\nuse byteorder::{ByteOrder, NativeEndian};\nuse netlink_packet_utils"
},
{
"path": "ethtool/src/ring/get.rs",
"chars": 900,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::TryStream;\nuse netlink_packet_generic::GenlMessage;\n\nuse crate::{ethtool_e"
},
{
"path": "ethtool/src/ring/handle.rs",
"chars": 479,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{EthtoolHandle, EthtoolRingGetRequest};\n\npub struct EthtoolRingHandle(Ethtoo"
},
{
"path": "ethtool/src/ring/mod.rs",
"chars": 206,
"preview": "// SPDX-License-Identifier: MIT\n\nmod attr;\nmod get;\nmod handle;\n\npub(crate) use attr::parse_ring_nlas;\n\npub use attr::Et"
},
{
"path": "ethtool/tests/dump_link_modes.rs",
"chars": 941,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::stream::TryStreamExt;\n\n#[test]\n// CI container normally have a veth for ex"
},
{
"path": "ethtool/tests/get_features_lo.rs",
"chars": 1088,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::stream::TryStreamExt;\n\n#[test]\nfn test_get_features_of_loopback() {\n le"
},
{
"path": "genetlink/Cargo.toml",
"chars": 1259,
"preview": "[package]\nname = \"genetlink\"\nversion = \"0.2.3\"\nauthors = [\"Leo <leo881003@gmail.com>\"]\nedition = \"2018\"\nhomepage = \"http"
},
{
"path": "genetlink/examples/dump_family_policy.rs",
"chars": 1617,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::env::args;\n\nuse anyhow::{bail, Error};\nuse futures::StreamExt;\nuse genetlink::"
},
{
"path": "genetlink/examples/list_genetlink_family.rs",
"chars": 3036,
"preview": "// SPDX-License-Identifier: MIT\n\n//! Example of listing generic families based on `netlink_proto`\n//!\n//! This example's"
},
{
"path": "genetlink/src/connection.rs",
"chars": 1745,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{message::RawGenlMessage, GenetlinkHandle};\nuse futures::channel::mpsc::Unbo"
},
{
"path": "genetlink/src/error.rs",
"chars": 945,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::message::RawGenlMessage;\n\n/// Error type of genetlink\n#[derive(Debug, Error)"
},
{
"path": "genetlink/src/handle.rs",
"chars": 5430,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n error::GenetlinkError,\n message::{map_from_rawgenlmsg, map_to_rawge"
},
{
"path": "genetlink/src/lib.rs",
"chars": 323,
"preview": "// SPDX-License-Identifier: MIT\n\n#[macro_use]\nextern crate thiserror;\n\nmod connection;\nmod error;\nmod handle;\npub mod me"
},
{
"path": "genetlink/src/message.rs",
"chars": 6154,
"preview": "// SPDX-License-Identifier: MIT\n\n//! Raw generic netlink payload message\n//!\n//! # Design\n//! Since we use generic type "
},
{
"path": "genetlink/src/resolver.rs",
"chars": 5028,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{error::GenetlinkError, GenetlinkHandle};\nuse futures::{future::Either, Stre"
},
{
"path": "mptcp-pm/Cargo.toml",
"chars": 1306,
"preview": "[package]\nname = \"mptcp-pm\"\nversion = \"0.1.1\"\nauthors = [\"Gris Ge <fge@redhat.com>\"]\nlicense = \"MIT\"\nedition = \"2018\"\nde"
},
{
"path": "mptcp-pm/examples/dump_mptcp.rs",
"chars": 943,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::stream::TryStreamExt;\n\nfn main() {\n let rt = tokio::runtime::Builder::n"
},
{
"path": "mptcp-pm/src/address/attr.rs",
"chars": 6078,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::net::{IpAddr, Ipv4Addr, Ipv6Addr};\n\nuse anyhow::Context;\nuse byteorder::{ByteO"
},
{
"path": "mptcp-pm/src/address/get.rs",
"chars": 812,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::TryStream;\nuse netlink_packet_generic::GenlMessage;\n\nuse crate::{\n mptc"
},
{
"path": "mptcp-pm/src/address/handle.rs",
"chars": 551,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{MptcpPathManagerAddressGetRequest, MptcpPathManagerHandle};\n\npub struct Mpt"
},
{
"path": "mptcp-pm/src/address/mod.rs",
"chars": 238,
"preview": "// SPDX-License-Identifier: MIT\n\nmod attr;\nmod get;\nmod handle;\n\npub use attr::{MptcpPathManagerAddressAttr, MptcpPathMa"
},
{
"path": "mptcp-pm/src/connection.rs",
"chars": 957,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::io;\n\nuse futures::channel::mpsc::UnboundedReceiver;\nuse genetlink::message::Ra"
},
{
"path": "mptcp-pm/src/error.rs",
"chars": 612,
"preview": "// SPDX-License-Identifier: MIT\n\nuse thiserror::Error;\n\nuse netlink_packet_core::{ErrorMessage, NetlinkMessage};\nuse net"
},
{
"path": "mptcp-pm/src/handle.rs",
"chars": 2419,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::{future::Either, FutureExt, Stream, StreamExt, TryStream};\nuse genetlink::"
},
{
"path": "mptcp-pm/src/lib.rs",
"chars": 735,
"preview": "// SPDX-License-Identifier: MIT\n\nmod address;\nmod connection;\nmod error;\nmod handle;\nmod limits;\nmod macros;\nmod message"
},
{
"path": "mptcp-pm/src/limits/attr.rs",
"chars": 1781,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\nuse byteorder::{ByteOrder, NativeEndian};\nuse netlink_packet_utils"
},
{
"path": "mptcp-pm/src/limits/get.rs",
"chars": 807,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::TryStream;\nuse netlink_packet_generic::GenlMessage;\n\nuse crate::{\n mptc"
},
{
"path": "mptcp-pm/src/limits/handle.rs",
"chars": 545,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{MptcpPathManagerHandle, MptcpPathManagerLimitsGetRequest};\n\npub struct Mptc"
},
{
"path": "mptcp-pm/src/limits/mod.rs",
"chars": 200,
"preview": "// SPDX-License-Identifier: MIT\n\nmod attr;\nmod get;\nmod handle;\n\npub use attr::MptcpPathManagerLimitsAttr;\npub use get::"
},
{
"path": "mptcp-pm/src/macros.rs",
"chars": 1017,
"preview": "// SPDX-License-Identifier: MIT\n\n#[macro_export]\nmacro_rules! try_mptcp {\n ($msg: expr) => {{\n use netlink_pac"
},
{
"path": "mptcp-pm/src/message.rs",
"chars": 5017,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\nuse netlink_packet_core::DecodeError;\nuse netlink_packet_generic::"
},
{
"path": "mptcp-pm/tests/dump_mptcp.rs",
"chars": 1845,
"preview": "// SPDX-License-Identifier: MIT\n\nuse futures::stream::TryStreamExt;\nuse std::process::Command;\n\nuse mptcp_pm::{MptcpPath"
},
{
"path": "netlink-packet-audit/Cargo.toml",
"chars": 716,
"preview": "[package]\nauthors = [\"Corentin Henry <corentinhenry@gmail.com>\"]\nname = \"netlink-packet-audit\"\nversion = \"0.4.2\"\nedition"
},
{
"path": "netlink-packet-audit/fuzz/.gitignore",
"chars": 25,
"preview": "\ntarget\ncorpus\nartifacts\n"
},
{
"path": "netlink-packet-audit/fuzz/Cargo.toml",
"chars": 490,
"preview": "[package]\nname = \"netlink-packet-audit-fuzz\"\nversion = \"0.0.1\"\nauthors = [\"Automatically generated\"]\npublish = false\nedi"
},
{
"path": "netlink-packet-audit/fuzz/fuzz_targets/netlink.rs",
"chars": 233,
"preview": "// SPDX-License-Identifier: MIT\n\n#![no_main]\n\nuse libfuzzer_sys::fuzz_target;\nuse netlink_packet_audit::{AuditMessage, N"
},
{
"path": "netlink-packet-audit/src/buffer.rs",
"chars": 3116,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n constants::*,\n rules::{RuleBuffer, RuleMessage},\n traits::{Parse"
},
{
"path": "netlink-packet-audit/src/codec.rs",
"chars": 5354,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::{fmt::Debug, io};\n\nuse bytes::BytesMut;\nuse netlink_packet_core::{\n Netlink"
},
{
"path": "netlink-packet-audit/src/constants.rs",
"chars": 15215,
"preview": "// SPDX-License-Identifier: MIT\n\npub use netlink_packet_core::constants::*;\n\n// ========================================"
},
{
"path": "netlink-packet-audit/src/lib.rs",
"chars": 808,
"preview": "// SPDX-License-Identifier: MIT\n\n#[macro_use]\nextern crate log;\n\npub(crate) extern crate netlink_packet_utils as utils;\n"
},
{
"path": "netlink-packet-audit/src/message.rs",
"chars": 4571,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n constants::*,\n rules::RuleMessage,\n traits::{Emitable, Parseable"
},
{
"path": "netlink-packet-audit/src/rules/action.rs",
"chars": 760,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::constants::*;\n\n#[derive(Copy, Debug, PartialEq, Eq, Clone)]\npub enum RuleAct"
},
{
"path": "netlink-packet-audit/src/rules/buffer.rs",
"chars": 9192,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\nuse byteorder::{ByteOrder, NativeEndian};\n\nuse crate::{constants::"
},
{
"path": "netlink-packet-audit/src/rules/field.rs",
"chars": 2302,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::constants::*;\n\n#[derive(Debug, PartialEq, Eq, Clone)]\npub enum RuleField {\n "
},
{
"path": "netlink-packet-audit/src/rules/flags.rs",
"chars": 1554,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::constants::*;\n\n#[derive(Copy, Debug, PartialEq, Eq, Clone)]\npub enum RuleFla"
},
{
"path": "netlink-packet-audit/src/rules/mod.rs",
"chars": 281,
"preview": "// SPDX-License-Identifier: MIT\n\nmod action;\npub use self::action::*;\n\nmod field;\npub use self::field::*;\n\nmod flags;\npu"
},
{
"path": "netlink-packet-audit/src/rules/rule.rs",
"chars": 10706,
"preview": "// SPDX-License-Identifier: MIT\n\nuse byteorder::{ByteOrder, NativeEndian};\n\nuse crate::{\n constants::AUDIT_MAX_FIELDS"
},
{
"path": "netlink-packet-audit/src/rules/syscalls.rs",
"chars": 6190,
"preview": "// SPDX-License-Identifier: MIT\n\nuse byteorder::{ByteOrder, NativeEndian};\n\nuse crate::{constants::*, DecodeError};\n\n#[d"
},
{
"path": "netlink-packet-audit/src/rules/tests.rs",
"chars": 23707,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n rules::{\n RuleAction,\n RuleBuffer,\n RuleField,\n "
},
{
"path": "netlink-packet-audit/src/status.rs",
"chars": 5878,
"preview": "// SPDX-License-Identifier: MIT\n\nuse byteorder::{ByteOrder, NativeEndian};\n\nuse crate::{\n traits::{Emitable, Parseabl"
},
{
"path": "netlink-packet-core/Cargo.toml",
"chars": 594,
"preview": "[package]\nauthors = [\"Corentin Henry <corentinhenry@gmail.com>\"]\nname = \"netlink-packet-core\"\nversion = \"0.4.2\"\nedition "
},
{
"path": "netlink-packet-core/examples/protocol.rs",
"chars": 4128,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::{error::Error, fmt};\n\nuse netlink_packet_core::{\n NetlinkDeserializable,\n "
},
{
"path": "netlink-packet-core/examples/rtnetlink.rs",
"chars": 1572,
"preview": "// SPDX-License-Identifier: MIT\n\nuse netlink_packet_core::{NetlinkHeader, NetlinkMessage, NLM_F_DUMP, NLM_F_REQUEST};\nus"
},
{
"path": "netlink-packet-core/src/buffer.rs",
"chars": 14779,
"preview": "// SPDX-License-Identifier: MIT\n\nuse byteorder::{ByteOrder, NativeEndian};\n\nuse crate::{DecodeError, Field, Rest};\n\ncons"
},
{
"path": "netlink-packet-core/src/constants.rs",
"chars": 1605,
"preview": "// SPDX-License-Identifier: MIT\n\n/// Must be set on all request messages (typically from user space to kernel space)\npub"
},
{
"path": "netlink-packet-core/src/error.rs",
"chars": 4311,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::{fmt, io, mem::size_of};\n\nuse byteorder::{ByteOrder, NativeEndian};\n\nuse crate"
},
{
"path": "netlink-packet-core/src/header.rs",
"chars": 4020,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{buffer::NETLINK_HEADER_LEN, DecodeError, Emitable, NetlinkBuffer, Parseable"
},
{
"path": "netlink-packet-core/src/lib.rs",
"chars": 10682,
"preview": "// SPDX-License-Identifier: MIT\n\n//! `netlink-packet-core` provides a generic netlink message\n//! `NetlinkMessage<T>` th"
},
{
"path": "netlink-packet-core/src/message.rs",
"chars": 5347,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\nuse std::fmt::Debug;\n\nuse crate::{\n payload::{NLMSG_DONE, NLMSG"
},
{
"path": "netlink-packet-core/src/payload.rs",
"chars": 1151,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::fmt::Debug;\n\nuse crate::{AckMessage, ErrorMessage, NetlinkSerializable};\n\n/// "
},
{
"path": "netlink-packet-core/src/traits.rs",
"chars": 1484,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::NetlinkHeader;\nuse std::error::Error;\n\n/// A `NetlinkDeserializable` type ca"
},
{
"path": "netlink-packet-generic/Cargo.toml",
"chars": 647,
"preview": "[package]\nname = \"netlink-packet-generic\"\nversion = \"0.3.1\"\nauthors = [\"Leo <leo881003@gmail.com>\"]\nedition = \"2018\"\nhom"
},
{
"path": "netlink-packet-generic/examples/list_generic_family.rs",
"chars": 3276,
"preview": "// SPDX-License-Identifier: MIT\n\nuse netlink_packet_core::{NetlinkMessage, NetlinkPayload, NLM_F_DUMP, NLM_F_REQUEST};\nu"
},
{
"path": "netlink-packet-generic/src/buffer.rs",
"chars": 1225,
"preview": "// SPDX-License-Identifier: MIT\n\n//! Buffer definition of generic netlink packet\nuse crate::{constants::GENL_HDRLEN, hea"
},
{
"path": "netlink-packet-generic/src/constants.rs",
"chars": 3402,
"preview": "// SPDX-License-Identifier: MIT\n\n//! Define constants related to generic netlink\npub const GENL_ID_CTRL: u16 = libc::GEN"
},
{
"path": "netlink-packet-generic/src/ctrl/mod.rs",
"chars": 3723,
"preview": "// SPDX-License-Identifier: MIT\n\n//! Generic netlink controller implementation\n//!\n//! This module provides the definiti"
},
{
"path": "netlink-packet-generic/src/ctrl/nlas/mcast.rs",
"chars": 1703,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::constants::*;\nuse anyhow::Context;\nuse byteorder::{ByteOrder, NativeEndian};"
},
{
"path": "netlink-packet-generic/src/ctrl/nlas/mod.rs",
"chars": 5769,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::constants::*;\nuse anyhow::Context;\nuse byteorder::{ByteOrder, NativeEndian};"
},
{
"path": "netlink-packet-generic/src/ctrl/nlas/oppolicy.rs",
"chars": 2600,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::constants::*;\nuse anyhow::Context;\nuse byteorder::{ByteOrder, NativeEndian};"
},
{
"path": "netlink-packet-generic/src/ctrl/nlas/ops.rs",
"chars": 1538,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::constants::*;\nuse anyhow::Context;\nuse byteorder::{ByteOrder, NativeEndian};"
},
{
"path": "netlink-packet-generic/src/ctrl/nlas/policy.rs",
"chars": 9451,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::constants::*;\nuse anyhow::Context;\nuse byteorder::{ByteOrder, NativeEndian};"
},
{
"path": "netlink-packet-generic/src/header.rs",
"chars": 861,
"preview": "// SPDX-License-Identifier: MIT\n\n//! header definition of generic netlink packet\nuse crate::{buffer::GenlBuffer, constan"
},
{
"path": "netlink-packet-generic/src/lib.rs",
"chars": 3320,
"preview": "// SPDX-License-Identifier: MIT\n\n//! This crate provides the packet of generic netlink family and its controller.\n//!\n//"
},
{
"path": "netlink-packet-generic/src/message.rs",
"chars": 5608,
"preview": "// SPDX-License-Identifier: MIT\n\n//! Message definition and method implementations\n\nuse crate::{buffer::GenlBuffer, head"
},
{
"path": "netlink-packet-generic/src/traits.rs",
"chars": 1160,
"preview": "// SPDX-License-Identifier: MIT\n\n//! Traits for implementing generic netlink family\n\n/// Provide the definition for gene"
},
{
"path": "netlink-packet-generic/tests/query_family_id.rs",
"chars": 1871,
"preview": "// SPDX-License-Identifier: MIT\n\nuse netlink_packet_core::{NetlinkMessage, NetlinkPayload, NLM_F_REQUEST};\nuse netlink_p"
},
{
"path": "netlink-packet-netfilter/Cargo.toml",
"chars": 738,
"preview": "[package]\nauthors = [\"Loïc Damien <loic.damien@dzamlo.ch>\"]\nname = \"netlink-packet-netfilter\"\nversion = \"0.1.0\"\nedition "
},
{
"path": "netlink-packet-netfilter/examples/nflog.rs",
"chars": 4025,
"preview": "// SPDX-License-Identifier: MIT\n\n// To run this example:\n// 1) create a iptables/nft rules that send packet with group"
},
{
"path": "netlink-packet-netfilter/src/buffer.rs",
"chars": 2153,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n message::{NetfilterHeader, NetfilterMessage, NetfilterMessageInner, NE"
},
{
"path": "netlink-packet-netfilter/src/constants.rs",
"chars": 4529,
"preview": "// SPDX-License-Identifier: MIT\n\npub use netlink_packet_core::constants::*;\n\npub const AF_UNSPEC: u8 = libc::AF_UNSPEC a"
},
{
"path": "netlink-packet-netfilter/src/lib.rs",
"chars": 330,
"preview": "// SPDX-License-Identifier: MIT\n\npub extern crate netlink_packet_core as nl;\npub(crate) extern crate netlink_packet_util"
},
{
"path": "netlink-packet-netfilter/src/message.rs",
"chars": 4404,
"preview": "// SPDX-License-Identifier: MIT\n\nuse netlink_packet_core::{\n DecodeError,\n NetlinkDeserializable,\n NetlinkHeade"
},
{
"path": "netlink-packet-netfilter/src/nflog/message.rs",
"chars": 2234,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n buffer::NetfilterBuffer,\n constants::{NFNL_SUBSYS_ULOG, NFULNL_MSG_"
},
{
"path": "netlink-packet-netfilter/src/nflog/mod.rs",
"chars": 811,
"preview": "// SPDX-License-Identifier: MIT\n\nmod message;\npub use message::NfLogMessage;\npub mod nlas;\n\nuse crate::{\n constants::"
},
{
"path": "netlink-packet-netfilter/src/nflog/nlas/config/config_cmd.rs",
"chars": 1684,
"preview": "// SPDX-License-Identifier: MIT\n\nuse netlink_packet_utils::nla::Nla;\n\nconst NFULA_CFG_CMD: u16 = libc::NFULA_CFG_CMD as "
},
{
"path": "netlink-packet-netfilter/src/nflog/nlas/config/config_flags.rs",
"chars": 874,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::mem::size_of;\n\nuse bitflags::bitflags;\nuse byteorder::{BigEndian, ByteOrder};\n"
},
{
"path": "netlink-packet-netfilter/src/nflog/nlas/config/config_mode.rs",
"chars": 2517,
"preview": "// SPDX-License-Identifier: MIT\n\nuse netlink_packet_utils::{buffer, errors::DecodeError, nla::Nla, Parseable};\n\nconst NF"
},
{
"path": "netlink-packet-netfilter/src/nflog/nlas/config/mod.rs",
"chars": 267,
"preview": "// SPDX-License-Identifier: MIT\nmod config_cmd;\nmod config_flags;\nmod config_mode;\nmod nla;\nmod timeout;\n\npub use config"
},
{
"path": "netlink-packet-netfilter/src/nflog/nlas/config/nla.rs",
"chars": 3662,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\nuse byteorder::{BigEndian, ByteOrder};\nuse derive_more::{From, IsV"
},
{
"path": "netlink-packet-netfilter/src/nflog/nlas/config/timeout.rs",
"chars": 869,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::{convert::TryInto, mem::size_of, time::Duration};\n\nuse byteorder::{BigEndian, "
},
{
"path": "netlink-packet-netfilter/src/nflog/nlas/mod.rs",
"chars": 65,
"preview": "// SPDX-License-Identifier: MIT\n\npub mod config;\npub mod packet;\n"
},
{
"path": "netlink-packet-netfilter/src/nflog/nlas/packet/hw_addr.rs",
"chars": 1680,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{constants::NFULA_HWADDR, nla::Nla, traits::Parseable, utils::buffer, Decode"
},
{
"path": "netlink-packet-netfilter/src/nflog/nlas/packet/mod.rs",
"chars": 251,
"preview": "// SPDX-License-Identifier: MIT\n\nmod hw_addr;\nmod nla;\nmod packet_hdr;\nmod timestamp;\n\npub use hw_addr::{HwAddr, HwAddrB"
},
{
"path": "netlink-packet-netfilter/src/nflog/nlas/packet/nla.rs",
"chars": 7828,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::ffi::{CStr, CString};\n\nuse anyhow::Context;\nuse byteorder::{BigEndian, ByteOrd"
},
{
"path": "netlink-packet-netfilter/src/nflog/nlas/packet/packet_hdr.rs",
"chars": 1048,
"preview": "// SPDX-License-Identifier: MIT\n\nuse netlink_packet_core::DecodeError;\nuse netlink_packet_utils::{buffer, nla::Nla, Pars"
},
{
"path": "netlink-packet-netfilter/src/nflog/nlas/packet/timestamp.rs",
"chars": 982,
"preview": "// SPDX-License-Identifier: MIT\n\nuse netlink_packet_core::DecodeError;\nuse netlink_packet_utils::{buffer, nla::Nla, Pars"
},
{
"path": "netlink-packet-route/Cargo.toml",
"chars": 930,
"preview": "[package]\nauthors = [\"Corentin Henry <corentinhenry@gmail.com>\"]\nname = \"netlink-packet-route\"\nversion = \"0.13.0\"\neditio"
},
{
"path": "netlink-packet-route/benches/link_message.rs",
"chars": 2223,
"preview": "// SPDX-License-Identifier: MIT\n\nuse criterion::{criterion_group, criterion_main, Criterion};\n\nuse netlink_packet_route:"
},
{
"path": "netlink-packet-route/benches/rtnetlink_dump.rs",
"chars": 805,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::fs::File;\n\nuse criterion::{criterion_group, criterion_main, Criterion};\nuse pc"
},
{
"path": "netlink-packet-route/data/README.md",
"chars": 589,
"preview": "The rtnetlink dump was generated with:\n\n```\nsudo ip link add name qemu-br1 type bridge\nsudo ip link set qemu-br1 up\nsudo"
},
{
"path": "netlink-packet-route/examples/dump_neighbours.rs",
"chars": 3841,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::{convert::TryFrom, net::IpAddr, string::ToString};\n\nuse netlink_packet_route::"
},
{
"path": "netlink-packet-route/examples/dump_packet_link_bridge_vlan.rs",
"chars": 2813,
"preview": "// SPDX-License-Identifier: MIT\n\nuse netlink_packet_route::{\n nlas::link::Nla,\n LinkMessage,\n NetlinkHeader,\n "
},
{
"path": "netlink-packet-route/examples/dump_packet_links.rs",
"chars": 2568,
"preview": "// SPDX-License-Identifier: MIT\n\nuse netlink_packet_route::{\n LinkMessage,\n NetlinkHeader,\n NetlinkMessage,\n "
},
{
"path": "netlink-packet-route/examples/dump_rules.rs",
"chars": 1902,
"preview": "// SPDX-License-Identifier: MIT\n\nuse netlink_packet_route::{\n constants::*,\n NetlinkHeader,\n NetlinkMessage,\n "
},
{
"path": "netlink-packet-route/examples/new_rule.rs",
"chars": 1899,
"preview": "// SPDX-License-Identifier: MIT\n\nuse netlink_packet_core::{NetlinkHeader, NetlinkMessage, NetlinkPayload};\nuse netlink_p"
},
{
"path": "netlink-packet-route/fuzz/.gitignore",
"chars": 25,
"preview": "\ntarget\ncorpus\nartifacts\n"
},
{
"path": "netlink-packet-route/fuzz/Cargo.toml",
"chars": 386,
"preview": "[package]\nname = \"netlink-packet-route-fuzz\"\nversion = \"0.0.1\"\nauthors = [\"Automatically generated\"]\npublish = false\nedi"
},
{
"path": "netlink-packet-route/fuzz/fuzz_targets/netlink.rs",
"chars": 230,
"preview": "// SPDX-License-Identifier: MIT\n\n#![no_main]\nuse libfuzzer_sys::fuzz_target;\nuse netlink_packet_route::{NetlinkMessage, "
},
{
"path": "netlink-packet-route/src/lib.rs",
"chars": 581,
"preview": "// SPDX-License-Identifier: MIT\n\n#[macro_use]\nextern crate bitflags;\n#[macro_use]\npub(crate) extern crate netlink_packet"
},
{
"path": "netlink-packet-route/src/rtnl/address/buffer.rs",
"chars": 578,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n nlas::{NlaBuffer, NlasIterator},\n DecodeError,\n};\n\npub const ADDRES"
},
{
"path": "netlink-packet-route/src/rtnl/address/message.rs",
"chars": 2338,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\n\nuse crate::{\n nlas::address::Nla,\n traits::{Emitable, Parse"
},
{
"path": "netlink-packet-route/src/rtnl/address/mod.rs",
"chars": 148,
"preview": "// SPDX-License-Identifier: MIT\n\nmod buffer;\npub use self::buffer::*;\n\nmod message;\npub use self::message::*;\n\npub mod n"
},
{
"path": "netlink-packet-route/src/rtnl/address/nlas/cache_info.rs",
"chars": 1216,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n};\n\n#[derive(Debug, Cl"
},
{
"path": "netlink-packet-route/src/rtnl/address/nlas/mod.rs",
"chars": 3551,
"preview": "// SPDX-License-Identifier: MIT\n\nmod cache_info;\npub use self::cache_info::*;\n\nuse std::mem::size_of;\n\nuse anyhow::Conte"
},
{
"path": "netlink-packet-route/src/rtnl/buffer.rs",
"chars": 8605,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n constants::*,\n traits::{Parseable, ParseableParametrized},\n Addr"
},
{
"path": "netlink-packet-route/src/rtnl/constants.rs",
"chars": 46170,
"preview": "// SPDX-License-Identifier: MIT\n\npub use netlink_packet_core::constants::*;\n\npub const RTM_BASE: u16 = 16;\npub const RTM"
},
{
"path": "netlink-packet-route/src/rtnl/link/buffer.rs",
"chars": 626,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n nlas::{NlaBuffer, NlasIterator},\n DecodeError,\n};\n\npub const LINK_H"
},
{
"path": "netlink-packet-route/src/rtnl/link/header.rs",
"chars": 2645,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n LinkMessageBuffer,"
},
{
"path": "netlink-packet-route/src/rtnl/link/message.rs",
"chars": 8480,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\n\nuse crate::{\n nlas::link::Nla,\n traits::{Emitable, Parseabl"
},
{
"path": "netlink-packet-route/src/rtnl/link/mod.rs",
"chars": 135,
"preview": "// SPDX-License-Identifier: MIT\n\nmod buffer;\nmod header;\nmod message;\npub mod nlas;\n\npub use self::{buffer::*, header::*"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/af_spec_bridge.rs",
"chars": 2965,
"preview": "// SPDX-License-Identifier: MIT\n\nuse std::convert::TryFrom;\n\nuse anyhow::Context;\n\nuse crate::{\n constants::*,\n nl"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/af_spec_inet.rs",
"chars": 8452,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\n\nuse super::{inet, inet6};\nuse crate::{\n constants::*,\n nlas"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/bond.rs",
"chars": 15837,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n constants::*,\n nlas::{Nla, NlaBuffer, NlasIterator},\n parsers::{"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/inet/dev_conf.rs",
"chars": 5998,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n};\n\npub const DEV_CONF"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/inet/mod.rs",
"chars": 1668,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\n\nuse crate::{\n constants::{IFLA_INET_CONF, IFLA_INET_UNSPEC},\n "
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/inet6/cache.rs",
"chars": 1309,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n};\n\n#[derive(Clone, Co"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/inet6/dev_conf.rs",
"chars": 10047,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n};\n\npub const LINK_INE"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/inet6/icmp6_stats.rs",
"chars": 1443,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n};\n\n#[derive(Clone, Co"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/inet6/mod.rs",
"chars": 3551,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\nuse byteorder::{ByteOrder, NativeEndian};\n\nuse crate::{\n consta"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/inet6/stats.rs",
"chars": 6447,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n};\n\npub const INET6_ST"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/link_infos.rs",
"chars": 84286,
"preview": "// SPDX-License-Identifier: MIT\n\nuse super::bond::InfoBond;\nuse crate::{\n constants::*,\n nlas::{DefaultNla, Nla, N"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/link_state.rs",
"chars": 1520,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::constants::*;\n\n#[derive(Debug, Clone, Copy, Eq, PartialEq)]\npub enum State {"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/map.rs",
"chars": 1349,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n};\n\npub const LINK_MAP"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/mod.rs",
"chars": 19950,
"preview": "// SPDX-License-Identifier: MIT\n\nmod inet;\npub use self::inet::*;\n\nmod inet6;\npub use self::inet6::*;\n\nmod af_spec_inet;"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/prop_list.rs",
"chars": 1584,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n constants::*,\n nlas::{DefaultNla, Nla, NlaBuffer},\n parsers::par"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/stats.rs",
"chars": 5055,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n};\n\n#[derive(Debug, Cl"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/stats64.rs",
"chars": 5100,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n};\n\npub const LINK_STA"
},
{
"path": "netlink-packet-route/src/rtnl/link/nlas/tests.rs",
"chars": 16892,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{utils::nla::Nla, DecodeError};\n\nuse super::*;\n// https://lists.infradead.or"
},
{
"path": "netlink-packet-route/src/rtnl/message.rs",
"chars": 11064,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n constants::*,\n traits::{Emitable, ParseableParametrized},\n Addre"
},
{
"path": "netlink-packet-route/src/rtnl/mod.rs",
"chars": 1413,
"preview": "// SPDX-License-Identifier: MIT\n\npub mod address;\npub use address::{AddressHeader, AddressMessage, AddressMessageBuffer,"
},
{
"path": "netlink-packet-route/src/rtnl/neighbour/buffer.rs",
"chars": 574,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n nlas::{NlaBuffer, NlasIterator},\n DecodeError,\n};\n\npub const NEIGHB"
},
{
"path": "netlink-packet-route/src/rtnl/neighbour/header.rs",
"chars": 2126,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n NeighbourMessageBu"
},
{
"path": "netlink-packet-route/src/rtnl/neighbour/message.rs",
"chars": 3499,
"preview": "// SPDX-License-Identifier: MIT\n\nuse anyhow::Context;\n\nuse crate::{\n nlas::neighbour::Nla,\n traits::{Emitable, Par"
},
{
"path": "netlink-packet-route/src/rtnl/neighbour/mod.rs",
"chars": 144,
"preview": "// SPDX-License-Identifier: MIT\n\nmod buffer;\nmod header;\nmod message;\npub mod nlas;\n\npub use self::{buffer::*, header::*"
},
{
"path": "netlink-packet-route/src/rtnl/neighbour/nlas/cache_info.rs",
"chars": 1158,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n};\n\n#[derive(Debug, Cl"
},
{
"path": "netlink-packet-route/src/rtnl/neighbour/nlas/mod.rs",
"chars": 3548,
"preview": "// SPDX-License-Identifier: MIT\n\nmod cache_info;\npub use self::cache_info::*;\n\nuse anyhow::Context;\nuse byteorder::{Byte"
},
{
"path": "netlink-packet-route/src/rtnl/neighbour_table/buffer.rs",
"chars": 510,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n nlas::{NlaBuffer, NlasIterator},\n DecodeError,\n};\n\npub const NEIGHB"
},
{
"path": "netlink-packet-route/src/rtnl/neighbour_table/header.rs",
"chars": 795,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n};\n\nuse super::buffer:"
},
{
"path": "netlink-packet-route/src/rtnl/neighbour_table/message.rs",
"chars": 1437,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n nlas::neighbour_table::Nla,\n traits::{Emitable, Parseable},\n Dec"
},
{
"path": "netlink-packet-route/src/rtnl/neighbour_table/mod.rs",
"chars": 144,
"preview": "// SPDX-License-Identifier: MIT\n\nmod buffer;\nmod header;\nmod message;\npub mod nlas;\n\npub use self::{buffer::*, header::*"
},
{
"path": "netlink-packet-route/src/rtnl/neighbour_table/nlas/config.rs",
"chars": 1871,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n};\n\n#[derive(Debug, Cl"
},
{
"path": "netlink-packet-route/src/rtnl/neighbour_table/nlas/mod.rs",
"chars": 3427,
"preview": "// SPDX-License-Identifier: MIT\n\nmod config;\npub use config::*;\n\nmod stats;\npub use stats::*;\n\nuse anyhow::Context;\nuse "
},
{
"path": "netlink-packet-route/src/rtnl/neighbour_table/nlas/stats.rs",
"chars": 2184,
"preview": "// SPDX-License-Identifier: MIT\n\nuse crate::{\n traits::{Emitable, Parseable},\n DecodeError,\n};\n\n#[derive(Debug, Cl"
}
]
// ... and 173 more files (download for full content)
About this extraction
This page contains the full source code of the little-dude/netlink GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 373 files (1.2 MB), approximately 360.4k tokens, and a symbol index with 3686 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.