Extend prefix_filter to work in relay mode for RA and NDP#390
Open
lqf96 wants to merge 1 commit intoopenwrt:masterfrom
Open
Extend prefix_filter to work in relay mode for RA and NDP#390lqf96 wants to merge 1 commit intoopenwrt:masterfrom
prefix_filter to work in relay mode for RA and NDP#390lqf96 wants to merge 1 commit intoopenwrt:masterfrom
Conversation
Author
|
Some information about testing: I tested this patch today on my router and can confirm that |
c1eb6a9 to
addc36b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
See #385 for details.
Changes
General
pio_filter_*toprefix_filter_*, since theprefix_filterwill no longer be used just for RA.IN6_MATCH_PREFIX_FILTERalongsideADDR_MATCH_PREFIX_FILTERto test if a single IPv6 address is in the prefix filter.NDP
prefix_filterto neighbor solicitation from downstream inhandle_solicit.prefix_filterto neighbor and interface address updates on upstream interface inndp_netevent_cb.RA
prefix_filterto filter out PIO and RIO from upstream RA inforward_router_advertisement.iov_builderis added toodhcpdto solve the problem of applying small edits to a received message before sending it again. See below for the details and usage of this tool.iov_builderworks,forward_router_advertisementis rewritten to perform option look-up and modification together in the per-interface loop, instead of doing so separately in the current implementation. The modifications for options other than PIO and RIO are kept intact.iov_builderiov_builderis a utility to apply small edits to an existing message stored in the buffer.iovecarray pointing to chunks of the original message or chunks to added data. Theiovecarray can then be written or sent through vector I/O.odhcpd_iov_builder_initto initalize aniov_builder. It takes aiovecarray callediov_bufas well as itsiov_capacity, and pointer to the original messagedata. It initializes the internal editing pointercurrent_iov_basetodata, set the current chunk lengthcurrent_iov_lento 0 and inclusioninclude_iovto false.odhcpd_iov_builder_appendto add an arbitraryiovecto the builder. This is a low-level tool. If theiov_bufis full the function returns 1.odhcpd_iov_builder_advanceto add a chunk from the original message to theiov_builder. This advances the internal editing pointer bychunk_len. Ifinclude_chunkis set to false, the chunk is not added toiov_bufbut is instead skipped.odhcpd_iov_builder_finalizeto finalize the edition in the end. You can now useiov_bufandiov_countfor any vectored I/O.Questions
ndp_netevent_cbboth addition and deletion are guarded on theprefix_filtercheck. But this might not work if the user changes theprefix_filterto a more specific prefix and then reload.forward_router_advertisementfunction has lower efficiency and may need to allocate for more memory due to the need of editing RA message. I thought about this but couldn't come up with a better approach here. Let me know what you think about this and if there is a better solution. It might be OK since NDP relay doesn't happen a lot unless you have many devices in your network