dhcp/bpf.asm
2026-08-18 23:53:39 -05:00

12 lines
576 B
NASM

l0: ldh [12] /* eth.type */
l1: jeq #0x800, l2, l10 /* if ipv4, l3 */
l2: ldb [23] /* ip.proto */
l3: jeq #0x11, l4, l10 /* if UDP, l5 */
l4: ldh [20] /* ip.frag_offset */
l5: jset #0x1fff, l10, l6 /* if not fragmented, l7 */
l6: ldxb 4*([14]&0xf) /* ip.hdr_len * 4 -> X */
l7: ldh [x + 16] /* 36: UDP destination port */
l8: jeq #0x44, l9, l10 /* if equal to 68, l10 */
l9: ret #0x40000 /* keep 262144 bytes */
l10: ret #0 /* discard the packet */