From: Olaf Titz <olaf@bigred.inka.de>
To: linux-kernel@vger.kernel.org
Subject: Re: novice coding in /linux/net/ipv4/util.c From: DJ Barrow <dj.barrow@asitatech.com>
Date: Mon, 22 Apr 2002 22:32:52 +0200 [thread overview]
Message-ID: <E16zkUW-0003iI-00@bigred.inka.de> (raw)
In-Reply-To: <20020422151025Z314220-22651+13849@vger.kernel.org> <Pine.LNX.3.95.1020422113750.11343A-100000@chaos.analogic.com>
> I love it! Last guy wins! I wonder how you fix it without having to
> pass it a pointer to something the caller owns? This is, truly,
> non-trivial. Also, this is in ../linux/net, not something specific
This very discussion came up over CIPE several years ago. I wrote a
function which is even less beautiful but at least can be used
the natural way, i.e. like this:
dprintk(DEB_OUT, (KERN_INFO
"%s: sending %d from %s:%d to %s:%d\n",
dev->name, skb->len,
cipe_ntoa(iph->saddr), ntohs(udph->source),
cipe_ntoa(iph->daddr), ntohs(udph->dest)));
It uses a circular chain of internal buffers (statically allocated
because I decided that more effort Just Isn't Worth It [tm]).
I proposed something like this on l-k back then and most people
disagreed on the grounds that we could use NIPQUAD instead. This may
be efficient but it is problematic on two counts IMHO:
1. it is Wrong[tm] because an IP address is _one_ argument to printk,
not four
2. there is no easy way to make this IPv6 compatible. Printing IPv6
addresses seems to me still an unsolved problem in the kernel (the
stuff in icmpv6_rcv() can't be the last word on it, and ip6t_LOG.c
neither, I mean really...)
> to Intel, and there is no macro to handle the network-order. It
> just 'comes-out-right' with Intel machines.
no, it comes out right because the argument is in network order, or
else it would come out _wrong_ on Intel boxen. (I'm glad I have a
little endian box if only because of catching such errors early :-)
Olaf
next prev parent reply other threads:[~2002-04-22 20:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-22 15:12 DJ Barrow
2002-04-22 15:48 ` Richard B. Johnson
2002-04-22 16:03 ` DJ Barrow
2002-04-22 16:21 ` Ben Greear
2002-04-22 20:32 ` Olaf Titz [this message]
[not found] <20020422151025Z314220-22651+13849@vger.kernel.org.suse.lists.linux.kernel>
2002-04-22 17:07 ` Andi Kleen
2002-04-22 17:19 ` DJ Barrow
2002-04-23 14:15 ` David S. Miller
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=E16zkUW-0003iI-00@bigred.inka.de \
--to=olaf@bigred.inka.de \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®