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 cargo
development workflow (cargo check, cargo test, etc).
You can find a list of good bugs to get started with in our good first bugs list, and a list of good bugs to tackle next in our good second bugs list.
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 connectivity-dev@fuchsia.dev mailing list.
Getting set up
- Get the source code
 - Configure and build Fuchsia
- Your 
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, usefx set core.x64 --with //src/connectivity/network/netstack3:bin --cargo-toml-gen. 
 - Your 
 - The source code for Netstack3's platform-agnostic core lives in
src/connectivity/network/netstack3/core. - Build the Netstack3 core by running 
fx build src/connectivity/network/netstack3/core:netstack3-core. - Generate a 
Cargo.tomlfile to enable development withcargoby runningfx build build/rust:cargo_toml_genfollowed byfx gen-cargo //src/connectivity/network/netstack3/core:netstack3-core. Add the following lines to your
~/.cargo/config.tomlfile, replacing the absolute path to your Fuchsia directory and replacing the target if your local development target is different thanx86_64-unknown-linux-gnu:[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 instructcargowhere to find the build artifacts for BoringSSL, which we use for some cryptographic operations.Configure
rustupto use the Fuchsia Rust toolchain by running:rustup toolchain link fuchsia $($FUCHSIA_DIR/scripts/youcompleteme/paths.py VSCODE_RUST_TOOLCHAIN) rustup default fuchsiaRun a
cargocommand likecargo checkorcargo 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.
Troubleshooting
- If you can't run 
cargocorrectly after pulling the latest changes withjiri update, try the following:- Remove the 
Cargo.lockfile, runcargo clean, and try again - If 
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 (probablyfx set core.x64 --with //src/connectivity/network/netstack3:bin --cargo-toml-gen). fx build src/connectivity/network/netstack3/core:netstack3-corefx build build/rust:cargo_toml_gen
 - Remove the 
 
Contributing changes
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 connectivity-dev@fuchsia.dev.
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
 
Understanding
If you're interested in diving deeper to understand Netstack3's design and architecture, check out our docs.