Giter VIP home page Giter VIP logo

csc458-routes-nat's Introduction

Overview of the Code:

Files Changed:
-------------
sr_router.c
sr_utils.c
sr_arpcache.c

Summary:
--------
sr_router.c
The sr_handlepacket function inside sr_router handles all the incoming ARP and ICMP packets. sr_handlepacket sorts the packets into either ARP or ICMP packets and processes the functions seperately.

We followed the logic provided under the tutorial slide to process an ARP and IP packet seperately. For incoming ARP requests, we will send the ARP reply immediately. Otherwise, for all IP packets, we will create the neccessary packet in the logic. Afterwards, we will check if we have the IP resolved in a cache. If it exists, we will encap the packet inside an Ethernet packet and send the packet right away, otherwise, we will cache the packet into an ARP cache and have the ARP sweep function send boardcasts to attempt to resolve the host. Similarly, for ARP replies, we will cache the reply and send all outstanding packets immediately.

sr_utils.c
We added additional utilities functions such as to grab the ip_packet header out of a packet or the find the length of an IP packet. We kept these functions in the sr_utils file to reduce code reduency but also to increase readibility

sr_arpcache.c
We added the sr_arpcache sweep function to send ARP broadcast requests to resolve the MAC addresses for cached ethernet packets.

However, if an ARP request has been sent 5 times, we will send all outstanding packets back to the client and delete the cache.

csc458-routes-nat's People

Contributors

sherryzw avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.