diff options
author | laforge <laforge> | 2004-04-07 09:33:17 +0000 |
---|---|---|
committer | Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> | 2007-11-30 23:42:16 +0900 |
commit | d1c67cf829ef5458055f06598d4529f14d288a73 (patch) | |
tree | 295e09c5e4c5b1735b1090cbf3cfac692fc1e92a | |
parent | 343a661a0013339644c306432a83ac1096732b16 (diff) |
use /etc/protocols when printing protocol names (Pedro LamarĂ£o)
-rw-r--r-- | iptables-save.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/iptables-save.c b/iptables-save.c index cdedfbf..422a8d2 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 ", |