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

Python module: assign something useful to the per-query data store 'qdata' #4

Merged
merged 1 commit into from Jun 18, 2019

Conversation

episource
Copy link
Contributor

@episource episource commented Apr 30, 2018

The methods operate and inform_super both have a parameter named qdata which is described as "per query data, here you can store your own data".

However, the python module implementation passes qdata=None as argument value. There's no way for the python code to assign something else to the per-query data store or modify None.

Please consider initializing the per-query data store as dict (this pull request). This would allow the python module script to add custom items.

The proposed patch also changes the initialization of the mod_env global variable from None to a dict instance. Certainly, mod_env could be omitted completely: If needed, a global variable could be created from the python module's code as well. I see no need for storing the data in the python module's internal C data structures.

I've been successfully using this patch with unbound-1.6.0, 1.6.1, 1.6.4 and 1.7.0.

See also: https://www.nlnetlabs.nl/bugs-script/show_bug.cgi?id=1212
(Pull-Requests were disabled when I created this ticket)

@episource
Copy link
Contributor Author

@episource episource commented Apr 30, 2018

If you are willing to accept all of the pull requests #4, #5, #6, you could also consider merging dev/all-merged/master instead: All three patches have been merged into this single branch.

@episource episource force-pushed the dev/pythonmod-data/master branch from 21ff1df to c024f95 Compare May 5, 2018
@episource episource force-pushed the dev/pythonmod-data/master branch from c024f95 to 080b3db Compare Nov 5, 2018
The python module used to assign None to the per-query (qdata argument)
and per-module (mod_env variable) data stores. Hence, there was no
obvious way for python code to use these data stores.

This commit initializes both data stores with a dict instance.
@episource episource force-pushed the dev/pythonmod-data/master branch from 080b3db to 7cc4ff0 Compare Mar 2, 2019
wtoorop added a commit that referenced this issue May 1, 2019
Fix test code for call change for XoT.
@wcawijngaards wcawijngaards merged commit 7cc4ff0 into NLnetLabs:master Jun 18, 2019
wcawijngaards added a commit that referenced this issue Jun 18, 2019
Merge PR #6: Python module: support multiple instances
Merge PR #5: Python module: define constant MODULE_RESTART_NEXT
Merge PR #4: Python module: assign something useful to the per-query data store 'qdata'
wcawijngaards added a commit that referenced this issue Jun 18, 2019
- Merge PR #5: Python module: define constant MODULE_RESTART_NEXT
- Merge PR #4: Python module: assign something useful to the
  per-query data store 'qdata'
Noted in Changelog.
jedisct1 added a commit to jedisct1/unbound that referenced this issue Jun 29, 2019
* nlnet/master: (22 commits)
  Nicer spelling and layout.
  - For NLnetLabs#45, check that 127.0.0.1 and ::1 are not used in unbound.conf   when do-not-query-localhost is turned on, or at default on,   unbound-checkconf prints a warning if it is found in forward-addr or   stub-addr statements.
  - Fix memleak in unit test, reported from the clang 8.0 static analyzer.
  - Fix python dict reference and double free in config.
  - Merge PR NLnetLabs#6: Python module: support multiple instances - Merge PR NLnetLabs#5: Python module: define constant MODULE_RESTART_NEXT - Merge PR NLnetLabs#4: Python module: assign something useful to the   per-query data store 'qdata' Noted in Changelog.
  - Added documentation to the ipset files (for doxygen output).
  - make depend
  - Fix to make unbound-control with ipset, remove unused variable,   use unsigned type because of comparison, and assign null instead   of compare with it.  Remade lex and yacc output.
  - PR NLnetLabs#28: IPSet module, by Kevin Chou.  Created a module to support   the ipset that could add the domain's ip to a list easily.   Needs libmnl, and --enable-ipset and config it, doc/README.ipset.md. - Fix to omit RRSIGs from addition to the ipset.
  - Fix for NLnetLabs#24: Fix abort due to scan of auth zone masters using old   address from previous scan.
  - Fix NLnetLabs#39: In libunbound, leftover logfile is close()d unpredictably.
  - Master contains version 1.9.3 in development.
  fix segmentation fault
  rollback the code
  bugfix
  performance improvement
  edit config parser to support ipset
  Add support for ipset
  Document how to configure multiple python modules
  Support multiple python module instances
  ...
@xiangbao227 xiangbao227 mentioned this pull request Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants