From: Shawn Routhier Date: Tue, 22 Mar 2016 05:56:07 +0000 (-0700) Subject: [trac4269] Add documentation and test for handling pkt4 as input X-Git-Tag: trac4106_update_base~43^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a01de22f20dfbfe18f981f6a72e6d7c1bcb65b0;p=thirdparty%2Fkea.git [trac4269] Add documentation and test for handling pkt4 as input --- diff --git a/doc/guide/classify.xml b/doc/guide/classify.xml index e18e993e7e..2aca1e4e31 100644 --- a/doc/guide/classify.xml +++ b/doc/guide/classify.xml @@ -169,6 +169,20 @@ sub-optionrelay4[code].hexThe value of sub-option with code "code" from the DHCPv4 Relay Agent Information option (option 82) + + Message Type in DHCPv6 packet + pkt6.msgtype + + The value of the message type field in the DHCPv6 packet. + + + Transaction ID in DHCPv6 packet + pkt6.transid + + The value of the transaction id in the DHCPv6 packet. + @@ -209,6 +223,14 @@ sub-option with code "code" from the DHCPv4 Relay Agent Information option instance "relay4[code].exists" is supported. + + "pkt6" refers to information from the client request. To access any + information from an intermediate relay use "relay6". "pkt6.msgtype" + outputs the string representation of the integer value for the message + type, for example SOLICIT will be '1'. "pkt6.transid" outputs the string + representation of the value of the transaction ID. + + List of Classification Expressions diff --git a/src/lib/eval/tests/token_unittest.cc b/src/lib/eval/tests/token_unittest.cc index 176b267113..bd63f1a68f 100644 --- a/src/lib/eval/tests/token_unittest.cc +++ b/src/lib/eval/tests/token_unittest.cc @@ -985,4 +985,9 @@ TEST_F(TokenTest, pkt6Fields) { EXPECT_NO_THROW(t_->evaluate(*pkt6_, values_)); ASSERT_EQ(1, values_.size()); EXPECT_EQ("12345", values_.top()); + + // Check that working with a v4 packet generates an error + clearStack(); + ASSERT_NO_THROW(t_.reset(new TokenPkt6(TokenPkt6::TRANSID))); + EXPECT_THROW(t_->evaluate(*pkt4_, values_), EvalTypeError); }