
Explore theory and implementation of a simplified interior gateway routing protocol in C, covering adjacency management, building a link-state database, SPF-based route computation, and testing practices.
Note : file testapp.c has been renamed as main.c
Explore show topology outputs for L3 routers, verify interface status and neighbors, note the IP addresses and randomly assigned MACs, and inspect routing and ARP tables with built-in commands.
Register for interface configuration change events during initialization and have the application layer react to admin changes, updating hello packets and other protocols that rely on the interface.
Outline the goals and problem statement: given a network graph of P2P links with costs, compute each node's routing table that reaches every loopback address using shortest paths.
This lecture shows how a routing table entry for destination 192.168.0.2 (router B's loopback) is built, using next hop, gateway IP, and local entries to forward toward the next hop.
Construct the input graph from a physical network topology by devices exchanging hello packets to learn neighbors, building naval ship databases, flooding membership databases, and forming a cumulative network graph.
Flood all routers with link state packets to share their local topology databases, enabling every router to build a graph and converge on a common link state database for routing.
Phase 3 computes the routing table from phase two's output produced by the sbf algorithm, replacing destination names with loopback addresses for node s with minimum-cost reachability under scmp constraints.
Conclude the section by translating protocol theory into action, outlining steps to integrate the protocol into a TCP/IP stack and related libraries, and planning a phased internal logic implementation.
Begin implementing the protocol by bringing it to life through minimal, barely breathing exercises in a new application on the application layer of the tcp/ip stack library.
Explore how a robust ecosystem of libraries, build systems, testing infrastructure, and technology stack enables developing a network protocol at the application layer.
Define protocol configuration holders as data structures that store device-level and interface-level configurations, then extend device and interface properties and create two header files in the ISIS directory.
Examine how halo (hello) packets are exchanged between routers, detailing the halo content such as loopback address, device host name, interface IP, interface index, time and cost for neighbor discovery.
Write a function to construct the halo packet from scratch, then transmit halo packets periodically on enabled interfaces and stop when the protocol is disabled, using the timeless timer library.
Learn to implement periodic ISIS hello packet transmission using a timer clock, wrapping multiple arguments, and start/stop APIs to send packets out of an interface.
Enable sending hello packets by invoking the hello APIs only on eligible interfaces: protocol enabled, IP configured, and interface up. Stop hellos and free resources when the protocol is disabled.
Master inserting traces and printouts for debugging, enabling per-node and per-interface logging in the IP stack library to diagnose race conditions and synchronization issues.
Explore how the ISIS protocol processes incoming packets through its entry point, classifying them as hello or LSP packets and using packet notify data to route processing.
Create and bind an adjacency object to the interface, update from halo packets, and use two boolean flags to track changes and fresh creation during state transitions.
Check status of the project upto this point of development stage as follows .
Download the Src code again in separate dir, say, project_progress
mkdir project_progress
cd project_progress
git clone https://github.com/sachinites/tcpip_stack
git checkout proto-dev2
git reset --hard 40b5289842d5914c7e4ff4173ef4945525ac9a86 ( this is commit hashcode )
use git log to verify , the top commit (at the top of screen) should be shown as below :
commit 40b5289842d5914c7e4ff4173ef4945525ac9a86 (HEAD -> proto-dev2, origin/proto-dev2)
Author: sachinites <sachinites@gmail.com>
Date: Sun Sep 26 12:59:03 2021 -0700
Added hit count to routing table.
Now browse the code at this point (using cscope or otherwise ). Check for show command enhancement we discussed before this lecture video.
To reset the project back to its original state ( latest commit ) use,
git pull
I will share only the commit hash code in a subsequent section of the course when I would want you to check the project dev status up to that point of development in our course. Follow the same procedure as described here. Copy-paste these steps in some text file.
Cover :
Display of Expiry timer remaining
Display of Delete Timer Remaining
Display of Adj Up time
Explore the adjacency state transition diagram for a network interface, detailing transitions from down to init to up via good hello packets, timers, and administrative actions.
Implement the adjacency state transition diagram by switching on old and new states, covering down-to-up, up-to-down, and up-to-up transitions, updating the adjacency state and timers.
Implement adjacency state transitions in a C network protocol, covering down, up, and delete states, halo packet handling, delete timer, and admin actions to free resources on interface disable.
What is this Course all about?
This Course presents the Case study in which we implement the Pseudo Interior Gateway Protocol similar to OSPF (Open Shortest Path First) & ISIS (Intermediate System to Intermediate System). Both ISIS and OSPF are IGP protocols that fall under the category of link-state protocols and achieves the same objectives. Don't worry, We shall cover all necessary theories regarding what we shall be going to implement in the project before we hit the first line of code of the project.
This full course is divided into 2 parts - Part A and Part B .
We shall implement the Simplified version of the actual ISIS protocol using our tcp-ip stack library. The goal is to learn the nuances involved in implementing a typical Network protocol on a device from absolute scratch. You will be doing it all your life once you join the industry, but here, this case study aims at giving you firsthand experience regarding what it takes to implement a typical Network protocol on a (simulated) device.
I bet if you are giving an interview in the company for a network developer role, entry-level up to 2-3 yrs of experience, or making a cross-domain switch into Networking Development, seeing the above mention of the project in your resume would give goosebumps to the interviewer. If you could answer cross-questions (I shall be covering in this Course) – you shall be selected without any doubt. Maintain GitHub to present your codes to him if asked.
Project Goals
The AIM of this project is to cycle you through the experience of end-to-end implementation of a typical network protocol. In this case study, we have chosen a routing protocol as an example, but the high-level logistics involved to implement a typical network protocol are more or less the same. For example, a typical network protocol has to:
Configurable via CLIs
Show internal states and results through show CLIs
Respond to generic configuration changes ( such as link shut-down, IP Address on interface change, etc)
Compute results and install the results in Tables (Routing Information Base, MAC Tables, hardware Tables, etc )
Respond to Topological Changes (link failures, device failures, etc )
Time-out stale Data structures if any.
Periodically Generate Or Process Protocol packet
How to add a new feature to the existing working Protocol Codebase. (This is what you shall be doing all your life as a software engineer !!)
Since the project is quite big (I am expecting around 20k LOCs), you would also get the opportunity to learn how to :
Organize the code in header and src files
Modularize the codebase: How to keep the code of different features in different src files
Testing the new feature, and cross-check it doesn’t break existing features
Maintain Code Commits through Version control system ( Github in this case )
Bug Fixing, and exercise various debugging techniques (gdb, Valgrind, etc )
Needless to say, you Can’t exercise the above points unless you do a project of considerable size.
Pre-requisites to do this Course
Needless to say, this project is very challenging, and you need to be reasonably good at Data Structures and Algorithms in C/C++ programming. If you are still struggling with LinkedList/Trees or other common Computer Science basic fundamentals, I would not recommend you spend time on this project – rather work on building your basics first. There is no point in showcasing this project on your resume while at the same time you cannot answer other fundamentals such as questions on Heap Memory, Multithreading, etc, or fail miserably in reversing a linked list.
Also, I shall assume that you have no background in Networking routing protocol (but do possess Networking Basics such as L3 routing, etc ) therefore I shall begin from absolute scratch, covering all necessary theories before we start coding. Along the journey in the implementation, we shall pick up various new concepts related to Networking, Project Planning, feature designing, or Coding Standards at the Industry level.