]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
printpkt, raw2packet_BASE: keep gateway address in NBO
authorJeremy Sowden <jeremy@azazel.net>
Mon, 21 Aug 2023 19:42:29 +0000 (20:42 +0100)
committerFlorian Westphal <fw@strlen.de>
Thu, 14 Sep 2023 12:22:49 +0000 (14:22 +0200)
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>
Signed-off-by: Florian Westphal <fw@strlen.de>
filter/raw2packet/ulogd_raw2packet_BASE.c
util/printpkt.c

index 9117d27da09aab69e127e001beaf7621e2518753..14423486a880507ddcf8f79286405bbd508eabaa 100644 (file)
@@ -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) {
index 11126b3c9af71256d407951b50c82fa806eafbd0..09a219417f914fd838fa4c98247ec1fa59ddb5e8 100644 (file)
@@ -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]);