]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
use /etc/protocols when printing protocol names (Pedro Lamarão)
authorPedro Lamarão <pedro.lamarao@globo.com>
Wed, 7 Apr 2004 09:33:17 +0000 (09:33 +0000)
committerYasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Fri, 30 Nov 2007 14:42:16 +0000 (23:42 +0900)
iptables-save.c

index cdedfbf39ff130f864a016a80564685c9639ac0b..422a8d2bb91565f8c01f3b794451870a55b87146 100644 (file)
@@ -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 ",