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.
domingo, 27 de noviembre de 2011
miércoles, 23 de noviembre de 2011
NachOS: 3rd Practical Assignment
Hi!!
In this post we will explain how it that we fix the execution errors in the NachOS network module.
FIRST: you must have correctly implemented the first phase of the project, that means, the part of synchronization.
This is because NachOS needs to synchronize the input and output data operations through the network, the synchronization is implemented in the file "synchlist.h".
We share to you our files, you can download at the following link.
Synch Files
SECOND: run the network module with the correct command, we look the code and read the notes in the header of each file and we conclude that the correct way is with the following command:
./nachos -m 1 -o 0 & ./nachos -m 0 -o 1 &
Results:- First we can see how NachOS open the 2 threads, obviously each one with different PID.
- Next, NachOS open two sockets, an then the comunication start.
- Each thread send 2 messages, one "question" and an "answer"
- The next block is the NachOS System Info, you can see that the system makes 2 Disk reads an each one receive and send two packets.
- Finally, the clean up and close the sockets.
- The two threads finish well.
We see that many of you tried to run the module with a single call, such as:
./nachos -m 1 -o 0 &
which is not quite right because you have to call two instances of the program to communicate with each other.
Others tried to run 2 instances in different terminals, it also was not possible with the normal way, if you want to comunicate 2 instances of NachOS in different terminals you need fisrt call the Ubuntu sockets, this could be done by including the file, and use the socket functions defined in "sysdep.h".Other exception that we receive it when NachOS tried to delete the swap file, that error ocurred because when we run 2 instances of the system, the first instance, at the end of the execution, delete the swap file and then the second don't have anything to delete.
We correct this exception verifying first if the swap file is still existing at the end of the execution of each thread, and if that is true, well, delete the file.
That was all that we did, we hope that this information be useful to you.
:)
viernes, 18 de noviembre de 2011
domingo, 6 de noviembre de 2011
Suscribirse a:
Entradas (Atom)