multipath-tcp / mptcpd

mptcpd is a daemon for Linux that performs Multipath TCP path management related operations in the user space 😈
https://mptcpd.mptcp.dev/
BSD 3-Clause "New" or "Revised" License
173 stars 39 forks source link

Plugin Priority Clarification #176

Open dulive opened 2 years ago

dulive commented 2 years ago

Hello,

What is exactly the purpose of the priority in the plugins?

By looking at the source code, more precisely at lib/plugins.c, the only thing it seems to be used for is to specify the initialization order of the plugins, is this right?

ossama-othman commented 2 years ago

That's correct. The plugin priority feature was based on the (removed) ELL plugin API.

dulive commented 2 years ago

Couldn't it also be used for defining the event receiving order for the functions that use l_hashmap_foreach, (i.e. mptcpd_plugin_new_interface, mptcpd_plugin_update_interface, mptcpd_plugin_delete_interface, mptcpd_plugin_new_local_address and mptcpd_plugin_delete_local_address)?

At first this probably appears that would do the same thing, but if with it, higher priority plugins could also control if the events should also be processed by lower priority plugins would simplify the development of a lot of plugins.

An example where this would be very useful is when developing/using a security focused plugin. Currently this type of plugins have to be massive, that do everything, from the security check to configuring endpoints. This make them most of the times useless or hard to use since they can't be used together with other plugins. However, if the events would go from the higher priority to the lower priority plugins, and if plugins could control if this flux of events should continue to lower priority plugins, security focused plugins (or any other type of plugins that suffer the same problem) would easily integrate with others plugins, as with the addr_adv plugin to configure the endpoints.

It could also be interesting if plugins could send/forward events to lower priority events. This would be very useful when a plugin doesn't have enough information or it's still not ready to take a decision, it could buffer them and when it can take the decision it could also forward the buffered events to the lower priority plugins.

dulive commented 2 years ago

I should probably open a new issue with this.