From: "Pedro Lamarão" <pedro.lamarao@globo.com>
To: netfilter-devel@lists.netfilter.org
Subject: Re: why don't we use /etc/protocols ?
Date: Thu, 01 Apr 2004 21:54:03 -0300 [thread overview]
Message-ID: <406CB9AB.4090306@globo.com> (raw)
In-Reply-To: <20040328184541.GA7039@sunbeam.de.gnumonks.org>
[-- Attachment #1: Type: text/plain, Size: 1122 bytes --]
Harald Welte wrote:
> Thanks for your patch. I think the original idea of that array was to
> have it working even if there is no /etc/protocols (small embedded
> system, ..).
>
> So in a 'perfect' world, we would keep our small table for
> commonly-used protocol and only query /etc/protocols if we don't have a
> match.
>
> Please also update iptables.c to make it consistent with
> iptables-save/restore.
I'm sorry to have taken so long to respond.
I've been studying this stuff and preparing a version of iptables-save
that outputs in a XML format (with the appropriate DTD). I'm not quite
finished yet.
As per your request, I've modified the patch to keep the protocol table.
Peeking more I saw that ip6tables-save.c has code to use
getprotobynumber, so I've sort of reproduced that exactly.
The patch got quite small.
And iptables.c uses getprotobynumber in proto-to-name -- if there's
somewhere else that requires change, I've not found it by myself.
When I'm finished with my little project, I'll post the code (rather
small) to the list for review.
--
Pedro Lamarão
[-- Attachment #2: iptables-save.patch --]
[-- Type: text/x-patch, Size: 746 bytes --]
? .cdtproject
? .project
? iptables-save.patch
Index: iptables-save.c
===================================================================
RCS file: /cvspublic/iptables/iptables-save.c,v
retrieving revision 1.27
diff -u -r1.27 iptables-save.c
--- iptables-save.c 21 Feb 2004 09:20:34 -0000 1.27
+++ iptables-save.c 2 Apr 2004 00:53:10 -0000
@@ -84,6 +84,13 @@
unsigned int i;
const char *invertstr = invert ? "! " : "";
+ struct protoent *pent = getprotobynumber(proto);
+ if (pent) {
+ printf("-p %s%s ",
+ invertstr, pent->p_name);
+ return;
+ }
+
for (i = 0; i < sizeof(chain_protos)/sizeof(struct pprot); i++)
if (chain_protos[i].num == proto) {
printf("-p %s%s ",
prev parent reply other threads:[~2004-04-02 0:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-18 18:54 why don't we use /etc/protocols ? Pedro Lamarão
2004-03-28 18:45 ` Harald Welte
2004-04-02 0:54 ` Pedro Lamarão [this message]
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=406CB9AB.4090306@globo.com \
--to=pedro.lamarao@globo.com \
--cc=netfilter-devel@lists.netfilter.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 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.