name: jinye xu PID: A99076165 not competing for George Varghese Espresso prize Descirption: I modified sr_router and sr_arpcache files. The sr_router defines the most logics of network flows. It handles ARP and IP packets in expected ways. The workflow is like it will get arp request first and it converts the incoming packet into a arp reply(appending the mac address that the original packet asks for) and send it back to the sender of the original packet. Then an ip packet will be sent using the mac addr it just obtained. To handle ip packet, first the router will look at where it is destined to. If it is for the router, it will send back a icmp reply type 0 if received ip packet is a type 8 icmp packet. Otherwise, it checks the ttl, if ttl <= 1 send icmp type 11 code 0. if not it means the router needs to forward this ip packet to somewhere else. This is handled by handle_ip_fowarding function. In handle_ip_fowarding, the router will go through the routing table, searching for the routing entry which has Longest prefix match to the ip destination. Router will send icmp type 3 code 0 if entry is not found. Once it gets that entry, it decrements the ttl by 1 loopup for the arp entry in the arp cache. This is for getting the mac address of the destination if that mac address has already been told. If not, we need to construct a arp request to the the next hop and queue the ip packet waiting for arp reply from the target. If arp reply is not received after 5 arp request, the router decides to send unreachable icmp back to the client. If arp reply is successful, it will send the ip packet in queue to the mac addr it gets.