domingo, 27 de noviembre de 2011

NP3: Firewall

To complement our Third Practical Assignment, we implement a simple Firewall in NachOS. First, we wrote 2 files, Firewall.cc and Firewall.h

Firewall.h

Firewall.cc

How it works?

The firewall uses a function named isBlocked(). That function receive a parameter (integer) that is a machine address. The function open a file named blocked, read whole the file and check if the received parameter is in the file. If the address is in the file that address is blocked, if not, the address is secure.

The function returns an integer, 1 if the address is secure, 0 if the address is blocked.

The firewall is included in nettest.cc:





And used ind the function:

When a package of a blocked address is received, the host machine receive a warning and the answer of the machine also changes.

Execution:



For this example, our blocked addresses are: 1, 3, 5, 10, 22, 30, 140, 200, 250, 310

The file blocked must be in the network folder, also the files Firewall.cc and Firewall.h.

Also includes the new Makefile of the network folder, an the new Makefile.common of NachOS main directory.

1 comentario: