From: Razvan Becheriu Date: Fri, 12 Sep 2025 09:06:57 +0000 (+0300) Subject: [#3860] addressed review X-Git-Tag: Kea-3.1.2~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1fde2aed03892d9a8ef22d044a949d6b36d995b2;p=thirdparty%2Fkea.git [#3860] addressed review --- diff --git a/doc/sphinx/arm/ext-radius.rst b/doc/sphinx/arm/ext-radius.rst index 6d32aae0a9..6427d1a057 100644 --- a/doc/sphinx/arm/ext-radius.rst +++ b/doc/sphinx/arm/ext-radius.rst @@ -235,7 +235,7 @@ At the service level, three sections can be configured: Vendor-Specific attribute can be specified in two ways: using a ``raw`` value which must include the vendor and the vsa data, note that the ``data`` - value is no longer supported sine Kea 3.1.2, and the ``expr`` value + value is no longer supported since Kea 3.1.2, and the ``expr`` value is evaluated to the content of the attribute. The second way was added by 3.1.2 and allows to specify a vendor attribute which is automatically embedded into a Vendor-Specific attribute. diff --git a/src/hooks/dhcp/radius/client_attribute.cc b/src/hooks/dhcp/radius/client_attribute.cc index b011488be8..5e3b1118a1 100644 --- a/src/hooks/dhcp/radius/client_attribute.cc +++ b/src/hooks/dhcp/radius/client_attribute.cc @@ -658,7 +658,7 @@ AttrVsa::AttrVsa(const uint8_t type, const uint32_t vendor, } AttributePtr -AttrVsa::fromText(const uint8_t type, const string& repr) { +AttrVsa::fromText(const uint8_t /* type */, const string& /* repr */) { isc_throw(NotImplemented, "Can't decode vsa from text"); } diff --git a/src/hooks/dhcp/radius/client_attribute.h b/src/hooks/dhcp/radius/client_attribute.h index 8d2879b1ca..b20e71b6a2 100644 --- a/src/hooks/dhcp/radius/client_attribute.h +++ b/src/hooks/dhcp/radius/client_attribute.h @@ -813,7 +813,6 @@ private: std::string value_; }; - /// @brief Collection of attributes. /// /// Designed to not handle vendor attributes so can be keyed by type only. @@ -841,12 +840,6 @@ public: Attributes() : container_() { } - /// @brief Copy constructor. - /// - /// @param other source attributes. - Attributes(const Attributes& other) : container_(other.container_) { - } - /// @brief Destructor. virtual ~Attributes() { clear(); diff --git a/src/hooks/dhcp/radius/radius_parsers.cc b/src/hooks/dhcp/radius/radius_parsers.cc index dc4526bbe8..4dc11f5fa5 100644 --- a/src/hooks/dhcp/radius/radius_parsers.cc +++ b/src/hooks/dhcp/radius/radius_parsers.cc @@ -109,7 +109,7 @@ RadiusConfigParser::parse(ElementPtr& config) { if (!AttrDefs::instance().getByType(1)) { uint32_t vendor = 0; try { - AttrDefs::instance().readDictionary(riref.dictionary_, vendor); + AttrDefs::instance().readDictionary(riref.dictionary_, vendor); } catch (const exception& ex) { isc_throw(BadValue, "can't read radius dictionary: " << ex.what()); diff --git a/src/hooks/dhcp/radius/tests/attribute_unittests.cc b/src/hooks/dhcp/radius/tests/attribute_unittests.cc index 02e9c3b48e..419592390f 100644 --- a/src/hooks/dhcp/radius/tests/attribute_unittests.cc +++ b/src/hooks/dhcp/radius/tests/attribute_unittests.cc @@ -243,8 +243,7 @@ TEST_F(AttributeTest, attrInt) { EXPECT_THROW_MSG(attr->toIpv6Prefix(), TypeError, "the attribute value type must be ipv6prefix, not integer"); EXPECT_THROW_MSG(attr->toIpv6PrefixLen(), TypeError, - "the attribute value type must be ipv6prefix, not integer" -); + "the attribute value type must be ipv6prefix, not integer"); EXPECT_THROW_MSG(attr->toVendorId(), TypeError, "the attribute value type must be vsa, not integer"); EXPECT_THROW_MSG(attr->toVsaData(), TypeError, @@ -584,8 +583,8 @@ TEST_F(AttributeTest, attrVsa) { too_big_binary), BadValue, "value is too large 250 > 249"); - vector too_bigvalue(MAX_STRING_LEN + 1, 0x87); - EXPECT_THROW_MSG(Attribute::fromBytes(def, too_bigvalue), BadValue, + vector too_big_value(MAX_STRING_LEN + 1, 0x87); + EXPECT_THROW_MSG(Attribute::fromBytes(def, too_big_value), BadValue, "value is too large 254 > 253"); EXPECT_THROW_MSG(attr->toString(), TypeError, diff --git a/src/hooks/dhcp/radius/tests/config_unittests.cc b/src/hooks/dhcp/radius/tests/config_unittests.cc index ea03e69795..1c67a9bb7d 100644 --- a/src/hooks/dhcp/radius/tests/config_unittests.cc +++ b/src/hooks/dhcp/radius/tests/config_unittests.cc @@ -76,7 +76,7 @@ public: static const char* TEST_FILE; }; -const char* ConfigTest::TEST_FILE = "test-dictonary"; +const char* ConfigTest::TEST_FILE = "test-dictionary"; // Verify that a configuration must be a map. TEST_F(ConfigTest, notMap) { diff --git a/src/hooks/dhcp/radius/tests/dictionary_unittests.cc b/src/hooks/dhcp/radius/tests/dictionary_unittests.cc index b2cc58ec7a..1942dfd5e1 100644 --- a/src/hooks/dhcp/radius/tests/dictionary_unittests.cc +++ b/src/hooks/dhcp/radius/tests/dictionary_unittests.cc @@ -98,7 +98,7 @@ public: static const char* TEST_FILE; }; -const char* DictionaryTest::TEST_FILE = "test-dictionary"; +const char* DictionaryTest::TEST_FILE = "test-dictionary"; // Verifies standards definitions can be read from the dictionary. TEST_F(DictionaryTest, standard) { @@ -160,11 +160,11 @@ TEST_F(DictionaryTest, parseLine) { "0 is reserved at line 1"); EXPECT_THROW_MSG(parseLine("BEGIN-VENDOR"), BadValue, "expected 2 tokens, got 1 at line 1"); - EXPECT_THROW_MSG(parseLine("BEGIN-VENDOR my-vendor 1"), BadValue, + EXPECT_THROW_MSG(parseLine("BEGIN-VENDOR my-vendor 1"), BadValue, "expected 2 tokens, got 3 at line 1"); EXPECT_THROW_MSG(parseLine("END-VENDOR", 1), BadValue, "expected 2 tokens, got 1 at line 1"); - EXPECT_THROW_MSG(parseLine("END-VENDOR my-vendor 1", 1), BadValue, + EXPECT_THROW_MSG(parseLine("END-VENDOR my-vendor 1", 1), BadValue, "expected 2 tokens, got 3 at line 1"); EXPECT_THROW_MSG(parseLine("BEGIN-TLV my-vendor"), BadValue, @@ -237,7 +237,7 @@ TEST_F(DictionaryTest, integerConstant) { "VENDOR DSL-Forum 3561", "BEGIN-VENDOR DSL-Forum", "ATTRIBUTE Agent-Circuit-Id 1 string", - "VALUE Agent-Circuit-Id My-Value 1", + "VALUE Agent-Circuit-Id My-Value 1", "END-VENDOR DSL-Forum" }; expected = "attribute 'Agent-Circuit-Id' in vendor 3561"; @@ -321,7 +321,7 @@ TEST_F(DictionaryTest, beginEndVendor) { list begin_unknown = { "BEGIN-VENDOR foo" }; - string expected = "unsupported embedded begin vendor, "; + string expected = "unsupported embedded begin vendor, "; expected += "1 is still open at line 1"; EXPECT_THROW_MSG(parseLines(begin_unknown, 1), BadValue, expected); // Value must be a known name or integer. @@ -362,7 +362,7 @@ TEST_F(DictionaryTest, beginEndVendor) { "ATTRIBUTE Actual-Data-Rate-Upstream 129 integer" }; EXPECT_NO_THROW_LOG(parseLines(positive_n, 0, 3561)); - auto adru = AttrDefs::instance().getByType(129, 3561); + auto adru = AttrDefs::instance().getByType(129, 3561); ASSERT_TRUE(adru); EXPECT_EQ(129, adru->type_); EXPECT_EQ(PW_TYPE_INTEGER, adru->value_type_); @@ -421,7 +421,7 @@ TEST_F(DictionaryTest, hookAttributes) { // Verifies the $INCLUDE entry. TEST_F(DictionaryTest, include) { list include; - include.push_back("# Including the dictonary"); + include.push_back("# Including the dictionary"); include.push_back(string("$INCLUDE ") + string(TEST_DICTIONARY)); include.push_back("# Dictionary included"); include.push_back("VENDOR ISC 2495");