Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "pppoes" filter for links with variable-length prefix to link header #835

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aliemjay
Copy link

This applies to all DLT_IEEE_802_11_* link types and should fix #834 .

off_outermostlinkhdr doesn't work as expected when
"off_outermostlinkhdr.is_variable" (e.g. IEEE_802_11_* links) since
registers are allocated only for off_linkhdr (off_outermostlinkhdr.reg
will always be -1)

Fix this by redefinig off_outermostlinkhdr as pointer to offset of the
outermost link header in the link header stack (i.e. either off_linkhdr
or off_prevlinkhdr.)
Store prefix lengths generated by gen_load_*_llprefixlen() in the
register of off_outermostlinkhdr instead of off_linkhdr.

This should fixes a bug for when stacking link headers (as is
the case with "pppoes" filter), offset values are stored in
off_linkhdr.reg instead of off_prevlinkhdr.reg.

gen_load_802_11_header_len should also generate code depending on
outermostlinktype instead of linktype.
@mcr mcr self-assigned this Aug 28, 2020
@mcr mcr added the compiling label Aug 28, 2020
@mcr
Copy link
Member

mcr commented Aug 28, 2020

Do you have a sample PCAP file and filter that would exercise this code?
I would put that into tcpdump.

@mcr mcr added this to the next-release milestone Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

"pppoes" filter for IEEE802_11_RADIO link: invalid bpf code generated!
3 participants