BPF to filter/mod ARP

From: Scheffenegger, Richard <rscheff_at_freebsd.org>
Date: Wed, 01 Mar 2023 20:33:03 UTC
Hi group,

Maybe someone can help me with this question - as I am usually only 
looking at L4 and the top side of L3 ;)

In order to validate a peculiar switches behavior, I want to adjust some 
fields in gracious arps sent out by an interface, after a new IP is 
assigned or changed.

I believe BPF can effectively filter on arbitrary bit patterns and 
modify packets on the fly.

However, as ARP doesn't seem to be accessible in the ipfw 
infrastructure, I was wondering how to go about setting up an BPF to 
tweak (temporarily) some of these ARPs to validate how the switch will 
behave.

(I need to validate, if there is some difference when the target 
hardware address doesn't conform to RFC5227 - which states it SHOULD be 
zero and is ignored on the receiving side; i have reasons to believe 
that the switch needs either a target hardware address of 
ff:ff:ff:ff:ff:ff or the local interface MAC, to properly update it's 
entries.)

Thanks a lot!

Richard