* [PATCH nft] payload: fix transport matching with no network layer info in bridge family
@ 2015-06-26 8:45 Pablo Neira Ayuso
2015-06-26 8:54 ` Patrick McHardy
0 siblings, 1 reply; 4+ messages in thread
From: Pablo Neira Ayuso @ 2015-06-26 8:45 UTC (permalink / raw)
To: netfilter-devel; +Cc: kaber
# nft --debug=netlink add rule bridge filter input tcp dport 22
bridge filter input
[ meta load l4proto => reg 1 ]
[ cmp eq reg 1 0x00000006 ]
[ payload load 2b @ transport header + 2 => reg 1 ]
[ cmp eq reg 1 0x00001600 ]
Reported-by: Eric Leblond <eric@regit.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/payload.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/payload.c b/src/payload.c
index 08578fd..e67ef17 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -219,6 +219,9 @@ int payload_gen_dependency(struct eval_ctx *ctx, const struct expr *expr,
case PROTO_BASE_LL_HDR:
desc = &proto_eth;
break;
+ case PROTO_BASE_TRANSPORT_HDR:
+ desc = &proto_inet_service;
+ break;
default:
break;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH nft] payload: fix transport matching with no network layer info in bridge family
2015-06-26 8:45 [PATCH nft] payload: fix transport matching with no network layer info in bridge family Pablo Neira Ayuso
@ 2015-06-26 8:54 ` Patrick McHardy
2015-06-26 9:55 ` [PATCH nft] payload: reorder case in a switch for consistency Eric Leblond
0 siblings, 1 reply; 4+ messages in thread
From: Patrick McHardy @ 2015-06-26 8:54 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
On 26.06, Pablo Neira Ayuso wrote:
> # nft --debug=netlink add rule bridge filter input tcp dport 22
> bridge filter input
> [ meta load l4proto => reg 1 ]
> [ cmp eq reg 1 0x00000006 ]
> [ payload load 2b @ transport header + 2 => reg 1 ]
> [ cmp eq reg 1 0x00001600 ]
>
> Reported-by: Eric Leblond <eric@regit.org>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> src/payload.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/src/payload.c b/src/payload.c
> index 08578fd..e67ef17 100644
> --- a/src/payload.c
> +++ b/src/payload.c
> @@ -219,6 +219,9 @@ int payload_gen_dependency(struct eval_ctx *ctx, const struct expr *expr,
> case PROTO_BASE_LL_HDR:
> desc = &proto_eth;
> break;
> + case PROTO_BASE_TRANSPORT_HDR:
> + desc = &proto_inet_service;
> + break;
Just a very minor issue - the switch statement for NFPROTO_INET
just above uses the opposite ordering. Would increase readbility
to use the same for both, and I actually LL then TRANSPORT.
> default:
> break;
> }
> --
> 1.7.10.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH nft] payload: reorder case in a switch for consistency
2015-06-26 8:54 ` Patrick McHardy
@ 2015-06-26 9:55 ` Eric Leblond
2015-06-30 0:03 ` Pablo Neira Ayuso
0 siblings, 1 reply; 4+ messages in thread
From: Eric Leblond @ 2015-06-26 9:55 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, Eric Leblond
As pointed out by Patrick McHardy the order in the inet switch
in payload_gen_dependency was not consistent.
Signed-off-by: Eric Leblond <eric@regit.org>
---
src/payload.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/payload.c b/src/payload.c
index e67ef17..5f8c4fe 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -204,12 +204,12 @@ int payload_gen_dependency(struct eval_ctx *ctx, const struct expr *expr,
switch (ctx->pctx.family) {
case NFPROTO_INET:
switch (expr->payload.base) {
- case PROTO_BASE_TRANSPORT_HDR:
- desc = &proto_inet_service;
- break;
case PROTO_BASE_LL_HDR:
desc = &proto_inet;
break;
+ case PROTO_BASE_TRANSPORT_HDR:
+ desc = &proto_inet_service;
+ break;
default:
break;
}
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-29 23:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-26 8:45 [PATCH nft] payload: fix transport matching with no network layer info in bridge family Pablo Neira Ayuso
2015-06-26 8:54 ` Patrick McHardy
2015-06-26 9:55 ` [PATCH nft] payload: reorder case in a switch for consistency Eric Leblond
2015-06-30 0:03 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).