]> The Tcpdump Group git mirrors - libpcap/commit
Generate cleaner code for "host", "net" and "gateway". 1475/head
authorDenis Ovsienko <[email protected]>
Tue, 25 Feb 2025 19:25:49 +0000 (19:25 +0000)
committerDenis Ovsienko <[email protected]>
Tue, 25 Feb 2025 20:26:31 +0000 (20:26 +0000)
commit2559282f3db683e03cd29d30ab5947d6e14a6500
tree019a67976cf00b48039aa1ab8fa351492078928a
parentd68b8052e762a9b74559d31e86d065a80892a348
Generate cleaner code for "host", "net" and "gateway".

Following the same logic as for DECnet in commit 6f8a28c earlier, take
the link-layer protocol value out of any recursion gen_hostop() and
gen_hostop6() might do, instead just call gen_linktype() beforehand
exactly once.  In gen_host6() join two equivalent cases together for
clarity.

For ARP-capable DLTs this improves SNR in the unoptimized filter
programs of:

* "arp (host|net)"
* "ip (host|net)"
* "ip6 (host|net)"
* "rarp (host|net)"
* "(host|net)" (which is a logical OR of the above four)
* "arp gateway" (which is a superset of "not arp host")
* "ip gateway" (which is a superset of "not ip host")
* "rarp gateway" (which is a superset of "not rarp host")
* "gateway" (which is a logical OR of the above three)

For DLTs with a relatively simple structure this change makes the
unoptimized filter program for most of the above primitives the same as
the optimized one.  For IEEE 802.11 and ARCnet there is now fewer
instructions and less work to do for the optimizer.
gencode.c
testprogs/TESTrun