summaryrefslogtreecommitdiffstats
path: root/contrib/ipfilter/lib
diff options
context:
space:
mode:
authorguido <guido@FreeBSD.org>2005-12-30 11:34:54 +0000
committerguido <guido@FreeBSD.org>2005-12-30 11:34:54 +0000
commit530bf89f140b005c1cc1706d6d7bcfa392bbf202 (patch)
tree61e8b83d132738b87e9980fc140d58e1d16ffd1e /contrib/ipfilter/lib
parent61382ac33f17a56cf1ff6a93775491b7e4950972 (diff)
parent9749beb9e35afd40d054e5592764d50ed069a890 (diff)
downloadFreeBSD-src-530bf89f140b005c1cc1706d6d7bcfa392bbf202.zip
FreeBSD-src-530bf89f140b005c1cc1706d6d7bcfa392bbf202.tar.gz
This commit was generated by cvs2svn to compensate for changes in r153877,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/ipfilter/lib')
-rw-r--r--contrib/ipfilter/lib/Makefile3
-rw-r--r--contrib/ipfilter/lib/printproto.c51
2 files changed, 54 insertions, 0 deletions
diff --git a/contrib/ipfilter/lib/Makefile b/contrib/ipfilter/lib/Makefile
index d448ba0..a6e9cc4 100644
--- a/contrib/ipfilter/lib/Makefile
+++ b/contrib/ipfilter/lib/Makefile
@@ -68,6 +68,7 @@ LIBOBJS=$(DEST)/addicmp.o \
$(DEST)/printip.o \
$(DEST)/printpool.o \
$(DEST)/printpoolnode.o \
+ $(DEST)/printproto.o \
$(DEST)/printfr.o \
$(DEST)/printfraginfo.o \
$(DEST)/printhostmap.o \
@@ -246,6 +247,8 @@ $(DEST)/printpool.o: $(LIBSRC)/printpool.c $(TOP)/ip_fil.h $(TOP)/ip_pool.h
$(DEST)/printpoolnode.o: $(LIBSRC)/printpoolnode.c $(TOP)/ip_fil.h \
$(TOP)/ip_pool.h $(TOP)/ip_lookup.h
$(CC) $(CCARGS) -c $(LIBSRC)/printpoolnode.c -o $@
+$(DEST)/printproto.o: $(LIBSRC)/printproto.c $(TOP)/ip_fil.h
+ $(CC) $(CCARGS) -c $(LIBSRC)/printproto.c -o $@
$(DEST)/printhostmap.o: $(LIBSRC)/printhostmap.c $(TOP)/ip_fil.h
$(CC) $(CCARGS) -c $(LIBSRC)/printhostmap.c -o $@
$(DEST)/printifname.o: $(LIBSRC)/printifname.c $(INCDEP)
diff --git a/contrib/ipfilter/lib/printproto.c b/contrib/ipfilter/lib/printproto.c
new file mode 100644
index 0000000..dd0ce39
--- /dev/null
+++ b/contrib/ipfilter/lib/printproto.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 1993-2005 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ */
+
+#include "ipf.h"
+
+
+#if !defined(lint)
+static const char rcsid[] = "@(#)$Id: printproto.c,v 1.1.2.1 2005/06/12 07:21:53 darrenr Exp $";
+#endif
+
+
+void printproto(pr, p, np)
+struct protoent *pr;
+int p;
+ipnat_t *np;
+{
+ if (np != NULL) {
+ if ((np->in_flags & IPN_TCPUDP) == IPN_TCPUDP)
+ printf("tcp/udp");
+ else if (np->in_flags & IPN_TCP)
+ printf("tcp");
+ else if (np->in_flags & IPN_UDP)
+ printf("udp");
+ else if (np->in_flags & IPN_ICMPQUERY)
+ printf("icmp");
+#ifdef _AIX51
+ /*
+ * To make up for "ip = 252" and "hopopt = 0" in /etc/protocols
+ */
+ else if (np->in_p == 0)
+ printf("ip");
+#endif
+ else if (pr != NULL)
+ printf("%s", pr->p_name);
+ else
+ printf("%d", np->in_p);
+ } else {
+#ifdef _AIX51
+ if (p == 0)
+ printf("ip");
+ else
+#endif
+ if (pr != NULL)
+ printf("%s", pr->p_name);
+ else
+ printf("%d", p);
+ }
+}
OpenPOWER on IntegriCloud