From: Tomek Mrugalski Date: Tue, 6 Dec 2016 20:43:11 +0000 (+0100) Subject: [5036] excluded-prefix{-len} implemented in the bison parser X-Git-Tag: trac5085_base~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dfac5a62ce2d67129a7b30bb003b64aef478b2e2;p=thirdparty%2Fkea.git [5036] excluded-prefix{-len} implemented in the bison parser --- diff --git a/doc/examples/kea6/advanced.json b/doc/examples/kea6/advanced.json index 3daca911fc..6730c9e9b8 100644 --- a/doc/examples/kea6/advanced.json +++ b/doc/examples/kea6/advanced.json @@ -66,6 +66,16 @@ "subnet6": [ { "pools": [ { "pool": "2001:db8:1::/80" } ], + + "pd-pools": [ + { + "prefix": "2001:db8:abcd::", + "prefix-len": 48, + "delegated-len": 64, + "excluded-prefix": "2001:db8:abcd:1234::", + "excluded-prefix-len": 62 + } + ], "subnet": "2001:db8:1::/64", "interface": "ethX" } diff --git a/doc/examples/kea6/reservations.json b/doc/examples/kea6/reservations.json index 9ec546e272..8fab75b503 100644 --- a/doc/examples/kea6/reservations.json +++ b/doc/examples/kea6/reservations.json @@ -81,7 +81,8 @@ { "name": "nis-servers", "data": "3000:1::234" - }] + }], + "client-classes": [ "special_snowflake", "office" ] }, # This is a bit more advanced reservation. The client with the specified # DUID will get a reserved address, a reserved prefix and a hostname. diff --git a/src/bin/dhcp6/dhcp6_lexer.ll b/src/bin/dhcp6/dhcp6_lexer.ll index 8c661cfead..fd3ef9c969 100644 --- a/src/bin/dhcp6/dhcp6_lexer.ll +++ b/src/bin/dhcp6/dhcp6_lexer.ll @@ -430,6 +430,24 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence} } } +\"excluded-prefix\" { + switch(driver.ctx_) { + case isc::dhcp::Parser6Context::PD_POOLS: + return isc::dhcp::Dhcp6Parser::make_EXCLUDED_PREFIX(driver.loc_); + default: + return isc::dhcp::Dhcp6Parser::make_STRING("excluded-prefix", driver.loc_); + } +} + +\"excluded-prefix-len\" { + switch(driver.ctx_) { + case isc::dhcp::Parser6Context::PD_POOLS: + return isc::dhcp::Dhcp6Parser::make_EXCLUDED_PREFIX_LEN(driver.loc_); + default: + return isc::dhcp::Dhcp6Parser::make_STRING("excluded-prefix-len", driver.loc_); + } +} + \"delegated-len\" { switch(driver.ctx_) { case isc::dhcp::Parser6Context::PD_POOLS: diff --git a/src/bin/dhcp6/dhcp6_parser.yy b/src/bin/dhcp6/dhcp6_parser.yy index 2a11e8ba0a..72b03d9edc 100644 --- a/src/bin/dhcp6/dhcp6_parser.yy +++ b/src/bin/dhcp6/dhcp6_parser.yy @@ -86,6 +86,8 @@ using namespace std; PD_POOLS "pd-pools" PREFIX "prefix" PREFIX_LEN "prefix-len" + EXCLUDED_PREFIX "excluded-prefix" + EXCLUDED_PREFIX_LEN "excluded-prefix-len" DELEGATED_LEN "delegated-len" SUBNET "subnet" @@ -1070,6 +1072,8 @@ pd_pool_param: pd_prefix | pd_prefix_len | pd_delegated_len | option_data_list + | excluded_prefix + | excluded_prefix_len | unknown_map_entry ; @@ -1086,6 +1090,19 @@ pd_prefix_len: PREFIX_LEN COLON INTEGER { ctx.stack_.back()->set("prefix-len", prf); } +excluded_prefix: EXCLUDED_PREFIX { + ctx.enter(ctx.NO_KEYWORD); +} COLON STRING { + ElementPtr prf(new StringElement($4, ctx.loc2pos(@4))); + ctx.stack_.back()->set("excluded-prefix", prf); + ctx.leave(); +} + +excluded_prefix_len: EXCLUDED_PREFIX_LEN COLON INTEGER { + ElementPtr prf(new IntElement($3, ctx.loc2pos(@3))); + ctx.stack_.back()->set("excluded-prefix-len", prf); +} + pd_delegated_len: DELEGATED_LEN COLON INTEGER { ElementPtr deleg(new IntElement($3, ctx.loc2pos(@3))); ctx.stack_.back()->set("delegated-len", deleg);