|
16 | 16 | namespace isc { |
17 | 17 | namespace dhcp { |
18 | 18 |
|
19 | | -/// @brief Implements the logic for the Option6ClientFqdn class. |
| 19 | +/// @brief Implements the logic for the Option4ClientFqdn class. |
20 | 20 | /// |
21 | 21 | /// The purpose of the class is to separate the implementation details |
22 | 22 | /// of the Option4ClientFqdn class from the interface. This implementation |
23 | 23 | /// uses libdns classes to process FQDNs. At some point it may be |
24 | 24 | /// desired to split libdhcp++ from libdns. In such case the |
25 | 25 | /// implementation of this class may be changed. The declaration of the |
26 | | -/// Option6ClientFqdn class holds the pointer to implementation, so |
| 26 | +/// Option4ClientFqdn class holds the pointer to implementation, so |
27 | 27 | /// the transition to a different implementation would not affect the |
28 | 28 | /// header file. |
29 | 29 | class Option4ClientFqdnImpl { |
@@ -88,7 +88,7 @@ class Option4ClientFqdnImpl { |
88 | 88 | /// check if the MBZ bits are set (if true). This parameter should be set |
89 | 89 | /// to false when validating flags in the received message. This is because |
90 | 90 | /// server should ignore MBZ bits in received messages. |
91 | | - /// @throw InvalidOption6FqdnFlags if flags are invalid. |
| 91 | + /// @throw InvalidOption4FqdnFlags if flags are invalid. |
92 | 92 | static void checkFlags(const uint8_t flags, const bool check_mbz); |
93 | 93 |
|
94 | 94 | /// @brief Parse the Option provided in the wire format. |
@@ -149,7 +149,15 @@ Option4ClientFqdnImpl::Option4ClientFqdnImpl(OptionBufferConstIter first, |
149 | 149 | // Verify that flags value was correct. This constructor is used to parse |
150 | 150 | // incoming packet, so don't check MBZ bits. They are ignored because we |
151 | 151 | // don't want to discard the whole option because MBZ bits are set. |
152 | | - checkFlags(flags_, false); |
| 152 | + try { |
| 153 | + checkFlags(flags_, false); |
| 154 | + } catch (const InvalidOption4FqdnFlags& ex) { |
| 155 | + if (Option::lenient_parsing_) { |
| 156 | + isc_throw(SkipThisOptionError, ex.what()); |
| 157 | + } else { |
| 158 | + throw; |
| 159 | + } |
| 160 | + } |
153 | 161 | } |
154 | 162 |
|
155 | 163 | Option4ClientFqdnImpl:: |
@@ -509,7 +517,15 @@ Option4ClientFqdn::unpack(OptionBufferConstIter first, |
509 | 517 | // Check that the flags in the received option are valid. Ignore MBZ bits, |
510 | 518 | // because we don't want to discard the whole option because of MBZ bits |
511 | 519 | // being set. |
512 | | - impl_->checkFlags(impl_->flags_, false); |
| 520 | + try { |
| 521 | + impl_->checkFlags(impl_->flags_, false); |
| 522 | + } catch (const InvalidOption4FqdnFlags& ex) { |
| 523 | + if (Option::lenient_parsing_) { |
| 524 | + isc_throw(SkipThisOptionError, ex.what()); |
| 525 | + } else { |
| 526 | + throw; |
| 527 | + } |
| 528 | + } |
513 | 529 | } |
514 | 530 |
|
515 | 531 | std::string |
|
0 commit comments