All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libnetfilter_conntrack bug in snprintf_xml.c
@ 2007-05-18 19:40 Morten Isaksen
  2007-05-20 19:31 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Morten Isaksen @ 2007-05-18 19:40 UTC (permalink / raw)
  To: netfilter-devel

The port numbers are wrong in the XML output.

Index: src/conntrack/snprintf_xml.c
===================================================================
--- src/conntrack/snprintf_xml.c        (revision 6832)
+++ src/conntrack/snprintf_xml.c        (working copy)
@@ -182,13 +182,13 @@
        case IPPROTO_SCTP:
                if (type == __ADDR_SRC) {
                        ret = snprintf(buf, len, "<sport>%u</sport>",
-                                      tuple->l4src.tcp.port);
+                                      htons(tuple->l4src.tcp.port));
                        if (ret == -1)
                                return -1;
                        buffer_size(ret, &size, &len);
                } else {
                        ret = snprintf(buf, len, "<dport>%u</dport>",
-                                      tuple->l4dst.tcp.port);
+                                      htons(tuple->l4dst.tcp.port));
                        if (ret == -1)
                                return -1;
                        buffer_size(ret, &size, &len);



Regards
Morten Isaksen
http://misak.dk/blog/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libnetfilter_conntrack bug in snprintf_xml.c
  2007-05-18 19:40 [PATCH] libnetfilter_conntrack bug in snprintf_xml.c Morten Isaksen
@ 2007-05-20 19:31 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2007-05-20 19:31 UTC (permalink / raw)
  To: Morten Isaksen; +Cc: netfilter-devel

Morten Isaksen wrote:
> The port numbers are wrong in the XML output.
> 
> Index: src/conntrack/snprintf_xml.c
> ===================================================================
> --- src/conntrack/snprintf_xml.c        (revision 6832)
> +++ src/conntrack/snprintf_xml.c        (working copy)
> @@ -182,13 +182,13 @@
>         case IPPROTO_SCTP:
>                 if (type == __ADDR_SRC) {
>                         ret = snprintf(buf, len, "<sport>%u</sport>",
> -                                      tuple->l4src.tcp.port);
> +                                      htons(tuple->l4src.tcp.port));
                                          ^^^

Thanks for spotting this, I just committed a patch to fix this problem.
BTW, this should be ntohs, snprintf_default has the same stupid mistake.
Anyway this doesn't affect anything since ntohs and htons do the same :)

-- 
The dawn of the fourth age of Linux firewalling is coming; a time of
great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-20 19:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-18 19:40 [PATCH] libnetfilter_conntrack bug in snprintf_xml.c Morten Isaksen
2007-05-20 19:31 ` Pablo Neira Ayuso

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.