Makefile update
If the source file has been changed, you need to update the name of the object file to match the new source file containing the module init_module and exit_module macros and the definition functions. SEE Makefile for more information.
Notice, you can include other source and header files but under the condition that there is a single source file containing the neccessary init_module and exit_module macros and their function.
Installation steps
change your current directory to to where the source and Makefile is located then issue:
git clone https://github.com/ahmedcs/COMP4511.git
cd COMP4511/rate_limit
make
Now the output files is as follows:
rate_limit.o and rate_limit.ko
The file ending with .o is the object file while the one ending in .ko is the module file
Run
To install the module into the kernel
sudo insmode rate_limit.ko
Note that the parameters of the module are:
1- port: the UDP port number of applications that needs to be tracked (5000 is the default, 0 to tracks all ports (avoid)).
2- enable: enable the module to intercept and regulate packets.
3- debug: debug will output the different logs on the kernel log (dmesg | tail) to display them.
4- rate: the target per flow rate (by default 1000 Bytes/s).
However to call the module with different parameters issue the following:
sudo insmod rate_limit.ko port=80 enable=1 debug=1 rate=1000;
Stop
To stop the rate_limit module and free the resources issue the following command:
sudo rmmod -f rate_limit;