aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Doan <daviddoan@Davids-MacBook-Pro-70.local>2023-10-23 18:15:54 -0400
committerDavid Doan <daviddoan@Davids-MacBook-Pro-70.local>2023-10-23 18:15:54 -0400
commitac25948cb2f8c8b7f88bd95b953cec12686bf109 (patch)
treeeba00f31723279f68d26543302a5cafe31b22aff
parent8b27a70aa14bc80ebabbb6e5cc14611b74cf6799 (diff)
comments and refactoring
-rw-r--r--README.md20
1 files changed, 8 insertions, 12 deletions
diff --git a/README.md b/README.md
index f51a87f..1be94fa 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ type Interface struct {
RecvSocket net.UDPConn
SocketChannel chan bool
State bool
-
+
}
type Neighbor struct {
@@ -67,34 +67,30 @@ First we, parse the lnxfile and populate our the data structures such as myInter
This goroutine is responsible for listening on the UDP socket and handling the packets that are received. The goroutine will hang on the recv and wait for a packet to be received. Once a packet is received, the goroutine will check if the interface is up and handle the packet per the protocol. If the interface is down, the goroutine will drop the packet, and it the channel is closed the thread will close.
-# Interface Up/Down
+## Interface Up/Down
When an interface is brought up or down, the state of the interface is changed and the channel is signaled. If the interface is brought up, the channel is signaled with true, and if the interface is brought down, the channel is signaled with false. The goroutine that is listening on the UDP socket will check the state of the interface and handle the packet accordingly. If the interface is down, the packet will be dropped, and if the interface is up, the packet will be handled per the protocol.
-# Send Test Packet
-
-When a test packet is sent, the packet is sent to the destination address. The goroutine that is listening on the UDP socket will check if the packet is for itself, and if it is, it will handle the packet per the protocol. If the packet is not for itself, the goroutine will check its neighbors and routing table and forward the packet accordingly. If the packet is not in the routing table, the packet will be dropped.
-
# RIP Threads
-# Periodic Updates
+## Periodic Updates
Every 5 seconds, a goroutine will send periodic updates to all of its neighbors. The goroutine will iterate through the nodes interfaces and neighbors and send the periodic updates to all of its RIP neighbors by creating and sending the entries to the corroding neighbor.
-# Manage Timeouts
+## Manage Timeouts
Every second, a goroutine will check the timeout table and increment the timeout for each entry. If the timeout is equal to the MAX_TIMEOUT, the entry will be deleted from the timeout table and the routing table. The goroutine will then send a triggered update to all of its neighbors.
-# Send Rip Requests
+## Send Rip Requests
There is a goroutine in RegisterProtocolHandler that will send a RIP request to all of its RIP neighbors. That goroutine will iterate through the nodes interfaces and neighbors and send the RIP request to all of its RIP neighbors by creating and sending the entries to the corroding neighbor. Then the main goroutine will create the periodic update goroutine and the manage timeout goroutine.
-## Processing IP packets
+# Processing IP packets
We process IP packets in the following way:
We first check if the interface is up, and if it is, we validate the checksum and TTL of the header. If either of these conditions fail, we drop the packet. Then we check who the package is for. If it is for me, I look at the protocol number to determine how to handle the packet. If the packet is not for me, I check my neighbors and routing table and forward the packet accordingly with SendIP. If the packet is not in the routing table, the packet will be dropped.
-## Other Design Decisions
+# Other Design Decisions
We have getter function, printing functions, checksum validation and other functions without our IPStack that either act as helper functions for bigger functions or to provide REPL functionality for the vrouter and vhost.
-## Known Bugs
+# Known Bugs
No known bugs. \ No newline at end of file