[PATCH 2/3] netlink_delinarize: fix payload dependency killing of link layer dependencies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



payload_dependency_kill() does not properly handle dependencies for link
layer expressions. Since those dependencies are logically defined on an
even lower layer (device layer), we don't have a payload base for them,
meaning they will use PROTO_BASE_INVALID, which is skipped.

So instead of storing the payload base on which the dependency is defined,
we store the base of the layer for which the dependency applies, meaning
dependencies defined by the device layer will properly work.

This fixes killing the dependency of ether saddr, instead of

iiftype ether ether ether saddr ...

we now only display

ether saddr ...

Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
---
 src/netlink_delinearize.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
index 387bb67..ec1a964 100644
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
@@ -753,7 +753,7 @@ struct rule_pp_ctx {
 static void payload_dependency_kill(struct rule_pp_ctx *ctx, struct expr *expr)
 {
 	if (ctx->pbase != PROTO_BASE_INVALID &&
-	    ctx->pbase == expr->payload.base - 1 &&
+	    ctx->pbase == expr->payload.base &&
 	    ctx->pdep != NULL) {
 		list_del(&ctx->pdep->list);
 		stmt_free(ctx->pdep);
@@ -766,7 +766,7 @@ static void payload_dependency_store(struct rule_pp_ctx *ctx,
 				     struct stmt *stmt,
 				     enum proto_bases base)
 {
-	ctx->pbase = base;
+	ctx->pbase = base + 1;
 	ctx->pdep  = stmt;
 }
 
-- 
2.1.0

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




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux