Skip to content

Commit

Permalink
[#3074] addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pzadroga committed Jan 15, 2024
1 parent 4d4e87b commit cf22095
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/dhcp/option_classless_static_route.cc
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ OptionClasslessStaticRoute::parseConfigData(const std::string& config_txt) {
try {
subnet_addr = IOAddress(txt_subnet_addr);
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 "
<< type_ << " has invalid value, provided subnet_addr "
<< txt_subnet_addr << " is not a valid IPv4 address. "
Expand Down Expand Up @@ -255,9 +255,9 @@ OptionClasslessStaticRoute::parseConfigData(const std::string& config_txt) {
try {
router_addr = IOAddress(txt_router);
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 "
<< type_ << " has invalid value, provided router address "
<< txt_router << " is not a valid IPv4 address. "
Expand Down
3 changes: 3 additions & 0 deletions src/lib/dhcp/tests/option_classless_static_route_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ TEST(OptionClasslessStaticRouteTest, bufferFromStrCtorWithOneRoute) {
// 3 static routes are defined.
TEST(OptionClasslessStaticRouteTest, bufferFromStrCtorWithMoreRoutes) {
// 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, "
"10.27.129.0/24 - 10.27.129.1";
OptionBuffer buf;
Expand Down

0 comments on commit cf22095

Please sign in to comment.