diff mbox series

exthdr: Add support for reserved header and address

Message ID 1506890220-12226-1-git-send-email-harshasharmaiitr@gmail.com
State Changes Requested
Delegated to: Pablo Neira
Headers show
Series exthdr: Add support for reserved header and address | expand

Commit Message

Harsha Sharma Oct. 1, 2017, 8:37 p.m. UTC
Add support for IPV6 type 0 routing header reserved field and address
unable to test it with nft-test.py

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
---
 include/exthdr.h  | 2 ++
 src/exthdr.c      | 7 +------
 tests/py/ip6/rt.t | 2 ++
 3 files changed, 5 insertions(+), 6 deletions(-)

Comments

Pablo Neira Ayuso Oct. 2, 2017, 7:08 p.m. UTC | #1
Hi Harsha,

On Mon, Oct 02, 2017 at 02:07:00AM +0530, Harsha Sharma wrote:
> Add support for IPV6 type 0 routing header reserved field and address
> unable to test it with nft-test.py

It seems you didn't test this patch.

# python nft-test.py ip6/rt.t

/home/pablo/devel/scm/git-netfilter/nftables/tests/py/ip6/rt.t.payload.ip6:
ERROR: line 2: did not find payload information for rule 'rt type 0 reserved 2'
ip6/rt.t: ERROR: line 48: src/nft add rule --debug=netlink ip6 test-ip6 input rt type 0 reserved 2: This rule should not have failed.
ip6/rt.t: 39 unit tests, 1 error, 0 warning

There's a README file under tests/py folder that explains how the test
infrastructure works.

Anyway, you also have to perform basic testing by hand on your
patches.

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/include/exthdr.h b/include/exthdr.h
index 97ccc38..ad09f27 100644
--- a/include/exthdr.h
+++ b/include/exthdr.h
@@ -14,6 +14,8 @@ 
 struct exthdr_desc {
 	const char			*name;
 	uint8_t				type;
+	unsigned int			protocol_key;
+	const struct exthdr_desc	*protocols[3];
 	struct proto_hdr_template	templates[10];
 };
 
diff --git a/src/exthdr.c b/src/exthdr.c
index 4add3da..87c09da 100644
--- a/src/exthdr.c
+++ b/src/exthdr.c
@@ -263,13 +263,8 @@  const struct exthdr_desc exthdr_rt0 = {
 const struct exthdr_desc exthdr_rt = {
 	.name		= "rt",
 	.type		= IPPROTO_ROUTING,
-#if 0
 	.protocol_key	= RTHDR_TYPE,
-	.protocols	= {
-		[0]	= &exthdr_rt0,
-		[2]	= &exthdr_rt2,
-	},
-#endif
+	.protocols	= {&exthdr_rt0, NULL, &exthdr_rt2},
 	.templates	= {
 		[RTHDR_NEXTHDR]		= RT_FIELD("nexthdr", ip6r_nxt, &inet_protocol_type),
 		[RTHDR_HDRLENGTH]	= RT_FIELD("hdrlength", ip6r_len, &integer_type),
diff --git a/tests/py/ip6/rt.t b/tests/py/ip6/rt.t
index 2d044c3..1eb198d 100644
--- a/tests/py/ip6/rt.t
+++ b/tests/py/ip6/rt.t
@@ -44,3 +44,5 @@  rt seg-left { 33, 55, 67, 88};ok
 rt seg-left != { 33, 55, 67, 88};ok
 rt seg-left { 33-55};ok
 rt seg-left != { 33-55};ok
+
+rt type 0 reserved 2;ok