{"id":25413677,"url":"https://github.com/rohithgowdam/linux-custom-packet-filtering","last_synced_at":"2026-02-23T12:53:13.873Z","repository":{"id":277824370,"uuid":"931068807","full_name":"RohithgowdaM/Linux-Custom-Packet-Filtering","owner":"RohithgowdaM","description":"This project demonstrates an enhanced Linux virtual network driver with custom packet filtering. It filters incoming packets based on IP addresses, UDP protocols, and specific MAC addresses. Designed for hands-on kernel module development and network security experiments.","archived":false,"fork":false,"pushed_at":"2025-02-16T11:11:37.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-16T12:19:19.704Z","etag":null,"topics":["kernel","kernel-module","linux","linux-el","network-drivers","networking","packet-filtering","rvce"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RohithgowdaM.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-11T17:05:49.000Z","updated_at":"2025-02-16T11:11:40.000Z","dependencies_parsed_at":"2025-02-16T12:29:25.270Z","dependency_job_id":null,"html_url":"https://github.com/RohithgowdaM/Linux-Custom-Packet-Filtering","commit_stats":null,"previous_names":["rohithgowdam/linux-custom-packet-filtering"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RohithgowdaM%2FLinux-Custom-Packet-Filtering","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RohithgowdaM%2FLinux-Custom-Packet-Filtering/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RohithgowdaM%2FLinux-Custom-Packet-Filtering/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RohithgowdaM%2FLinux-Custom-Packet-Filtering/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RohithgowdaM","download_url":"https://codeload.github.com/RohithgowdaM/Linux-Custom-Packet-Filtering/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239139716,"owners_count":19588246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kernel","kernel-module","linux","linux-el","network-drivers","networking","packet-filtering","rvce"],"created_at":"2025-02-16T14:21:25.298Z","updated_at":"2025-10-26T09:07:17.106Z","avatar_url":"https://github.com/RohithgowdaM.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Enhanced Simple Network Driver with Custom Packet Filtering\n\n## Overview\n\nThis project implements a simple Linux kernel network driver that registers a virtual network interface (e.g., `snet0`) and provides custom packet filtering. The driver applies multiple filtering rules:\n- **IP Filtering:** Drops packets with source IP `192.168.1.1`\n- **Protocol Filtering:** Drops UDP packets\n- **MAC Filtering:** Drops packets with source MAC address `00:11:22:33:44:55`\n\nThis project provides hands-on experience in:\n- Linux kernel module development\n- Network interface registration and handling\n- Real-time packet inspection and filtering\n\n## Problem Definition\n\nMany network drivers do not incorporate advanced packet filtering directly into the kernel, which is critical for enhancing security and performance. This project addresses that gap by implementing a virtual network driver with built-in filtering rules, allowing unwanted packets to be dropped before they reach the higher layers of the networking stack.\n\n## Literature Review\n\n1. **Design and Implementation of a Network Driver in Linux**  \n   - Explores the structure and implementation of network drivers in the Linux kernel.\n\n2. **A Survey on Network Packet Filtering in Linux Kernel**  \n   - Provides an overview of various packet filtering techniques used within Linux.\n\n3. **Kernel Module Programming and Development**  \n   - Offers a comprehensive guide on writing and debugging Linux kernel modules.\n\n4. **Customizing Network Stack in Linux for High-Performance Computing**  \n   - Discusses performance optimizations, including packet filtering in high-traffic environments.\n\n5. **Secure Network Programming in Linux**  \n   - Examines the importance of packet filtering for secure network communications.\n\n## Objectives\n\n- **Develop a Basic Network Driver:**  \n  Create a kernel module that registers a virtual network interface.\n\n- **Implement Custom Packet Filtering:**  \n  - Drop packets with source IP `192.168.1.1`.\n  - Drop UDP packets.\n  - Drop packets with source MAC address `00:11:22:33:44:55`.\n\n- **Gain Practical Kernel Module Experience:**  \n  Work with Linux kernel APIs, debugging tools, and packet processing routines.\n\n- **Establish a Modular Base:**  \n  Create a foundation that can be extended with additional filtering rules or enhancements.\n\n## Methodology\n\n1. **Environment Setup:**  \n   Install required packages (build tools, kernel headers, and Scapy for testing) and create a working directory.\n\n2. **Driver Implementation:**  \n   Write the kernel module (`simple_net_driver.c`) to register a virtual network device and implement custom packet filtering inside the transmit function. Use `printk` for detailed logging.\n\n3. **Compilation and Installation:**  \n   Build the module using a Makefile and load it into the kernel.\n\n4. **Testing:**  \n   Use a Python test script with Scapy to send packets that trigger each filtering rule. Verify behavior by examining kernel logs with `dmesg`.\n\n5. **Documentation and Future Work:**  \n   Provide detailed instructions and outline potential future enhancements.\n\n## Installation \u0026 Setup\n\n### Prerequisites\n\n1. **Operating System:** Lubuntu/Ubuntu  \n2. **Packages:**  \n    ```bash\n    sudo apt-get update\n    sudo apt-get install build-essential linux-headers-$(uname -r) python3-scapy\n    ```\n### Directory \u0026 Setup\n1. **Directory-setup:**\n    ```bash\n    mkdir ~/simple_net_driver\n    cd ~/simple_net_driver\n    ```\n2. **Code-files:**\n    - simple_net_driver.c\n    - Makefile\n    - test.py\n\n### Compilation \u0026 Installation\n1. **Compile the Module:**\n    In your project directory, run:\n    ```bash\n    make\n    ```\n    This will generate the simple_net_driver.ko file.\n2. **Insert the Module:**\n    Load the module into the kernel:\n    ```bash\n    sudo insmod simple_net_driver.ko\n    ```\n    Verify the module is loaded successfully by checking:\n    ```bash\n    dmesg | tail -n 20\n    ```\n    (Use sudo command if permission error occurs)\n3. **Bring Up the Virtual Interface:**\n    Bring up the network interface:\n    ```bash\n    sudo ip link set snet0 up\n    ```\n    or\n    ```bash\n    sudo ifconfig snet0 up\n    ```\n### Testing the driver\n1. **Run the Test Script:**\n    Make the test script executable:\n    ```bash\n    chmod +x test.py\n    ```\n    Then run it with root privileges:\n    ```bash\n    sudo ./test.py\n    ```\n2. **Monitor Kernel Logs:**\n    In another terminal, check the kernel logs to see the filtering behavior:\n    ```bash\n    dmesg | tail -n 30\n    ```\n    You should see messages indicating which packets were dropped (due to IP, UDP, or MAC filters) and which were accepted.\n\n### Cleanup\n1. **Unload the module:**\n    ```bash\n    sudo rmmod simple_net_driver\n    ```\n2. **Verify the modules was removed:**\n    ```bash\n    dmesg | tail -n 20\n    ```\n\n## Conclusion\nThis project demonstrates an enhanced Linux network driver with custom packet filtering that:\n\n- Drops packets with source IP 192.168.1.1\n- Drops UDP packets\n- Drops packets from source MAC 00:11:22:33:44:55\n- Accepts valid packets","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohithgowdam%2Flinux-custom-packet-filtering","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohithgowdam%2Flinux-custom-packet-filtering","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohithgowdam%2Flinux-custom-packet-filtering/lists"}