Netstack3 is a networking stack being developed from scratch in Rust. It is
under active development, and we encourage everyone to contribute! Most of
Netstack3 - roughly 90% by lines of code - is platform-agnostic, meaning you can
build and test on your development machine without needing to build all of
Fuchsia or run it in a virtual machine. You can just use your normal
development workflow (
cargo test, etc).
This document is designed to get you started with the basics of contributing to Netstack3. It will get you from zero to building, testing, and contributing to Netstack3's platform-agnostic core.
If you're interested in contributing and would like to chat with the Netstack3 developers, don't hesitate to reach out! We hang out on the email@example.com mailing list.
Getting set up
- Get the source code
- Configure and build Fuchsia
fx setcommand will need to enable Netstack3 development using Cargo by including the flags
--with //src/connectivity/network/netstack3:bin --cargo-toml-gen. Assuming you're developing on an x86 machine, use
fx set core.x64 --with //src/connectivity/network/netstack3:bin --cargo-toml-gen.
- The source code for Netstack3's platform-agnostic core lives in
- Build the Netstack3 core by running
fx build src/connectivity/network/netstack3/core:netstack3-core.
- Generate a
Cargo.tomlfile to enable development with
fx build build/rust:cargo_toml_genfollowed by
fx gen-cargo //src/connectivity/network/netstack3/core:netstack3-core.
Add the following lines to your
~/.cargo/configfile, replacing the absolute path to your Fuchsia directory and replacing the target if your local development target is different than
[target.x86_64-unknown-linux-gnu] rustflags = ["-L", "absolute_path_to_fuchsia_directory/out/default/host_x64/obj/third_party/boringssl"]
If you don't have a config file, you can create one with just these contents. If you're not sure what your development target is, run
rustup show. These config lines instruct
cargowhere to find the build artifacts for BoringSSL, which we use for some cryptographic operations.
cargo testto see it in action!
From now on, you will mostly be able to just use
cargo for development.
Sometimes, major changes to Netstack3's dependencies may cause your build setup
to break. See the Troubleshooting section for advice on
fixing your build if this happens.
- If you can't run
cargocorrectly after pulling the latest changes with
jiri update, try the following:
- Remove the
cargo clean, and try again
cargostill doesn't work correctly, try a full clean build:
fx clean- this cleans out the build output, and prepares you to do a full clean build
- Run the same
fx setcommand you ran in the beginning (probably
fx set core.x64 --with //src/connectivity/network/netstack3:bin --cargo-toml-gen).
fx build src/connectivity/network/netstack3/core:netstack3-core
fx build build/rust:cargo_toml_gen
- Remove the
Interested in contributing to Netstack3? We'd love to have you! If you're not sure where to start, try our good first bugs list or our good second bugs list. If you're still a bit lost, don't hesitate to reach out to us at firstname.lastname@example.org.
If you have ideas for changes which aren't already tracked on our issue tracker, that's great! Bug fixes and documentation improvements are especially welcome. Just reach out to us first to make sure we're on the same page so you don't spend time doing work that we won't end up accepting.
Once you're ready to contribute, just follow these simple steps:
- Read the general instructions for Contributing to Fuchsia
- Read our Fuchsia Networking Contributor Guide
If you're interested in diving deeper to understand Netstack3's design and architecture, check out our docs.