From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: akashavkin@gmail.com
Subject: [PATCH nft 1/2] ipopt: use ipv4 address datatype for address field in ip options
Date: Fri, 31 Jan 2025 11:47:15 +0100 [thread overview]
Message-ID: <20250131104716.492246-1-pablo@netfilter.org> (raw)
So user does not have to play integer arithmetics to match on IPv4
address.
Before:
# nft describe ip option lsrr addr
exthdr expression, datatype integer (integer), 32 bits
After:
# nft describe ip option lsrr addr
exthdr expression, datatype ipv4_addr (IPv4 address) (basetype integer), 32 bits
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/ipopt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/ipopt.c b/src/ipopt.c
index 37f779d468ab..ddb42f5712d4 100644
--- a/src/ipopt.c
+++ b/src/ipopt.c
@@ -24,7 +24,7 @@ static const struct exthdr_desc ipopt_lsrr = {
[IPOPT_FIELD_TYPE] = PHT("type", 0, 8),
[IPOPT_FIELD_LENGTH] = PHT("length", 8, 8),
[IPOPT_FIELD_PTR] = PHT("ptr", 16, 8),
- [IPOPT_FIELD_ADDR_0] = PHT("addr", 24, 32),
+ [IPOPT_FIELD_ADDR_0] = PROTO_HDR_TEMPLATE("addr", &ipaddr_type, BYTEORDER_BIG_ENDIAN, 24, 32),
},
};
@@ -35,7 +35,7 @@ static const struct exthdr_desc ipopt_rr = {
[IPOPT_FIELD_TYPE] = PHT("type", 0, 8),
[IPOPT_FIELD_LENGTH] = PHT("length", 8, 8),
[IPOPT_FIELD_PTR] = PHT("ptr", 16, 8),
- [IPOPT_FIELD_ADDR_0] = PHT("addr", 24, 32),
+ [IPOPT_FIELD_ADDR_0] = PROTO_HDR_TEMPLATE("addr", &ipaddr_type, BYTEORDER_BIG_ENDIAN, 24, 32),
},
};
@@ -46,7 +46,7 @@ static const struct exthdr_desc ipopt_ssrr = {
[IPOPT_FIELD_TYPE] = PHT("type", 0, 8),
[IPOPT_FIELD_LENGTH] = PHT("length", 8, 8),
[IPOPT_FIELD_PTR] = PHT("ptr", 16, 8),
- [IPOPT_FIELD_ADDR_0] = PHT("addr", 24, 32),
+ [IPOPT_FIELD_ADDR_0] = PROTO_HDR_TEMPLATE("addr", &ipaddr_type, BYTEORDER_BIG_ENDIAN, 24, 32),
},
};
@@ -56,7 +56,7 @@ static const struct exthdr_desc ipopt_ra = {
.templates = {
[IPOPT_FIELD_TYPE] = PHT("type", 0, 8),
[IPOPT_FIELD_LENGTH] = PHT("length", 8, 8),
- [IPOPT_FIELD_VALUE] = PHT("value", 16, 16),
+ [IPOPT_FIELD_ADDR_0] = PROTO_HDR_TEMPLATE("addr", &ipaddr_type, BYTEORDER_BIG_ENDIAN, 24, 32),
},
};
--
2.30.2
next reply other threads:[~2025-01-31 10:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-31 10:47 Pablo Neira Ayuso [this message]
2025-01-31 10:47 ` [PATCH nft 2/2] parser_bison: turn redudant ip option type field match into boolean Pablo Neira Ayuso
2025-02-05 12:29 ` Alexey Kashavkin
2025-02-06 11:55 ` Pablo Neira Ayuso
2025-02-06 12:02 ` Alexey Kashavkin
2025-02-06 12:44 ` Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250131104716.492246-1-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=akashavkin@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.