From f59c6a35b7404374d07330c88a9ee70ef73b9b0c Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Thu, 23 May 2019 15:24:24 +0300 Subject: [PATCH] [#605,!329] allow creation of subnet6 without id set --- src/lib/dhcpsrv/parsers/dhcp_parsers.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc index a0c751ce89..f29feee04e 100644 --- a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc +++ b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc @@ -714,7 +714,10 @@ Subnet4ConfigParser::initSubnet(data::ConstElementPtr params, asiolink::IOAddress addr, uint8_t len) { // Subnet ID is optional. If it is not supplied the value of 0 is used, // which means autogenerate. - SubnetID subnet_id = static_cast(getInteger(params, "id")); + SubnetID subnet_id = 0; + if (params->contains("id")) { + subnet_id = static_cast(getInteger(params, "id")); + } Subnet4Ptr subnet4(new Subnet4(addr, len, Triplet(), Triplet(), Triplet(), @@ -1147,7 +1150,10 @@ Subnet6ConfigParser::initSubnet(data::ConstElementPtr params, asiolink::IOAddress addr, uint8_t len) { // Subnet ID is optional. If it is not supplied the value of 0 is used, // which means autogenerate. - SubnetID subnet_id = static_cast(getInteger(params, "id")); + SubnetID subnet_id = 0; + if (params->contains("id")) { + subnet_id = static_cast(getInteger(params, "id")); + } // We want to log whether rapid-commit is enabled, so we get this // before the actual subnet creation. -- 2.47.2