summaryrefslogtreecommitdiffstats
path: root/iptables-save.c
diff options
context:
space:
mode:
Diffstat (limited to 'iptables-save.c')
-rw-r--r--iptables-save.c6
1 files changed, 6 insertions, 0 deletions
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 ",