Happy new year! On this post I am going to talk about my experience contributing to NetworkManager and how to set up your development environment. I will try to give all the details possible. Maybe there could be a follow up post.

Why should you contribute to NetworkManager?

There are plenty of reasons for contributing to NetworkManager.

What do you need to know?

I think almost everything can be learnt when contributing but there are several skills that will help you during the process.

First steps: Before contributing

One of the most important thing to do before starting to contribute is to decide what you would like to do. I would recommend to think on something that you miss on NetworkManager, or an issue that you have found there. Usually, to work on problems that are affecting you directly will motivate you even more!

If you don’t have any ideas on mind, you can check their Gitlab issues or ask on their IRC #nm channel on freenode.

Another important step is to read their CONTRIBUTING guidelines. It is very important to avoid wasting other people’s time.

Fork the project and clone it

NetworkManager project is hosted at [freedesktop Gitlab instance], you will need to log in and fork the NetworkManager project. After that you can clone it.

I strongly recommend to set the original repository as upstream git remote. This way you will be able to update and rebase your repository quite quickly.

git clone https://gitlab.freedesktop.org/<your_account>/NetworkManager.git
cd NetworkManager
git remote add upstream https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git

Create a container for developing

I strongly recommend to use podman instead of docker for multiple reasons but in the end, you can use whatever you prefer. My container is being created with this template.

FROM fedora:33

ENTRYPOINT ["/sbin/init"]

RUN dnf install -y which systemd NetworkManager iproute bash-completion \
    ModemManager-devel \
    ModemManager-glib-devel \
    audit-libs-devel \
    bluez-libs-devel \
    dbus-devel \
    dbus-x11 \
    dhclient \
    firewalld-filesystem \
    gcc-c++ \
    gettext-devel \
    git \
    glib2-doc \
    gnutls-devel \
    gobject-introspection-devel \
    gtk-doc \
    intltool \
    iptables \
    jansson-devel \
    libcurl-devel \
    libndp-devel \
    libselinux-devel \
    libtool \
    libuuid-devel \
    make \
    meson \
    mobile-broadband-provider-info-devel \
    newt-devel \
    nss-devel \
    polkit-devel \
    ppp \
    ppp-devel \
    python3-dbus \
    python3-gobject \
    readline-devel \
    rpm-build \
    systemd-devel \
    teamd-devel \
    vala-devel \
    vala-tools \
    valgrind \
    libpsl-devel \
    libasan \
    meson \
    gdb \
    python3-pip \
    python3-devel \
    pkill \
RUN pip install gdbgui
RUN systemctl enable NetworkManager
RUN echo 'export PATH=$HOME/scripts:$PATH' >> ~/.bashrc

Run the container image sharing/mounting the NetworkManager project folder. After running the container image, you can get into the container with a shell prompt.

podman run --name nm --rm -d -v /<host_path>/NetworkManager/:/<guest_path>/NetworkManager:Z <image_name>
podman exec -it bash
cd /<guest_path>/NetworkManager

All the following steps will be done inside the container shell prompt.

Install Fedora required packages

There are some recommended packages that will be useful for you. NetworkManager team has prepared a script to install them quite fast on Fedora but also on debian and debian-based distributions.


Compile NetworkManager and run the unit tests

Now is the time to compile NetworkManager and check that everything is working as expected. I do recommend you to first compile it and then run the tests.

make -j20
make check -k

Everything is ready now!

Now you can work with you preferred editor in NetworkManager and use the container shell prompt in order to compile and test the changes. If you are willing to contribute to a GUI as nm-applet or nmtui, I recommend you to create a Fedora VM and test it there.

For other resources or help, you can contact me on #nmstate and #nm channels on freenode IRC.