From: Francis Dupont Date: Mon, 23 Oct 2017 13:23:16 +0000 (+0200) Subject: [master] Finishing merge of trac5277 (bootp parameters) X-Git-Tag: Kea-1.3.0~2^2~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0d611d0e77812f0b880fcbbe5a1ef2c884dc5d9;p=thirdparty%2Fkea.git [master] Finishing merge of trac5277 (bootp parameters) --- d0d611d0e77812f0b880fcbbe5a1ef2c884dc5d9 diff --cc src/bin/dhcp4/dhcp4_lexer.cc index d28ab1cb6b,3305d5878a..3af22c061b --- a/src/bin/dhcp4/dhcp4_lexer.cc +++ b/src/bin/dhcp4/dhcp4_lexer.cc @@@ -1575,25 -1551,25 +1575,25 @@@ static char *yy_last_accepting_cpos extern int yy_flex_debug; int yy_flex_debug = 1; -static const flex_int16_t yy_rule_linenum[155] = +static const flex_int16_t yy_rule_linenum[158] = { 0, - 139, 141, 143, 148, 149, 154, 155, 156, 168, 171, - 176, 183, 192, 201, 210, 219, 229, 238, 247, 256, - 265, 274, 285, 294, 303, 312, 321, 331, 341, 351, - 361, 371, 381, 391, 401, 411, 422, 433, 444, 453, - 463, 472, 482, 497, 513, 522, 531, 540, 549, 559, - 568, 578, 587, 596, 605, 615, 624, 633, 642, 651, - 661, 670, 679, 688, 697, 706, 715, 724, 733, 742, - 751, 761, 772, 782, 791, 801, 811, 821, 831, 841, - 850, 860, 869, 878, 887, 896, 906, 916, 926, 935, - 944, 953, 962, 971, 980, 989, 998, 1007, 1016, 1025, - - 1034, 1043, 1052, 1061, 1070, 1079, 1088, 1097, 1106, 1115, - 1124, 1133, 1142, 1151, 1160, 1169, 1178, 1188, 1198, 1208, - 1218, 1228, 1238, 1248, 1258, 1268, 1277, 1286, 1295, 1304, - 1313, 1322, 1331, 1342, 1355, 1368, 1383, 1481, 1486, 1491, - 1496, 1497, 1498, 1499, 1500, 1501, 1503, 1521, 1534, 1539, - 1543, 1545, 1547, 1549 + 143, 145, 147, 152, 153, 158, 159, 160, 172, 175, + 180, 187, 196, 205, 214, 223, 233, 242, 251, 260, + 269, 278, 287, 296, 305, 316, 325, 334, 343, 352, + 362, 372, 382, 392, 402, 412, 422, 432, 442, 453, + 464, 475, 484, 494, 503, 513, 528, 544, 553, 562, + 571, 580, 590, 599, 609, 618, 627, 636, 646, 655, + 664, 673, 682, 692, 701, 710, 719, 728, 737, 746, + 755, 764, 773, 782, 792, 803, 813, 822, 832, 842, + 852, 862, 872, 881, 891, 900, 909, 918, 927, 937, + 947, 957, 966, 975, 984, 993, 1002, 1011, 1020, 1029, + + 1038, 1047, 1056, 1065, 1074, 1083, 1092, 1101, 1110, 1119, + 1128, 1137, 1146, 1155, 1164, 1173, 1182, 1191, 1200, 1209, + 1219, 1229, 1239, 1249, 1259, 1269, 1279, 1289, 1299, 1308, + 1317, 1326, 1335, 1344, 1353, 1364, 1375, 1388, 1399, 1412, - 1510, 1515, 1520, 1525, 1526, 1527, 1528, 1529, 1530, 1532, - 1550, 1563, 1568, 1572, 1574, 1576, 1578 ++ 1511, 1516, 1521, 1526, 1527, 1528, 1529, 1530, 1531, 1533, ++ 1551, 1564, 1569, 1573, 1575, 1577, 1579 } ; /* The intent behind this definition is that it'll catch @@@ -3788,6 -3726,6 +3788,7 @@@ YY_RULE_SETU case '"': /* impossible condition */ driver.error(driver.loc_, "Bad quote in \"" + raw + "\""); ++ break; case '\\': ++pos; if (pos >= len) { @@@ -3870,65 -3808,65 +3871,65 @@@ return isc::dhcp::Dhcp4Parser::make_STRING(decoded, driver.loc_); } YY_BREAK -case 138: -/* rule 138 can match eol */ +case 141: +/* rule 141 can match eol */ YY_RULE_SETUP - #line 1510 "dhcp4_lexer.ll" -#line 1481 "dhcp4_lexer.ll" ++#line 1511 "dhcp4_lexer.ll" { /* Bad string with a forbidden control character inside */ driver.error(driver.loc_, "Invalid control in " + std::string(yytext)); } YY_BREAK -case 139: -/* rule 139 can match eol */ +case 142: +/* rule 142 can match eol */ YY_RULE_SETUP - #line 1515 "dhcp4_lexer.ll" -#line 1486 "dhcp4_lexer.ll" ++#line 1516 "dhcp4_lexer.ll" { /* Bad string with a bad escape inside */ driver.error(driver.loc_, "Bad escape in " + std::string(yytext)); } YY_BREAK -case 140: +case 143: YY_RULE_SETUP - #line 1520 "dhcp4_lexer.ll" -#line 1491 "dhcp4_lexer.ll" ++#line 1521 "dhcp4_lexer.ll" { /* Bad string with an open escape at the end */ driver.error(driver.loc_, "Overflow escape in " + std::string(yytext)); } YY_BREAK -case 141: +case 144: YY_RULE_SETUP - #line 1525 "dhcp4_lexer.ll" -#line 1496 "dhcp4_lexer.ll" ++#line 1526 "dhcp4_lexer.ll" { return isc::dhcp::Dhcp4Parser::make_LSQUARE_BRACKET(driver.loc_); } YY_BREAK -case 142: +case 145: YY_RULE_SETUP - #line 1526 "dhcp4_lexer.ll" -#line 1497 "dhcp4_lexer.ll" ++#line 1527 "dhcp4_lexer.ll" { return isc::dhcp::Dhcp4Parser::make_RSQUARE_BRACKET(driver.loc_); } YY_BREAK -case 143: +case 146: YY_RULE_SETUP - #line 1527 "dhcp4_lexer.ll" -#line 1498 "dhcp4_lexer.ll" ++#line 1528 "dhcp4_lexer.ll" { return isc::dhcp::Dhcp4Parser::make_LCURLY_BRACKET(driver.loc_); } YY_BREAK -case 144: +case 147: YY_RULE_SETUP - #line 1528 "dhcp4_lexer.ll" -#line 1499 "dhcp4_lexer.ll" ++#line 1529 "dhcp4_lexer.ll" { return isc::dhcp::Dhcp4Parser::make_RCURLY_BRACKET(driver.loc_); } YY_BREAK -case 145: +case 148: YY_RULE_SETUP - #line 1529 "dhcp4_lexer.ll" -#line 1500 "dhcp4_lexer.ll" ++#line 1530 "dhcp4_lexer.ll" { return isc::dhcp::Dhcp4Parser::make_COMMA(driver.loc_); } YY_BREAK -case 146: +case 149: YY_RULE_SETUP - #line 1530 "dhcp4_lexer.ll" -#line 1501 "dhcp4_lexer.ll" ++#line 1531 "dhcp4_lexer.ll" { return isc::dhcp::Dhcp4Parser::make_COLON(driver.loc_); } YY_BREAK -case 147: +case 150: YY_RULE_SETUP - #line 1532 "dhcp4_lexer.ll" -#line 1503 "dhcp4_lexer.ll" ++#line 1533 "dhcp4_lexer.ll" { /* An integer was found. */ std::string tmp(yytext); @@@ -3947,9 -3885,9 +3948,9 @@@ return isc::dhcp::Dhcp4Parser::make_INTEGER(integer, driver.loc_); } YY_BREAK -case 148: +case 151: YY_RULE_SETUP - #line 1550 "dhcp4_lexer.ll" -#line 1521 "dhcp4_lexer.ll" ++#line 1551 "dhcp4_lexer.ll" { /* A floating point was found. */ std::string tmp(yytext); @@@ -3963,43 -3901,43 +3964,43 @@@ return isc::dhcp::Dhcp4Parser::make_FLOAT(fp, driver.loc_); } YY_BREAK -case 149: +case 152: YY_RULE_SETUP - #line 1563 "dhcp4_lexer.ll" -#line 1534 "dhcp4_lexer.ll" ++#line 1564 "dhcp4_lexer.ll" { string tmp(yytext); return isc::dhcp::Dhcp4Parser::make_BOOLEAN(tmp == "true", driver.loc_); } YY_BREAK -case 150: +case 153: YY_RULE_SETUP - #line 1568 "dhcp4_lexer.ll" -#line 1539 "dhcp4_lexer.ll" ++#line 1569 "dhcp4_lexer.ll" { return isc::dhcp::Dhcp4Parser::make_NULL_TYPE(driver.loc_); } YY_BREAK -case 151: +case 154: YY_RULE_SETUP - #line 1572 "dhcp4_lexer.ll" -#line 1543 "dhcp4_lexer.ll" ++#line 1573 "dhcp4_lexer.ll" driver.error (driver.loc_, "JSON true reserved keyword is lower case only"); YY_BREAK -case 152: +case 155: YY_RULE_SETUP - #line 1574 "dhcp4_lexer.ll" -#line 1545 "dhcp4_lexer.ll" ++#line 1575 "dhcp4_lexer.ll" driver.error (driver.loc_, "JSON false reserved keyword is lower case only"); YY_BREAK -case 153: +case 156: YY_RULE_SETUP - #line 1576 "dhcp4_lexer.ll" -#line 1547 "dhcp4_lexer.ll" ++#line 1577 "dhcp4_lexer.ll" driver.error (driver.loc_, "JSON null reserved keyword is lower case only"); YY_BREAK -case 154: +case 157: YY_RULE_SETUP - #line 1578 "dhcp4_lexer.ll" -#line 1549 "dhcp4_lexer.ll" ++#line 1579 "dhcp4_lexer.ll" driver.error (driver.loc_, "Invalid character: " + std::string(yytext)); YY_BREAK case YY_STATE_EOF(INITIAL): - #line 1580 "dhcp4_lexer.ll" -#line 1551 "dhcp4_lexer.ll" ++#line 1581 "dhcp4_lexer.ll" { if (driver.states_.empty()) { return isc::dhcp::Dhcp4Parser::make_END(driver.loc_); @@@ -4023,12 -3961,12 +4024,12 @@@ BEGIN(DIR_EXIT); } YY_BREAK -case 155: +case 158: YY_RULE_SETUP - #line 1603 "dhcp4_lexer.ll" -#line 1574 "dhcp4_lexer.ll" ++#line 1604 "dhcp4_lexer.ll" ECHO; YY_BREAK - #line 4031 "dhcp4_lexer.cc" -#line 3969 "dhcp4_lexer.cc" ++#line 4032 "dhcp4_lexer.cc" case YY_END_OF_BUFFER: { @@@ -5133,7 -5071,7 +5134,7 @@@ void yyfree (void * ptr /* %ok-for-header */ - #line 1603 "dhcp4_lexer.ll" -#line 1574 "dhcp4_lexer.ll" ++#line 1604 "dhcp4_lexer.ll" using namespace isc::dhcp; diff --cc src/bin/dhcp4/tests/config_parser_unittest.cc index 8c47e36f51,0cb062d867..ae1d36a172 --- a/src/bin/dhcp4/tests/config_parser_unittest.cc +++ b/src/bin/dhcp4/tests/config_parser_unittest.cc @@@ -5357,8 -5358,10 +5418,10 @@@ TEST_F(Dhcp4ParserTest, sharedNetworksD // These are values derived from shared network scope: EXPECT_EQ("eth0", s->getIface()); - EXPECT_EQ(false, s->getMatchClientId()); + EXPECT_FALSE(s->getMatchClientId()); EXPECT_EQ(IOAddress("1.2.3.4"), s->getSiaddr()); + EXPECT_EQ("foo", s->getSname()); + EXPECT_EQ("bar", s->getFilename()); EXPECT_EQ(IOAddress("5.6.7.8"), s->getRelayInfo().addr_); EXPECT_EQ(Network::HR_OUT_OF_POOL, s->getHostReservationMode()); @@@ -5370,8 -5373,10 +5433,10 @@@ // These are values derived from shared network scope: EXPECT_EQ("eth0", s->getIface()); - EXPECT_EQ(true, s->getMatchClientId()); + EXPECT_TRUE(s->getMatchClientId()); EXPECT_EQ(IOAddress("11.22.33.44"), s->getSiaddr()); + EXPECT_EQ("some-name.example.org", s->getSname()); + EXPECT_EQ("bootfile.efi", s->getFilename()); EXPECT_EQ(IOAddress("55.66.77.88"), s->getRelayInfo().addr_); EXPECT_EQ(Network::HR_DISABLED, s->getHostReservationMode()); @@@ -5387,8 -5392,10 +5452,10 @@@ // All other parameters should have default values. s = checkSubnet(*subs, "192.0.3.0/24", 1, 2, 4); EXPECT_EQ("", s->getIface()); - EXPECT_EQ(true, s->getMatchClientId()); + EXPECT_TRUE(s->getMatchClientId()); EXPECT_EQ(IOAddress("0.0.0.0"), s->getSiaddr()); + EXPECT_TRUE(s->getSname().empty()); + EXPECT_TRUE(s->getFilename().empty()); EXPECT_EQ(IOAddress("0.0.0.0"), s->getRelayInfo().addr_); EXPECT_EQ(Network::HR_ALL, s->getHostReservationMode()); }