class PoolAction : public DNSAction
{
public:
- PoolAction(const std::string& pool) : d_pool(pool) {}
+ PoolAction(const std::string& pool, bool stopProcessing) : d_pool(pool), d_stopProcessing(stopProcessing) {}
+
DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
{
- *ruleresult=d_pool;
- return Action::Pool;
+ if (d_stopProcessing) {
+ *ruleresult = d_pool;
+ return Action::Pool;
+ }
+ else {
+ dq->poolname = d_pool;
+ return Action::None;
+ }
}
+
std::string toString() const override
{
return "to pool "+d_pool;
private:
std::string d_pool;
+ bool d_stopProcessing;
};
return std::shared_ptr<DNSAction>(new SetEDNSOptionAction(code, data));
});
- luaCtx.writeFunction("PoolAction", [](const std::string& a) {
- return std::shared_ptr<DNSAction>(new PoolAction(a));
+ luaCtx.writeFunction("PoolAction", [](const std::string& a, boost::optional<bool> stopProcessing) {
+ return std::shared_ptr<DNSAction>(new PoolAction(a, stopProcessing.get_value_or(true)));
});
luaCtx.writeFunction("QPSAction", [](int limit) {
Strip RD bit from the question, let it go through.
Subsequent rules are processed after this action.
-.. function:: PoolAction(poolname)
+.. function:: PoolAction(poolname [, stop])
- Send the packet into the specified pool.
+ .. versionchanged:: 1.8.0
+ Added the ``stop`` optional parameter.
+
+ Send the packet into the specified pool. If ``stop`` is set to false, subsequent rules will be processed after this action.
:param string poolname: The name of the pool
+ :param bool stop: Whether to stop processing rules after this action. Default is true, meaning the remaining rules will not be processed.
.. function:: QPSAction(maxqps)