This directory contains solutions to all the assignments in the packet01, packet02, and packet03 lessons.
See the parse_ethhdr
function from the parsing_helpers.h file.
See the parse_ip6hdr
function from the parsing_helpers.h file.
See the parse_icmp6hdr
function from the parsing_helpers.h
file. The sequence number should be accessed as bpf_ntohs(icmp6h->icmp6_sequence)
as it is a 2-byte value in the network order.
See the parse_ethhdr
function from the parsing_helpers.h file.
See the parse_iphdr
and parse_icmphdr
functions from the parsing_helpers.h file.
An example XDP program can be found in the xdp_patch_ports
section in the xdp_prog_kern_02.c file. The program will decrease by one destination port number in any TCP or UDP packet.
fix_port_egress
section in the tc_reply_kern_02.c file will increase by one source port number in reply packet.
Steps to do before generate traffic: tc qdisc add dev eth0 clsact tc filter add dev eth0 egress bpf da obj tc_reply_kern_02.o sec tc tc filter show dev eth0 egress
Clean qdisc clsact: tc qdisc del dev eth0 clsact
See the vlan_tag_pop
function from the rewrite_helpers.h file.
An example XDP program can be found in the xdp_vlan_swap
section in the xdp_prog_kern_02.c file.
See the vlan_tag_push
function from the rewrite_helpers.h file.
An example XDP program can be found in the xdp_vlan_swap
section in the xdp_prog_kern_02.c file.
See the xdp_icmp_echo
program in the xdp_prog_kern_03.c file.
See the xdp_redirect
program in the xdp_prog_kern_03.c file.
See the xdp_redirect_map
program in the xdp_prog_kern_03.c file.
User space part of the assignment is implemented in the xdp_prog_user.c file.
See the xdp_router
program in the xdp_prog_kern_03.c file.
User space part of the assignment is implemented in the xdp_prog_user.c file.