mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-03 07:25:18 +00:00
[#3074] addressed review comments
This commit is contained in:
@@ -225,9 +225,9 @@ OptionClasslessStaticRoute::parseConfigData(const std::string& config_txt) {
|
|||||||
try {
|
try {
|
||||||
subnet_addr = IOAddress(txt_subnet_addr);
|
subnet_addr = IOAddress(txt_subnet_addr);
|
||||||
if (!subnet_addr.isV4()) {
|
if (!subnet_addr.isV4()) {
|
||||||
isc_throw(IOError, "This is not IPv4 address.");
|
isc_throw(BadValue, "This is not IPv4 address.");
|
||||||
}
|
}
|
||||||
} catch (const IOError& e) {
|
} catch (const std::exception& e) {
|
||||||
isc_throw(BadValue, "DHCPv4 OptionClasslessStaticRoute "
|
isc_throw(BadValue, "DHCPv4 OptionClasslessStaticRoute "
|
||||||
<< type_ << " has invalid value, provided subnet_addr "
|
<< type_ << " has invalid value, provided subnet_addr "
|
||||||
<< txt_subnet_addr << " is not a valid IPv4 address. "
|
<< txt_subnet_addr << " is not a valid IPv4 address. "
|
||||||
@@ -255,9 +255,9 @@ OptionClasslessStaticRoute::parseConfigData(const std::string& config_txt) {
|
|||||||
try {
|
try {
|
||||||
router_addr = IOAddress(txt_router);
|
router_addr = IOAddress(txt_router);
|
||||||
if (!router_addr.isV4()) {
|
if (!router_addr.isV4()) {
|
||||||
isc_throw(IOError, "This is not IPv4 address.");
|
isc_throw(BadValue, "This is not IPv4 address.");
|
||||||
}
|
}
|
||||||
} catch (const IOError& e) {
|
} catch (const std::exception& e) {
|
||||||
isc_throw(BadValue, "DHCPv4 OptionClasslessStaticRoute "
|
isc_throw(BadValue, "DHCPv4 OptionClasslessStaticRoute "
|
||||||
<< type_ << " has invalid value, provided router address "
|
<< type_ << " has invalid value, provided router address "
|
||||||
<< txt_router << " is not a valid IPv4 address. "
|
<< txt_router << " is not a valid IPv4 address. "
|
||||||
|
@@ -46,6 +46,9 @@ TEST(OptionClasslessStaticRouteTest, bufferFromStrCtorWithOneRoute) {
|
|||||||
// 3 static routes are defined.
|
// 3 static routes are defined.
|
||||||
TEST(OptionClasslessStaticRouteTest, bufferFromStrCtorWithMoreRoutes) {
|
TEST(OptionClasslessStaticRouteTest, bufferFromStrCtorWithMoreRoutes) {
|
||||||
// Prepare data to decode - 3 static routes
|
// Prepare data to decode - 3 static routes
|
||||||
|
// White space added/missing inconsistency is on purpose,
|
||||||
|
// it simulates real user typing inconsistent config.
|
||||||
|
// Trimming spaces in config is tested as well.
|
||||||
const std::string config = "0.0.0.0/0 - 10.17.0.1,10.229.0.128/25-10.229.0.1, "
|
const std::string config = "0.0.0.0/0 - 10.17.0.1,10.229.0.128/25-10.229.0.1, "
|
||||||
"10.27.129.0/24 - 10.27.129.1";
|
"10.27.129.0/24 - 10.27.129.1";
|
||||||
OptionBuffer buf;
|
OptionBuffer buf;
|
||||||
|
Reference in New Issue
Block a user