From: Pedro Lamarão Date: Wed, 7 Apr 2004 09:33:17 +0000 (+0000) Subject: use /etc/protocols when printing protocol names (Pedro Lamarão) X-Git-Tag: v1.3.0-rc1~112 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0e3b3379abec1695a68871862b6c22b59de3c5a5;p=thirdparty%2Fiptables.git use /etc/protocols when printing protocol names (Pedro Lamarão) --- 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 ",