From: Jeremy Sowden <jeremy@azazel.net>
To: Netfilter Devel <netfilter-devel@vger.kernel.org>
Subject: [PATCH ulogd2 v3 03/11] printpkt, raw2packet_BASE: keep gateway address in NBO
Date: Mon, 21 Aug 2023 20:42:29 +0100 [thread overview]
Message-ID: <20230821194237.51139-4-jeremy@azazel.net> (raw)
In-Reply-To: <20230821194237.51139-1-jeremy@azazel.net>
Everywhere else ipv4 addresses are left in NBO until output. The only
exception is the IP2HBIN filter, which is explicitly intended to convert
from NBO to HBO.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
filter/raw2packet/ulogd_raw2packet_BASE.c | 2 +-
util/printpkt.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/filter/raw2packet/ulogd_raw2packet_BASE.c b/filter/raw2packet/ulogd_raw2packet_BASE.c
index 9117d27da09a..14423486a880 100644
--- a/filter/raw2packet/ulogd_raw2packet_BASE.c
+++ b/filter/raw2packet/ulogd_raw2packet_BASE.c
@@ -645,7 +645,7 @@ static int _interp_icmp(struct ulogd_pluginstance *pi, struct icmphdr *icmph,
break;
case ICMP_REDIRECT:
case ICMP_PARAMETERPROB:
- okey_set_u32(&ret[KEY_ICMP_GATEWAY], ntohl(icmph->un.gateway));
+ okey_set_u32(&ret[KEY_ICMP_GATEWAY], icmph->un.gateway);
break;
case ICMP_DEST_UNREACH:
if (icmph->code == ICMP_FRAG_NEEDED) {
diff --git a/util/printpkt.c b/util/printpkt.c
index 11126b3c9af7..09a219417f91 100644
--- a/util/printpkt.c
+++ b/util/printpkt.c
@@ -260,8 +260,9 @@ static int printpkt_ipv4(struct ulogd_key *res, char *buf)
ikey_get_u16(&res[KEY_ICMP_ECHOSEQ]));
break;
case ICMP_PARAMETERPROB:
+ paddr = ikey_get_u32(&res[KEY_ICMP_GATEWAY]);
buf_cur += sprintf(buf_cur, "PARAMETER=%u ",
- ikey_get_u32(&res[KEY_ICMP_GATEWAY]) >> 24);
+ *(uint8_t *) &paddr);
break;
case ICMP_REDIRECT:
paddr = ikey_get_u32(&res[KEY_ICMP_GATEWAY]);
--
2.40.1
next prev parent reply other threads:[~2023-08-21 19:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-21 19:42 [PATCH ulogd2 v3 00/11] Fixes for handling and output of IP addresses Jeremy Sowden
2023-08-21 19:42 ` [PATCH ulogd2 v3 01/11] src: record length of integer key values Jeremy Sowden
2023-08-21 19:42 ` [PATCH ulogd2 v3 02/11] printpkt: fix statement punctuator Jeremy Sowden
2023-08-21 19:42 ` Jeremy Sowden [this message]
2023-08-21 19:42 ` [PATCH ulogd2 v3 04/11] raw2packet_BASE: store ARP address values as integers Jeremy Sowden
2023-08-21 19:42 ` [PATCH ulogd2 v3 05/11] ip2hbin: store ipv6 address as integer Jeremy Sowden
2023-08-21 19:42 ` [PATCH ulogd2 v3 06/11] ipfix: skip non-ipv4 addresses Jeremy Sowden
2023-08-21 19:42 ` [PATCH ulogd2 v3 07/11] gprint, oprint: use inet_ntop to format ip addresses Jeremy Sowden
2023-08-21 19:42 ` [PATCH ulogd2 v3 08/11] gprint, oprint: add support for printing ipv6 addresses Jeremy Sowden
2023-08-21 19:42 ` [PATCH ulogd2 v3 09/11] sqlite3: correct binding of ipv4 addresses and 64-bit integers Jeremy Sowden
2023-08-21 19:42 ` [PATCH ulogd2 v3 10/11] sqlite3: insert ipv6 addresses as null rather than garbage Jeremy Sowden
2023-08-21 19:42 ` [PATCH ulogd2 v3 11/11] db: insert ipv6 addresses in the same format as ip2bin Jeremy Sowden
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=20230821194237.51139-4-jeremy@azazel.net \
--to=jeremy@azazel.net \
--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 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).