mirror of
https://github.com/xdp-project/BNG-router.git
synced 2024-05-06 15:54:53 +00:00
09bc68580f
Adjusting tail instead of headers because of complications with variable length DHCP options - beware that this doesn't appear to work with veth interfaces. Use a physical NIC for testing for now.
31 lines
972 B
Plaintext
31 lines
972 B
Plaintext
Usage
|
|
-----
|
|
dhcp_user_xdp takes network interface, DHCP server IP and DHCP relay agent IP
|
|
as inputs and stores them in a map. Filters the incoming DHCP requests and inserts
|
|
option 82 in the DHCP request packets and overwrites the destination IP to that
|
|
of DHCP relay server IP.
|
|
|
|
Build instructions:
|
|
cd bpf-examples/dhcp-relay
|
|
make
|
|
|
|
Loading bpf program:
|
|
sudo ./dhcp_user_xdp -i <netif> -d <dhcp server IP> -s <dhcp relay agent IP>
|
|
where,
|
|
netif: Ingress network interface name
|
|
|
|
unloading program:
|
|
sudo ./dhcp_user_xdp -i <netif> -u
|
|
|
|
To run in SKB mode:
|
|
add option "-m skb" for both load and uload commands
|
|
|
|
Please beware that testing requires a physical NIC because we tail extend
|
|
packets due to complications with variable length DHCP options.
|
|
|
|
Enable forwarding and allow local address spoofing:
|
|
sudo echo 1 > /proc/sys/net/ipv4/ip_forward
|
|
sudo echo 1 > /proc/sys/net/ipv4/conf/all/accept_local
|
|
|
|
Verify using tcpdump:
|
|
sudo tcpdump -s 0 -i <netif> port 67 and port 68 -vvv |