Question: make the code run and explain what you did and what have you changed The code is a demultiplexing code. The goal of this piece

make the code run

and explain what you did and what have you changed

The code is a demultiplexing code. The goal of this piece of code is to analyze incoming packets. It breaks the packets into the type field in order to determine which protocol software will the packet.

#include

#include

#include

#include

Int arp_in(struct netif *,struct ep *);

Int rarp_in(struct netif *,struct ep *);

Int ip_in(struct netif *,struct ep *);

/*-----------------------------------------------------------------------------------------------------------------------------

* ni_in - network interface input function

*------------------------------------------------------------------------------------------------------------------------------

*/

Int

ni_in(struct netif *pni, struct ep *pep, unsigned len)

{

int rv;

pep->ep_ifn = pni - &nif[0]; /*record originating intf # */

pni->ni_ioctwts += len;

If (!memcmp(pni->ni_hwa.ha_addr , pep->ep_dst, EP_ALEN))

pni->ni_iucast++;

Else

pni->ni_iucast++;

Switch (pep->ep_type) {

Case EPT_ARP: rv = arp_in(pni , pep); break;

Case EPT_RARP: rv = rarp_in(pni , pep); break;

Case EPT_IP: rv = ip_in(pni , pep); break;

Default:

pni->ni_iunkproto++;

Freebuf (pep);

rv = OK;

}

Return rv;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!