This repository contains code to create duplicate packets for UDP and ICMP protocols within the Linux kernel. The modified kernel code sends duplicate packets over a specified interface.
- Operating System: Ubuntu 22.04
- Kernel Version: 5.15.0
Ensure you have the correct kernel version installed:
sudo apt install linux-image-5.15.0-50-genericCopy the modified source files (udp.c, ping.c, etc.) into the kernel source directory:
<kernel_source_directory>/net/ipv4/
The code sends packets over the default interface. Update the interface names and IP addresses in the following files:
- In udp.c:
static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4, struct inet_cork *cork)Modify the condition to match your second interface IP and the multicast IP for the duplicate packet:
if (iph->saddr == in_aton("SECOND_INTERFACE_IP") && iph->daddr == in_aton("MULTICAST_IP_FOR_DUPLICATE"))- In ping.c:
Set the device name and destination IP address:
dev = dev_get_by_name(&init_net, "INTERFACE_NAME");
iph->daddr = in_aton("SECOND_INTERFACE_IP");Note: Replace the placeholders with your actual network configurations:
SECOND_INTERFACE_IP: The IP address of your second interface.
MULTICAST_IP_FOR_DUPLICATE: The multicast IP for the duplicate packet.
INTERFACE_NAME: The name of your network interface (e.g., eth1, wlp2s2).
make -j$(nproc)
sudo make modules_install
sudo make install
sudo update-grub
sudo reboot