Commit ea110815 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

Merge branch 'master' into trac2650

parents e540ba5b 12071a88
571. [build] jinmei
The ./configure script can now handle output from python-config
--ldflags that contains a space after -L switches. This fixes
failure reported on some Solaris environments.
(Trac #2661, git e6f86f2f5eec8e6003c13d36804a767a840d96d6)
570. [bug] tmark, marcin, tomek
b10-dhcp4: Address renewal now works properly for DHCPv4 clients
that do not send client ID.
(Trac #2702, git daf2abe68ce9c111334a15c14e440730f3a085e2)
569. [bug] tomek
b10-dhcp4: Fix bug whereby a DHCP packet without a client ID
could crash the MySQL lease database backend.
(Trac #2697, git b5e2be95d21ed750ad7cf5e15de2058aa8bc45f4)
568. [func] muks
Various message IDs have been renamed to remove the word 'ERROR'
from them when they are not logged at ERROR severity level.
(Trac #2672, git 660a0d164feaf055677f375977f7ed327ead893e)
567. [doc] marcin, stephen, tomek
Update DHCP sections of the BIND 10 guide.
(Trac #2657, git 1d0c2004865d1bf322bf78d13630d992e39179fd)
566. [func]* jinmei
libdns++/Python isc.dns: In Python isc.dns, function style
constants for RRType, RRClass, Rcode and Opcode were deprecated
and replaced with straightforward object constants, e.g., from
RRType.AAAA() to RRType.AAAA. This is a backward incompatible
change (see the Trac ticket for a conversion script if needed).
Also, these constants are now more consistent between C++
and Python, and RRType constants for all currently standardized
types are now supported (even if Rdata for these are not yet
available).
(Trac #1866 and #2409, git e5005185351cf73d4a611407c2cfcd163f80e428)
565. [func]* jelte
The main initializer script (formerly known as either 'bind10',
'boss', or 'bob'), has been renamed to b10-init (and Init in
......
......@@ -238,6 +238,21 @@ AM_CONDITIONAL(SET_ENV_LIBRARY_PATH, test $SET_ENV_LIBRARY_PATH = yes)
AC_SUBST(SET_ENV_LIBRARY_PATH)
AC_SUBST(ENV_LIBRARY_PATH)
# Our experiments have shown Solaris 10 has broken support for the
# IPV6_USE_MIN_MTU socket option for getsockopt(); it doesn't return the value
# previously set via setsockopt(). We know it doesn't happen on one instance
# on Solaris 11, but we don't know whether it happens for any Solaris 10
# implementations or for earlier versions of Solaris. In any case, at the
# moment this matters for only one unittest case, so we'll simply disable
# the affected test using the following definition with the specific hardcoding
# of that version of Solaris.
case "$host" in
*-solaris2.10)
AC_DEFINE([HAVE_BROKEN_GET_IPV6_USE_MIN_MTU], [1],
[Define to 1 if getsockopt(IPV6_USE_MIN_MTU) does not work])
;;
esac
m4_define([_AM_PYTHON_INTERPRETER_LIST], [python python3.3 python3.2 python3.1 python3])
AC_ARG_WITH([pythonpath],
AC_HELP_STRING([--with-pythonpath=PATH],
......@@ -298,8 +313,16 @@ AC_SUBST(COMMON_PYTHON_PATH)
if test -x ${PYTHON}-config; then
PYTHON_INCLUDES=`${PYTHON}-config --includes`
for flag in `${PYTHON}-config --ldflags`; do
# add any '-L..." flags to PYTHON_LDFLAGS
# Add any '-L..." flags to PYTHON_LDFLAGS. We first make a copy of
# python-config --ldflags, removing any spaces and tabs
# between "-L" and its argument (some instances of python-config
# insert a space, which would confuse the code below).
# Notes: if -L isn't contained at all we can simply skip this process,
# so we only go through the flag if it's contained; also, protecting
# the output with [] seems necessary for environment to avoid getting
# an empty output accidentally.
python_config_ldflags=[`${PYTHON}-config --ldflags | sed -ne 's/\([ \t]*-L\)[ ]*\([^ \t]*[ \t]*\)/\1\2/pg'`]
for flag in $python_config_ldflags; do
flag=`echo $flag | sed -ne 's/^\(\-L.*\)$/\1/p'`
if test "X${flag}" != X; then
PYTHON_LDFLAGS="$PYTHON_LDFLAGS ${flag}"
......@@ -1319,7 +1342,7 @@ AC_OUTPUT([doc/version.ent
src/bin/stats/stats_httpd.py
src/bin/bind10/init.py
src/bin/bind10/run_bind10.sh
src/bin/bind10/tests/bind10_test.py
src/bin/bind10/tests/init_test.py
src/bin/bindctl/run_bindctl.sh
src/bin/bindctl/bindctl_main.py
src/bin/bindctl/tests/bindctl_test
......
This diff is collapsed.
......@@ -106,7 +106,7 @@ public:
rollbackAddresses_ = old;
}
virtual void commit() {
rollbackAddresses_.release();
rollbackAddresses_.reset();
}
private:
AuthSrv& server_;
......
......@@ -14,7 +14,7 @@
$NAMESPACE isc::auth
% AUTH_AXFR_ERROR error handling AXFR request: %1
% AUTH_AXFR_PROBLEM error handling AXFR request: %1
This is a debug message produced by the authoritative server when it
has encountered an error processing an AXFR request. The message gives
the reason for the error, and the server will return a SERVFAIL code to
......@@ -232,13 +232,13 @@ This is a debug message produced by the authoritative server when it receives
a NOTIFY packet but the XFRIN process is not running. The packet will be
dropped and nothing returned to the sender.
% AUTH_PACKET_PARSE_ERROR unable to parse received DNS packet: %1
% AUTH_PACKET_PARSE_FAILED unable to parse received DNS packet: %1
This is a debug message, generated by the authoritative server when an
attempt to parse a received DNS packet has failed due to something other
than a protocol error. The reason for the failure is given in the message;
the server will return a SERVFAIL error code to the sender.
% AUTH_PACKET_PROTOCOL_ERROR DNS packet protocol error: %1. Returning %2
% AUTH_PACKET_PROTOCOL_FAILURE DNS packet protocol error: %1. Returning %2
This is a debug message, generated by the authoritative server when an
attempt to parse a received DNS packet has failed due to a protocol error.
The reason for the failure is given in the message, as is the error code
......
......@@ -526,13 +526,13 @@ AuthSrv::processMessage(const IOMessage& io_message, Message& message,
// Parse the message.
message.fromWire(request_buffer);
} catch (const DNSProtocolError& error) {
LOG_DEBUG(auth_logger, DBG_AUTH_DETAIL, AUTH_PACKET_PROTOCOL_ERROR)
LOG_DEBUG(auth_logger, DBG_AUTH_DETAIL, AUTH_PACKET_PROTOCOL_FAILURE)
.arg(error.getRcode().toText()).arg(error.what());
makeErrorMessage(impl_->renderer_, message, buffer, error.getRcode());
impl_->resumeServer(server, message, stats_attrs, true);
return;
} catch (const Exception& ex) {
LOG_DEBUG(auth_logger, DBG_AUTH_DETAIL, AUTH_PACKET_PARSE_ERROR)
LOG_DEBUG(auth_logger, DBG_AUTH_DETAIL, AUTH_PACKET_PARSE_FAILED)
.arg(ex.what());
makeErrorMessage(impl_->renderer_, message, buffer, Rcode::SERVFAIL());
impl_->resumeServer(server, message, stats_attrs, true);
......@@ -725,7 +725,7 @@ AuthSrvImpl::processXfrQuery(const IOMessage& io_message, Message& message,
xfrout_connected_ = false;
}
LOG_DEBUG(auth_logger, DBG_AUTH_DETAIL, AUTH_AXFR_ERROR)
LOG_DEBUG(auth_logger, DBG_AUTH_DETAIL, AUTH_AXFR_PROBLEM)
.arg(err.what());
makeErrorMessage(renderer_, message, buffer, Rcode::SERVFAIL(),
tsig_context);
......
......@@ -130,7 +130,7 @@ TEST_F(AuthConfigTest, invalidListenAddressConfig) {
isc::testutils::portconfig::invalidListenAddressConfig(server);
}
// Try setting addresses trough config
// Try setting addresses through config
TEST_F(AuthConfigTest, listenAddressConfig) {
isc::testutils::portconfig::listenAddressConfig(server);
......
#!/bin/sh
prefix=@prefix@
exec_prefix=@exec_prefix@
exec @libexecdir@/@PACKAGE@/b10-init $*
# We use this wrapper script both for production and in-source tests; in
# the latter case B10_FROM_BUILD environment is expected to be defined.
if test -n "${B10_FROM_BUILD}"; then
exec ${B10_FROM_BUILD}/src/bin/bind10/b10-init $*
else
prefix=@prefix@
exec_prefix=@exec_prefix@
exec @libexecdir@/@PACKAGE@/b10-init $*
fi
......@@ -72,6 +72,7 @@ import isc.cc
import isc.util.process
import isc.net.parse
import isc.log
import isc.config
from isc.log_messages.init_messages import *
import isc.bind10.component
import isc.bind10.special_component
......
PYCOVERAGE_RUN = @PYCOVERAGE_RUN@
#PYTESTS = args_test.py bind10_test.py
# NOTE: this has a generated test found in the builddir
PYTESTS = bind10_test.py
PYTESTS = init_test.py
noinst_SCRIPTS = $(PYTESTS)
# If necessary (rare cases), explicitly specify paths to dynamic libraries
......
......@@ -31,8 +31,8 @@ import signal
import socket
from isc.net.addr import IPAddr
import time
import isc
import isc.log
import isc.config
import isc.bind10.socket_cache
import errno
import random
......
......@@ -25,7 +25,7 @@ from bindctl.moduleinfo import *
from bindctl.cmdparse import BindCmdParser
from bindctl import command_sets
from xml.dom import minidom
import isc
import isc.config
import isc.cc.data
import http.client
import json
......
......@@ -23,7 +23,7 @@ BINDCTL_PATH=@abs_top_builddir@/src/bin/bindctl
# Note: lib/dns/python/.libs is necessary because __init__.py of isc package
# automatically imports isc.datasrc, which then requires the DNS loadable
# module. #2145 should eliminate the need for it.
PYTHONPATH=@abs_top_srcdir@/src/bin:@abs_top_builddir@/src/lib/python/isc/log_messages:@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/bin:@abs_top_srcdir@/src/lib/python:@abs_top_builddir@/src/lib/dns/python/.libs
PYTHONPATH=@abs_top_srcdir@/src/bin:@abs_top_builddir@/src/lib/python/isc/log_messages:@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/bin:@abs_top_srcdir@/src/lib/python
export PYTHONPATH
# If necessary (rare cases), explicitly specify paths to dynamic libraries
......
......@@ -134,7 +134,7 @@ def get_datasrc_client(cc_session):
function will simply be removed.
'''
HARDCODED_DATASRC_CLASS = RRClass.IN()
HARDCODED_DATASRC_CLASS = RRClass.IN
file, is_default = cc_session.get_remote_config_value("Auth",
"database_file")
# See xfrout.py:get_db_file() for this trick:
......@@ -469,7 +469,7 @@ class DDNSServer:
self.__request_msg.clear(Message.PARSE)
# specify PRESERVE_ORDER as we need to handle each RR separately.
self.__request_msg.from_wire(req_data, Message.PRESERVE_ORDER)
if self.__request_msg.get_opcode() != Opcode.UPDATE():
if self.__request_msg.get_opcode() != Opcode.UPDATE:
raise self.InternalError('Update request has unexpected '
'opcode: ' +
str(self.__request_msg.get_opcode()))
......@@ -536,7 +536,7 @@ class DDNSServer:
else:
tcp_ctx.close()
except socket.error as ex:
logger.warn(DDNS_RESPONSE_SOCKET_ERROR, ClientFormatter(dest), ex)
logger.warn(DDNS_RESPONSE_SOCKET_SEND_FAILED, ClientFormatter(dest), ex)
return False
return True
......@@ -683,7 +683,7 @@ class DDNSServer:
result = ctx[0].send_ready()
if result != DNSTCPContext.SENDING:
if result == DNSTCPContext.CLOSED:
logger.warn(DDNS_RESPONSE_TCP_SOCKET_ERROR,
logger.warn(DDNS_RESPONSE_TCP_SOCKET_SEND_FAILED,
ClientFormatter(ctx[1]))
ctx[0].close()
del self._tcp_ctxs[fileno]
......
......@@ -134,12 +134,12 @@ appropriate ACL configuration or some lower layer filtering. The
number of existing TCP clients are shown in the log, which should be
identical to the current quota.
% DDNS_RESPONSE_SOCKET_ERROR failed to send update response to %1: %2
% DDNS_RESPONSE_SOCKET_SEND_FAILED failed to send update response to %1: %2
Network I/O error happens in sending an update response. The
client's address that caused the error and error details are also
logged.
% DDNS_RESPONSE_TCP_SOCKET_ERROR failed to complete sending update response to %1 over TCP
% DDNS_RESPONSE_TCP_SOCKET_SEND_FAILED failed to complete sending update response to %1 over TCP
b10-ddns had tried to send an update response over TCP, and it hadn't
been completed at that time, and a followup attempt to complete the
send operation failed due to some network I/O error. While a network
......
......@@ -39,9 +39,9 @@ TESTDATA_PATH = os.environ['TESTDATA_PATH'] + os.sep
READ_ZONE_DB_FILE = TESTDATA_PATH + "rwtest.sqlite3" # original, to be copied
TEST_ZONE_NAME = Name('example.org')
TEST_ZONE_NAME_STR = TEST_ZONE_NAME.to_text()
UPDATE_RRTYPE = RRType.SOA()
UPDATE_RRTYPE = RRType.SOA
TEST_QID = 5353 # arbitrary chosen
TEST_RRCLASS = RRClass.IN()
TEST_RRCLASS = RRClass.IN
TEST_RRCLASS_STR = TEST_RRCLASS.to_text()
TEST_SERVER6 = ('2001:db8::53', 53, 0, 0)
TEST_CLIENT6 = ('2001:db8::1', 53000, 0, 0)
......@@ -169,9 +169,9 @@ class FakeUpdateSession:
self.__msg.make_response()
self.__msg.clear_section(SECTION_ZONE)
if self.__faked_result == UPDATE_SUCCESS:
self.__msg.set_rcode(Rcode.NOERROR())
self.__msg.set_rcode(Rcode.NOERROR)
else:
self.__msg.set_rcode(Rcode.REFUSED())
self.__msg.set_rcode(Rcode.REFUSED)
return self.__msg
class FakeKeyringModule:
......@@ -478,7 +478,7 @@ class TestDDNSServer(unittest.TestCase):
# By default (in our faked config) it should be derived from the
# test data source
rrclass, datasrc_client = self.ddns_server._datasrc_info
self.assertEqual(RRClass.IN(), rrclass)
self.assertEqual(RRClass.IN, rrclass)
self.assertEqual(DataSourceClient.SUCCESS,
datasrc_client.find_zone(Name('example.org'))[0])
......@@ -491,7 +491,7 @@ class TestDDNSServer(unittest.TestCase):
{'database_file': './notexistentdir/somedb.sqlite3'}
self.__cc_session.add_remote_config_by_name('Auth')
rrclass, datasrc_client = self.ddns_server._datasrc_info
self.assertEqual(RRClass.IN(), rrclass)
self.assertEqual(RRClass.IN, rrclass)
self.assertRaises(isc.datasrc.Error,
datasrc_client.find_zone, Name('example.org'))
......@@ -887,12 +887,12 @@ class TestDDNSServer(unittest.TestCase):
self.__select_answer = ([], [10], [])
self.assertRaises(KeyError, self.ddns_server.run)
def create_msg(opcode=Opcode.UPDATE(), zones=[TEST_ZONE_RECORD], prereq=[],
def create_msg(opcode=Opcode.UPDATE, zones=[TEST_ZONE_RECORD], prereq=[],
tsigctx=None):
msg = Message(Message.RENDER)
msg.set_qid(TEST_QID)
msg.set_opcode(opcode)
msg.set_rcode(Rcode.NOERROR())
msg.set_rcode(Rcode.NOERROR)
for z in zones:
msg.add_question(z)
for p in prereq:
......@@ -936,7 +936,7 @@ class TestDDNSSession(unittest.TestCase):
return FakeUpdateSession(req_message, client_addr, zone_config,
self.__faked_result)
def check_update_response(self, resp_wire, expected_rcode=Rcode.NOERROR(),
def check_update_response(self, resp_wire, expected_rcode=Rcode.NOERROR,
tsig_ctx=None, tcp=False):
'''Check if given wire data are valid form of update response.
......@@ -963,7 +963,7 @@ class TestDDNSSession(unittest.TestCase):
self.assertNotEqual(None, tsig_record)
self.assertEqual(TSIGError.NOERROR,
tsig_ctx.verify(tsig_record, resp_wire))
self.assertEqual(Opcode.UPDATE(), msg.get_opcode())
self.assertEqual(Opcode.UPDATE, msg.get_opcode())
self.assertEqual(expected_rcode, msg.get_rcode())
self.assertEqual(TEST_QID, msg.get_qid())
for section in [SECTION_ZONE, SECTION_PREREQUISITE, SECTION_UPDATE]:
......@@ -977,7 +977,7 @@ class TestDDNSSession(unittest.TestCase):
server_addr = TEST_SERVER6 if ipv6 else TEST_SERVER4
client_addr = TEST_CLIENT6 if ipv6 else TEST_CLIENT4
tsig = TSIGContext(tsig_key) if tsig_key is not None else None
rcode = Rcode.NOERROR() if result == UPDATE_SUCCESS else Rcode.REFUSED()
rcode = Rcode.NOERROR if result == UPDATE_SUCCESS else Rcode.REFUSED
has_response = (result != UPDATE_DROP)
self.assertEqual(has_response,
......@@ -1015,7 +1015,7 @@ class TestDDNSSession(unittest.TestCase):
# Opcode is not UPDATE
self.assertFalse(self.server.handle_request(
(self.__sock, None, None, create_msg(opcode=Opcode.QUERY()))))
(self.__sock, None, None, create_msg(opcode=Opcode.QUERY))))
self.assertEqual((None, None), (s._sent_data, s._sent_addr))
# TSIG verification error. We use UPDATE_DROP to signal check_session
......@@ -1031,7 +1031,7 @@ class TestDDNSSession(unittest.TestCase):
TEST_CLIENT6,
create_msg())))
# this check ensures sendto() was really attempted.
self.check_update_response(self.__sock._sent_data, Rcode.NOERROR())
self.check_update_response(self.__sock._sent_data, Rcode.NOERROR)
def test_tcp_request(self):
# A simple case using TCP: all resopnse data are sent out at once.
......@@ -1040,7 +1040,7 @@ class TestDDNSSession(unittest.TestCase):
self.assertTrue(self.server.handle_request((s, TEST_SERVER6,
TEST_CLIENT6,
create_msg())))
self.check_update_response(s._sent_data, Rcode.NOERROR(), tcp=True)
self.check_update_response(s._sent_data, Rcode.NOERROR, tcp=True)
# In the current implementation, the socket should be closed
# immedidately after a successful send.
self.assertEqual(1, s._close_called)
......@@ -1071,7 +1071,7 @@ class TestDDNSSession(unittest.TestCase):
s.make_send_ready()
self.assertEqual(DNSTCPContext.SEND_DONE,
self.server._tcp_ctxs[s.fileno()][0].send_ready())
self.check_update_response(s._sent_data, Rcode.NOERROR(), tcp=True)
self.check_update_response(s._sent_data, Rcode.NOERROR, tcp=True)
def test_tcp_request_error(self):
# initial send() on the TCP socket will fail. The request handling
......@@ -1127,9 +1127,9 @@ class TestDDNSSession(unittest.TestCase):
self.__faked_result = UPDATE_DROP
# Put the same RR twice in the prerequisite section. We should see
# them as separate RRs.
dummy_record = RRset(TEST_ZONE_NAME, TEST_RRCLASS, RRType.NS(),
dummy_record = RRset(TEST_ZONE_NAME, TEST_RRCLASS, RRType.NS,
RRTTL(0))
dummy_record.add_rdata(Rdata(RRType.NS(), TEST_RRCLASS, "ns.example."))
dummy_record.add_rdata(Rdata(RRType.NS, TEST_RRCLASS, "ns.example."))
self.server.handle_request((self.__sock, TEST_SERVER6, TEST_CLIENT6,
create_msg(prereq=[dummy_record,
dummy_record])))
......
......@@ -5,6 +5,10 @@ AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CXXFLAGS = $(B10_CXXFLAGS)
if USE_CLANGPP
# Disable unused parameter warning caused by some Boost headers when compiling with clang
AM_CXXFLAGS += -Wno-unused-parameter
endif
if USE_STATIC_LINK
AM_LDFLAGS = -static
......@@ -51,12 +55,6 @@ b10_dhcp4_SOURCES += dhcp4_srv.cc dhcp4_srv.h
nodist_b10_dhcp4_SOURCES = dhcp4_messages.h dhcp4_messages.cc
EXTRA_DIST += dhcp4_messages.mes
if USE_CLANGPP
# Disable unused parameter warning caused by some of the
# Boost headers when compiling with clang.
b10_dhcp4_CXXFLAGS = -Wno-unused-parameter
endif
b10_dhcp4_LDADD = $(top_builddir)/src/lib/dhcp/libb10-dhcp++.la
b10_dhcp4_LDADD += $(top_builddir)/src/lib/util/libb10-util.la
b10_dhcp4_LDADD += $(top_builddir)/src/lib/dhcpsrv/libb10-dhcpsrv.la
......
......@@ -967,13 +967,13 @@ public:
return (new OptionDataListParser(param_name));
}
/// Pointer to options instances storage.
OptionStorage* options_;
/// Intermediate option storage. This storage is used by
/// lower level parsers to add new options. Values held
/// in this storage are assigned to main storage (options_)
/// if overall parsing was successful.
OptionStorage local_options_;
/// Pointer to options instances storage.
OptionStorage* options_;
/// Collection of parsers;
ParserCollection parsers_;
};
......
......@@ -42,6 +42,18 @@ using namespace isc::dhcp;
using namespace isc::log;
using namespace std;
namespace isc {
namespace dhcp {
/// @brief file name of a server-id file
///
/// Server must store its server identifier in persistent storage that must not
/// change between restarts. This is name of the file that is created in dataDir
/// (see isc::dhcp::CfgMgr::getDataDir()). It is a text file that uses
/// regular IPv4 address, e.g. 192.0.2.1. Server will create it during
/// first run and then use it afterwards.
static const char* SERVER_ID_FILE = "b10-dhcp4-serverid";
// These are hardcoded parameters. Currently this is a skeleton server that only
// grants those options and a single, fixed, hardcoded lease.
......@@ -98,7 +110,8 @@ Dhcpv4Srv::~Dhcpv4Srv() {
IfaceMgr::instance().closeSockets();
}
void Dhcpv4Srv::shutdown() {
void
Dhcpv4Srv::shutdown() {
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_BASIC, DHCP4_SHUTDOWN_REQUEST);
shutdown_ = true;
}
......@@ -199,7 +212,8 @@ Dhcpv4Srv::run() {
return (true);
}
bool Dhcpv4Srv::loadServerID(const std::string& file_name) {
bool
Dhcpv4Srv::loadServerID(const std::string& file_name) {
// load content of the file into a string
fstream f(file_name.c_str(), ios::in);
......@@ -233,7 +247,8 @@ bool Dhcpv4Srv::loadServerID(const std::string& file_name) {
return (true);
}
void Dhcpv4Srv::generateServerID() {
void
Dhcpv4Srv::generateServerID() {
const IfaceMgr::IfaceCollection& ifaces = IfaceMgr::instance().getIfaces();
......@@ -270,16 +285,19 @@ void Dhcpv4Srv::generateServerID() {
isc_throw(BadValue, "No suitable interfaces for server-identifier found");
}
bool Dhcpv4Srv::writeServerID(const std::string& file_name) {
bool
Dhcpv4Srv::writeServerID(const std::string& file_name) {
fstream f(file_name.c_str(), ios::out | ios::trunc);
if (!f.good()) {
return (false);
}
f << srvidToString(getServerID());
f.close();
return (true);
}
string Dhcpv4Srv::srvidToString(const OptionPtr& srvid) {
string
Dhcpv4Srv::srvidToString(const OptionPtr& srvid) {
if (!srvid) {
isc_throw(BadValue, "NULL pointer passed to srvidToString()");
}
......@@ -298,7 +316,8 @@ string Dhcpv4Srv::srvidToString(const OptionPtr& srvid) {
return (addrs[0].toText());
}
void Dhcpv4Srv::copyDefaultFields(const Pkt4Ptr& question, Pkt4Ptr& answer) {
void
Dhcpv4Srv::copyDefaultFields(const Pkt4Ptr& question, Pkt4Ptr& answer) {
answer->setIface(question->getIface());
answer->setIndex(question->getIndex());
answer->setCiaddr(question->getCiaddr());
......@@ -327,7 +346,8 @@ void Dhcpv4Srv::copyDefaultFields(const Pkt4Ptr& question, Pkt4Ptr& answer) {
}
}
void Dhcpv4Srv::appendDefaultOptions(Pkt4Ptr& msg, uint8_t msg_type) {
void
Dhcpv4Srv::appendDefaultOptions(Pkt4Ptr& msg, uint8_t msg_type) {
OptionPtr opt;
// add Message Type Option (type 53)
......@@ -339,8 +359,8 @@ void Dhcpv4Srv::appendDefaultOptions(Pkt4Ptr& msg, uint8_t msg_type) {
// more options will be added here later
}
void Dhcpv4Srv::appendRequestedOptions(const Pkt4Ptr& question, Pkt4Ptr& msg) {
void
Dhcpv4Srv::appendRequestedOptions(const Pkt4Ptr& question, Pkt4Ptr& msg) {
// Get the subnet relevant for the client. We will need it
// to get the options associated with it.
......@@ -411,7 +431,8 @@ Dhcpv4Srv::appendBasicOptions(const Pkt4Ptr& question, Pkt4Ptr& msg) {
}
}
void Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
void
Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
// We need to select a subnet the client is connected in.
Subnet4Ptr subnet = selectSubnet(question);
......@@ -509,7 +530,8 @@ void Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
}
}
OptionPtr Dhcpv4Srv::getNetmaskOption(const Subnet4Ptr& subnet) {
OptionPtr
Dhcpv4Srv::getNetmaskOption(const Subnet4Ptr& subnet) {
uint32_t netmask = getNetmask4(subnet->get().second);
OptionPtr opt(new OptionInt<uint32_t>(Option::V4,
......@@ -518,7 +540,8 @@ OptionPtr Dhcpv4Srv::getNetmaskOption(const Subnet4Ptr& subnet) {
return (opt);
}
Pkt4Ptr Dhcpv4Srv::processDiscover(Pkt4Ptr& discover) {
Pkt4Ptr
Dhcpv4Srv::processDiscover(Pkt4Ptr& discover) {
Pkt4Ptr offer = Pkt4Ptr
(new Pkt4(DHCPOFFER, discover->getTransid()));
......@@ -536,7 +559,8 @@ Pkt4Ptr Dhcpv4Srv::processDiscover(Pkt4Ptr& discover) {
return (offer);
}
Pkt4Ptr Dhcpv4Srv::processRequest(Pkt4Ptr& request) {
Pkt4Ptr
Dhcpv4Srv::processRequest(Pkt4Ptr& request) {
Pkt4Ptr ack = Pkt4Ptr
(new Pkt4(DHCPACK, request->getTransid()));
......@@ -554,7 +578,8 @@ Pkt4Ptr Dhcpv4Srv::processRequest(Pkt4Ptr& request) {
return (ack);
}
void Dhcpv4Srv::processRelease(Pkt4Ptr& release) {
void
Dhcpv4Srv::processRelease(Pkt4Ptr& release) {
// Try to find client-id
ClientIdPtr client_id;
......@@ -622,11 +647,13 @@ void Dhcpv4Srv::processRelease(Pkt4Ptr& release) {
}
void Dhcpv4Srv::processDecline(Pkt4Ptr& decline) {
void
Dhcpv4Srv::processDecline(Pkt4Ptr& /* decline */) {
/// TODO: Implement this.
}
Pkt4Ptr Dhcpv4Srv::processInform(Pkt4Ptr& inform) {
Pkt4Ptr
Dhcpv4Srv::processInform(Pkt4Ptr& inform) {
/// TODO: Currently implemented echo mode. Implement this for real
return (inform);
}
......@@ -662,7 +689,8 @@ Dhcpv4Srv::serverReceivedPacketName(uint8_t type) {
return (UNKNOWN);
}
Subnet4Ptr Dhcpv4Srv::selectSubnet(const Pkt4Ptr& question) {
Subnet4Ptr
Dhcpv4Srv::selectSubnet(const Pkt4Ptr& question) {
// Is this relayed message?
IOAddress relay = question->getGiaddr();
......@@ -677,7 +705,8 @@ Subnet4Ptr Dhcpv4Srv::selectSubnet(const Pkt4Ptr& question) {
}
}
void Dhcpv4Srv::sanityCheck(const Pkt4Ptr& pkt, RequirementLevel serverid) {
void
Dhcpv4Srv::sanityCheck(const Pkt4Ptr& pkt, RequirementLevel serverid) {
OptionPtr server_id = pkt->getOption(DHO_DHCP_SERVER_IDENTIFIER);