• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PowerDNS / pdns / 19957761886

05 Dec 2025 08:52AM UTC coverage: 73.063% (-0.07%) from 73.131%
19957761886

push

github

web-flow
Merge pull request #16590 from rgacogne/ddist-coverity-20251204

dnsdist: Fix missed optimizations reported by Coverity in config

38511 of 63422 branches covered (60.72%)

Branch coverage included in aggregate %.

3 of 5 new or added lines in 1 file covered. (60.0%)

13941 existing lines in 122 files now uncovered.

128037 of 164529 relevant lines covered (77.82%)

5473411.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/modules/lua2backend/lua2backend.cc
1
/*
2
 * This file is part of PowerDNS or dnsdist.
3
 * Copyright -- PowerDNS.COM B.V. and its contributors
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of version 2 of the GNU General Public License as
7
 * published by the Free Software Foundation.
8
 *
9
 * In addition, for the avoidance of any doubt, permission is granted to
10
 * link this program with OpenSSL and to (re)distribute the binaries
11
 * produced as the result of such linking.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTAPILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
 */
22
#ifdef HAVE_CONFIG_H
23
#include "config.h"
24
#endif
25
#include "pdns/logger.hh"
26
#include "pdns/arguments.hh"
27
#include "lua2backend.hh"
28

29
class Lua2Factory : public BackendFactory
30
{
31
public:
32
  Lua2Factory() :
33
    BackendFactory("lua2") {}
5,904✔
34

35
  void declareArguments(const string& suffix = "") override
UNCOV
36
  {
2✔
UNCOV
37
    declare(suffix, "filename", "Filename of the script for lua backend", "powerdns-luabackend.lua");
2✔
UNCOV
38
    declare(suffix, "query-logging", "Logging of the Lua2 Backend", "no");
2✔
UNCOV
39
    declare(suffix, "api", "Lua backend API version", "2");
2✔
UNCOV
40
  }
2✔
41

42
  DNSBackend* make(const string& suffix = "") override
UNCOV
43
  {
21✔
UNCOV
44
    const std::string apiSet = "lua2" + suffix + "-api";
21✔
UNCOV
45
    const int api = ::arg().asNum(apiSet);
21✔
UNCOV
46
    DNSBackend* be;
21✔
UNCOV
47
    switch (api) {
21✔
48
    case 1:
×
49
      throw PDNSException("Use luabackend for api version 1");
×
UNCOV
50
    case 2:
21!
UNCOV
51
      be = new Lua2BackendAPIv2(suffix);
21✔
UNCOV
52
      break;
21✔
53
    default:
×
54
      throw PDNSException("Unsupported ABI version " + ::arg()[apiSet]);
×
UNCOV
55
    }
21✔
UNCOV
56
    return be;
21✔
UNCOV
57
  }
21✔
58
};
59

60
class Lua2Loader
61
{
62
public:
63
  Lua2Loader()
64
  {
5,904✔
65
    BackendMakers().report(std::make_unique<Lua2Factory>());
5,904✔
66

67
    g_log << Logger::Info << "[lua2backend] This is the lua2 backend version " VERSION
5,904✔
68
#ifndef REPRODUCIBLE
5,904✔
69
          << " (" __DATE__ " " __TIME__ ")"
5,904✔
70
#endif
5,904✔
71
          << " reporting" << endl;
5,904✔
72
  }
5,904✔
73
};
74

75
static Lua2Loader luaLoader;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc