notifier: report only the devices of the initial namespace - #797
Open
lneto wants to merge 3 commits into
Open
Conversation
register_netdevice_notifier hands the chain every namespace, and the callback receives a device name, which resolves for the script only in the initial one: the loopback of a new namespace, registering as "lo", made ifquarantine quarantine the host's. The netdevice chain registers with register_netdevice_notifier_net, which 5.15 already has, and LUANOTIFIER_NEWCHAIN takes the pair of functions, since the per-netns ones do not follow the register_<name>_notifier spelling. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The read callback ignored the offset and returned the whole listing every time, so a reader never reached the end of the file: the cat the README suggests ran until it filled the disk. Return the slice the offset and the length ask for. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Two defects found while validating the ifquarantine example.
notifier.netdevicewas given every network namespace while the name it hands the script only resolves in the initial one, so the loopback of a new namespace made the example quarantine the host one; and the example read callback ignored the offset, socat /dev/ifquarantine, which the README suggests, never reached end of file and filled the disk here.The netdevice chain registers per namespace, with
register_netdevice_notifier_net, and the callback returns the slice the offset asks for. Test:netns_scope, which the global chain fails.