From Nsnam
Revision as of 05:44, 25 March 2019 by Tomh (Talk | contribs) (update patch requirement)

Jump to: navigation, search

As part of their Google Summer of Code 2019 applications to ns-3, we require that students produce at least a small amount of code for ns-3. This will allow us to gauge your ability to dive into source code, understand it, make a modification, and proceed to build and verify if your modification works.

Students can submit patches to our existing open issues, or point us to code that you have already submitted for review, or if you are new to ns-3, we provide below a small coding project that you can work on and submit with your application.

  • If you already have contributed a patch for ns-3 in the past, please check with the org admins whether the patch requirement can be satisfied by this prior code. If you have code posted somewhere else (GitHub, for example, or a class project page) that you feel is a good indicator of your ability to write ns-3 code, please point us to the URL.
  • If not the above, either complete the minimum requirement test given below, or pick a bug in our Bugzilla that does not already have a patch pending, and try to fix it.

In summary, students must (1) satisfy either the minimum required patch below or else provide a pointer to a comparable piece of ns-3 code that they have authored, and optionally (2) also contribute code to fix something in ns-3, even if only a small improvement to the codebase or documentation.

Minimum requirement patch

Setting up the environment

Perform the following steps (you may want to review our Installation page):

  • Download the ns-3-dev repository, or clone it from Git:
 $: git clone
 $: cd ns-3-dev
 $: git checkout -b patch-requirement origin/master
  • Verify if you can build ns-3 and run the test suite:
 $: ./waf configure --disable-python --enable-examples
 $: ./waf build
 $: ./


In ns-3, a preferred way to split module dependencies is to use a callback. For instance, a hypothetical L3 protocol can directly call methods on a NetDevice (e.g., Send()) to perform operations. But when a NetDevice has to call the above layer, the callback mechanism comes into play: since it is not possible for a NetDevice to know what future network layer will be placed on top of it, it must rely, in general, on callbacks. This kind of connection is prevalent inside a Node: if you take a look at, you will see that forwarding packets from NetDevice to a L3 layer is done through callbacks. Any L3 protocol has to register its own handler that will be called if the protocol number matches the number on the packet.

The objective of this patch is to add a new, simple, basic, L3 protocol, with the protocol number 99. The new protocol implementation should be registered on the node, and it should be able to send a ping packet, and receive a response. That is, it does not need to do routing or introduce any new addressing scheme; it merely needs to be able to send a 'ping-like' packet to the NetDevice, and receive a packet (destined to protocol 99) from a NetDevice. A simple print on the screen at the send and receive moment is enough to show a working implementation.

What to submit

  • A patch to ns-3-dev that accomplishes the objectives. In your GSoC application, point us to a publicly available URL where you've hosted the patch (such as a "gist" on for instance). See also some guidelines here about formatting patches for review. If you need help with this step, contact the ns-3 Org Admin (Tom Henderson) for advice.

Note: Keep your solution private by pasting the link in your application to Google, not posting it on the mailing list.