Skip to content

Commit 33d8e1c

Browse files
committed
Enable CI
Signed-off-by: Gris Ge <[email protected]>
1 parent 54066e7 commit 33d8e1c

File tree

6 files changed

+115
-72
lines changed

6 files changed

+115
-72
lines changed

.github/workflows/clippy-rustfmt.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Rustfmt and clippy check
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
rustfmt_clippy:
12+
strategy:
13+
fail-fast: true
14+
15+
name: Rustfmt and clippy check
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Install Rust Nightly
22+
uses: actions-rs/toolchain@v1
23+
with:
24+
toolchain: nightly
25+
override: true
26+
components: rustfmt, clippy
27+
28+
- name: rustfmt
29+
run: cargo fmt --all -- --check
30+
31+
- name: clippy-tokio-socket
32+
run: cargo clippy
33+
34+
- name: clippy-smol-socket
35+
run: cargo clippy --no-default-features --features smol_socket

.github/workflows/license.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: license
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
check-license:
12+
name: Check License
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 3
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Check License Header
19+
uses: apache/[email protected]

.github/workflows/main.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
ci:
12+
name: CI (stable)
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Install Rust Stable
19+
uses: actions-rs/toolchain@v1
20+
with:
21+
toolchain: stable
22+
override: true
23+
24+
- name: Test with default feature
25+
env:
26+
# Needed root permission to modify MPTCP
27+
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: "sudo -E"
28+
run: cargo test
29+
30+
- name: Test with tokio feature
31+
env:
32+
# Needed root permission to modify MPTCP
33+
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: "sudo -E"
34+
run: cargo test --features tokio_socket
35+
36+
- name: Test with smol_socket feature
37+
env:
38+
# Needed root permission to modify MPTCP
39+
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: "sudo -E"
40+
run: cargo test --features smol_socket

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Cargo.lock
2+
target
3+
vendor/
4+
5+
*.swp

.licenserc.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
header:
2+
license:
3+
content: |
4+
SPDX-License-Identifier: MIT
5+
paths-ignore:
6+
- 'target'
7+
- '**/*.toml'
8+
- '**/*.lock'
9+
- '**/*.yml'
10+
- '**/*.md'
11+
- 'CHANGELOG'
12+
- 'LICENSE-MIT'
13+
- '.gitignore'
14+
15+
comment: on-failure

README.md

+1-72
Original file line numberDiff line numberDiff line change
@@ -1,72 +1 @@
1-
[![Build Status](https://travis-ci.org/little-dude/netlink.svg?branch=master)](https://travis-ci.org/little-dude/netlink)
2-
3-
# Netlink
4-
5-
This project aims at providing building blocks for [netlink][man-netlink] (see `man 7 netlink`).
6-
7-
## Organization
8-
9-
- the [`netlink_sys`](./netlink-sys) crate provides netlink sockets. Integration with [`mio`][mio] and [`tokio`][tokio]
10-
is optional.
11-
- Each netlink protocol has a `netlink-packet-<protocol_name>` crate that provides the packets for this protocol:
12-
- [`netlink-packet-route`](./netlink-packet-route) provides messages for the [route protocol][man-rtnetlink]
13-
- [`netlink-packet-audit`](./netlink-packet-audit) provides messages for the [audit][man-audit] protocol
14-
- [`netlink-packet-sock-diag`](./netlink-packet-sock-diag) provides messages for the [sock-diag][man-sock-diag]
15-
protocol
16-
- [`netlink-packet-generic`](./netlink-packet-generic) provides message for the [generic netlink][man-genl]
17-
protocol
18-
- [`netlink-packet-netfilter`](./netlink-packet-netfilter) provides message for the `NETLINK_NETFILTER`
19-
protocol
20-
- the [`netlink-packet-core`](./netlink-packet-core) is the glue for all the other `netlink-packet-*` crates. It
21-
provides a `NetlinkMessage<T>` type that represent any netlink message for any sub-protocol.
22-
- the [`netlink_proto`](./netlink-proto) crate is an asynchronous implementation of the netlink protocol. It only
23-
depends on `netlink-packet-core` for the `NetlinkMessage` type and `netlink-sys` for the socket.
24-
- the [`rtnetlink`](./rtnetlink) crate provides higher level abstraction for the [route protocol][man-rtnetlink]
25-
- the [`audit`](./audit) crate provides higher level abstractions for the audit protocol.
26-
- the [`genetlink`](./genetlink) crate provide higher level abstraction for the
27-
[generic netlink protocol][man-genl]
28-
- the [`ethtool`](./ethtool) crate provide higher level abstraction for
29-
[ethtool netlink protocol][ethtool-kernel-doc]
30-
31-
32-
## Altnernatives
33-
34-
- https://github.com/jbaublitz/neli: the main alternative to these crates, as it is actively developed.
35-
- Other but less actively developed alternatives:
36-
- https://github.com/achanda/netlink
37-
- https://github.com/polachok/pnetlink
38-
- https://github.com/crhino/netlink-rs
39-
- https://github.com/carrotsrc/rsnl
40-
- https://github.com/TaborKelly/nl-utils
41-
42-
## Credits
43-
44-
My main resource so far has been the source code of [`pyroute2`][pyroute2] (python) and [`netlink`][netlink-go] (golang)
45-
a lot. These two projects are great, and very nicely written. As someone who does not read C fluently, and that does not
46-
know much about netlink, they have been invaluable.
47-
48-
I'd also like to praise [`libnl`][libnl] for its documentation. It helped me a lot in understanding the protocol basics.
49-
50-
The whole packet parsing logic is inspired by @whitequark excellent blog posts ([part 1][whitequark-1], [part
51-
2][whitequark-2] and [part 3][whitequark-3], although I've only really used the concepts described in the first blog
52-
post).
53-
54-
Thanks also to the people behind [tokio](tokio.rs) for the amazing
55-
tool they are building, and the support they provide.
56-
57-
[man-netlink]: https://www.man7.org/linux/man-pages/man7/netlink.7.html
58-
[man-audit]: https://man7.org/linux/man-pages/man3/audit_open.3.html
59-
[man-sock-diag]: https://www.man7.org/linux/man-pages/man7/sock_diag.7.html
60-
[man-rtnetlink]: https://www.man7.org/linux/man-pages/man7/rtnetlink.7.html
61-
[man-genl]: https://www.man7.org/linux/man-pages/man8/genl.8.html
62-
[generic-netlink-lwn]: https://lwn.net/Articles/208755/
63-
[mio]: https://github.com/tokio-rs/mio
64-
[tokio]: https://github.com/tokio-rs/tokio
65-
[route-proto-doc]: https://www.infradead.org/~tgr/libnl/doc/route.html
66-
[netlink-go]: https://github.com/vishvananda/netlink
67-
[pyroute2]: https://github.com/svinota/pyroute2/tree/master/pyroute2/netlink
68-
[libnl]: https://www.infradead.org/~tgr/libnl
69-
[whitequark-1]: https://lab.whitequark.org/notes/2016-12-13/abstracting-over-mutability-in-rust
70-
[whitequark-2]: https://lab.whitequark.org/notes/2016-12-17/owning-collections-in-heap-less-rust
71-
[whitequark-3]: https://lab.whitequark.org/notes/2017-01-16/abstracting-over-mutability-in-rust-macros
72-
[ethtool-kernel-doc]: https://www.kernel.org/doc/html/latest/networking/ethtool-netlink.html
1+
# Linux kernel MPTCP path manager netlink Library

0 commit comments

Comments
 (0)