Linux Netfilter development
 help / color / mirror / Atom feed
From: Duncan Roe <duncan_roe@optusnet.com.au>
To: Netfilter Development <netfilter-devel@vger.kernel.org>
Subject: RFC: libnetfilter_queue: nfq_udp_get_payload_len() gives wrong answer
Date: Sun, 8 Dec 2019 14:49:30 +1100	[thread overview]
Message-ID: <20191208034930.GA10353@dimstar.local.net> (raw)

nfq_udp_get_payload() correctly returns a pointer to the first data byte in a
UDP message, e.g. to "A" in the message "ASD\n".

BUT nfq_udp_get_payload_len() returns 12 for the length of the above message,
i.e. combined lengths of payload and UDP header.

I plan to do an update of the documentation in src/extra/udp.c so I can document
this behaviour then.

OR

Should I change the behaviour of nfq_udp_get_payload_len() to what one would
expect? (e.g. return 4 in the example above)

OR

Should there be a new function, say nfq_udp_get_payload_len2(), to give the
expected answer?

AND, should the new or updated function guard against returning a -ve result?
(which, being unsigned, would become a large +ve result)

Any opinions?

Cheers ... Duncan.

             reply	other threads:[~2019-12-08  3:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-08  3:49 Duncan Roe [this message]
2019-12-09 21:12 ` RFC: libnetfilter_queue: nfq_udp_get_payload_len() gives wrong answer Pablo Neira Ayuso
2019-12-09 23:52   ` [PATCH libnetfilter_queue] src: Fix value returned by nfq_udp_get_payload_len() Duncan Roe
2019-12-11 21:59     ` 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=20191208034930.GA10353@dimstar.local.net \
    --to=duncan_roe@optusnet.com.au \
    --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