From 0e3b3379abec1695a68871862b6c22b59de3c5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Lamar=C3=A3o?= Date: Wed, 7 Apr 2004 09:33:17 +0000 Subject: =?UTF-8?q?use=20/etc/protocols=20when=20printing=20protocol=20nam?= =?UTF-8?q?es=20(Pedro=20Lamar=C3=A3o)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iptables-save.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'iptables-save.c') diff --git a/iptables-save.c b/iptables-save.c index cdedfbf3..422a8d2b 100644 --- a/iptables-save.c +++ b/iptables-save.c @@ -84,6 +84,12 @@ static void print_proto(u_int16_t proto, int invert) 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 ", -- cgit v1.2.3